Skip to content

Commit ad06073

Browse files
lhusovaLucia Anna Tarasovicova
andauthored
CTP: new check and trending histograms (#2204)
* add trending and check for input and class ratios + configurable parameters for check * implementation of the requested changes * code simplification for the input and class rate check * add check in order not to divide by 0 * implementation of the requested changes --------- Co-authored-by: Lucia Anna Tarasovicova <lucia.anna.husova@cern.ch>
1 parent 241b6ef commit ad06073

7 files changed

Lines changed: 337 additions & 82 deletions

File tree

Modules/CTP/include/CTP/RawDataQcTask.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class CTPRawDataReaderTask final : public TaskInterface
5050
o2::ctp::RawDataDecoder mDecoder;
5151
TH1F* mHistoInputs = nullptr;
5252
TH1F* mHistoClasses = nullptr;
53+
TH1F* mHistoInputRatios = nullptr;
54+
TH1F* mHistoClassRatios = nullptr;
5355
TH1F* mHistoMTVXBC = nullptr;
5456
};
5557

Modules/CTP/include/CTP/RawDataReaderCheck.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RawDataReaderCheck : public o2::quality_control::checker::CheckInterface
4040
std::string getAcceptedType() override;
4141
void startOfActivity(const Activity& activity) override;
4242

43-
ClassDefOverride(RawDataReaderCheck, 4);
43+
ClassDefOverride(RawDataReaderCheck, 5);
4444

4545
private:
4646
int getRunNumberFromMO(std::shared_ptr<MonitorObject> mo);
@@ -49,10 +49,20 @@ class RawDataReaderCheck : public o2::quality_control::checker::CheckInterface
4949
int mRunNumber;
5050
long int mTimestamp;
5151
float mThreshold;
52-
int inputCycleCounter;
53-
int classCycleCounter;
52+
float mThresholdRateBad;
53+
float mThresholdRateMedium;
54+
float mThresholdRateRatioBad;
55+
float mThresholdRateRatioMedium;
56+
int cycleCounter;
57+
int mIndexMBclass = -1;
58+
float mFraction;
59+
int mCycleDuration;
60+
bool relativeRates = false;
61+
bool inputRates = false;
5462
TH1F* fHistInputPrevious;
5563
TH1F* fHistClassesPrevious;
64+
TH1F* fHistInputRatioPrevious;
65+
TH1F* fHistClassRatioPrevious;
5666
std::vector<int> vGoodBC;
5767
std::vector<int> vMediumBC;
5868
std::vector<int> vBadBC;

Modules/CTP/src/CTPTrendingTask.cxx

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ void CTPTrendingTask::trendValues(const Trigger& t, repository::DatabaseInterfac
127127
ILOG(Info, Support) << "no MO object" << ENDM;
128128
continue;
129129
}
130-
ILOG(Info, Support) << "Got MO " << mo << ENDM;
131130
TObject* obj = mo ? mo->getObject() : nullptr;
132131
if (!obj) {
133132
ILOG(Info, Support) << "inputs not found" << ENDM;
@@ -154,7 +153,11 @@ void CTPTrendingTask::generatePlots()
154153
return;
155154
}
156155

157-
int index = 0;
156+
int index = 0; // for keeping track what is trended:
157+
// 0 <= index < 5 - absolute input rates are trended
158+
// 5 <= index < 10 - absolute class rates are trended
159+
// 10 <= index < 15 - input rate ratios are trended
160+
// 15 <= index < 19 - class rate ratios are trended
158161

159162
for (const auto& plot : mConfig.plots) {
160163

@@ -165,24 +168,40 @@ void CTPTrendingTask::generatePlots()
165168
delete mPlots[plot.name];
166169
}
167170

168-
if (index > 4 && mClassIndex[index - 5] == 65) {
171+
if (index > 4 && index < 10 && mClassIndex[index - 5] == 65) { // if the class index == 65, this class is not defined in the config, so it won't be trended
169172
ILOG(Info, Support) << "Class " << mClassNames[index - 5] << " is not trended." << ENDM;
170173
index++;
171174
continue;
172175
}
173176

177+
if (index > 13 && (mClassIndex[index - 13] == 65 || mClassIndex[0] == 65)) { // if the class index == 65, this class is not defined in the config, so it won't be trended
178+
ILOG(Info, Support) << "Class ratio " << mClassNames[index - 13] << " / " << mClassNames[0] << " is not trended." << ENDM;
179+
index++;
180+
continue;
181+
}
182+
174183
auto* c = new TCanvas();
175184
ILOG(Info, Support) << plot.varexp << " " << plot.selection << " " << plot.option << ENDM;
176185
mTrend->Draw(plot.varexp.c_str(), plot.selection.c_str(), plot.option.c_str());
177186

178187
c->SetName(plot.name.c_str());
179188

180189
if (auto histo = dynamic_cast<TH1*>(c->GetPrimitive("htemp"))) {
181-
if (index < 5)
190+
if (index < 5) {
182191
histo->SetTitle(mInputNames[index].c_str());
183-
else
192+
} else if (index < 10) {
184193
histo->SetTitle(mClassNames[index - 5].c_str());
185-
histo->GetYaxis()->SetTitle("rate [Hz]");
194+
} else if (index < 14) {
195+
histo->SetTitle(Form("%s/%s", mInputNames[index - 9].c_str(), mInputNames[0].c_str()));
196+
} else {
197+
histo->SetTitle(Form("%s/%s", mClassNames[index - 13].c_str(), mClassNames[0].c_str()));
198+
}
199+
200+
if (index < 10) {
201+
histo->GetYaxis()->SetTitle("rate [Hz]");
202+
} else {
203+
histo->GetYaxis()->SetTitle("rate ratio");
204+
}
186205
c->Update();
187206

188207
if (plot.varexp.find(":time") != std::string::npos) {

Modules/CTP/src/RawDataQcTask.cxx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ void CTPRawDataReaderTask::initialize(o2::framework::InitContext& /*ctx*/)
4747
mHistoInputs = new TH1F("inputs", "Inputs distribution", 48, 0, 48);
4848
mHistoClasses = new TH1F("classes", "Classes distribution", 65, 0, 65);
4949
mHistoMTVXBC = new TH1F("bcMTVX", "BC position of MTVX", 3564, 0, 3564);
50+
mHistoInputRatios = new TH1F("inputRatio", "Input Ratio distribution", 48, 0, 48);
51+
mHistoClassRatios = new TH1F("classRatio", "Class Ratio distribution", 65, 0, 65);
5052
getObjectsManager()->startPublishing(mHistoInputs);
5153
getObjectsManager()->startPublishing(mHistoClasses);
54+
getObjectsManager()->startPublishing(mHistoClassRatios);
55+
getObjectsManager()->startPublishing(mHistoInputRatios);
5256
getObjectsManager()->startPublishing(mHistoMTVXBC);
5357

5458
mDecoder.setDoLumi(1);
@@ -60,6 +64,8 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity)
6064
ILOG(Debug, Devel) << "startOfActivity " << activity.mId << ENDM;
6165
mHistoInputs->Reset();
6266
mHistoClasses->Reset();
67+
mHistoClassRatios->Reset();
68+
mHistoInputRatios->Reset();
6369
mHistoMTVXBC->Reset();
6470
}
6571

@@ -88,6 +94,7 @@ void CTPRawDataReaderTask::monitorData(o2::framework::ProcessingContext& ctx)
8894
for (int i = 0; i < o2::ctp::CTP_NINPUTS; i++) {
8995
if (digit.CTPInputMask[i]) {
9096
mHistoInputs->Fill(i);
97+
mHistoInputRatios->Fill(i);
9198
if (i == indexTvx - 1)
9299
mHistoMTVXBC->Fill(bcid);
93100
}
@@ -97,6 +104,7 @@ void CTPRawDataReaderTask::monitorData(o2::framework::ProcessingContext& ctx)
97104
for (int i = 0; i < o2::ctp::CTP_NCLASSES; i++) {
98105
if (digit.CTPClassMask[i]) {
99106
mHistoClasses->Fill(i);
107+
mHistoClassRatios->Fill(i);
100108
}
101109
}
102110
}
@@ -120,6 +128,8 @@ void CTPRawDataReaderTask::reset()
120128
ILOG(Debug, Devel) << "Resetting the histograms" << ENDM;
121129
mHistoInputs->Reset();
122130
mHistoClasses->Reset();
131+
mHistoInputRatios->Reset();
132+
mHistoClassRatios->Reset();
123133
mHistoMTVXBC->Reset();
124134
}
125135

0 commit comments

Comments
 (0)