Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DataFormats/Parameters/src/ParametersDataLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
#pragma link C++ class o2::parameters::GRPECSObject + ;
#pragma link C++ class o2::parameters::GRPMagField + ;
#pragma link C++ class std::unordered_map < unsigned int, unsigned int> + ;
#pragma link C++ class std::pair < unsigned long, std::string> + ;

#endif
50 changes: 25 additions & 25 deletions Detectors/DCS/include/DetectorsDCS/DataPointCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@
namespace o2::dcs
{
/**
* createDataPointCompositeObject is a convenience function to
* simplify the creation of a DataPointCompositeObject.
*
* @param alias the DataPoint alias name (max 56 characters)
* @param val the value of the datapoint
* @param flags value for ADAPOS flags.
* @param milliseconds value for milliseconds.
* @param seconds value for seconds.
*
* @returns a DataPointCompositeObject
*
* The actual DeliveryType of the returned
* DataPointCompositeObject is deduced from the type of val.
*
* Note that only a few relevant specialization are actually provided
*
* - T=int32_t : DeliveryType = RAW_INT
* - T=uint32_t : DeliveryType = RAW_UINT
* - T=float : DeliveryType = RAW_FLOAT
* - T=double : DeliveryType = RAW_DOUBLE
* - T=bool : DeliveryType = RAW_BOOL
* - T=char : DeliveryType = RAW_CHAR
* - T=std::string : DeliveryType = RAW_STRING
*
*/
* createDataPointCompositeObject is a convenience function to
* simplify the creation of a DataPointCompositeObject.
*
* @param alias the DataPoint alias name (max 56 characters)
* @param val the value of the datapoint
* @param flags value for ADAPOS flags.
* @param milliseconds value for milliseconds.
* @param seconds value for seconds.
*
* @returns a DataPointCompositeObject
*
* The actual DeliveryType of the returned
* DataPointCompositeObject is deduced from the type of val.
*
* Note that only a few relevant specialization are actually provided
*
* - T=int32_t : DeliveryType = DPVAL_INT
* - T=uint32_t : DeliveryType = DPVAL_UINT
* - T=float : DeliveryType = DPVAL_FLOAT
* - T=double : DeliveryType = DPVAL_DOUBLE
* - T=bool : DeliveryType = DPVAL_BOOL
* - T=char : DeliveryType = DPVAL_CHAR
* - T=std::string : DeliveryType = DPVAL_STRING
*
*/
template <typename T>
o2::dcs::DataPointCompositeObject createDataPointCompositeObject(const std::string& alias, T val, uint32_t seconds, uint16_t msec, uint16_t flags = 0);
} // namespace o2::dcs
Expand Down
9 changes: 6 additions & 3 deletions Detectors/DCS/include/DetectorsDCS/DataPointIdentifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class alignas(64) DataPointIdentifier final
}

/**
* A copy constructor for DataPointIdentifier.
*/
* A copy constructor for DataPointIdentifier.
*/
DataPointIdentifier(const DataPointIdentifier& src) noexcept : DataPointIdentifier(src.pt1, src.pt2, src.pt3, src.pt4, src.pt5, src.pt6, src.pt7, src.pt8) {}

DataPointIdentifier& operator=(const DataPointIdentifier& src) noexcept
Expand Down Expand Up @@ -137,7 +137,10 @@ class alignas(64) DataPointIdentifier final
*/
inline bool operator==(const DataPointIdentifier& other) const
{
return memcmp((char*)this, (char*)&other, 64) == 0;
constexpr char mask = 0x7F;

return (memcmp((char*)this, (char*)&other, 63) == 0) &&
(((DeliveryType)this->get_type() & mask) == ((DeliveryType)other.get_type() & mask));
}

/**
Expand Down
14 changes: 7 additions & 7 deletions Detectors/DCS/src/DataPointCompositeObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,43 +47,43 @@ T getValueImpl(const DataPointCompositeObject& dpcom)
template <>
double getValue(const DataPointCompositeObject& dpcom)
{
return getValueImpl<double, DeliveryType::RAW_DOUBLE>(dpcom);
return getValueImpl<double, DeliveryType::DPVAL_DOUBLE>(dpcom);
}

template <>
float getValue(const DataPointCompositeObject& dpcom)
{
return getValueImpl<float, DeliveryType::RAW_FLOAT>(dpcom);
return getValueImpl<float, DeliveryType::DPVAL_FLOAT>(dpcom);
}

template <>
uint32_t getValue(const DataPointCompositeObject& dpcom)
{
return getValueImpl<uint32_t, DeliveryType::RAW_UINT>(dpcom);
return getValueImpl<uint32_t, DeliveryType::DPVAL_UINT>(dpcom);
}

template <>
int32_t getValue(const DataPointCompositeObject& dpcom)
{
return getValueImpl<int32_t, DeliveryType::RAW_INT>(dpcom);
return getValueImpl<int32_t, DeliveryType::DPVAL_INT>(dpcom);
}

template <>
char getValue(const DataPointCompositeObject& dpcom)
{
return getValueImpl<char, DeliveryType::RAW_CHAR>(dpcom);
return getValueImpl<char, DeliveryType::DPVAL_CHAR>(dpcom);
}

template <>
bool getValue(const DataPointCompositeObject& dpcom)
{
return getValueImpl<bool, DeliveryType::RAW_BOOL>(dpcom);
return getValueImpl<bool, DeliveryType::DPVAL_BOOL>(dpcom);
}

template <>
std::string getValue(const DataPointCompositeObject& dpcom)
{
if (dpcom.id.get_type() != o2::dcs::DeliveryType::RAW_STRING) {
if (dpcom.id.get_type() != o2::dcs::DeliveryType::DPVAL_STRING) {
throw std::runtime_error("DPCOM is of unexpected type " + o2::dcs::show(dpcom.id.get_type()));
}
return std::string((char*)&dpcom.data.payload_pt1);
Expand Down
14 changes: 7 additions & 7 deletions Detectors/DCS/src/DataPointCreator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace o2::dcs
template <>
DataPointCompositeObject createDataPointCompositeObject(const std::string& alias, double val, uint32_t seconds, uint16_t msec, uint16_t flags)
{
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&val), seconds, msec, flags, DeliveryType::RAW_DOUBLE);
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&val), seconds, msec, flags, DeliveryType::DPVAL_DOUBLE);
}

template <>
Expand All @@ -40,34 +40,34 @@ DataPointCompositeObject createDataPointCompositeObject(const std::string& alias
float tmp[2];
tmp[0] = val;
tmp[1] = 0;
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&tmp[0]), seconds, msec, flags, DeliveryType::RAW_FLOAT);
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&tmp[0]), seconds, msec, flags, DeliveryType::DPVAL_FLOAT);
}

template <>
DataPointCompositeObject createDataPointCompositeObject(const std::string& alias, int32_t val, uint32_t seconds, uint16_t msec, uint16_t flags)
{
int64_t tmp{val};
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&tmp), seconds, msec, flags, DeliveryType::RAW_INT);
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&tmp), seconds, msec, flags, DeliveryType::DPVAL_INT);
}

template <>
DataPointCompositeObject createDataPointCompositeObject(const std::string& alias, uint32_t val, uint32_t seconds, uint16_t msec, uint16_t flags)
{
uint64_t tmp{val};
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&tmp), seconds, msec, flags, DeliveryType::RAW_UINT);
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&tmp), seconds, msec, flags, DeliveryType::DPVAL_UINT);
}

template <>
DataPointCompositeObject createDataPointCompositeObject(const std::string& alias, char val, uint32_t seconds, uint16_t msec, uint16_t flags)
{
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&val), seconds, msec, flags, DeliveryType::RAW_CHAR);
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&val), seconds, msec, flags, DeliveryType::DPVAL_CHAR);
}

template <>
DataPointCompositeObject createDataPointCompositeObject(const std::string& alias, bool val, uint32_t seconds, uint16_t msec, uint16_t flags)
{
uint64_t tmp{val};
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&tmp), seconds, msec, flags, DeliveryType::RAW_BOOL);
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&tmp), seconds, msec, flags, DeliveryType::DPVAL_BOOL);
}

template <>
Expand All @@ -76,7 +76,7 @@ DataPointCompositeObject createDataPointCompositeObject(const std::string& alias
constexpr int N{56};
char str[N];
strncpy(str, val.c_str(), N);
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&str[0]), seconds, msec, flags, DeliveryType::RAW_STRING);
return createDPCOM(alias, reinterpret_cast<const uint64_t*>(&str[0]), seconds, msec, flags, DeliveryType::DPVAL_STRING);
}

} // namespace o2::dcs
12 changes: 6 additions & 6 deletions Detectors/DCS/test/testDataPointGenerator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(GenerateDouble)
BOOST_CHECK_EQUAL(fbi.size(), 28);

for (auto dp : fbi) {
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::RAW_DOUBLE);
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::DPVAL_DOUBLE);
double value = o2::dcs::getValue<double>(dp);
BOOST_CHECK(value >= fmin && value <= fmax);
}
Expand All @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(GenerateFloat)
BOOST_CHECK_EQUAL(fbi.size(), 28);

for (auto dp : fbi) {
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::RAW_FLOAT);
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::DPVAL_FLOAT);
float value = o2::dcs::getValue<float>(dp);
BOOST_TEST_INFO(fmt::format("value={}", value));
BOOST_CHECK(value >= fmin && value <= fmax);
Expand All @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(GenerateInt)
BOOST_CHECK_EQUAL(fbi.size(), 28);

for (auto dp : fbi) {
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::RAW_INT);
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::DPVAL_INT);
double value = o2::dcs::getValue<int32_t>(dp);
BOOST_CHECK(value >= imin && value <= imax);
BOOST_CHECK_THROW(o2::dcs::getValue<double>(dp), std::runtime_error);
Expand All @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(GenerateUInt)
BOOST_CHECK_EQUAL(fbi.size(), 28);

for (auto dp : fbi) {
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::RAW_UINT);
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::DPVAL_UINT);
double value = o2::dcs::getValue<uint32_t>(dp);
BOOST_CHECK(value >= imin && value <= imax);
BOOST_CHECK_THROW(o2::dcs::getValue<double>(dp), std::runtime_error);
Expand All @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(GenerateBool)
BOOST_CHECK_EQUAL(fbi.size(), 7);

for (auto dp : fbi) {
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::RAW_BOOL);
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::DPVAL_BOOL);
BOOST_CHECK_NO_THROW(o2::dcs::getValue<bool>(dp));
BOOST_CHECK_THROW(o2::dcs::getValue<int>(dp), std::runtime_error);
}
Expand All @@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(GenerateString)
BOOST_CHECK_EQUAL(fbi.size(), 7);

for (auto dp : fbi) {
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::RAW_STRING);
BOOST_CHECK_EQUAL(dp.id.get_type(), o2::dcs::DeliveryType::DPVAL_STRING);
BOOST_CHECK_NO_THROW(o2::dcs::getValue<std::string>(dp));
BOOST_CHECK_THROW(o2::dcs::getValue<int>(dp), std::runtime_error);
auto value = o2::dcs::getValue<std::string>(dp);
Expand Down
6 changes: 3 additions & 3 deletions Detectors/DCS/testWorkflow/macros/makeCCDBEntryForDCS.C
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ int makeCCDBEntryForDCS(const std::string url = "http://localhost:8080")

DPID dpidtmp;
for (size_t i = 0; i < aliasesCommonStr.size(); ++i) {
DPID::FILL(dpidtmp, aliasesCommonStr[i], o2::dcs::DeliveryType::RAW_STRING);
DPID::FILL(dpidtmp, aliasesCommonStr[i], o2::dcs::DeliveryType::DPVAL_STRING);
dpid2DataDesc_Common[dpidtmp] = "COMMON";
}
for (size_t i = 0; i < aliasesCommon_1_Int.size(); ++i) {
DPID::FILL(dpidtmp, aliasesCommon_1_Int[i], o2::dcs::DeliveryType::RAW_INT);
DPID::FILL(dpidtmp, aliasesCommon_1_Int[i], o2::dcs::DeliveryType::DPVAL_INT);
dpid2DataDesc_Common_1[dpidtmp] = "COMMON1";
}
for (size_t i = 0; i < aliasesCommon_1_Str.size(); ++i) {
DPID::FILL(dpidtmp, aliasesCommon_1_Str[i], o2::dcs::DeliveryType::RAW_STRING);
DPID::FILL(dpidtmp, aliasesCommon_1_Str[i], o2::dcs::DeliveryType::DPVAL_STRING);
dpid2DataDesc_Common_1[dpidtmp] = "COMMON1";
}

Expand Down
8 changes: 4 additions & 4 deletions Detectors/DCS/testWorkflow/src/dcs-proxy.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config)

if (testMode) {
DPID dpidtmp;
DPID::FILL(dpidtmp, "ADAPOS_LG/TEST_000100", DeliveryType::RAW_STRING);
DPID::FILL(dpidtmp, "ADAPOS_LG/TEST_000100", DeliveryType::DPVAL_STRING);
dpid2DataDesc[dpidtmp] = "COMMON"; // i.e. this will go to {DCS/COMMON/0} OutputSpec
DPID::FILL(dpidtmp, "ADAPOS_LG/TEST_000110", DeliveryType::RAW_STRING);
DPID::FILL(dpidtmp, "ADAPOS_LG/TEST_000110", DeliveryType::DPVAL_STRING);
dpid2DataDesc[dpidtmp] = "COMMON";
DPID::FILL(dpidtmp, "ADAPOS_LG/TEST_000200", DeliveryType::RAW_STRING);
DPID::FILL(dpidtmp, "ADAPOS_LG/TEST_000200", DeliveryType::DPVAL_STRING);
dpid2DataDesc[dpidtmp] = "COMMON1";
DPID::FILL(dpidtmp, "ADAPOS_LG/TEST_000240", DeliveryType::RAW_INT);
DPID::FILL(dpidtmp, "ADAPOS_LG/TEST_000240", DeliveryType::DPVAL_INT);
dpid2DataDesc[dpidtmp] = "COMMON1";
}

Expand Down
6 changes: 3 additions & 3 deletions Detectors/EMCAL/calib/macros/makeEMCALCCDBEntryForDCS.C
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ int makeEMCALCCDBEntryForDCS(const std::string url = "http://ccdb-test.cern.ch:8

DPID dpidtmp;
for (size_t i = 0; i < expaliasesTEMP.size(); ++i) {
DPID::FILL(dpidtmp, expaliasesTEMP[i], o2::dcs::DeliveryType::RAW_DOUBLE);
DPID::FILL(dpidtmp, expaliasesTEMP[i], o2::dcs::DeliveryType::DPVAL_DOUBLE);
dpid2DataDesc[dpidtmp] = "EMCDATAPOINTS";
}
for (size_t i = 0; i < expaliasesINT.size(); ++i) {
DPID::FILL(dpidtmp, expaliasesINT[i], o2::dcs::DeliveryType::RAW_INT);
DPID::FILL(dpidtmp, expaliasesINT[i], o2::dcs::DeliveryType::DPVAL_INT);
dpid2DataDesc[dpidtmp] = "EMCDATAPOINTS";
}
for (size_t i = 0; i < expaliasesUINT.size(); ++i) {
DPID::FILL(dpidtmp, expaliasesUINT[i], o2::dcs::DeliveryType::RAW_UINT);
DPID::FILL(dpidtmp, expaliasesUINT[i], o2::dcs::DeliveryType::DPVAL_UINT);
dpid2DataDesc[dpidtmp] = "EMCDATAPOINTS";
}

Expand Down
14 changes: 7 additions & 7 deletions Detectors/EMCAL/calib/src/EMCDCSProcessor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ int EMCDCSProcessor::processDP(const DPCOM& dp)
auto& val = dp.data;

if (mVerbose) {
if (type == RAW_DOUBLE) {
if (type == DPVAL_DOUBLE) {
LOG(info) << "Processing DP = " << dp << ", with value = " << o2::dcs::getValue<double>(dp);
} else if (type == RAW_INT) {
} else if (type == DPVAL_INT) {
LOG(info) << "Processing DP = " << dp << ", with value = " << o2::dcs::getValue<int32_t>(dp);
} else if (type == RAW_UINT) {
} else if (type == DPVAL_UINT) {
LOG(info) << "Processing DP = " << dp << ", with value = " << o2::dcs::getValue<uint32_t>(dp);
}
}

if ((type == RAW_INT) || (type == RAW_UINT)) // FEE config params and STU_TRU error counters
if ((type == DPVAL_INT) || (type == DPVAL_UINT)) // FEE config params and STU_TRU error counters
{
auto& dpval_prev = mapFEEcfg[dpid];
if (dpval_prev.size() == 0 || val.get_epoch_time() != dpval_prev.back().get_epoch_time()) //compate the time stamps
Expand All @@ -117,7 +117,7 @@ int EMCDCSProcessor::processDP(const DPCOM& dp)
FillFeeDP(dp);
setTF(val.get_epoch_time()); // fix: this must not be here!
}
} else if (type == RAW_DOUBLE) { // ELMB data
} else if (type == DPVAL_DOUBLE) { // ELMB data
FillElmbDP(dp);
}
//printPDCOM(dp);
Expand Down Expand Up @@ -149,7 +149,7 @@ void EMCDCSProcessor::FillElmbDP(const DPCOM& dpcom)
}
mELMB->addMeasurement(iPT, val);
} else {
LOG(info) << "EMC_PT pattern not found for DPype = RAW_DOUBLE: alias = " << alias.data();
LOG(info) << "EMC_PT pattern not found for DPype = DPVAL_DOUBLE: alias = " << alias.data();
}
return;
}
Expand Down Expand Up @@ -311,4 +311,4 @@ void EMCDCSProcessor::printPDCOM(const DPCOM& dpcom)
std::cout << " | type : " << type_str;
std::cout << " | ts : " << ts;
std::cout << " | value: " << val << std::endl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ class EMCALDCSDataProcessor : public o2::framework::Task
std::vector<std::string> expaliasesINT = o2::dcs::expandAliases(aliasesINT);

for (const auto& i : expaliasesTEMP) {
vect.emplace_back(i, o2::dcs::RAW_DOUBLE);
vect.emplace_back(i, o2::dcs::DPVAL_DOUBLE);
}
for (const auto& i : expaliasesINT) {
vect.emplace_back(i, o2::dcs::RAW_INT);
vect.emplace_back(i, o2::dcs::DPVAL_INT);
}
for (const auto& i : expaliasesUINT) {
vect.emplace_back(i, o2::dcs::RAW_UINT);
vect.emplace_back(i, o2::dcs::DPVAL_UINT);
}
}

Expand Down
3 changes: 3 additions & 0 deletions Detectors/GRP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@

add_subdirectory(calibration)
add_subdirectory(workflows)
if(BUILD_TESTING)
add_subdirectory(macros)
endif()
Loading