diff --git a/Modules/TRD/include/TRD/DigitsTask.h b/Modules/TRD/include/TRD/DigitsTask.h index 0edf813c39..58a4b28689 100644 --- a/Modules/TRD/include/TRD/DigitsTask.h +++ b/Modules/TRD/include/TRD/DigitsTask.h @@ -56,7 +56,6 @@ class DigitsTask final : public TaskInterface void buildHistograms(); void drawLinesMCM(TH2F* histo); void drawTrdLayersGrid(TH2F* hist); - void retrieveCCDBSettings(); void drawLinesOnPulseHeight(TH1F* h); void fillLinesOnHistsPerLayer(int iLayer); void drawHashOnLayers(int layer, int hcid, int col, int rowstart, int rowend); @@ -69,7 +68,6 @@ class DigitsTask final : public TaskInterface unsigned int mPulseHeightThreshold; std::pair mDriftRegion; std::pair mPulseHeightPeakRegion; - long int mTimestamp; std::shared_ptr mDigitsPerEvent; std::shared_ptr mEventswDigitsPerTimeFrame; @@ -112,8 +110,8 @@ class DigitsTask final : public TaskInterface // std::array, 540> mPulseHeightPerChamber_1D; // ph2DSM; std::vector mLayers; // information pulled from ccdb - o2::trd::NoiseStatusMCM* mNoiseMap = nullptr; - o2::trd::HalfChamberStatusQC* mChamberStatus = nullptr; + const o2::trd::NoiseStatusMCM* mNoiseMap = nullptr; + const o2::trd::HalfChamberStatusQC* mChamberStatus = nullptr; std::string mChambersToIgnore; std::bitset mChambersToIgnoreBP; }; diff --git a/Modules/TRD/include/TRD/PulseHeight.h b/Modules/TRD/include/TRD/PulseHeight.h index dc3f7b4b89..39534f19b3 100644 --- a/Modules/TRD/include/TRD/PulseHeight.h +++ b/Modules/TRD/include/TRD/PulseHeight.h @@ -52,10 +52,8 @@ class PulseHeight final : public TaskInterface void endOfActivity(const Activity& activity) override; void reset() override; void buildHistograms(); - void retrieveCCDBSettings(); private: - long int mTimestamp; std::shared_ptr mPulseHeight = nullptr; std::shared_ptr mPulseHeightScaled = nullptr; std::shared_ptr mTotalPulseHeight2D = nullptr; @@ -70,7 +68,7 @@ class PulseHeight final : public TaskInterface std::shared_ptr mPulseHeightDuration; std::shared_ptr mPulseHeightDuration1; std::shared_ptr mPulseHeightDurationDiff; - o2::trd::NoiseStatusMCM* mNoiseMap = nullptr; + const o2::trd::NoiseStatusMCM* mNoiseMap = nullptr; std::shared_ptr mPulseHeightpro = nullptr; std::shared_ptr mPulseHeightperchamber = nullptr; }; diff --git a/Modules/TRD/include/TRD/PulseHeightCheck.h b/Modules/TRD/include/TRD/PulseHeightCheck.h index 680ce74247..c1e7ca7f8d 100644 --- a/Modules/TRD/include/TRD/PulseHeightCheck.h +++ b/Modules/TRD/include/TRD/PulseHeightCheck.h @@ -39,7 +39,6 @@ class PulseHeightCheck : public o2::quality_control::checker::CheckInterface void beautify(std::shared_ptr mo, Quality checkResult = Quality::Null) override; std::string getAcceptedType() override; void buildChamberIgnoreBP(); - long int mTimeStamp; std::pair mDriftRegion; std::pair mPulseHeightPeakRegion; unsigned int mPulseHeightMinSum; diff --git a/Modules/TRD/include/TRD/TrackletsCheck.h b/Modules/TRD/include/TRD/TrackletsCheck.h index 7f572d77a0..732491e15f 100644 --- a/Modules/TRD/include/TRD/TrackletsCheck.h +++ b/Modules/TRD/include/TRD/TrackletsCheck.h @@ -40,10 +40,8 @@ class TrackletsCheck : public o2::quality_control::checker::CheckInterface void beautify(std::shared_ptr mo, Quality checkResult = Quality::Null) override; std::string getAcceptedType() override; - void retrieveCCDBSettings(); private: - long int mTimestamp; float mIntegralThreshold; float mRatioThreshold; float mZeroBinRatioThreshold; diff --git a/Modules/TRD/include/TRD/TrackletsTask.h b/Modules/TRD/include/TRD/TrackletsTask.h index 9c7e612802..d01cae5d5a 100644 --- a/Modules/TRD/include/TRD/TrackletsTask.h +++ b/Modules/TRD/include/TRD/TrackletsTask.h @@ -50,7 +50,6 @@ class TrackletsTask final : public TaskInterface void endOfActivity(const Activity& activity) override; void reset() override; void buildHistograms(); - void retrieveCCDBSettings(); void drawLinesMCM(TH2F* histo); void drawTrdLayersGrid(TH2F* hist); void buildTrackletLayers(); @@ -86,8 +85,8 @@ class TrackletsTask final : public TaskInterface std::array mLayers; // data to pull from CCDB - o2::trd::NoiseStatusMCM* mNoiseMap = nullptr; - o2::trd::HalfChamberStatusQC* mChamberStatus = nullptr; + const o2::trd::NoiseStatusMCM* mNoiseMap = nullptr; + const o2::trd::HalfChamberStatusQC* mChamberStatus = nullptr; }; } // namespace o2::quality_control_modules::trd diff --git a/Modules/TRD/src/DigitsTask.cxx b/Modules/TRD/src/DigitsTask.cxx index ffeabdb347..c1ebc0b24e 100644 --- a/Modules/TRD/src/DigitsTask.cxx +++ b/Modules/TRD/src/DigitsTask.cxx @@ -38,31 +38,11 @@ using namespace o2::quality_control_modules::common; namespace o2::quality_control_modules::trd { + DigitsTask::~DigitsTask() { } -void DigitsTask::retrieveCCDBSettings() -{ - if (auto param = mCustomParameters.find("ccdbtimestamp"); param != mCustomParameters.end()) { - mTimestamp = std::stol(mCustomParameters["ccdbtimestamp"]); - ILOG(Debug, Support) << "configure() : using ccdbtimestamp = " << mTimestamp << ENDM; - } else { - mTimestamp = o2::ccdb::getCurrentTimestamp(); - ILOG(Debug, Support) << "configure() : using default timestam of now = " << mTimestamp << ENDM; - } - auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setTimestamp(mTimestamp); - mNoiseMap = mgr.get("/TRD/Calib/NoiseMapMCM"); - if (mNoiseMap == nullptr) { - ILOG(Info, Support) << "mNoiseMap is null, no noisy mcm reduction" << ENDM; - } - mChamberStatus = mgr.get("/TRD/Calib/HalfChamberStatusQC"); - if (mChamberStatus == nullptr) { - ILOG(Info, Support) << "mChamberStatus is null, no chamber status to display" << ENDM; - } -} - void DigitsTask::buildChamberIgnoreBP() { mChambersToIgnoreBP.reset(); @@ -416,13 +396,13 @@ void DigitsTask::initialize(o2::framework::InitContext& /*ctx*/) buildChamberIgnoreBP(); - retrieveCCDBSettings(); buildHistograms(); } void DigitsTask::startOfActivity(const Activity& /*activity*/) { ILOG(Debug, Devel) << "startOfActivity" << ENDM; + // mTimeStamp = activity.mValidity.; } // set stats/stacs void DigitsTask::startOfCycle() @@ -461,6 +441,28 @@ bool DigitsTask::isChamberToBeIgnored(unsigned int sm, unsigned int stack, unsig void DigitsTask::monitorData(o2::framework::ProcessingContext& ctx) { + //get ccdb objects if not already retrieved: + if (mNoiseMap == nullptr) { + ILOG(Info, Support) << "Getting noisemap from ccdb" << ENDM; + auto mNoiseMapPtr = ctx.inputs().get("clnoisemap"); + mNoiseMap = mNoiseMapPtr.get(); + if (mNoiseMap == nullptr) { + ILOG(Error, Support) << "NoiseMap never loaded, leaving monitor" << ENDM; + return; + } + ILOG(Info, Support) << "NoiseMap loaded" << ENDM; + } + if (mChamberStatus == nullptr) { + ILOG(Info, Support) << "Getting chamber status from ccdb" << ENDM; + auto mChamberStatusPtr = ctx.inputs().get("clchamberstatus"); + mChamberStatus = mChamberStatusPtr.get(); + if (mChamberStatus == nullptr) { + ILOG(Error, Support) << "Chamber Status never loaded, leaving monitor" << ENDM; + return; + } + ILOG(Info, Support) << "Chamber Status loaded" << ENDM; + } + for (auto&& input : ctx.inputs()) { if (input.header != nullptr && input.payload != nullptr) { diff --git a/Modules/TRD/src/PulseHeight.cxx b/Modules/TRD/src/PulseHeight.cxx index 6f46a43105..949fd0bbb5 100644 --- a/Modules/TRD/src/PulseHeight.cxx +++ b/Modules/TRD/src/PulseHeight.cxx @@ -41,22 +41,6 @@ PulseHeight::~PulseHeight() { } -void PulseHeight::retrieveCCDBSettings() -{ - if (auto param = mCustomParameters.find("ccdbtimestamp"); param != mCustomParameters.end()) { - mTimestamp = std::stol(mCustomParameters["ccdbtimestamp"]); - ILOG(Debug, Support) << "configure() : using ccdbtimestamp = " << mTimestamp << ENDM; - } else { - mTimestamp = o2::ccdb::getCurrentTimestamp(); - ILOG(Debug, Support) << "configure() : using default timestam of now = " << mTimestamp << ENDM; - } - auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setTimestamp(mTimestamp); - mNoiseMap = mgr.get("/TRD/Calib/NoiseMapMCM"); - if (mNoiseMap == nullptr) { - ILOG(Info, Support) << "mNoiseMap is null, no noisy mcm reduction" << ENDM; - } -} void PulseHeight::buildHistograms() { @@ -142,7 +126,6 @@ void PulseHeight::initialize(o2::framework::InitContext& /*ctx*/) ILOG(Debug, Support) << "configure() : using default pulseheightupper = " << mPulseHeightPeakRegion.second << ENDM; } buildHistograms(); - retrieveCCDBSettings(); } void PulseHeight::startOfActivity(const Activity& activity) @@ -181,6 +164,17 @@ bool pulseheightdigitindexcompare(unsigned int A, unsigned int B, const std::vec void PulseHeight::monitorData(o2::framework::ProcessingContext& ctx) { + //get ccdb objects if not already retrieved: + if (mNoiseMap == nullptr) { + ILOG(Info, Support) << "Getting noisemap from ccdb" << ENDM; + auto mNoiseMapPtr = ctx.inputs().get("clnoisemap"); + mNoiseMap = mNoiseMapPtr.get(); + if (mNoiseMap == nullptr) { + ILOG(Error, Support) << "NoiseMap never loaded, leaving monitor" << ENDM; + return; + } + ILOG(Info, Support) << "NoiseMap loaded" << ENDM; + } auto digits = ctx.inputs().get>("digits"); auto tracklets = ctx.inputs().get>("tracklets"); auto triggerrecords = ctx.inputs().get>("triggers"); diff --git a/Modules/TRD/src/PulseHeightCheck.cxx b/Modules/TRD/src/PulseHeightCheck.cxx index 22a2fafebd..d573477a34 100644 --- a/Modules/TRD/src/PulseHeightCheck.cxx +++ b/Modules/TRD/src/PulseHeightCheck.cxx @@ -38,15 +38,6 @@ namespace o2::quality_control_modules::trd void PulseHeightCheck::configure() { - if (auto param = mCustomParameters.find("ccdbtimestamp"); param != mCustomParameters.end()) { - mTimeStamp = std::stol(mCustomParameters["ccdbtimestamp"]); - ILOG(Debug, Support) << "configure() : using ccdbtimestamp = " << mTimeStamp << ENDM; - } else { - mTimeStamp = o2::ccdb::getCurrentTimestamp(); - ILOG(Debug, Support) << "configure() : using default timestam of now = " << mTimeStamp << ENDM; - } - auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setTimestamp(mTimeStamp); ILOG(Debug, Devel) << "initialize PulseHeight" << ENDM; // QcInfoLogger is used. FairMQ logs will go to there as well. if (auto param = mCustomParameters.find("driftregionstart"); param != mCustomParameters.end()) { mDriftRegion.first = stof(param->second); diff --git a/Modules/TRD/src/TrackletsCheck.cxx b/Modules/TRD/src/TrackletsCheck.cxx index 44d9b3b96d..5b844e2f5c 100644 --- a/Modules/TRD/src/TrackletsCheck.cxx +++ b/Modules/TRD/src/TrackletsCheck.cxx @@ -32,17 +32,8 @@ using namespace o2::quality_control; namespace o2::quality_control_modules::trd { -void TrackletsCheck::retrieveCCDBSettings() +void TrackletsCheck::configure() { - if (auto param = mCustomParameters.find("ccdbtimestamp"); param != mCustomParameters.end()) { - mTimestamp = std::stol(mCustomParameters["ccdbtimestamp"]); - ILOG(Debug, Support) << "configure() : using ccdbtimestamp = " << mTimestamp << ENDM; - } else { - mTimestamp = o2::ccdb::getCurrentTimestamp(); - ILOG(Debug, Support) << "configure() : using default timestam of now = " << mTimestamp << ENDM; - } - auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setTimestamp(mTimestamp); if (auto param = mCustomParameters.find("integralthreshold"); param != mCustomParameters.end()) { mIntegralThreshold = std::stol(mCustomParameters["integralthreshold"]); ILOG(Debug, Support) << "configure() : using integral threshold = " << mIntegralThreshold << ENDM; diff --git a/Modules/TRD/src/TrackletsTask.cxx b/Modules/TRD/src/TrackletsTask.cxx index efec7afc59..76e5d9cd2e 100644 --- a/Modules/TRD/src/TrackletsTask.cxx +++ b/Modules/TRD/src/TrackletsTask.cxx @@ -374,6 +374,28 @@ void TrackletsTask::startOfCycle() void TrackletsTask::monitorData(o2::framework::ProcessingContext& ctx) { + //get ccdb objects if not already retrieved: + if (mNoiseMap == nullptr) { + ILOG(Info, Support) << "Getting noisemap from ccdb" << ENDM; + auto mNoiseMapPtr = ctx.inputs().get("clnoisemap"); + mNoiseMap = mNoiseMapPtr.get(); + ILOG(Info, Support) << "NoiseMap loaded" << ENDM; + if (mNoiseMap == nullptr) { + ILOG(Error, Support) << "NoiseMap never loaded, leaving monitor" << ENDM; + return; + } + } + if (mChamberStatus == nullptr) { + ILOG(Info, Support) << "Getting chamber status from ccdb" << ENDM; + auto mChamberStatusPtr = ctx.inputs().get("clchamberstatus"); + mChamberStatus = mChamberStatusPtr.get(); + if (mChamberStatus == nullptr) { + ILOG(Error, Support) << "Chamber Status never loaded, leaving monitor" << ENDM; + return; + } + ILOG(Info, Support) << "Chamber Status loaded" << ENDM; + } + for (auto&& input : ctx.inputs()) { if (input.header != nullptr && input.payload != nullptr) {