Skip to content

Commit e768833

Browse files
authored
HelperFIT: removing unprepared and unused in runtime class (#1940)
* HelperFIT: removing unprepared and unused in runtime class * Update CMakeLists.txt * Update HelperCommon.cxx * FIT: hotfix for excluding noisy message during hist division * cosmetics * hotfix
1 parent b6e750a commit e768833

5 files changed

Lines changed: 33 additions & 94 deletions

File tree

Modules/FIT/Common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(MODULE_NAME "O2QcFITCommon")
33
# ---- Files ----
44

55
set(SRCS
6+
src/HelperCommon.cxx
67
src/HelperFIT.cxx
78
src/HelperHist.cxx
89
src/HelperLUT.cxx

Modules/FIT/Common/include/FITCommon/HelperFIT.h

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -222,73 +222,5 @@ class TrgValidation
222222
std::function<void(DataTCM_t&)> mFunctorTrgCalc;
223223
};
224224

225-
struct RatioProcessor2D {
226-
RatioProcessor2D() = default;
227-
~RatioProcessor2D() = default;
228-
using SchemaBC_t = o2::BunchFilling::Pattern;
229-
using TF_t = long long;
230-
std::set<int> mBinsCollBC{};
231-
std::set<int> mBinsCollFirstBCinTrain{};
232-
std::set<int> mBinsNonCollBC{};
233-
std::map<int, int> mBinsBCtrains{};
234-
235-
SchemaBC_t mSchemaBC{};
236-
TF_t mNTFs; // processed number of TFs
237-
//
238-
double mLengthTF{}; //
239-
void init()
240-
{
241-
for (const auto& initType : mSetInitTypes) {
242-
(mMapInitFns.find(initType)->second)();
243-
}
244-
}
245-
bool addFnType(const std::string& fnType)
246-
{
247-
if (mMapInitFnNames.find(fnType) == mMapInitFnNames.end()) {
248-
return false;
249-
}
250-
mSetInitTypes.insert(mMapInitFnNames.find(fnType)->second);
251-
}
252-
std::set<std::string> mSetInitTypes{}; // set of projection functors which will participate in calculations
253-
const std::map<std::string, std::function<TH1D*(const TH2F*, std::pair<double, double>, int)>> mMapRatios = {
254-
{ "out_of_coll", [this](const TH2F* histSrc, std::pair<double, double> rangeProj, int axis) {
255-
return helper::makePartialProj(histSrc, "out_of_coll", "out_of_coll", mBinsNonCollBC, rangeProj, axis);
256-
} },
257-
{ "in_coll", [this](const TH2F* histSrc, std::pair<double, double> rangeProj, int axis) {
258-
return helper::makePartialProj(histSrc, "in_coll", "in_coll", mBinsCollBC, rangeProj, axis);
259-
} },
260-
261-
{ "in_coll_norm_train", [this](const TH2F* histSrc, std::pair<double, double> rangeProj, int axis) {
262-
return helper::makePartialProj(histSrc, "in_coll", "in_coll", mBinsCollBC, rangeProj, axis);
263-
} },
264-
{ "proj", [this](const TH2F* histSrc, std::pair<double, double> rangeProj, int axis) {
265-
return helper::makeProj(histSrc, "proj", "proj", rangeProj, axis);
266-
} }
267-
};
268-
const std::map<std::string, std::string> mMapInitFnNames = {
269-
{ "out_of_coll", "bc_schema" },
270-
{ "in_coll", "bc_schema" },
271-
{ "in_coll_norm_train", "bc_schema" },
272-
{ "proj", "none" }
273-
};
274-
std::map<std::string, std::function<void(void)>> mMapInitFns = {
275-
{ "bc_schema", [this]() {
276-
for (int iBC = 0; iBC < mSchemaBC.size(); iBC) {
277-
if (mSchemaBC.test(iBC)) {
278-
mBinsCollBC.insert(iBC + 1);
279-
} else {
280-
mBinsNonCollBC.insert(iBC + 1);
281-
}
282-
}
283-
const auto& mapBCtrains = helper::getMapBCtrains(mSchemaBC);
284-
for (const auto& entry : mapBCtrains) {
285-
mBinsBCtrains.insert({ entry.first + 1, entry.second });
286-
mBinsCollFirstBCinTrain.insert(entry.first + 1);
287-
}
288-
} },
289-
{ "none", [this]() {} }
290-
};
291-
};
292-
293225
} // namespace o2::quality_control_modules::fit
294226
#endif

Modules/FIT/Common/src/HelperCommon.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace o2::quality_control_modules::fit
2020
namespace helper
2121
{
2222

23-
std::map<unsigned int, std::string> multiplyMaps(const std::vector<std::tuple<std::string, std::map<unsigned int, std::string>, std::string>>& vecPreffixMapSuffix, bool useMapSizeAsMultFactor = true)
23+
std::map<unsigned int, std::string> multiplyMaps(const std::vector<std::tuple<std::string, std::map<unsigned int, std::string>, std::string>>& vecPreffixMapSuffix, bool useMapSizeAsMultFactor)
2424
{
2525

2626
auto multiplyPairMaps = [](bool useMapSizeAsMultFactor, const std::tuple<std::string, std::map<unsigned int, std::string>, std::string>& firstPreffixMapSuffix,
@@ -64,4 +64,4 @@ std::map<unsigned int, std::string> multiplyMaps(const std::vector<std::tuple<st
6464
}
6565

6666
} // namespace helper
67-
} // namespace o2::quality_control_modules::fit
67+
} // namespace o2::quality_control_modules::fit

Modules/FIT/FDD/src/DigitQcTask.cxx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@
2828
#include "DataFormatsFDD/ChannelData.h"
2929
#include "DataFormatsFDD/Digit.h"
3030

31+
#include "FITCommon/HelperHist.h"
32+
#include "FITCommon/HelperCommon.h"
33+
#include "FITCommon/HelperFIT.h"
34+
3135
namespace o2::quality_control_modules::fdd
3236
{
33-
37+
using namespace o2::quality_control_modules::fit;
3438
DigitQcTask::~DigitQcTask()
3539
{
3640
delete mListHistGarbage;
@@ -242,23 +246,24 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
242246
mHistPmTcmSumAmpC = std::make_unique<TH2F>("PmTcmSumAmpC", "Comparison of sum of amplitudes C from PM and TCM;Sum of amplitudes(TCM), side C;PM - TCM", 2e2, 0, 1e3, 2e3, -1e3 - 0.5, 1e3 - 0.5);
243247
mHistPmTcmAverageTimeC = std::make_unique<TH2F>("PmTcmAverageTimeC", "Comparison of average time C from PM and TCM;Average time(TCM), side C;PM - TCM", 410, -2050, 2050, 820, -410 - 0.5, 410 - 0.5);
244248
mHistTriggersSw = std::make_unique<TH1F>("TriggersSoftware", "Triggers from software", mMapDigitTrgNames.size(), 0, mMapDigitTrgNames.size());
245-
mHistTriggersSoftwareVsTCM = std::make_unique<TH2F>("TriggersSoftwareVsTCM", "Comparison of triggers from software and TCM;;Trigger name", mMapDigitTrgNames.size(), 0, mMapDigitTrgNames.size(), 4, 0, 4);
246-
mHistTriggersSoftwareVsTCM->SetOption("colz");
247-
mHistTriggersSoftwareVsTCM->SetStats(0);
249+
250+
const auto mapBasicTrgBits = HelperTrgFIT::sMapBasicTrgBitsFDD;
251+
const std::map<unsigned int, std::string> mapTrgValidationStatus = {
252+
{ TrgComparisonResult::kSWonly, "Sw only" },
253+
{ TrgComparisonResult::kTCMonly, "TCM only" },
254+
{ TrgComparisonResult::kNone, "neither TCM nor Sw" },
255+
{ TrgComparisonResult::kBoth, "both TCM and Sw" }
256+
};
257+
mHistTriggersSoftwareVsTCM = o2::quality_control_modules::fit::helper::registerHist<TH2F>(getObjectsManager(), "COLZ", "TriggersSoftwareVsTCM", "Comparison of triggers from software and TCM;;Trigger name", mapBasicTrgBits, mapTrgValidationStatus);
258+
248259
for (const auto& entry : mMapDigitTrgNames) {
249260
mHistOrbitVsTrg->GetYaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
250261
mHistTriggersCorrelation->GetXaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
251262
mHistTriggersCorrelation->GetYaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
252263
mHistBCvsTrg->GetYaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
253264
mHistTriggersSw->GetXaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
254-
mHistTriggersSoftwareVsTCM->GetXaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
255265
}
256266
mHistTriggersSw->GetXaxis()->SetRange(1, 5);
257-
mHistTriggersSoftwareVsTCM->GetXaxis()->SetRange(1, 5);
258-
mHistTriggersSoftwareVsTCM->GetYaxis()->SetBinLabel(TrgComparisonResult::kSWonly + 1, "Sw only");
259-
mHistTriggersSoftwareVsTCM->GetYaxis()->SetBinLabel(TrgComparisonResult::kTCMonly + 1, "TCM only");
260-
mHistTriggersSoftwareVsTCM->GetYaxis()->SetBinLabel(TrgComparisonResult::kNone + 1, "neither TCM nor Sw");
261-
mHistTriggersSoftwareVsTCM->GetYaxis()->SetBinLabel(TrgComparisonResult::kBoth + 1, "both TCM and Sw");
262267

263268
mListHistGarbage = new TList();
264269
mListHistGarbage->SetOwner(kTRUE);
@@ -431,8 +436,6 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
431436
getObjectsManager()->setDefaultDrawOptions(mHistPmTcmAverageTimeC.get(), "COLZ");
432437
getObjectsManager()->startPublishing(mHistTriggersCorrelation.get());
433438
getObjectsManager()->setDefaultDrawOptions(mHistTriggersCorrelation.get(), "COLZ");
434-
getObjectsManager()->startPublishing(mHistTriggersSoftwareVsTCM.get());
435-
getObjectsManager()->setDefaultDrawOptions(mHistTriggersSoftwareVsTCM.get(), "COLZ");
436439

437440
for (int i = 0; i < getObjectsManager()->getNumberPublishedObjects(); i++) {
438441
TH1* obj = dynamic_cast<TH1*>(getObjectsManager()->getMonitorObject(i)->getObject());

Modules/FIT/FV0/src/DigitQcTask.cxx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@
2525
#include "Framework/TimingInfo.h"
2626
#include "DataFormatsFV0/LookUpTable.h"
2727

28+
#include "FITCommon/HelperHist.h"
29+
#include "FITCommon/HelperCommon.h"
30+
#include "FITCommon/HelperFIT.h"
31+
2832
namespace o2::quality_control_modules::fv0
2933
{
30-
34+
using namespace o2::quality_control_modules::fit;
3135
DigitQcTask::~DigitQcTask()
3236
{
3337
delete mListHistGarbage;
@@ -148,6 +152,7 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
148152
{
149153
ILOG(Debug, Devel) << "initialize DigitQcTask" << ENDM; // QcInfoLogger is used. FairMQ logs will go to there as well.
150154
mStateLastIR2Ch = {};
155+
151156
mMapChTrgNames.insert({ o2::fv0::ChannelData::kNumberADC, "NumberADC" });
152157
mMapChTrgNames.insert({ o2::fv0::ChannelData::kIsDoubleEvent, "IsDoubleEvent" });
153158
mMapChTrgNames.insert({ o2::fv0::ChannelData::kIsTimeInfoNOTvalid, "IsTimeInfoNOTvalid" });
@@ -217,23 +222,23 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
217222
mHistPmTcmSumAmpA = std::make_unique<TH2F>("PmTcmSumAmpA", "Comparison of sum of amplitudes A from PM and TCM;Sum of amplitudes(TCM), side A;PM - TCM", 2e2, 0, 1e4, 2e3, -1e3 - 0.5, 1e3 - 0.5);
218223
mHistPmTcmAverageTimeA = std::make_unique<TH2F>("PmTcmAverageTimeA", "Comparison of average time A from PM and TCM;Average time(TCM), side A;PM - TCM", 410, -2050, 2050, 820, -410 - 0.5, 410 - 0.5);
219224
mHistTriggersSw = std::make_unique<TH1F>("TriggersSoftware", "Triggers from software", mMapDigitTrgNames.size(), 0, mMapDigitTrgNames.size());
220-
mHistTriggersSoftwareVsTCM = std::make_unique<TH2F>("TriggersSoftwareVsTCM", "Comparison of triggers from software and TCM;;Trigger name", mMapDigitTrgNames.size(), 0, mMapDigitTrgNames.size(), 4, 0, 4);
221-
mHistTriggersSoftwareVsTCM->SetOption("colz");
222-
mHistTriggersSoftwareVsTCM->SetStats(1);
225+
226+
const auto mapBasicTrgBits = HelperTrgFIT::sMapBasicTrgBitsFV0;
227+
const std::map<unsigned int, std::string> mapTrgValidationStatus = {
228+
{ TrgComparisonResult::kSWonly, "Sw only" },
229+
{ TrgComparisonResult::kTCMonly, "TCM only" },
230+
{ TrgComparisonResult::kNone, "neither TCM nor Sw" },
231+
{ TrgComparisonResult::kBoth, "both TCM and Sw" }
232+
};
233+
mHistTriggersSoftwareVsTCM = helper::registerHist<TH2F>(getObjectsManager(), "COLZ", "TriggersSoftwareVsTCM", "Comparison of triggers from software and TCM;;Trigger name", mapBasicTrgBits, mapTrgValidationStatus);
223234
for (const auto& entry : mMapDigitTrgNames) {
224235
mHistOrbitVsTrg->GetYaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
225236
mHistTriggersCorrelation->GetXaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
226237
mHistTriggersCorrelation->GetYaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
227238
mHistBCvsTrg->GetYaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
228239
mHistTriggersSw->GetXaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
229-
mHistTriggersSoftwareVsTCM->GetXaxis()->SetBinLabel(entry.first + 1, entry.second.c_str());
230240
}
231241
mHistTriggersSw->GetXaxis()->SetRange(1, 5);
232-
mHistTriggersSoftwareVsTCM->GetXaxis()->SetRange(1, 5);
233-
mHistTriggersSoftwareVsTCM->GetYaxis()->SetBinLabel(TrgComparisonResult::kSWonly + 1, "Sw only");
234-
mHistTriggersSoftwareVsTCM->GetYaxis()->SetBinLabel(TrgComparisonResult::kTCMonly + 1, "TCM only");
235-
mHistTriggersSoftwareVsTCM->GetYaxis()->SetBinLabel(TrgComparisonResult::kNone + 1, "neither TCM nor Sw");
236-
mHistTriggersSoftwareVsTCM->GetYaxis()->SetBinLabel(TrgComparisonResult::kBoth + 1, "both TCM and Sw");
237242

238243
mListHistGarbage = new TList();
239244
mListHistGarbage->SetOwner(kTRUE);
@@ -400,8 +405,6 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
400405
getObjectsManager()->setDefaultDrawOptions(mHistPmTcmAverageTimeA.get(), "COLZ");
401406
getObjectsManager()->startPublishing(mHistTriggersCorrelation.get());
402407
getObjectsManager()->setDefaultDrawOptions(mHistTriggersCorrelation.get(), "COLZ");
403-
getObjectsManager()->startPublishing(mHistTriggersSoftwareVsTCM.get());
404-
getObjectsManager()->setDefaultDrawOptions(mHistTriggersSoftwareVsTCM.get(), "COLZ");
405408

406409
for (int i = 0; i < getObjectsManager()->getNumberPublishedObjects(); i++) {
407410
TH1* obj = dynamic_cast<TH1*>(getObjectsManager()->getMonitorObject(i)->getObject());

0 commit comments

Comments
 (0)