Skip to content

Commit 2a8330d

Browse files
author
Lucia Anna Tarasovicova
committed
comments from Barth and fix for trending
1 parent 0d5c64b commit 2a8330d

File tree

3 files changed

+39
-55
lines changed

3 files changed

+39
-55
lines changed

Modules/CTP/include/CTP/RawDataReaderCheck.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "QualityControl/CheckInterface.h"
2121
#include "CommonConstants/LHCConstants.h"
2222
#include "DetectorsBase/GRPGeomHelper.h"
23+
#include <TLatex.h>
2324
#include <bitset>
2425
class TH1D;
2526

@@ -50,6 +51,7 @@ class RawDataReaderCheck : public o2::quality_control::checker::CheckInterface
5051
int getRunNumberFromMO(std::shared_ptr<MonitorObject> mo);
5152
int checkChange(TH1D* mHist, TH1D* mHistPrev);
5253
int checkChangeOfRatio(TH1D* mHist, TH1D* mHistPrev, TH1D* mHistAbs);
54+
float setTextPosition(float iPos, std::shared_ptr<TLatex> msg, TH1D* h);
5355
Quality setQualityResult(std::vector<int>& vBad, std::vector<int>& vMedium);
5456
void clearIndexVectors();
5557
long int mTimestamp;
@@ -73,7 +75,7 @@ class RawDataReaderCheck : public o2::quality_control::checker::CheckInterface
7375
std::vector<int> mVecIndexMedium; // vector of ctp input and class indices, which had a relative change
7476
std::bitset<o2::constants::lhc::LHCMaxBunches> mLHCBCs; // LHC filling scheme
7577

76-
ClassDefOverride(RawDataReaderCheck, 9);
78+
ClassDefOverride(RawDataReaderCheck, 10);
7779
};
7880

7981
} // namespace o2::quality_control_modules::ctp

Modules/CTP/src/CTPTrendingTask.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ void CTPTrendingTask::initCTP(Trigger& t)
6262
mgr.setURL(CCDBHost);
6363
map<string, string> metadata; // can be empty
6464
metadata["runNumber"] = run;
65+
mgr.setFatalWhenNull(false);
6566
auto ctpconfigdb = mgr.getSpecific<o2::ctp::CTPConfiguration>(o2::ctp::CCDBPathCTPConfig, t.timestamp, metadata);
6667
if (ctpconfigdb == nullptr) {
6768
LOG(info) << "CTP config not in database, timestamp:" << t.timestamp;
@@ -125,6 +126,7 @@ void CTPTrendingTask::initCTP(Trigger& t)
125126
}
126127
void CTPTrendingTask::initialize(Trigger t, framework::ServiceRegistryRef services)
127128
{
129+
initCTP(t);
128130
}
129131

130132
void CTPTrendingTask::update(Trigger t, framework::ServiceRegistryRef services)

Modules/CTP/src/RawDataReaderCheck.cxx

Lines changed: 34 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ int RawDataReaderCheck::checkChangeOfRatio(TH1D* mHist, TH1D* mHistPrev, TH1D* m
192192
}
193193
return 0;
194194
}
195+
float RawDataReaderCheck::setTextPosition(float iPos, std::shared_ptr<TLatex> msg, TH1D* h)
196+
{
197+
msg->SetTextSize(0.03);
198+
msg->SetNDC();
199+
h->GetListOfFunctions()->Add(msg->Clone());
200+
float MessagePos = iPos - 0.04;
201+
return MessagePos;
202+
}
195203

196204
std::string RawDataReaderCheck::getAcceptedType() { return "TH1"; }
197205

@@ -200,6 +208,10 @@ void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality che
200208
std::shared_ptr<TLatex> msg;
201209
if (mo->getName() == "bcMinBias1" || mo->getName() == "bcMinBias2") {
202210
auto* h = dynamic_cast<TH1D*>(mo->getObject());
211+
if (h == nullptr) {
212+
ILOG(Info, Support) << "null pointer for hist:" << mo->getName() << ENDM;
213+
return;
214+
}
203215
h->SetMarkerStyle(20);
204216
h->SetMarkerSize(0.6);
205217
if (checkResult != Quality::Null) {
@@ -263,6 +275,10 @@ void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality che
263275
h->GetYaxis()->SetRangeUser(0, h->GetMaximum() * 1.5);
264276
} else if (mo->getName() == "decodeError") {
265277
auto* h = dynamic_cast<TH1D*>(mo->getObject());
278+
if (h == nullptr) {
279+
ILOG(Info, Support) << "null pointer for hist:" << mo->getName() << ENDM;
280+
return;
281+
}
266282
if (checkResult != Quality::Null) {
267283
msg = std::make_shared<TLatex>(0.2, 0.85, Form("Quality: %s", (checkResult.getName()).c_str()));
268284
if (checkResult == Quality::Bad) {
@@ -276,64 +292,28 @@ void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality che
276292
}
277293
if (checkResult == Quality::Bad) {
278294
float initialMessagePos = 0.8;
279-
if (h->GetBinContent(1) > 0) {
280-
msg = std::make_shared<TLatex>(0.2, initialMessagePos, "Failed to extract RDD");
281-
msg->SetTextSize(0.03);
282-
msg->SetNDC();
283-
h->GetListOfFunctions()->Add(msg->Clone());
284-
initialMessagePos -= 0.04;
285-
}
286-
if (h->GetBinContent(3) > 0) {
287-
msg = std::make_shared<TLatex>(0.2, initialMessagePos, "Two CTP IRs with the same ts");
288-
msg->SetTextSize(0.03);
289-
msg->SetNDC();
290-
h->GetListOfFunctions()->Add(msg->Clone());
291-
initialMessagePos -= 0.04;
292-
}
293-
if (h->GetBinContent(4) > 0) {
294-
msg = std::make_shared<TLatex>(0.2, initialMessagePos, "Two digits with the same ts");
295-
msg->SetTextSize(0.03);
296-
msg->SetNDC();
297-
h->GetListOfFunctions()->Add(msg->Clone());
298-
initialMessagePos -= 0.04;
299-
}
300-
if (h->GetBinContent(5) > 0) {
301-
msg = std::make_shared<TLatex>(0.2, initialMessagePos, "Two CTP class masks with the same ts");
302-
msg->SetTextSize(0.03);
303-
msg->SetNDC();
304-
h->GetListOfFunctions()->Add(msg->Clone());
305-
initialMessagePos -= 0.04;
306-
}
307-
if (h->GetBinContent(6) > 0) {
308-
msg = std::make_shared<TLatex>(0.2, initialMessagePos, "Two digits (Class Mask) with the same ts");
309-
msg->SetTextSize(0.03);
310-
msg->SetNDC();
311-
h->GetListOfFunctions()->Add(msg->Clone());
312-
initialMessagePos -= 0.04;
313-
}
314-
if (h->GetBinContent(7) > 0) {
315-
msg = std::make_shared<TLatex>(0.2, initialMessagePos, "Trigger class without input");
316-
msg->SetTextSize(0.03);
317-
msg->SetNDC();
318-
h->GetListOfFunctions()->Add(msg->Clone());
319-
initialMessagePos -= 0.04;
320-
}
321-
if (h->GetBinContent(8) > 0) {
322-
msg = std::make_shared<TLatex>(0.2, initialMessagePos, "CTP class mask not compatible with input class mask");
323-
msg->SetTextSize(0.03);
324-
msg->SetNDC();
325-
h->GetListOfFunctions()->Add(msg->Clone());
326-
initialMessagePos -= 0.04;
327-
}
328-
if (h->GetBinContent(9) > 0) {
329-
msg = std::make_shared<TLatex>(0.2, initialMessagePos, "CTP class not found in the digit");
330-
msg->SetTextSize(0.03);
331-
msg->SetNDC();
332-
h->GetListOfFunctions()->Add(msg->Clone());
295+
string messages[9] = { "Failed to extract RDD",
296+
"",
297+
"Two CTP IRs with the same ts",
298+
"Two digits with the same ts",
299+
"Two CTP class masks with the same ts",
300+
"Two digits (Class Mask) with the same ts",
301+
"Trigger class without input",
302+
"CTP class mask not compatible with input class mask",
303+
"CTP class not found in the digit" };
304+
for (int i = 1; i < h->GetXaxis()->GetNbins() + 1; i++) {
305+
if (h->GetBinContent(i) > 0) {
306+
msg = std::make_shared<TLatex>(0.2, initialMessagePos, messages[i - 1].c_str());
307+
initialMessagePos = setTextPosition(initialMessagePos, msg, h);
308+
}
333309
}
334310
}
335311
} else {
336312
auto* h = dynamic_cast<TH1D*>(mo->getObject());
313+
if (h == nullptr) {
314+
ILOG(Info, Support) << "null pointer for hist:" << mo->getName() << ENDM;
315+
return;
316+
}
337317
h->SetStats(kFALSE);
338318
msg = std::make_shared<TLatex>(0.45, 0.8, Form("Quality: %s", (checkResult.getName()).c_str()));
339319
std::string groupName = "Input";

0 commit comments

Comments
 (0)