From 25b3a3890696513061e129135bfa2cf309455758 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Mon, 23 May 2022 21:54:34 +0200 Subject: [PATCH 01/19] Update CalibDB.h --- .../EMCAL/calib/include/EMCALCalib/CalibDB.h | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/Detectors/EMCAL/calib/include/EMCALCalib/CalibDB.h b/Detectors/EMCAL/calib/include/EMCALCalib/CalibDB.h index fdad7c5a6f499..01fb64884edce 100644 --- a/Detectors/EMCAL/calib/include/EMCALCalib/CalibDB.h +++ b/Detectors/EMCAL/calib/include/EMCALCalib/CalibDB.h @@ -27,7 +27,8 @@ class TempCalibParamSM; class TimeCalibrationParams; class TimeCalibParamL1Phase; class GainCalibrationFactors; -class TriggerDCS; +class FeeDCS; +class ElmbData; /// \class CalibDB /// \brief Interface to calibration data from CCDB for EMCAL @@ -256,19 +257,33 @@ class CalibDB /// \throw TypeMismatchException if object is present but type is different (CCDB corrupted) GainCalibrationFactors* readGainCalibFactors(ULong_t timestamp, const std::map& metadata); - /// \brief Store Trigger DCS data in the CCDB - /// \param dcs trigger DCS data to be stored + /// \brief Store FEE DCS data in the CCDB + /// \param dcs FEE DCS data to be stored /// \param metadata Additional metadata that can be used in the query /// \param timestart Start of the time range of the validity of the object /// \param timeend End of the time range of the validity of the object - void storeTriggerDCSData(TriggerDCS* dcs, const std::map& metadata, ULong_t timestart, ULong_t timeend); + void storeFeeDCSData(FeeDCS* dcs, const std::map& metadata, ULong_t timestart, ULong_t timeend); - /// \brief Find trigger DCS data in the CCDB for given timestamp + /// \brief Find FEE DCS data in the CCDB for given timestamp /// \param timestamp Timestamp used in query /// \param metadata Additional metadata to be used in the query /// \throw ObjectNotFoundException if object is not found for the given timestamp /// \throw TypeMismatchException if object is present but type is different (CCDB corrupted) - TriggerDCS* readTriggerDCSData(ULong_t timestamp, const std::map& metadata); + FeeDCS* readFeeDCSData(ULong_t timestamp, const std::map& metadata); + + /// \brief Store Temperature Sensor data in the CCDB + /// \param dcs Temperature Sensor data to be stored + /// \param metadata Additional metadata that can be used in the query + /// \param timestart Start of the time range of the validity of the object + /// \param timeend End of the time range of the validity of the object + void storeTemperatureSensorData(ElmbData* dcs, const std::map& metadata, ULong_t timestart, ULong_t timeend); + + /// \brief Find Temperature Sensor data in the CCDB for given timestamp + /// \param timestamp Timestamp used in query + /// \param metadata Additional metadata to be used in the query + /// \throw ObjectNotFoundException if object is not found for the given timestamp + /// \throw TypeMismatchException if object is present but type is different (CCDB corrupted) + ElmbData* readTemperatureSensorData(ULong_t timestamp, const std::map& metadata); /// \brief Set new CCDB server URL /// \param server Name of the CCDB server to be used in queries @@ -306,9 +321,13 @@ class CalibDB /// \return Path of the gain calibration in the CCDB static const char* getCDBPathGainCalibrationParams() { return "EMC/Calib/GainCalibFactors"; } - /// \brief Get CDB path for the trigger DCS settings - /// \return Path of the trigger DCS settings in the CCDB - static const char* getCDBPathTriggerDCS() { return "EMC/Calib/TriggerDCS"; } + /// \brief Get CDB path for the FEE DCS settings + /// \return Path of the FEE DCS settings in the CCDB + static const char* getCDBPathFeeDCS() { return "EMC/Calib/FeeDCS"; } + + /// \brief Get CDB path for the Temperature Sensor data + /// \return Path of the Temperature Sensor data in the CCDB + static const char* getCDBPathTemperatureSensor() { return "EMC/Calib/Temperature"; } private: /// \brief Initialize CCDB server (when new object is created or the server URL changes) From 33dbf1974ccee176a39371e7b94a586be3c503f5 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Mon, 23 May 2022 21:56:32 +0200 Subject: [PATCH 02/19] Update FeeDCS.h --- Detectors/EMCAL/calib/include/EMCALCalib/FeeDCS.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Detectors/EMCAL/calib/include/EMCALCalib/FeeDCS.h b/Detectors/EMCAL/calib/include/EMCALCalib/FeeDCS.h index 828b844129439..ac61bd10efad9 100644 --- a/Detectors/EMCAL/calib/include/EMCALCalib/FeeDCS.h +++ b/Detectors/EMCAL/calib/include/EMCALCalib/FeeDCS.h @@ -55,6 +55,7 @@ class FeeDCS unsigned int getSRUFWversion(int ism = 0) const { return mSRUFWversion.at(ism); } unsigned int getSRUconfig(int ism = 0) const { return mSRUcfg.at(ism); } int getNSRUbuffers(int ism = 0) const { return (mSRUcfg.at(ism) >> 1 & 0x7); } + int getRunNumber() const { return mRunNumber; } void setTRUDCS(Int_t iTRU, o2::emcal::TriggerTRUDCS tru) { mTrigDCS.setTRU(iTRU, tru); } void setSTUEMCal(o2::emcal::TriggerSTUDCS stu) { mTrigDCS.setSTUEMCal(stu); } @@ -63,6 +64,7 @@ class FeeDCS void setDDLlist1(unsigned int a) { mLinks1 = std::bitset<14>(a); } void setSRUFWversion(int ism, unsigned int ver) { mSRUFWversion.at(ism) = ver; } void setSRUconfig(int ism, unsigned int ver) { mSRUcfg.at(ism) = ver; } + void setRunNumber(int rn) { mRunNumber = rn; } bool isDDLactive(int iDDL) { return (iDDL < 32 ? mLinks0.test(iDDL) : mLinks1.test(iDDL - 32)); } bool isSMactive(int iSM); @@ -70,6 +72,7 @@ class FeeDCS bool isDCalSTUactive() { return mLinks1.test(13); } // EMCAL STU FEEID is 45 private: + int mRunNumber = 0; ///< Run Number o2::emcal::TriggerDCS mTrigDCS; ///< TRU and STU config std::bitset<32> mLinks0; ///< info on first 32 DDLs included in RO, 1 means the DDL is active std::bitset<14> mLinks1; ///< info on remining 14 DDLs included in RO, 1 means the DDL is active @@ -84,4 +87,4 @@ std::ostream& operator<<(std::ostream& in, const FeeDCS& dcs); } // namespace emcal } // namespace o2 -#endif \ No newline at end of file +#endif From cf06df13d3e6ab29315b83de57f7398c642268a6 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Mon, 23 May 2022 21:57:46 +0200 Subject: [PATCH 03/19] Update CalibDB.cxx --- Detectors/EMCAL/calib/src/CalibDB.cxx | 33 ++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/Detectors/EMCAL/calib/src/CalibDB.cxx b/Detectors/EMCAL/calib/src/CalibDB.cxx index 92db36fec14d6..dd5094003736d 100644 --- a/Detectors/EMCAL/calib/src/CalibDB.cxx +++ b/Detectors/EMCAL/calib/src/CalibDB.cxx @@ -15,8 +15,9 @@ #include "EMCALCalib/TimeCalibParamL1Phase.h" #include "EMCALCalib/TempCalibParamSM.h" #include "EMCALCalib/GainCalibrationFactors.h" -#include "EMCALCalib/TriggerDCS.h" +#include "EMCALCalib/FeeDCS.h" #include "EMCALCalib/CalibDB.h" +#include "EMCALCalib/ElmbData.h" using namespace o2::emcal; @@ -79,12 +80,20 @@ void CalibDB::storeGainCalibFactors(GainCalibrationFactors* gcf, const std::map< mCCDBManager.storeAsTFileAny(gcf, getCDBPathGainCalibrationParams(), metadata, rangestart, rangeend); } -void CalibDB::storeTriggerDCSData(TriggerDCS* dcs, const std::map& metadata, ULong_t rangestart, ULong_t rangeend) +void CalibDB::storeFeeDCSData(FeeDCS* dcs, const std::map& metadata, ULong_t rangestart, ULong_t rangeend) { if (!mInit) { init(); } - mCCDBManager.storeAsTFileAny(dcs, getCDBPathTriggerDCS(), metadata, rangestart, rangeend); + mCCDBManager.storeAsTFileAny(dcs, getCDBPathFeeDCS(), metadata, rangestart, rangeend); +} + +void CalibDB::storeTemperatureSensorData(ElmbData* dcs, const std::map& metadata, ULong_t rangestart, ULong_t rangeend) +{ + if (!mInit) { + init(); + } + mCCDBManager.storeAsTFileAny(dcs, getCDBPathTemperatureSensor(), metadata, rangestart, rangeend); } BadChannelMap* CalibDB::readBadChannelMap(ULong_t timestamp, const std::map& metadata) @@ -159,14 +168,26 @@ GainCalibrationFactors* CalibDB::readGainCalibFactors(ULong_t timestamp, const s return result; } -TriggerDCS* CalibDB::readTriggerDCSData(ULong_t timestamp, const std::map& metadata) +FeeDCS* CalibDB::readFeeDCSData(ULong_t timestamp, const std::map& metadata) +{ + if (!mInit) { + init(); + } + FeeDCS* result = mCCDBManager.retrieveFromTFileAny(getCDBPathFeeDCS(), metadata, timestamp); + if (!result) { + throw ObjectNotFoundException(mCCDBServer, getCDBPathFeeDCS(), metadata, timestamp); + } + return result; +} + +ElmbData* CalibDB::readTemperatureSensorData(ULong_t timestamp, const std::map& metadata) { if (!mInit) { init(); } - TriggerDCS* result = mCCDBManager.retrieveFromTFileAny(getCDBPathTriggerDCS(), metadata, timestamp); + ElmbData* result = mCCDBManager.retrieveFromTFileAny(getCDBPathTemperatureSensor(), metadata, timestamp); if (!result) { - throw ObjectNotFoundException(mCCDBServer, getCDBPathTriggerDCS(), metadata, timestamp); + throw ObjectNotFoundException(mCCDBServer, getCDBPathTemperatureSensor(), metadata, timestamp); } return result; } From 992915175d9c70de5eaf032a5cab133363a8fcef Mon Sep 17 00:00:00 2001 From: mpoghos Date: Mon, 23 May 2022 21:58:25 +0200 Subject: [PATCH 04/19] Update FeeDCS.cxx --- Detectors/EMCAL/calib/src/FeeDCS.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Detectors/EMCAL/calib/src/FeeDCS.cxx b/Detectors/EMCAL/calib/src/FeeDCS.cxx index 8de3ab5c87be1..aee89e7ad02a8 100644 --- a/Detectors/EMCAL/calib/src/FeeDCS.cxx +++ b/Detectors/EMCAL/calib/src/FeeDCS.cxx @@ -19,13 +19,13 @@ bool FeeDCS::operator==(const FeeDCS& other) const { return ((mTrigDCS == other.mTrigDCS) && (mLinks0 == other.mLinks0) && (mLinks1 == other.mLinks1) && - (mSRUFWversion == other.mSRUFWversion) && (mSRUcfg == other.mSRUcfg)); + (mSRUFWversion == other.mSRUFWversion) && (mSRUcfg == other.mSRUcfg) && (mRunNumber == other.mRunNumber)); } bool FeeDCS::isSMactive(int iSM) { - //assert(iSM>19 && "SM index larger than 19!"); + // assert(iSM>19 && "SM index larger than 19!"); if (iSM == 10 || iSM == 19) { // SMs 10 and 19 have 1 DDL each return isDDLactive(2 * iSM); @@ -38,9 +38,13 @@ bool FeeDCS::isSMactive(int iSM) std::ostream& o2::emcal::operator<<(std::ostream& stream, const FeeDCS& dcs) { - stream << "EMCAL FEE config:\n"; stream << "================================\n"; - stream << "DDL Link list0: b'" << std::hex << dcs.getDDLlist0() << std::endl; + stream << "EMCAL FEE config for run #" << std::dec << dcs.getRunNumber() << ": \n "; + stream + << "DDL Link list0: b'" + << std::hex + << dcs.getDDLlist0() + << std::endl; stream << "DDL Link list1: b'" << std::hex << dcs.getDDLlist1() << std::endl; for (int i = 0; i < 20; i++) { From b43eb4d5e220227a10dafeb441c952d7483a865d Mon Sep 17 00:00:00 2001 From: mpoghos Date: Mon, 23 May 2022 21:59:20 +0200 Subject: [PATCH 05/19] Update EMCDCSProcessor.h --- .../include/EMCALCalibration/EMCDCSProcessor.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Detectors/EMCAL/calibration/include/EMCALCalibration/EMCDCSProcessor.h b/Detectors/EMCAL/calibration/include/EMCALCalibration/EMCDCSProcessor.h index c8c96a133d518..5b3069e275050 100644 --- a/Detectors/EMCAL/calibration/include/EMCALCalibration/EMCDCSProcessor.h +++ b/Detectors/EMCAL/calibration/include/EMCALCalibration/EMCDCSProcessor.h @@ -70,6 +70,7 @@ class EMCDCSProcessor CcdbObjectInfo& getccdbELMBinfo() { return mccdbELMBinfo; } CcdbObjectInfo& getccdbFeeDCSinfo() { return mccdbFEEcfginfo; } + int getRunNumberFromGRP() { return mRunNumberFromGRP; } void updateFeeCCDBinfo(); void updateElmbCCDBinfo(); @@ -82,11 +83,14 @@ class EMCDCSProcessor void setTF(TFType tf) { mTF = tf; } void setElmbCCDBupdateRate(TFType tf) { mElmbCCDBupdateRate = tf; } + void setRunNumberFromGRP(int rn) { mRunNumberFromGRP = rn; } private: TFType mTF{0}; // TF index for processing TFType mTFprevELMB{0}; // TF index of previous ELMB data update in CCDB TFType mElmbCCDBupdateRate{1000}; // duration (in TF units) for averaging and updating the ELMB data in CCDB + bool mVerbose = false; + int mRunNumberFromGRP = -2; // Run number from GRP; -1 is the default in RunStatusChecker.h. Here use -2. std::unordered_map mPids; // contains all PIDs for the processor, the bool // will be true if the DP was processed at least once @@ -102,14 +106,11 @@ class EMCDCSProcessor std::unique_ptr mELMBdata; o2::emcal::TriggerSTUDCS mSTU; - //o2::emcal::TriggerTRUDCS mTRU; - TriggerTRUDCS mTRU; + o2::emcal::TriggerTRUDCS mTRU; void FillFeeDP(const DPCOM& dpcom); void FillElmbDP(const DPCOM& dpcom); - bool mVerbose = false; - ClassDefNV(EMCDCSProcessor, 1); }; @@ -131,4 +132,4 @@ void EMCDCSProcessor::prepareCCDBobjectInfo(const T& obj, CcdbObjectInfo& info, } // namespace emcal } // namespace o2 -#endif \ No newline at end of file +#endif From f59c057d41a28e8decb7456c1959048717accde0 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Mon, 23 May 2022 22:01:45 +0200 Subject: [PATCH 06/19] Update readEMCALDCSentries.C --- Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C b/Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C index a127dd642cf5d..d8c4b85fbf29a 100644 --- a/Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C +++ b/Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C @@ -26,9 +26,10 @@ using namespace o2::emcal; +typedef std::tuple Sensor_t; //{Npoints, mean, rms, min, max} void printElmbData(std::vector data); -void readEMCALDCSentries(long ts = 9999999999000, const char* ccdb = "http://ccdb-test.cern.ch:8080") +void readEMCALDCSentries(long ts = 9999999999990, const char* ccdb = "http://ccdb-test.cern.ch:8080") { o2::ccdb::CcdbApi api; @@ -39,7 +40,7 @@ void readEMCALDCSentries(long ts = 9999999999000, const char* ccdb = "http://ccd } FeeDCS* feeDCS(nullptr); - feeDCS = api.retrieveFromTFileAny("EMC/FeeDCS", metadata, ts); + feeDCS = api.retrieveFromTFileAny(o2::emcal::CalibDB::getCDBPathFeeDCS(), metadata, ts); if (!feeDCS) { std::cerr << "No FeeDCS object received from CCDB" << std::endl; } else { @@ -47,7 +48,7 @@ void readEMCALDCSentries(long ts = 9999999999000, const char* ccdb = "http://ccd } ElmbData* mELMBdata(nullptr); - mELMBdata = api.retrieveFromTFileAny("EMC/Temperature", metadata, ts); + mELMBdata = api.retrieveFromTFileAny(o2::emcal::CalibDB::getCDBPathTemperatureSensor(), metadata, ts); if (!mELMBdata) { std::cerr << "No Temperature object received from CCDB" << std::endl; } else { From 9c6998ff239894d43444ee21d095ccc6283f5b7e Mon Sep 17 00:00:00 2001 From: mpoghos Date: Mon, 23 May 2022 22:03:20 +0200 Subject: [PATCH 07/19] Update makeEMCALCCDBEntryForDCS.C --- Detectors/EMCAL/calibration/macros/makeEMCALCCDBEntryForDCS.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Detectors/EMCAL/calibration/macros/makeEMCALCCDBEntryForDCS.C b/Detectors/EMCAL/calibration/macros/makeEMCALCCDBEntryForDCS.C index 12ee6638e18d6..31f951890815f 100644 --- a/Detectors/EMCAL/calibration/macros/makeEMCALCCDBEntryForDCS.C +++ b/Detectors/EMCAL/calibration/macros/makeEMCALCCDBEntryForDCS.C @@ -29,7 +29,7 @@ int makeEMCALCCDBEntryForDCS(const std::string url = "http://ccdb-test.cern.ch:8 // macro to populate CCDB for EMC with the configuration for DCS std::unordered_map dpid2DataDesc; - std::vector aliasesTEMP = {"EMC_PT_[00..83]/Temperature", "EMC_PT_[88..91]/Temperature", "EMC_PT_[96..159]/Temperature"}; + std::vector aliasesTEMP = {"EMC_PT_[00..83].Temperature", "EMC_PT_[88..91].Temperature", "EMC_PT_[96..159].Temperature"}; std::vector aliasesUINT = {"EMC_DDL_LIST[0..1]", "EMC_SRU[00..19]_CFG", "EMC_SRU[00..19]_FMVER", "EMC_TRU[00..45]_PEAKFINDER", "EMC_TRU[00..45]_L0ALGSEL", "EMC_TRU[00..45]_COSMTHRESH", "EMC_TRU[00..45]_GLOBALTHRESH", "EMC_TRU[00..45]_MASK[0..5]", @@ -38,7 +38,7 @@ int makeEMCALCCDBEntryForDCS(const std::string url = "http://ccdb-test.cern.ch:8 "EMC_STU_JA[0..1]", "EMC_STU_JB[0..1]", "EMC_STU_JC[0..1]", "EMC_STU_PATCHSIZE", "EMC_STU_GETRAW", "EMC_STU_MEDIAN", "EMC_STU_REGION", "DMC_STU_FWVERS", "DMC_STU_PHOS_scale[0..3]", "DMC_STU_GA[0..1]", "DMC_STU_GB[0..1]", "DMC_STU_GC[0..1]", "DMC_STU_JA[0..1]", "DMC_STU_JB[0..1]", "DMC_STU_JC[0..1]", - "DMC_STU_PATCHSIZE", "DMC_STU_GETRAW", "DMC_STU_MEDIAN", "DMC_STU_REGION"}; + "DMC_STU_PATCHSIZE", "DMC_STU_GETRAW", "DMC_STU_MEDIAN", "DMC_STU_REGION", "EMC_RUNNUMBER"}; std::vector expaliasesTEMP = o2::dcs::expandAliases(aliasesTEMP); std::vector expaliasesUINT = o2::dcs::expandAliases(aliasesUINT); From e4e7c78716c90f06a330d4af8a12b874440bf9ca Mon Sep 17 00:00:00 2001 From: mpoghos Date: Mon, 23 May 2022 22:04:06 +0200 Subject: [PATCH 08/19] Update EMCDCSProcessor.cxx --- .../EMCAL/calibration/src/EMCDCSProcessor.cxx | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx b/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx index c04cd51f2e8be..e93738b723921 100644 --- a/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx +++ b/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx @@ -30,6 +30,7 @@ #include #include +#include "EMCALCalib/CalibDB.h" #include "EMCALCalibration/EMCDCSProcessor.h" using namespace o2::dcs; @@ -109,10 +110,10 @@ int EMCDCSProcessor::processDP(const DPCOM& dp) 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 + if (dpval_prev.size() == 0 || val.get_epoch_time() != dpval_prev.back().get_epoch_time()) // compare the time stamps { dpval_prev.push_back(val); // do we need to archive them all????? - mUpdateFEEcfg = true; + // mUpdateFEEcfg = true; FEE data will be updated based on SOR/EOR FillFeeDP(dp); setTF(val.get_epoch_time()); // fix: this must not be here! @@ -179,6 +180,19 @@ void EMCDCSProcessor::FillFeeDP(const DPCOM& dpcom) if ((index = alias.find("STU_ERROR_COUNT_TRU")) != std::string::npos) { // processing of STU_TRU error counters not included yet return; + } + + else if (alias.find("EMC_RUNNUMBER") != std::string::npos) { + if (mFEECFG->getRunNumber() != val) { + mUpdateFEEcfg = true; + } + if (mRunNumberFromGRP == -2) { // no run number from GRP + mFEECFG->setRunNumber(val); + } else { + mFEECFG->setRunNumber(mRunNumberFromGRP); + if (mRunNumberFromGRP != val) + LOG(error) << "RunNumber from GRP (=" << mRunNumberFromGRP << ") and from EMC DCS (=" << val << ") are not consistant"; + } } else if (alias.find("EMC_DDL_LIST0") != std::string::npos) { mFEECFG->setDDLlist0(val); } else if (alias.find("EMC_DDL_LIST1") != std::string::npos) { @@ -278,7 +292,7 @@ void EMCDCSProcessor::updateElmbCCDBinfo() std::map metadata; metadata["responsible"] = "Martin Poghosyan"; - prepareCCDBobjectInfo(mELMBdata.get(), mccdbELMBinfo, "EMC/Temperature", mTF, metadata); + prepareCCDBobjectInfo(*mELMBdata.get(), mccdbELMBinfo, o2::emcal::CalibDB::getCDBPathTemperatureSensor(), mTF, metadata); } void EMCDCSProcessor::updateFeeCCDBinfo() @@ -290,7 +304,7 @@ void EMCDCSProcessor::updateFeeCCDBinfo() } std::map metadata; metadata["responsible"] = "Martin Poghosyan"; - prepareCCDBobjectInfo(mFEECFG.get(), mccdbFEEcfginfo, "EMC/FeeDCS", mTF, metadata); + prepareCCDBobjectInfo(*mFEECFG.get(), mccdbFEEcfginfo, o2::emcal::CalibDB::getCDBPathFeeDCS(), mTF, metadata); } void EMCDCSProcessor::printPDCOM(const DPCOM& dpcom) From c27250ccdc8acd039a4abea8271de457a53c1b4b Mon Sep 17 00:00:00 2001 From: mpoghos Date: Mon, 23 May 2022 22:05:02 +0200 Subject: [PATCH 09/19] Update EMCALDCSDataProcessorSpec.h --- .../EMCALWorkflow/EMCALDCSDataProcessorSpec.h | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/Detectors/EMCAL/workflow/include/EMCALWorkflow/EMCALDCSDataProcessorSpec.h b/Detectors/EMCAL/workflow/include/EMCALWorkflow/EMCALDCSDataProcessorSpec.h index 1d285d4e67160..dc4d321fe4b0b 100644 --- a/Detectors/EMCAL/workflow/include/EMCALWorkflow/EMCALDCSDataProcessorSpec.h +++ b/Detectors/EMCAL/workflow/include/EMCALWorkflow/EMCALDCSDataProcessorSpec.h @@ -82,7 +82,7 @@ class EMCALDCSDataProcessor : public o2::framework::Task } else { LOG(info) << "Configuring via hardcoded strings"; - std::vector aliasesTEMP = {"EMC_PT_[00..83]/Temperature", "EMC_PT_[88..91]/Temperature", "EMC_PT_[96..159]/Temperature"}; + std::vector aliasesTEMP = {"EMC_PT_[00..83].Temperature", "EMC_PT_[88..91].Temperature", "EMC_PT_[96..159].Temperature"}; std::vector aliasesUINT = {"EMC_DDL_LIST[0..1]", "EMC_SRU[00..19]_CFG", "EMC_SRU[00..19]_FMVER", "EMC_TRU[00..45]_PEAKFINDER", "EMC_TRU[00..45]_L0ALGSEL", "EMC_TRU[00..45]_COSMTHRESH", "EMC_TRU[00..45]_GLOBALTHRESH", "EMC_TRU[00..45]_MASK[0..5]", @@ -91,7 +91,7 @@ class EMCALDCSDataProcessor : public o2::framework::Task "EMC_STU_JA[0..1]", "EMC_STU_JB[0..1]", "EMC_STU_JC[0..1]", "EMC_STU_PATCHSIZE", "EMC_STU_GETRAW", "EMC_STU_MEDIAN", "EMC_STU_REGION", "DMC_STU_FWVERS", "DMC_STU_PHOS_scale[0..3]", "DMC_STU_GA[0..1]", "DMC_STU_GB[0..1]", "DMC_STU_GC[0..1]", "DMC_STU_JA[0..1]", "DMC_STU_JB[0..1]", "DMC_STU_JC[0..1]", - "DMC_STU_PATCHSIZE", "DMC_STU_GETRAW", "DMC_STU_MEDIAN", "DMC_STU_REGION"}; + "DMC_STU_PATCHSIZE", "DMC_STU_GETRAW", "DMC_STU_MEDIAN", "DMC_STU_REGION", "EMC_RUNNUMBER"}; std::vector expaliasesTEMP = o2::dcs::expandAliases(aliasesTEMP); std::vector expaliasesUINT = o2::dcs::expandAliases(aliasesUINT); @@ -134,14 +134,18 @@ class EMCALDCSDataProcessor : public o2::framework::Task } else if (mRunChecker.getRunStatus() == RunStatus::START) { // saw new run with wanted detectors LOGP(info, "Run {} has started", mRunChecker.getFollowedRun()); grp->print(); + mProcessor->setRunNumberFromGRP(mRunChecker.getFollowedRun()); } else if (mRunChecker.getRunStatus() == RunStatus::ONGOING) { // run which was already seen is still ongoing LOGP(info, "Run {} is still ongoing", mRunChecker.getFollowedRun()); } else if (mRunChecker.getRunStatus() == RunStatus::STOP) { // run which was already seen was stopped (EOR seen) LOGP(info, "Run {} was stopped", mRunChecker.getFollowedRun()); } + } else { + mProcessor->setRunNumberFromGRP(-2); } - auto tfid = o2::header::get(pc.inputs().get("input").header)->startTime; + // auto tfid = o2::header::get(pc.inputs().get("input").header)->startTime; + auto tfid = o2::header::get(pc.inputs().get("input").header)->creation; auto dps = pc.inputs().get>("input"); mProcessor->setTF(tfid); mProcessor->process(dps); @@ -151,13 +155,14 @@ class EMCALDCSDataProcessor : public o2::framework::Task sendELMButput(pc.outputs()); mTimer = timeNow; } - sendCFGoutput(pc.outputs()); + if ((mCheckRunStartStop && (mRunChecker.getRunStatus() == RunStatus::START)) || (!mCheckRunStartStop && mProcessor->isUpdateFEEcfg())) + sendCFGoutput(pc.outputs()); } void endOfStream(o2::framework::EndOfStreamContext& ec) final { sendELMButput(ec.outputs()); - sendCFGoutput(ec.outputs()); + // sendCFGoutput(ec.outputs()); } private: @@ -189,18 +194,18 @@ class EMCALDCSDataProcessor : public o2::framework::Task { // extract CCDB and FeeDCS info - if (mProcessor->isUpdateFEEcfg()) { - mProcessor->updateFeeCCDBinfo(); + // if (mProcessor->isUpdateFEEcfg()) { + mProcessor->updateFeeCCDBinfo(); - const auto& payload = mProcessor->getFeeDCSdata(); - auto& info = mProcessor->getccdbFeeDCSinfo(); - auto image = o2::ccdb::CcdbApi::createObjectImage(&payload, &info); - LOG(info) << "Sending object " << info.getPath() << "/" << info.getFileName() << " of size " << image->size() - << " bytes, valid for " << info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp(); + const auto& payload = mProcessor->getFeeDCSdata(); + auto& info = mProcessor->getccdbFeeDCSinfo(); + auto image = o2::ccdb::CcdbApi::createObjectImage(&payload, &info); + LOG(info) << "Sending object " << info.getPath() << "/" << info.getFileName() << " of size " << image->size() + << " bytes, valid for " << info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp(); - output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, "EMC_FeeDCS", 0}, *image.get()); - output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBWrapper, "EMC_FeeDCS", 0}, info); - } + output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, "EMC_FeeDCS", 0}, *image.get()); + output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBWrapper, "EMC_FeeDCS", 0}, info); + // } } }; // end class From a9fee12e637b84b47853f19b7d325bfc473fdd35 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Tue, 24 May 2022 17:09:41 +0200 Subject: [PATCH 10/19] Update readEMCALDCSentries.C --- Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C | 1 + 1 file changed, 1 insertion(+) diff --git a/Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C b/Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C index d8c4b85fbf29a..5ceb73ab9e80a 100644 --- a/Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C +++ b/Detectors/EMCAL/calibration/macros/readEMCALDCSentries.C @@ -17,6 +17,7 @@ #include "DetectorsDCS/DataPointIdentifier.h" #include "EMCALCalib/ElmbData.h" #include "EMCALCalibration/EMCDCSProcessor.h" +#include "EMCALCalib/CalibDB.h" //#include //#include From cec0af5dfead74ad00b08d4d925112c9a17647c6 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Tue, 24 May 2022 17:11:08 +0200 Subject: [PATCH 11/19] Delete TriggerDCS_CCDBApiTest.C TriggerDCS is included in FeeDCS. no need for a special check --- .../calib/macros/TriggerDCS_CCDBApiTest.C | 124 ------------------ 1 file changed, 124 deletions(-) delete mode 100644 Detectors/EMCAL/calib/macros/TriggerDCS_CCDBApiTest.C diff --git a/Detectors/EMCAL/calib/macros/TriggerDCS_CCDBApiTest.C b/Detectors/EMCAL/calib/macros/TriggerDCS_CCDBApiTest.C deleted file mode 100644 index 695b333f19063..0000000000000 --- a/Detectors/EMCAL/calib/macros/TriggerDCS_CCDBApiTest.C +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include "CCDB/CcdbApi.h" -#include "EMCALCalib/TriggerDCS.h" -#include "RStringView.h" -#include -#include -#include -#endif - -// functions getting test data -void ConfigureTRU(o2::emcal::TriggerTRUDCS& testobject) -{ - testobject.setSELPF(7711); - testobject.setL0SEL(1); - testobject.setL0COSM(100); - testobject.setGTHRL0(132); - testobject.setMaskReg(1024, 0); - testobject.setMaskReg(0, 1); - testobject.setMaskReg(512, 2); - testobject.setMaskReg(31985, 3); - testobject.setMaskReg(0, 4); - testobject.setMaskReg(0, 5); - testobject.setRLBKSTU(0); - testobject.setFw(0x21); -} - -void ConfigureSTU(o2::emcal::TriggerSTUDCS& testobject) -{ - testobject.setGammaHigh(0, 0); - testobject.setGammaHigh(1, 0); - testobject.setGammaHigh(2, 115); - testobject.setGammaLow(0, 0); - testobject.setGammaLow(1, 0); - testobject.setGammaLow(2, 51); - testobject.setJetHigh(0, 0); - testobject.setJetHigh(1, 0); - testobject.setJetHigh(2, 255); - testobject.setJetLow(0, 0); - testobject.setJetLow(1, 0); - testobject.setJetLow(2, 204); - testobject.setPatchSize(2); - testobject.setFw(0x2A012); - testobject.setMedianMode(0); - testobject.setRegion(0xffffffff); - for (int i = 0; i < 4; i++) - testobject.setPHOSScale(i, 0); -} - -/// \brief Converting time into numerical time stamp representation -unsigned long create_timestamp(int year, int month, int day, int hour, int minutes, int seconds) -{ - struct tm timeinfo; - timeinfo.tm_year = year; - timeinfo.tm_mon = month; - timeinfo.tm_mday = day; - timeinfo.tm_hour = hour; - timeinfo.tm_min = minutes; - timeinfo.tm_sec = seconds; - - time_t timeformat = mktime(&timeinfo); - return static_cast(timeformat); -} - -/// \brief Read-write test -/// -/// Writing to EMCAL CCDB server -/// Attention: Might overwrite existing CCDB content - use with care! -void TriggerDCS_CCDBApiTest(const std::string_view ccdbserver = "emcccdb-test.cern.ch") -{ - std::cout << "Using CCDB server " << ccdbserver << std::endl; - o2::ccdb::CcdbApi ccdbhandler; - ccdbhandler.init(ccdbserver.data()); - - // Prepare database object - o2::emcal::TriggerDCS* dcs = new o2::emcal::TriggerDCS; - - o2::emcal::TriggerSTUDCS stuEMCal; - ConfigureSTU(stuEMCal); - - o2::emcal::TriggerSTUDCS stuDCal; - ConfigureSTU(stuDCal); - stuDCal.setRegion(0xffffff7f); - - o2::emcal::TriggerTRUDCS tru; - ConfigureTRU(tru); - - dcs->setSTUEMCal(stuEMCal); - dcs->setSTUDCal(stuDCal); - dcs->setTRU(0, tru); - - // Set time limits: These are from the start of the run validity range (252235) to the end of the run validity range (267166) LHC16 - auto rangestart = create_timestamp(2016, 4, 23, 0, 58, 40), - rangeend = create_timestamp(2016, 12, 5, 6, 3, 19); - std::cout << "Using time stamps " << rangestart << " and " << rangeend << std::endl; - std::map metadata; - ccdbhandler.storeAsTFileAny(dcs, "EMC/TriggerDCS", metadata, rangestart, rangeend); - - // Read Trigger DCS data from CCDB, check whether they are the same - auto rangetest = create_timestamp(2016, 4, 23, 0, 58, 40); //LHC16 - std::cout << "Using read timestamp " << rangetest << std::endl; - o2::emcal::TriggerDCS* read(nullptr); - read = ccdbhandler.retrieveFromTFileAny("EMC/TriggerDCS", metadata, rangetest); - if (!read) { - std::cerr << "No object received from CCDB" << std::endl; - return; - } - std::cout << "Obtained Trigger DCS data from CCDB - test for match" << std::endl; - if (*dcs == *read) { - std::cout << "Trigger DCS data matching - test successfull" << std::endl; - } else { - std::cerr << "Trigger DCS data don't match" << std::endl; - } -} From 68bb4dc5e32148a034d4a9640fe393118741c841 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Tue, 24 May 2022 17:11:20 +0200 Subject: [PATCH 12/19] Delete TriggerDCS_CalibDBTest.C TriggerDCS is included in FeeDCS. no need for a special check --- .../calib/macros/TriggerDCS_CalibDBTest.C | 131 ------------------ 1 file changed, 131 deletions(-) delete mode 100644 Detectors/EMCAL/calib/macros/TriggerDCS_CalibDBTest.C diff --git a/Detectors/EMCAL/calib/macros/TriggerDCS_CalibDBTest.C b/Detectors/EMCAL/calib/macros/TriggerDCS_CalibDBTest.C deleted file mode 100644 index 6ebe114c1a8c3..0000000000000 --- a/Detectors/EMCAL/calib/macros/TriggerDCS_CalibDBTest.C +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include "EMCALCalib/TriggerDCS.h" -#include "EMCALCalib/CalibDB.h" -#include "RStringView.h" -#include -#include -#include -#endif - -// functions getting test data -void ConfigureTRU(o2::emcal::TriggerTRUDCS& testobject) -{ - testobject.setSELPF(7711); - testobject.setL0SEL(1); - testobject.setL0COSM(100); - testobject.setGTHRL0(132); - testobject.setMaskReg(1024, 0); - testobject.setMaskReg(0, 1); - testobject.setMaskReg(512, 2); - testobject.setMaskReg(31985, 3); - testobject.setMaskReg(0, 4); - testobject.setMaskReg(0, 5); - testobject.setRLBKSTU(0); - testobject.setFw(0x21); -} - -void ConfigureSTU(o2::emcal::TriggerSTUDCS& testobject) -{ - testobject.setGammaHigh(0, 0); - testobject.setGammaHigh(1, 0); - testobject.setGammaHigh(2, 115); - testobject.setGammaLow(0, 0); - testobject.setGammaLow(1, 0); - testobject.setGammaLow(2, 51); - testobject.setJetHigh(0, 0); - testobject.setJetHigh(1, 0); - testobject.setJetHigh(2, 255); - testobject.setJetLow(0, 0); - testobject.setJetLow(1, 0); - testobject.setJetLow(2, 204); - testobject.setPatchSize(2); - testobject.setFw(0x2A012); - testobject.setMedianMode(0); - testobject.setRegion(0xffffffff); - for (int i = 0; i < 4; i++) - testobject.setPHOSScale(i, 0); -} - -/// \brief Converting time into numerical time stamp representation -unsigned long create_timestamp(int year, int month, int day, int hour, int minutes, int seconds) -{ - struct tm timeinfo; - timeinfo.tm_year = year; - timeinfo.tm_mon = month; - timeinfo.tm_mday = day; - timeinfo.tm_hour = hour; - timeinfo.tm_min = minutes; - timeinfo.tm_sec = seconds; - - time_t timeformat = mktime(&timeinfo); - return static_cast(timeformat); -} - -/// \brief Read-write test -/// -/// Writing to EMCAL CCDB server -/// Attention: Might overwrite existing CCDB content - use with care! -void TriggerDCS_CalibDBTest(const std::string_view ccdbserver = "emcccdb-test.cern.ch") -{ - std::cout << "Using CCDB server " << ccdbserver << std::endl; - o2::emcal::CalibDB ccdbhandler(ccdbserver); - - // Prepare database object - o2::emcal::TriggerDCS* dcs = new o2::emcal::TriggerDCS; - - o2::emcal::TriggerSTUDCS stuEMCal; - ConfigureSTU(stuEMCal); - - o2::emcal::TriggerSTUDCS stuDCal; - ConfigureSTU(stuDCal); - stuDCal.setRegion(0xffffff7f); - - o2::emcal::TriggerTRUDCS tru; - ConfigureTRU(tru); - - dcs->setSTUEMCal(stuEMCal); - dcs->setSTUDCal(stuDCal); - dcs->setTRU(0, tru); - - // Set time limits: These are from the start of the run validity range (252235) to the end of the run validity range (267166) LHC16 - auto rangestart = create_timestamp(2016, 4, 23, 0, 58, 40), - rangeend = create_timestamp(2016, 12, 5, 6, 3, 19); - std::cout << "Using time stamps " << rangestart << " and " << rangeend << std::endl; - std::map metadata; - ccdbhandler.storeTriggerDCSData(dcs, metadata, rangestart, rangeend); - - // Read Trigger DCS from CCDB, check whether they are the same - auto rangetest = create_timestamp(2016, 4, 23, 0, 58, 40); //LHC16 - std::cout << "Using read timestamp " << rangetest << std::endl; - o2::emcal::TriggerDCS* read(nullptr); - try { - read = ccdbhandler.readTriggerDCSData(rangetest, metadata); - } catch (o2::emcal::CalibDB::ObjectNotFoundException& oe) { - std::cerr << "CCDB error: " << oe.what() << std::endl; - return; - } catch (o2::emcal::CalibDB::TypeMismatchException& te) { - std::cout << "CCDB error: " << te.what() << std::endl; - return; - } - if (!read) { - std::cerr << "No object received from CCDB" << std::endl; - return; - } - std::cout << "Obtained Trigger DCS data from CCDB - test for match" << std::endl; - if (*dcs == *read) { - std::cout << "Trigger DCS data matching - test successfull" << std::endl; - } else { - std::cerr << "Trigger DCS data don't match" << std::endl; - } -} From f90a5190c625d5f859fc685ebc615fc4416606c5 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Tue, 24 May 2022 17:12:38 +0200 Subject: [PATCH 13/19] Create FeeDCS_CalibDBTest.C --- .../EMCAL/calib/macros/FeeDCS_CalibDBTest.C | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C diff --git a/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C b/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C new file mode 100644 index 0000000000000..26a396aec6d9d --- /dev/null +++ b/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C @@ -0,0 +1,148 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#if !defined(__CLING__) || defined(__ROOTCLING__) +#include "EMCALCalib/FeeDCS.h" +#include "EMCALCalib/CalibDB.h" +#include "RStringView.h" +#include +#include +#include +#endif + +// functions getting test data +void ConfigureTRU(o2::emcal::TriggerTRUDCS& testobject) +{ + testobject.setSELPF(7711); + testobject.setL0SEL(1); + testobject.setL0COSM(100); + testobject.setGTHRL0(132); + testobject.setMaskReg(1024, 0); + testobject.setMaskReg(0, 1); + testobject.setMaskReg(512, 2); + testobject.setMaskReg(31985, 3); + testobject.setMaskReg(0, 4); + testobject.setMaskReg(0, 5); + testobject.setRLBKSTU(0); + testobject.setFw(0x21); +} + +void ConfigureSTU(o2::emcal::TriggerSTUDCS& testobject) +{ + testobject.setGammaHigh(0, 0); + testobject.setGammaHigh(1, 0); + testobject.setGammaHigh(2, 115); + testobject.setGammaLow(0, 0); + testobject.setGammaLow(1, 0); + testobject.setGammaLow(2, 51); + testobject.setJetHigh(0, 0); + testobject.setJetHigh(1, 0); + testobject.setJetHigh(2, 255); + testobject.setJetLow(0, 0); + testobject.setJetLow(1, 0); + testobject.setJetLow(2, 204); + testobject.setPatchSize(2); + testobject.setFw(0x2A012); + testobject.setMedianMode(0); + testobject.setRegion(0xffffffff); + for (int i = 0; i < 4; i++) + testobject.setPHOSScale(i, 0); +} + +/// \brief Converting time into numerical time stamp representation +unsigned long create_timestamp(int year, int month, int day, int hour, int minutes, int seconds) +{ + struct tm timeinfo; + timeinfo.tm_year = year; + timeinfo.tm_mon = month; + timeinfo.tm_mday = day; + timeinfo.tm_hour = hour; + timeinfo.tm_min = minutes; + timeinfo.tm_sec = seconds; + + time_t timeformat = mktime(&timeinfo); + return static_cast(timeformat); +} + +/// \brief Read-write test +/// +/// Writing to EMCAL CCDB server +/// Attention: Might overwrite existing CCDB content - use with care! +//void FeeDCS_CalibDBTest(const std::string_view ccdbserver = "emcccdb-test.cern.ch") +void FeeDCS_CalibDBTest(const std::string_view ccdbserver = "http://ccdb-test.cern.ch") +{ + std::cout << "Using CCDB server " << ccdbserver << std::endl; + o2::emcal::CalibDB ccdbhandler(ccdbserver); + + // Prepare database object + + o2::emcal::FeeDCS* feeDCS = new o2::emcal::FeeDCS; + feeDCS->setRunNumber(101010); + feeDCS->setDDLlist0(12345); + feeDCS->setDDLlist1(16789); + + for (int ism = 0; ism < 20; ism++) { + feeDCS->setSRUFWversion(ism, ism * 2); + feeDCS->setSRUconfig(ism, ism * 3); + } + + o2::emcal::TriggerSTUDCS stuEMCal; + ConfigureSTU(stuEMCal); + + o2::emcal::TriggerSTUDCS stuDCal; + ConfigureSTU(stuDCal); + stuDCal.setRegion(0xffffff7f); + + o2::emcal::TriggerTRUDCS tru; + ConfigureTRU(tru); + + feeDCS->setSTUEMCal(stuEMCal); + feeDCS->setSTUDCal(stuDCal); + for (int itru = 0; itru < 46; itru++) + feeDCS->setTRUDCS(itru, tru); + + // Set time limits: These are from the start of the run validity range (252235) to the end of the run validity range (267166) LHC16 + auto rangestart = create_timestamp(2017, 4, 23, 0, 58, 40), + rangeend = create_timestamp(2017, 12, 5, 6, 3, 19); + std::cout << "Using time stamps " << rangestart << " and " << rangeend << std::endl; + std::map metadata; + + ccdbhandler.storeFeeDCSData(feeDCS, metadata, rangestart, rangeend); + +// return; + + + // Read FEE DCS from CCDB, check whether they are the same + auto rangetest = create_timestamp(2017, 4, 23, 0, 58, 40); // LHC16 + std::cout << "Using read timestamp " << rangetest << std::endl; + o2::emcal::FeeDCS* read(nullptr); + try { + read = ccdbhandler.readFeeDCSData(rangetest, metadata); + } catch (o2::emcal::CalibDB::ObjectNotFoundException& oe) { + std::cerr << "CCDB error: " << oe.what() << std::endl; + return; + } catch (o2::emcal::CalibDB::TypeMismatchException& te) { + std::cout << "CCDB error: " << te.what() << std::endl; + return; + } + if (!read) { + std::cerr << "No object received from CCDB" << std::endl; + return; + } + std::cout << "Obtained Trigger DCS data from CCDB - test for match" << std::endl; + if (*feeDCS == *read) { + std::cout << "FEE DCS data matching - test successfull" << std::endl; + } else { + std::cerr << "FEE DCS data don't match" << std::endl; + } + +std:: cout << *read << endl; +} From f0a25ef71a7ed6b8c638aa53d90ba8e5632f47e0 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Tue, 24 May 2022 17:27:11 +0200 Subject: [PATCH 14/19] Update FeeDCS_CalibDBTest.C --- Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C | 1 + 1 file changed, 1 insertion(+) diff --git a/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C b/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C index 26a396aec6d9d..d20d125ee62ac 100644 --- a/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C +++ b/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C @@ -146,3 +146,4 @@ void FeeDCS_CalibDBTest(const std::string_view ccdbserver = "http://ccdb-test.ce std:: cout << *read << endl; } + From 38e9bec6f77667491ec7217e9e286d5057965e2d Mon Sep 17 00:00:00 2001 From: mpoghos Date: Tue, 24 May 2022 17:28:38 +0200 Subject: [PATCH 15/19] Delete FeeDCS_CalibDBTest.C --- .../EMCAL/calib/macros/FeeDCS_CalibDBTest.C | 149 ------------------ 1 file changed, 149 deletions(-) delete mode 100644 Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C diff --git a/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C b/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C deleted file mode 100644 index d20d125ee62ac..0000000000000 --- a/Detectors/EMCAL/calib/macros/FeeDCS_CalibDBTest.C +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include "EMCALCalib/FeeDCS.h" -#include "EMCALCalib/CalibDB.h" -#include "RStringView.h" -#include -#include -#include -#endif - -// functions getting test data -void ConfigureTRU(o2::emcal::TriggerTRUDCS& testobject) -{ - testobject.setSELPF(7711); - testobject.setL0SEL(1); - testobject.setL0COSM(100); - testobject.setGTHRL0(132); - testobject.setMaskReg(1024, 0); - testobject.setMaskReg(0, 1); - testobject.setMaskReg(512, 2); - testobject.setMaskReg(31985, 3); - testobject.setMaskReg(0, 4); - testobject.setMaskReg(0, 5); - testobject.setRLBKSTU(0); - testobject.setFw(0x21); -} - -void ConfigureSTU(o2::emcal::TriggerSTUDCS& testobject) -{ - testobject.setGammaHigh(0, 0); - testobject.setGammaHigh(1, 0); - testobject.setGammaHigh(2, 115); - testobject.setGammaLow(0, 0); - testobject.setGammaLow(1, 0); - testobject.setGammaLow(2, 51); - testobject.setJetHigh(0, 0); - testobject.setJetHigh(1, 0); - testobject.setJetHigh(2, 255); - testobject.setJetLow(0, 0); - testobject.setJetLow(1, 0); - testobject.setJetLow(2, 204); - testobject.setPatchSize(2); - testobject.setFw(0x2A012); - testobject.setMedianMode(0); - testobject.setRegion(0xffffffff); - for (int i = 0; i < 4; i++) - testobject.setPHOSScale(i, 0); -} - -/// \brief Converting time into numerical time stamp representation -unsigned long create_timestamp(int year, int month, int day, int hour, int minutes, int seconds) -{ - struct tm timeinfo; - timeinfo.tm_year = year; - timeinfo.tm_mon = month; - timeinfo.tm_mday = day; - timeinfo.tm_hour = hour; - timeinfo.tm_min = minutes; - timeinfo.tm_sec = seconds; - - time_t timeformat = mktime(&timeinfo); - return static_cast(timeformat); -} - -/// \brief Read-write test -/// -/// Writing to EMCAL CCDB server -/// Attention: Might overwrite existing CCDB content - use with care! -//void FeeDCS_CalibDBTest(const std::string_view ccdbserver = "emcccdb-test.cern.ch") -void FeeDCS_CalibDBTest(const std::string_view ccdbserver = "http://ccdb-test.cern.ch") -{ - std::cout << "Using CCDB server " << ccdbserver << std::endl; - o2::emcal::CalibDB ccdbhandler(ccdbserver); - - // Prepare database object - - o2::emcal::FeeDCS* feeDCS = new o2::emcal::FeeDCS; - feeDCS->setRunNumber(101010); - feeDCS->setDDLlist0(12345); - feeDCS->setDDLlist1(16789); - - for (int ism = 0; ism < 20; ism++) { - feeDCS->setSRUFWversion(ism, ism * 2); - feeDCS->setSRUconfig(ism, ism * 3); - } - - o2::emcal::TriggerSTUDCS stuEMCal; - ConfigureSTU(stuEMCal); - - o2::emcal::TriggerSTUDCS stuDCal; - ConfigureSTU(stuDCal); - stuDCal.setRegion(0xffffff7f); - - o2::emcal::TriggerTRUDCS tru; - ConfigureTRU(tru); - - feeDCS->setSTUEMCal(stuEMCal); - feeDCS->setSTUDCal(stuDCal); - for (int itru = 0; itru < 46; itru++) - feeDCS->setTRUDCS(itru, tru); - - // Set time limits: These are from the start of the run validity range (252235) to the end of the run validity range (267166) LHC16 - auto rangestart = create_timestamp(2017, 4, 23, 0, 58, 40), - rangeend = create_timestamp(2017, 12, 5, 6, 3, 19); - std::cout << "Using time stamps " << rangestart << " and " << rangeend << std::endl; - std::map metadata; - - ccdbhandler.storeFeeDCSData(feeDCS, metadata, rangestart, rangeend); - -// return; - - - // Read FEE DCS from CCDB, check whether they are the same - auto rangetest = create_timestamp(2017, 4, 23, 0, 58, 40); // LHC16 - std::cout << "Using read timestamp " << rangetest << std::endl; - o2::emcal::FeeDCS* read(nullptr); - try { - read = ccdbhandler.readFeeDCSData(rangetest, metadata); - } catch (o2::emcal::CalibDB::ObjectNotFoundException& oe) { - std::cerr << "CCDB error: " << oe.what() << std::endl; - return; - } catch (o2::emcal::CalibDB::TypeMismatchException& te) { - std::cout << "CCDB error: " << te.what() << std::endl; - return; - } - if (!read) { - std::cerr << "No object received from CCDB" << std::endl; - return; - } - std::cout << "Obtained Trigger DCS data from CCDB - test for match" << std::endl; - if (*feeDCS == *read) { - std::cout << "FEE DCS data matching - test successfull" << std::endl; - } else { - std::cerr << "FEE DCS data don't match" << std::endl; - } - -std:: cout << *read << endl; -} - From 6a33278402a025f673e32f5508c23d83fa8540d2 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Tue, 24 May 2022 19:33:07 +0200 Subject: [PATCH 16/19] Update CMakeLists.txt --- Detectors/EMCAL/calib/CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Detectors/EMCAL/calib/CMakeLists.txt b/Detectors/EMCAL/calib/CMakeLists.txt index 8907a61690ea7..68f706faa1bd5 100644 --- a/Detectors/EMCAL/calib/CMakeLists.txt +++ b/Detectors/EMCAL/calib/CMakeLists.txt @@ -155,13 +155,5 @@ o2_add_test_root_macro(macros/GainCalibrationFactors_CalibDBTest.C PUBLIC_LINK_LIBRARIES O2::EMCALCalib LABELS emcal COMPILE_ONLY) -o2_add_test_root_macro(macros/TriggerDCS_CCDBApiTest.C - PUBLIC_LINK_LIBRARIES O2::EMCALCalib - LABELS emcal COMPILE_ONLY) - -o2_add_test_root_macro(macros/TriggerDCS_CalibDBTest.C - PUBLIC_LINK_LIBRARIES O2::EMCALCalib - LABELS emcal COMPILE_ONLY) - o2_data_file(COPY files DESTINATION Detectors/EMC) From 5582fa740852bb75ad84f1c0978f76ded35a8b62 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Wed, 25 May 2022 06:37:27 +0200 Subject: [PATCH 17/19] Update EMCDCSProcessor.cxx --- Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx b/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx index e93738b723921..02ff38834b12b 100644 --- a/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx +++ b/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx @@ -190,8 +190,9 @@ void EMCDCSProcessor::FillFeeDP(const DPCOM& dpcom) mFEECFG->setRunNumber(val); } else { mFEECFG->setRunNumber(mRunNumberFromGRP); - if (mRunNumberFromGRP != val) + if (mRunNumberFromGRP != val) { LOG(error) << "RunNumber from GRP (=" << mRunNumberFromGRP << ") and from EMC DCS (=" << val << ") are not consistant"; + } } } else if (alias.find("EMC_DDL_LIST0") != std::string::npos) { mFEECFG->setDDLlist0(val); From 6b3c9a839afbc8c54970cf9675f2d30b55b27a35 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Wed, 25 May 2022 06:39:52 +0200 Subject: [PATCH 18/19] Update EMCALDCSDataProcessorSpec.h --- .../workflow/include/EMCALWorkflow/EMCALDCSDataProcessorSpec.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Detectors/EMCAL/workflow/include/EMCALWorkflow/EMCALDCSDataProcessorSpec.h b/Detectors/EMCAL/workflow/include/EMCALWorkflow/EMCALDCSDataProcessorSpec.h index dc4d321fe4b0b..215319ea37015 100644 --- a/Detectors/EMCAL/workflow/include/EMCALWorkflow/EMCALDCSDataProcessorSpec.h +++ b/Detectors/EMCAL/workflow/include/EMCALWorkflow/EMCALDCSDataProcessorSpec.h @@ -155,8 +155,9 @@ class EMCALDCSDataProcessor : public o2::framework::Task sendELMButput(pc.outputs()); mTimer = timeNow; } - if ((mCheckRunStartStop && (mRunChecker.getRunStatus() == RunStatus::START)) || (!mCheckRunStartStop && mProcessor->isUpdateFEEcfg())) + if ((mCheckRunStartStop && (mRunChecker.getRunStatus() == RunStatus::START)) || (!mCheckRunStartStop && mProcessor->isUpdateFEEcfg())) { sendCFGoutput(pc.outputs()); + } } void endOfStream(o2::framework::EndOfStreamContext& ec) final From 602107060921c5f59ced16ca24a3c8dc43001d84 Mon Sep 17 00:00:00 2001 From: mpoghos Date: Wed, 25 May 2022 22:47:10 +0200 Subject: [PATCH 19/19] Update EMCDCSProcessor.cxx for triggering pr --- Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx b/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx index 02ff38834b12b..210ef349f66f1 100644 --- a/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx +++ b/Detectors/EMCAL/calibration/src/EMCDCSProcessor.cxx @@ -112,7 +112,7 @@ int EMCDCSProcessor::processDP(const DPCOM& dp) auto& dpval_prev = mapFEEcfg[dpid]; if (dpval_prev.size() == 0 || val.get_epoch_time() != dpval_prev.back().get_epoch_time()) // compare the time stamps { - dpval_prev.push_back(val); // do we need to archive them all????? + dpval_prev.push_back(val); // do we need to archive them all??? // mUpdateFEEcfg = true; FEE data will be updated based on SOR/EOR FillFeeDP(dp);