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 Mar 13, 2023
1 parent 8dc17a4 commit 5432aab
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 129 deletions.
11 changes: 4 additions & 7 deletions Modules/TRD/TRDQC.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,9 @@
"maxNumberCycles": "-1",
"dataSource": {
"type": "direct",
"query": "digits:TRD/DIGITS;tracklets:TRD/TRACKLETS;triggers:TRD/TRKTRGRD"
"query": "digits:TRD/DIGITS;tracklets:TRD/TRACKLETS;triggers:TRD/TRKTRGRD;clnoisemap:TRD/NOISEMCM/0?lifetime=condition&ccdb-path=TRD/Calib/NoiseMapMCM;clchamberstatus:TRD/CHAMBERSTATUS/0?lifetime=condition&ccdb-path=TRD/Calib/ChamberStatus"
},
"taskParameters": {
"peakregionstart": "7.0",
"peakregionend": "20.0",
"pulseheightpeaklower": "1.0",
"taskParameters": { "peakregionstart": "7.0", "peakregionend": "20.0", "pulseheightpeaklower": "1.0",
"pulseheightpeakupper": "5.0"
},
"location": "remote",
Expand All @@ -80,7 +77,7 @@
"dataSource_comment": "no comment",
"dataSource": {
"type": "direct",
"query": "digits:TRD/DIGITS;tracklets:TRD/TRACKLETS;triggers:TRD/TRKTRGRD"
"query": "digits:TRD/DIGITS;tracklets:TRD/TRACKLETS;triggers:TRD/TRKTRGRD;clnoisemap:TRD/NOISEMCM/0?lifetime=condition&ccdb-path=TRD/Calib/NoiseMapMCM;clchamberstatus:TRD/CHAMBERSTATUS/0?lifetime=condition&ccdb-path=TRD/Calib/ChamberStatus"
},
"taskParameters": {
"peakregionstart": "7.0",
Expand All @@ -100,7 +97,7 @@
"maxNumberCycles": "-1",
"dataSource": {
"type": "direct",
"query": "digits:TRD/DIGITS;tracklets:TRD/TRACKLETS;triggers:TRD/TRKTRGRD;rawstats:TRD/RAWSTATS"
"query": "digits:TRD/DIGITS;tracklets:TRD/TRACKLETS;triggers:TRD/TRKTRGRD;clnoisemap:TRD/NOISEMCM/0?lifetime=condition&ccdb-path=TRD/Calib/NoiseMapMCM;clchamberstatus:TRD/CHAMBERSTATUS/0?lifetime=condition&ccdb-path=TRD/Calib/ChamberStatus"
},
"taskParameters": {
"peakregionstart": "7.0",
Expand Down
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(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
6 changes: 0 additions & 6 deletions Modules/TRD/include/TRD/PulseHeightTrackMatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class PulseHeightTrackMatch final : public TaskInterface
unsigned int mPulseHeightThreshold;
std::pair<float, float> mDriftRegion;
std::pair<float, float> mPulseHeightPeakRegion;
long int mTimestamp;
std::shared_ptr<TH1F> mParsingTimePerTF;
std::shared_ptr<TH1F> mDigitsPerEvent;
std::shared_ptr<TH1F> mTrackletsPerEvent;
Expand All @@ -83,11 +82,6 @@ class PulseHeightTrackMatch final : public TaskInterface
std::shared_ptr<TProfile2D> mPulseHeightperchamber = nullptr;
std::vector<TH2F*> mLayers;

// information pulled from ccdb
o2::trd::NoiseStatusMCM* mNoiseMap = nullptr;
o2::trd::HalfChamberStatusQC* mChamberStatus = nullptr;
std::string mChambersToIgnore;
std::bitset<o2::trd::constants::MAXCHAMBER> mChambersToIgnoreBP;
};

} // namespace o2::quality_control_modules::trd
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
6 changes: 2 additions & 4 deletions Modules/TRD/include/TRD/TrackletsTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ class TrackletsTask final : public TaskInterface
void endOfActivity(Activity& activity) override;
void reset() override;
void buildHistograms();
void retrieveCCDBSettings();
void drawLinesMCM(TH2F* histo);
void drawTrdLayersGrid(TH2F* hist);
void buildTrackletLayers();
void drawHashedOnHistsPerLayer(int layer); //, int hcid, int rowstart, int rowend);
void drawHashOnLayers(int layer, int hcid, int rowstart, int rowend);

private:
long int mTimestamp;
std::array<TH2F*, 18> moHCMCM;
std::array<TH1F*, 18> mTrackletQ0perSector;
std::array<TH1F*, 18> mTrackletQ1perSector;
Expand Down Expand Up @@ -86,8 +84,8 @@ class TrackletsTask final : public TaskInterface
int mMarkerStyle;

// 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
48 changes: 25 additions & 23 deletions Modules/TRD/src/DigitsTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,11 @@
#include "CCDB/BasicCCDBManager.h"
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 @@ -465,13 +445,13 @@ void DigitsTask::initialize(o2::framework::InitContext& /*ctx*/)
}
buildChamberIgnoreBP();

retrieveCCDBSettings();
buildHistograms();
}

void DigitsTask::startOfActivity(Activity& /*activity*/)
void DigitsTask::startOfActivity(Activity& activity)
{
ILOG(Debug, Devel) << "startOfActivity" << ENDM;
// mTimeStamp = activity.mValidity.;
} // set stats/stacs

void DigitsTask::startOfCycle()
Expand Down Expand Up @@ -510,6 +490,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(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: 0 additions & 11 deletions Modules/TRD/src/PulseHeightTrackMatch.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ PulseHeightTrackMatch::~PulseHeightTrackMatch()
{
}

void PulseHeightTrackMatch::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;
}
}

void PulseHeightTrackMatch::buildHistograms()
{
mParsingTimePerTF.reset(new TH1F("parsingtimeperTF", "Time for processing each TF", 100000, 0, 100000));
Expand Down
17 changes: 1 addition & 16 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 All @@ -66,12 +57,6 @@ void TrackletsCheck::retrieveCCDBSettings()
}
}

void TrackletsCheck::configure()
{
//get ccdb values
//fill mask spectra
retrieveCCDBSettings();
}

Quality TrackletsCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
{
Expand Down
Loading

0 comments on commit 5432aab

Please sign in to comment.