Skip to content

Commit

Permalink
TRD fix ccdb object time requesting [O2-3592]
Browse files Browse the repository at this point in the history
  • Loading branch information
bazinski committed Nov 1, 2023
1 parent c518497 commit 34c5fc7
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Modules/TRD/TRDQC.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@
},
"dataSamplingPolicies": []
}
}
}
6 changes: 2 additions & 4 deletions Modules/TRD/include/TRD/DigitsTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -69,7 +68,6 @@ class DigitsTask final : public TaskInterface
unsigned int mPulseHeightThreshold;
std::pair<float, float> mDriftRegion;
std::pair<float, float> mPulseHeightPeakRegion;
long int mTimestamp;

std::shared_ptr<TH1F> mDigitsPerEvent;
std::shared_ptr<TH1F> mEventswDigitsPerTimeFrame;
Expand Down Expand Up @@ -112,8 +110,8 @@ class DigitsTask final : public TaskInterface
// std::array<std::shared_ptr<TH1F>, 540> mPulseHeightPerChamber_1D; // ph2DSM;
std::vector<TH2F*> 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<o2::trd::constants::MAXCHAMBER> mChambersToIgnoreBP;
};
Expand Down
4 changes: 1 addition & 3 deletions Modules/TRD/include/TRD/PulseHeight.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<TH1F> mPulseHeight = nullptr;
std::shared_ptr<TH1F> mPulseHeightScaled = nullptr;
std::shared_ptr<TH2F> mTotalPulseHeight2D = nullptr;
Expand All @@ -70,7 +68,7 @@ class PulseHeight final : public TaskInterface
std::shared_ptr<TH1F> mPulseHeightDuration;
std::shared_ptr<TH1F> mPulseHeightDuration1;
std::shared_ptr<TH1F> mPulseHeightDurationDiff;
o2::trd::NoiseStatusMCM* mNoiseMap = nullptr;
const o2::trd::NoiseStatusMCM* mNoiseMap = nullptr;
std::shared_ptr<TProfile> mPulseHeightpro = nullptr;
std::shared_ptr<TProfile2D> mPulseHeightperchamber = nullptr;
};
Expand Down
1 change: 0 additions & 1 deletion Modules/TRD/include/TRD/PulseHeightCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class PulseHeightCheck : public o2::quality_control::checker::CheckInterface
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;
void buildChamberIgnoreBP();
long int mTimeStamp;
std::pair<float, float> mDriftRegion;
std::pair<float, float> mPulseHeightPeakRegion;
unsigned int mPulseHeightMinSum;
Expand Down
2 changes: 0 additions & 2 deletions Modules/TRD/include/TRD/TrackletsCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ class TrackletsCheck : public o2::quality_control::checker::CheckInterface
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

void retrieveCCDBSettings();

private:
long int mTimestamp;
float mIntegralThreshold;
float mRatioThreshold;
float mZeroBinRatioThreshold;
Expand Down
5 changes: 2 additions & 3 deletions Modules/TRD/include/TRD/TrackletsTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -86,8 +85,8 @@ class TrackletsTask final : public TaskInterface
std::array<TH2F*, 6> 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
Expand Down
46 changes: 24 additions & 22 deletions Modules/TRD/src/DigitsTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<o2::trd::NoiseStatusMCM>("/TRD/Calib/NoiseMapMCM");
if (mNoiseMap == nullptr) {
ILOG(Info, Support) << "mNoiseMap is null, no noisy mcm reduction" << ENDM;
}
mChamberStatus = mgr.get<o2::trd::HalfChamberStatusQC>("/TRD/Calib/HalfChamberStatusQC");
if (mChamberStatus == nullptr) {
ILOG(Info, Support) << "mChamberStatus is null, no chamber status to display" << ENDM;
}
}

void DigitsTask::buildChamberIgnoreBP()
{
mChambersToIgnoreBP.reset();
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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<o2::trd::NoiseStatusMCM*>("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<o2::trd::HalfChamberStatusQC*>("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) {

Expand Down
28 changes: 11 additions & 17 deletions Modules/TRD/src/PulseHeight.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<o2::trd::NoiseStatusMCM>("/TRD/Calib/NoiseMapMCM");
if (mNoiseMap == nullptr) {
ILOG(Info, Support) << "mNoiseMap is null, no noisy mcm reduction" << ENDM;
}
}

void PulseHeight::buildHistograms()
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<o2::trd::NoiseStatusMCM*>("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<gsl::span<o2::trd::Digit>>("digits");
auto tracklets = ctx.inputs().get<gsl::span<o2::trd::Tracklet64>>("tracklets");
auto triggerrecords = ctx.inputs().get<gsl::span<o2::trd::TriggerRecord>>("triggers");
Expand Down
9 changes: 0 additions & 9 deletions Modules/TRD/src/PulseHeightCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 1 addition & 10 deletions Modules/TRD/src/TrackletsCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 22 additions & 0 deletions Modules/TRD/src/TrackletsTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<o2::trd::NoiseStatusMCM*>("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<o2::trd::HalfChamberStatusQC*>("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) {

Expand Down

0 comments on commit 34c5fc7

Please sign in to comment.