Skip to content

Commit 2f70542

Browse files
authored
MUONS: second part of QC review corrections (#2182)
* [MUON] enabled use of extended parameters in tasks and checkers The tasks and checkers now use by default the extended parameters, and fall back to the standard parameters if the extended ones are not found in the configuration. * [MCH] code cleanup - Removed unnecessary headers - Moved some header inclusions into source files - Moved some template definitions into source files - Removed obsolete class members
1 parent 691d912 commit 2f70542

26 files changed

Lines changed: 326 additions & 423 deletions

Modules/MUON/Common/src/Helpers.cxx

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
namespace o2::quality_control_modules::muon
2121
{
2222
template <>
23-
std::string getConfigurationParameter(o2::quality_control::core::CustomParameters customParameters, std::string parName, const std::string defaultValue)
23+
std::string getConfigurationParameter<std::string>(o2::quality_control::core::CustomParameters customParameters, std::string parName, const std::string defaultValue)
2424
{
2525
std::string result = defaultValue;
2626
auto parOpt = customParameters.atOptional(parName);
@@ -31,7 +31,7 @@ std::string getConfigurationParameter(o2::quality_control::core::CustomParameter
3131
}
3232

3333
template <>
34-
std::string getConfigurationParameter(o2::quality_control::core::CustomParameters customParameters, std::string parName, const std::string defaultValue, const o2::quality_control::core::Activity& activity)
34+
std::string getConfigurationParameter<std::string>(o2::quality_control::core::CustomParameters customParameters, std::string parName, const std::string defaultValue, const o2::quality_control::core::Activity& activity)
3535
{
3636
auto parOpt = customParameters.atOptional(parName, activity);
3737
if (parOpt.has_value()) {
@@ -41,6 +41,43 @@ std::string getConfigurationParameter(o2::quality_control::core::CustomParameter
4141
return getConfigurationParameter<std::string>(customParameters, parName, defaultValue);
4242
}
4343

44+
template <>
45+
bool getConfigurationParameter<bool>(o2::quality_control::core::CustomParameters customParameters, std::string parName, const bool defaultValue)
46+
{
47+
bool result = defaultValue;
48+
auto parOpt = customParameters.atOptional(parName);
49+
if (parOpt.has_value()) {
50+
std::string value = parOpt.value();
51+
std::transform(value.begin(), value.end(), value.begin(), ::toupper);
52+
if (value == "TRUE" || value == "YES" || value == "1") {
53+
return true;
54+
}
55+
if (value == "FALSE" || value == "NO" || value == "0") {
56+
return false;
57+
}
58+
throw std::invalid_argument(std::string("error parsing boolean configurable parameter: key=") + parName + " value=" + value);
59+
}
60+
return result;
61+
}
62+
63+
template <>
64+
bool getConfigurationParameter<bool>(o2::quality_control::core::CustomParameters customParameters, std::string parName, const bool defaultValue, const o2::quality_control::core::Activity& activity)
65+
{
66+
auto parOpt = customParameters.atOptional(parName, activity);
67+
if (parOpt.has_value()) {
68+
std::string value = parOpt.value();
69+
std::transform(value.begin(), value.end(), value.begin(), ::toupper);
70+
if (value == "TRUE" || value == "YES" || value == "1") {
71+
return true;
72+
}
73+
if (value == "FALSE" || value == "NO" || value == "0") {
74+
return false;
75+
}
76+
throw std::invalid_argument(std::string("error parsing boolean configurable parameter: key=") + parName + " value=" + value);
77+
}
78+
return getConfigurationParameter<bool>(customParameters, parName, defaultValue);
79+
}
80+
4481
//_________________________________________________________________________________________
4582

4683
TLine* addHorizontalLine(TH1& histo, double y,

Modules/MUON/Common/src/TracksTask.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void TracksTask::initialize(o2::framework::InitContext& /*ic*/)
8686

8787
void TracksTask::createTrackHistos(const Activity& activity)
8888
{
89-
bool fullHistos = getConfigurationParameter<int>(mCustomParameters, "fullHistos", 0, activity) == 1;
89+
bool fullHistos = getConfigurationParameter<bool>(mCustomParameters, "fullHistos", false, activity);
9090

9191
double maxTracksPerTF = getConfigurationParameter<double>(mCustomParameters, "maxTracksPerTF", 400, activity);
9292
double cutRAbsMin = getConfigurationParameter<double>(mCustomParameters, "cutRAbsMin", 17.6, activity);

Modules/MUON/MCH/include/MCH/DecodingCheck.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class DecodingCheck : public o2::quality_control::checker::CheckInterface
4141

4242
// Override interface
4343
void configure() override;
44+
void startOfActivity(const Activity& activity) override;
4445
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
4546
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
4647
std::string getAcceptedType() override;

Modules/MUON/MCH/include/MCH/DecodingPostProcessing.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
#ifndef QC_MODULE_MCH_PP_DIAGNOSTICS_H
2020
#define QC_MODULE_MCH_PP_DIAGNOSTICS_H
2121

22-
#include "QualityControl/PostProcessingInterface.h"
23-
22+
#include "MCH/PostProcessingConfigMCH.h"
2423
#include "MCH/Helpers.h"
2524
#include "Common/TH2Ratio.h"
2625
#include "MCH/HistoOnCycle.h"
2726
#include "MCH/DecodingErrorsPlotter.h"
2827
#include "MCH/HeartBeatPacketsPlotter.h"
2928
#include "MCH/FECSyncStatusPlotter.h"
29+
#include "QualityControl/PostProcessingInterface.h"
3030

3131
#include <memory>
3232

@@ -73,9 +73,10 @@ class DecodingPostProcessing : public PostProcessingInterface
7373
static std::string hbPacketsSourceName() { return "hbpackets"; }
7474
static std::string syncStatusSourceName() { return "syncstatus"; }
7575

76-
int64_t mRefTimeStamp;
7776
bool mFullHistos{ false };
7877

78+
PostProcessingConfigMCH mConfig;
79+
7980
// CCDB object accessors
8081
std::map<std::string, CcdbObjectHelper> mCcdbObjects;
8182

Modules/MUON/MCH/include/MCH/DecodingTask.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,6 @@ class DecodingTask /*final*/ : public TaskInterface
109109
std::vector<TH1*> mAllHistograms;
110110
};
111111

112-
template <typename T>
113-
void DecodingTask::publishObject(T* histo, std::string drawOption, std::string displayHints, bool statBox, bool isExpert)
114-
{
115-
histo->SetOption(drawOption.c_str());
116-
if (!statBox) {
117-
histo->SetStats(0);
118-
}
119-
mAllHistograms.push_back(histo);
120-
getObjectsManager()->startPublishing(histo);
121-
getObjectsManager()->setDefaultDrawOptions(histo, drawOption);
122-
getObjectsManager()->setDisplayHint(histo, displayHints);
123-
}
124-
125112
} // namespace o2::quality_control_modules::muonchambers
126113

127114
#endif // QC_MODULE_MCH_DECODINGTASK_H

Modules/MUON/MCH/include/MCH/DigitsCheck.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "MCH/Helpers.h"
2121
#include "QualityControl/CheckInterface.h"
2222
#include "QualityControl/Quality.h"
23-
#include "MCHRawElecMap/Mapper.h"
2423
#include <string>
2524

2625
namespace o2::quality_control::core
@@ -44,6 +43,7 @@ class DigitsCheck : public o2::quality_control::checker::CheckInterface
4443

4544
// Override interface
4645
void configure() override;
46+
void startOfActivity(const Activity& activity) override;
4747
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
4848
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
4949
std::string getAcceptedType() override;
@@ -70,10 +70,7 @@ class DigitsCheck : public o2::quality_control::checker::CheckInterface
7070

7171
QualityChecker mQualityChecker;
7272

73-
o2::mch::raw::Elec2DetMapper mElec2DetMapper;
74-
o2::mch::raw::FeeLink2SolarMapper mFeeLink2SolarMapper;
75-
76-
ClassDefOverride(DigitsCheck, 1);
73+
ClassDefOverride(DigitsCheck, 2);
7774
};
7875

7976
} // namespace o2::quality_control_modules::muonchambers

Modules/MUON/MCH/include/MCH/DigitsPostProcessing.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
#ifndef QC_MODULE_MCH_PP_DIGITS_H
2020
#define QC_MODULE_MCH_PP_DIGITS_H
2121

22-
#include "QualityControl/PostProcessingInterface.h"
23-
#include "Common/TH2Ratio.h"
22+
#include "MCH/PostProcessingConfigMCH.h"
2423
#include "MCH/HistoOnCycle.h"
2524
#include "MCH/RatesPlotter.h"
2625
#include "MCH/RatesTrendsPlotter.h"
2726
#include "MCH/OrbitsPlotter.h"
27+
#include "Common/TH2Ratio.h"
28+
#include "QualityControl/PostProcessingInterface.h"
2829

2930
namespace o2::quality_control::repository
3031
{
@@ -61,10 +62,12 @@ class DigitsPostProcessing : public PostProcessingInterface
6162
static std::string orbitsSourceName() { return "orbits"; }
6263
static std::string orbitsSignalSourceName() { return "orbits_signal"; }
6364

64-
int64_t mRefTimeStamp;
65+
int64_t mRefTimeStamp{ 0 };
6566
bool mFullHistos{ false };
66-
float mChannelRateMin;
67-
float mChannelRateMax;
67+
float mChannelRateMin{ 0 };
68+
float mChannelRateMax{ 100 };
69+
70+
PostProcessingConfigMCH mConfig;
6871

6972
// CCDB object accessors
7073
std::map<std::string, CcdbObjectHelper> mCcdbObjects;

Modules/MUON/MCH/include/MCH/DigitsTask.h

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@
1818
#define QC_MODULE_MUONCHAMBERS_DIGITSTASK_H
1919

2020
#include "QualityControl/TaskInterface.h"
21-
#include "MCHRawElecMap/Mapper.h"
2221
#ifdef HAVE_DIGIT_IN_DATAFORMATS
2322
#include "DataFormatsMCH/Digit.h"
2423
#else
2524
#include "MCHBase/Digit.h"
2625
#endif
2726
#include "MCHDigitFiltering/DigitFilter.h"
2827
#include "Common/TH2Ratio.h"
29-
#include "MCH/Helpers.h"
3028

3129
class TH1F;
3230
class TH2F;
@@ -48,9 +46,9 @@ class DigitsTask /*final*/ : public TaskInterface // todo add back the "final" w
4846
{
4947
public:
5048
/// \brief Constructor
51-
DigitsTask();
49+
DigitsTask() = default;
5250
/// Destructor
53-
~DigitsTask() override;
51+
~DigitsTask() override = default;
5452

5553
// Definition of the methods for the template method pattern
5654
void initialize(o2::framework::InitContext& ctx) override;
@@ -67,23 +65,9 @@ class DigitsTask /*final*/ : public TaskInterface // todo add back the "final" w
6765
void resetOrbits();
6866

6967
template <typename T>
70-
void publishObject(T* histo, std::string drawOption, bool statBox, bool isExpert)
71-
{
72-
histo->SetOption(drawOption.c_str());
73-
if (!statBox) {
74-
histo->SetStats(0);
75-
}
76-
mAllHistograms.push_back(histo);
77-
if (mDiagnostic || (isExpert == false)) {
78-
getObjectsManager()->startPublishing(histo);
79-
getObjectsManager()->setDefaultDrawOptions(histo, drawOption);
80-
}
81-
}
82-
83-
bool mDiagnostic{ false }; // publish extra diagnostics plots
84-
85-
o2::mch::raw::Elec2DetMapper mElec2DetMapper;
86-
o2::mch::raw::FeeLink2SolarMapper mFeeLink2SolarMapper;
68+
void publishObject(T* histo, std::string drawOption, bool statBox, bool isExpert);
69+
70+
bool mFullHistos{ false }; // publish extra diagnostics plots
8771

8872
o2::mch::DigitFilter mIsSignalDigit;
8973

Modules/MUON/MCH/include/MCH/PedestalsCheck.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919

2020
#include "MCH/Helpers.h"
2121
#include "QualityControl/CheckInterface.h"
22-
#include "QualityControl/MonitorObject.h"
2322
#include "QualityControl/Quality.h"
24-
#include "MCHRawCommon/DataFormats.h"
25-
#include "MCHRawElecMap/Mapper.h"
2623

2724
namespace o2::quality_control_modules::muonchambers
2825
{

Modules/MUON/MCH/include/MCH/PedestalsTask.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class PedestalsTask final : public TaskInterface
8585
static constexpr int sMaxDsId = 40;
8686

8787
o2::mch::raw::Elec2DetMapper mElec2DetMapper;
88-
o2::mch::raw::Det2ElecMapper mDet2ElecMapper;
8988
o2::mch::raw::FeeLink2SolarMapper mFeeLink2SolarMapper;
9089
o2::mch::raw::Solar2FeeLinkMapper mSolar2FeeLinkMapper;
9190

0 commit comments

Comments
 (0)