Skip to content

Commit 182a1f1

Browse files
Tracklet per trigger check trend and gloabl quality (#1957)
* TrackletPerTriggerCheck-Trend-and-Gloabl-Quality * clang-formatting * restoring changes in json * restoring other changes in TRDQC.json
1 parent f81d778 commit 182a1f1

4 files changed

Lines changed: 34 additions & 36 deletions

File tree

Modules/TRD/TRDQC.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"checkParameters":{
130130
"Lowerthreshold":"500.0",
131131
"Upperthreshold":"520.0",
132-
"StatThreshold": "1"
132+
"StatThreshold": "1000"
133133
}
134134
}
135135
},

Modules/TRD/include/TRD/TrackletPerTriggerCheck.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ class TrackletPerTriggerCheck : public o2::quality_control::checker::CheckInterf
3838
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
3939
std::string getAcceptedType() override;
4040
long int mTimeStamp;
41-
std::pair<float, float> DesiredMeanRegion;
42-
long int StatThreshold;
41+
std::pair<float, float> mDesiredMeanRegion;
42+
long int mStatThreshold;
4343

4444
ClassDefOverride(TrackletPerTriggerCheck, 2);
4545
};
4646

4747
} // namespace o2::quality_control_modules::trd
4848

49-
#endif // QC_MODULE_TRD_TRDTRACKLETPERTRIGGERCHECK_H
49+
#endif // QC_MODULE_TRD_TRDTRACKLETPERTRIGGERCHECK_H

Modules/TRD/src/RawData.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void RawData::monitorData(o2::framework::ProcessingContext& ctx)
199199
{
200200

201201
auto rawdatastats = ctx.inputs().get<o2::trd::TRDDataCountersPerTimeFrame*>("rawstats");
202-
mStats->AddBinContent(1, 1); // count number of TFs seen
202+
mStats->AddBinContent(1, 1); // count number of TFs seen
203203
mStats->AddBinContent(2, rawdatastats->mNTriggersTotal); // count total number of triggers seen
204204
mStats->AddBinContent(3, rawdatastats->mNTriggersCalib); // count total number of calibration triggers seen
205205
mStats->AddBinContent(4, rawdatastats->mTrackletsFound); // count total number of tracklets seen

Modules/TRD/src/TrackletPerTriggerCheck.cxx

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
#include "QualityControl/QcInfoLogger.h"
2121
// ROOT
2222
#include <TH1.h>
23-
#include "TString.h"
24-
#include "TPaveText.h"
23+
#include <TString.h>
24+
#include <TPaveText.h>
2525

2626
#include <DataFormatsQualityControl/FlagReasons.h>
27-
#include "CCDB/BasicCCDBManager.h"
27+
#include <CCDB/BasicCCDBManager.h>
2828

2929
using namespace std;
3030
using namespace o2::quality_control;
@@ -48,71 +48,66 @@ void TrackletPerTriggerCheck::configure()
4848
ILOG(Debug, Devel) << "initialize TrackletPertriggerCheck" << ENDM; // QcInfoLogger is used. FairMQ logs will go to there as well.
4949

5050
if (auto param = mCustomParameters.find("Lowerthreshold"); param != mCustomParameters.end()) {
51-
DesiredMeanRegion.first = stof(param->second);
52-
ILOG(Debug, Support) << "configure() : using json Lowerthreshold" << DesiredMeanRegion.first << ENDM;
51+
mDesiredMeanRegion.first = stof(param->second);
52+
ILOG(Debug, Support) << "configure() : using json Lowerthreshold" << mDesiredMeanRegion.first << ENDM;
5353
} else {
54-
DesiredMeanRegion.first = 500.0;
55-
ILOG(Debug, Support) << "configure() : using default Lowerthreshold" << DesiredMeanRegion.first << ENDM;
54+
mDesiredMeanRegion.first = 500.0;
55+
ILOG(Debug, Support) << "configure() : using default Lowerthreshold" << mDesiredMeanRegion.first << ENDM;
5656
}
5757

5858
if (auto param = mCustomParameters.find("Upperthreshold"); param != mCustomParameters.end()) {
59-
DesiredMeanRegion.second = stof(param->second);
60-
ILOG(Debug, Support) << "configure() : using json Upperthreshold" << DesiredMeanRegion.second << ENDM;
59+
mDesiredMeanRegion.second = stof(param->second);
60+
ILOG(Debug, Support) << "configure() : using json Upperthreshold" << mDesiredMeanRegion.second << ENDM;
6161
} else {
62-
DesiredMeanRegion.second = 520.0;
63-
ILOG(Debug, Support) << "configure() : using default Upperthreshold" << DesiredMeanRegion.second << ENDM;
62+
mDesiredMeanRegion.second = 520.0;
63+
ILOG(Debug, Support) << "configure() : using default Upperthreshold" << mDesiredMeanRegion.second << ENDM;
6464
}
6565

6666
if (auto param = mCustomParameters.find("StatThreshold"); param != mCustomParameters.end()) {
67-
StatThreshold = stod(param->second);
68-
ILOG(Debug, Support) << "configure() : using json StatThreshold" << StatThreshold << ENDM;
67+
mStatThreshold = stod(param->second);
68+
ILOG(Debug, Support) << "configure() : using json mStatThreshold" << mStatThreshold << ENDM;
6969
} else {
70-
StatThreshold = 1000;
71-
ILOG(Debug, Support) << "configure() : using default StatThreshold" << StatThreshold << ENDM;
70+
mStatThreshold = 1000;
71+
ILOG(Debug, Support) << "configure() : using default mStatThreshold" << mStatThreshold << ENDM;
7272
}
7373
}
7474

7575
Quality TrackletPerTriggerCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
7676
{
7777
Quality result = Quality::Null;
7878

79-
// you can get details about the activity via the object mActivity:
80-
ILOG(Debug, Devel) << "Run " << getActivity()->mId << ", type: " << getActivity()->mType << ", beam: " << getActivity()->mBeamType << ENDM;
81-
// and you can get your custom parameters:
82-
ILOG(Debug, Devel) << "custom param physics.pp.myOwnKey1 : " << mCustomParameters.atOrDefaultValue("myOwnKey1", "physics", "pp", "default_value") << ENDM;
83-
8479
for (auto& [moName, mo] : *moMap) {
85-
8680
(void)moName;
8781
if (mo->getName() == "trackletsperevent") {
8882
auto* h = dynamic_cast<TH1F*>(mo->getObject());
89-
83+
if (h == nullptr) {
84+
// ILOG(Debug, Support) << "Requested Histogram type does not match with the Histogram in source" << ENDM;
85+
continue;
86+
}
9087
// writing text over hist
9188
TPaveText* msg1 = new TPaveText(0.3, 0.7, 0.7, 0.9, "NDC"); // check option "br","NDC"
9289
h->GetListOfFunctions()->Add(msg1);
9390
msg1->SetTextSize(10);
9491
int Entries = h->GetEntries();
95-
if (Entries > StatThreshold) {
96-
msg1->AddText(TString::Format("Hist Can't be ignored. Stat is enough. Entries: %d > Threshold: %d", Entries, StatThreshold));
92+
if (Entries > mStatThreshold) {
93+
msg1->AddText(TString::Format("Hist Can't be ignored. Stat is enough. Entries: %d > Threshold: %d", Entries, mStatThreshold));
9794
// msg1->SetTextColor(kGreen);
9895
} else if (Entries > 0) {
99-
msg1->AddText(TString::Format("Hist Can be ignored. Stat is low. Entries: %d < Threshold: %d", Entries, StatThreshold));
96+
msg1->AddText(TString::Format("Hist Can be ignored. Stat is low. Entries: %d < Threshold: %d", Entries, mStatThreshold));
10097
// msg1->SetTextColor(kYellow);
10198
} else if (Entries == 0) {
102-
msg1->AddText(TString::Format("Hist is empty. Entries: %d < Threshold: %d", Entries, StatThreshold));
99+
msg1->AddText(TString::Format("Hist is empty. Entries: %d < Threshold: %d", Entries, mStatThreshold));
103100
msg1->SetTextColor(kRed);
104101
}
105102

106103
// applying check
107104
float MeanTracletPertrigger = h->GetMean();
108-
if (MeanTracletPertrigger > DesiredMeanRegion.second && MeanTracletPertrigger < DesiredMeanRegion.first) {
105+
if (MeanTracletPertrigger > mDesiredMeanRegion.second && MeanTracletPertrigger < mDesiredMeanRegion.first) {
109106
result = Quality::Good;
110107
} else {
111108
result = Quality::Bad;
112109
result.addReason(FlagReasonFactory::Unknown(), "MeanTracletPertrigger is not in bound region");
113110
}
114-
115-
result.addMetadata("mykey", "myvalue");
116111
}
117112
}
118113
return result;
@@ -124,7 +119,10 @@ void TrackletPerTriggerCheck::beautify(std::shared_ptr<MonitorObject> mo, Qualit
124119
{
125120
if (mo->getName() == "trackletsperevent") {
126121
auto* h = dynamic_cast<TH1F*>(mo->getObject());
127-
122+
if (h == nullptr) {
123+
// ILOG(Debug, Support) << "Requested Histogram type does not match with the Histogram in source" << ENDM;
124+
return;
125+
}
128126
if (checkResult == Quality::Good) {
129127
h->SetFillColor(kGreen);
130128
} else if (checkResult == Quality::Bad) {
@@ -138,4 +136,4 @@ void TrackletPerTriggerCheck::beautify(std::shared_ptr<MonitorObject> mo, Qualit
138136
}
139137
}
140138

141-
} // namespace o2::quality_control_modules::trd
139+
} // namespace o2::quality_control_modules::trd

0 commit comments

Comments
 (0)