Skip to content

Commit 3beb53a

Browse files
mvishiu11andreasmolander
authored andcommitted
feat: changes to task config
1 parent 83c6f4b commit 3beb53a

2 files changed

Lines changed: 62 additions & 37 deletions

File tree

Modules/FIT/FT0/include/FT0/AgingLaserPostProcTask.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
#define QC_MODULE_FT0_AGINGLASERPOSTPROC_H
1919

2020
#include "QualityControl/PostProcessingInterface.h"
21-
#include <FT0Base/Constants.h>
21+
#include "FT0Base/Constants.h"
22+
#include "FITCommon/PostProcHelper.h"
2223

2324
#include <TH1F.h>
2425
#include <memory>
2526
#include <vector>
27+
#include <string>
2628

2729
namespace o2::quality_control_modules::ft0
2830
{
@@ -35,13 +37,16 @@ class AgingLaserPostProcTask final : public quality_control::postprocessing::Pos
3537
AgingLaserPostProcTask() = default;
3638
~AgingLaserPostProcTask() override;
3739

40+
void configure(const boost::property_tree::ptree& config) override;
3841
void initialize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override;
3942
void update(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override;
4043
void finalize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override;
4144

4245
private:
4346
static constexpr std::size_t sNCHANNELS_PM = o2::ft0::Constants::sNCHANNELS_PM;
4447

48+
std::string mAmpMoPath = "FT0/MO/AgingLaser"; //< Path to amplitude monitor object
49+
4550
std::vector<uint8_t> mDetectorChIDs; ///< Detector (target) channels
4651
std::vector<uint8_t> mReferenceChIDs; ///< Reference channels
4752

@@ -52,6 +57,8 @@ class AgingLaserPostProcTask final : public quality_control::postprocessing::Pos
5257

5358
std::unique_ptr<TH1F> mAmpVsChNormWeightedMeanA;
5459
std::unique_ptr<TH1F> mAmpVsChNormWeightedMeanC;
60+
61+
o2::quality_control_modules::fit::PostProcHelper mPostProcHelper;
5562
};
5663

5764
} // namespace o2::quality_control_modules::ft0

Modules/FIT/FT0/src/AgingLaserPostProcTask.cxx

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
/// \file AgingLaserPostProcTask.h
12+
/// \file AgingLaserPostProcTask.cxx
1313
/// \author Andreas Molander <andreas.molander@cern.ch>, Jakub Muszyński <jakub.milosz.muszynski@cern.ch>
1414

1515
#include "FT0/AgingLaserPostProcTask.h"
@@ -28,47 +28,64 @@
2828
#include <string>
2929

3030
using namespace o2::quality_control::postprocessing;
31+
using namespace o2::quality_control_modules::fit;
3132

3233
namespace o2::quality_control_modules::ft0
3334
{
3435

3536
AgingLaserPostProcTask::~AgingLaserPostProcTask() = default;
3637

37-
void AgingLaserPostProcTask::initialize(Trigger, framework::ServiceRegistryRef)
38+
void AgingLaserPostProcTask::configure(const boost::property_tree::ptree& cfg)
3839
{
39-
ILOG(Info) << "initialize AgingLaserPostProcTask" << ENDM;
40-
41-
const std::string detChs = o2::quality_control_modules::common::getFromConfig<std::string>(
42-
mCustomParameters, "detectorChannelIDs", "");
43-
if (!detChs.empty()) {
44-
mDetectorChIDs = fit::helper::parseParameters<uint8_t>(detChs, ",");
45-
} else { // default: all detector channels 0–207
46-
mDetectorChIDs.resize(208);
47-
std::iota(mDetectorChIDs.begin(), mDetectorChIDs.end(), 0);
40+
const char* cfgPath = Form("qc.postprocessing.%s", getID().c_str());
41+
const char* cfgCustom = Form("%s.custom", cfgPath);
42+
43+
mPostProcHelper.configure(cfg, cfgPath, "FT0");
44+
45+
auto key = [&cfgCustom](const std::string& e) { return Form("%s.%s", cfgCustom, e.c_str()); };
46+
47+
mAmpMoPath = helper::getConfigFromPropertyTree<std::string>(cfg, key("agingTaskSourcePath"), mAmpMoPath);
48+
49+
mDetectorChIDs.resize(208);
50+
std::iota(mDetectorChIDs.begin(), mDetectorChIDs.end(), 0);
51+
const std::string detSkip =
52+
helper::getConfigFromPropertyTree<std::string>(cfg, key("ignoreDetectorChannels"), "");
53+
if (!detSkip.empty()) {
54+
auto toSkip = fit::helper::parseParameters<uint8_t>(detSkip, ",");
55+
for (auto s : toSkip) {
56+
mDetectorChIDs.erase(std::remove(mDetectorChIDs.begin(), mDetectorChIDs.end(), s),
57+
mDetectorChIDs.end());
58+
}
4859
}
4960

50-
const std::string refChs = o2::quality_control_modules::common::getFromConfig<std::string>(
51-
mCustomParameters, "referenceChannelIDs", "");
52-
if (!refChs.empty()) {
53-
mReferenceChIDs = fit::helper::parseParameters<uint8_t>(refChs, ",");
54-
} else { // default: 208–210
55-
for (uint8_t ch = 208; ch < 211; ++ch)
56-
mReferenceChIDs.push_back(ch);
61+
// Reference channels: default 208–210, then remove skipped ones
62+
mReferenceChIDs.clear();
63+
for (uint8_t ch = 208; ch < 211; ++ch) {
64+
mReferenceChIDs.push_back(ch);
5765
}
66+
const std::string refSkip =
67+
helper::getConfigFromPropertyTree<std::string>(cfg, key("ignoreRefChannels"), "");
68+
if (!refSkip.empty()) {
69+
auto toSkip = fit::helper::parseParameters<uint8_t>(refSkip, ",");
70+
for (auto s : toSkip) {
71+
mReferenceChIDs.erase(std::remove(mReferenceChIDs.begin(), mReferenceChIDs.end(), s),
72+
mReferenceChIDs.end());
73+
}
74+
}
75+
76+
mADCSearchMin = helper::getConfigFromPropertyTree<double>(cfg, key("refPeakWindowMin"), mADCSearchMin);
77+
mADCSearchMax = helper::getConfigFromPropertyTree<double>(cfg, key("refPeakWindowMax"), mADCSearchMax);
78+
mFracWindowA = helper::getConfigFromPropertyTree<double>(cfg, key("fracWindowLow"), mFracWindowA);
79+
mFracWindowB = helper::getConfigFromPropertyTree<double>(cfg, key("fracWindowHigh"), mFracWindowB);
80+
}
5881

59-
mADCSearchMin = o2::quality_control_modules::common::getFromConfig<double>(
60-
mCustomParameters, "adcSearchMin", mADCSearchMin);
61-
mADCSearchMax = o2::quality_control_modules::common::getFromConfig<double>(
62-
mCustomParameters, "adcSearchMax", mADCSearchMax);
63-
mFracWindowA = o2::quality_control_modules::common::getFromConfig<double>(
64-
mCustomParameters, "fracWindowA", mFracWindowA);
65-
mFracWindowB = o2::quality_control_modules::common::getFromConfig<double>(
66-
mCustomParameters, "fracWindowB", mFracWindowB);
82+
void AgingLaserPostProcTask::initialize(Trigger, framework::ServiceRegistryRef)
83+
{
84+
ILOG(Debug, Devel) << "initialize AgingLaserPostProcTask" << ENDM;
6785

68-
ILOG(Info) << "detector channels : " << detChs << ENDM;
69-
ILOG(Info) << "reference channels : " << refChs << ENDM;
70-
ILOG(Info) << "ADC search window : [" << mADCSearchMin << ", " << mADCSearchMax << "]" << ENDM;
71-
ILOG(Info) << "fractional window : a=" << mFracWindowA << " b=" << mFracWindowB << ENDM;
86+
ILOG(Debug, Devel) << "agingTaskSourcePath : " << mAmpMoPath << ENDM;
87+
ILOG(Debug, Devel) << "ADC search window : [" << mADCSearchMin << ", " << mADCSearchMax << "]" << ENDM;
88+
ILOG(Debug, Devel) << "fractional window : a=" << mFracWindowA << " b=" << mFracWindowB << ENDM;
7289

7390
mAmpVsChNormWeightedMeanA = fit::helper::registerHist<TH1F>(
7491
getObjectsManager(),
@@ -90,11 +107,11 @@ void AgingLaserPostProcTask::update(Trigger t, framework::ServiceRegistryRef srv
90107

91108
/* ---- fetch source histogram ---- */
92109
auto& qcdb = srv.get<quality_control::repository::DatabaseInterface>();
93-
auto moIn = qcdb.retrieveMO("FT0/MO/AgingLaser", "AmpPerChannel", t.timestamp, t.activity);
110+
auto moIn = qcdb.retrieveMO(mAmpMoPath, "AmpPerChannel", t.timestamp, t.activity);
94111
TH2* h2amp = moIn ? dynamic_cast<TH2*>(moIn->getObject()) : nullptr;
95112

96113
if (!h2amp) {
97-
ILOG(Error) << "Could not retrieve FT0/MO/AgingLaser/AmpPerChannel for timestamp "
114+
ILOG(Error) << "Could not retrieve " << mAmpMoPath << "/AmpPerChannel for timestamp "
98115
<< t.timestamp << ENDM;
99116
return;
100117
}
@@ -164,15 +181,16 @@ void AgingLaserPostProcTask::update(Trigger t, framework::ServiceRegistryRef srv
164181
}
165182
};
166183

167-
for (uint8_t ch = 0; ch < sNCHANNELS_PM; ++ch)
184+
for (auto ch : mDetectorChIDs) {
168185
processChannel(ch);
186+
}
169187

170-
ILOG(Info) << "update done – " << nRef << " reference fits, norm=" << norm << ENDM;
188+
ILOG(Debug, Devel) << "update done – " << nRef << " reference fits, norm=" << norm << ENDM;
171189
}
172190

173191
void AgingLaserPostProcTask::finalize(Trigger, framework::ServiceRegistryRef)
174192
{
175-
ILOG(Info) << "finalize AgingLaserPostProcTask" << ENDM;
193+
ILOG(Debug, Devel) << "finalize AgingLaserPostProcTask" << ENDM;
176194
}
177195

178-
} // namespace o2::quality_control_modules::ft0
196+
} // namespace o2::quality_control_modules::ft0

0 commit comments

Comments
 (0)