Skip to content

Commit 92b49e7

Browse files
lhusovaLucia Anna Tarasovicova
andauthored
CTP: Input alinement check (#2526)
* Input aligment check * comments from Barth and fix for trending * fix for json --------- Co-authored-by: Lucia Anna Tarasovicova <lucia.anna.husova@cern.ch>
1 parent a8d3833 commit 92b49e7

File tree

6 files changed

+79
-7
lines changed

6 files changed

+79
-7
lines changed

Modules/CTP/include/CTP/RawDataQcTask.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class CTPRawDataReaderTask final : public TaskInterface
5656
std::unique_ptr<TH1DRatio> mHistoClassRatios = nullptr; // histogram with ctp class ratios to MB
5757
std::unique_ptr<TH1D> mHistoBCMinBias1 = nullptr; // histogram of BC positions to check LHC filling scheme
5858
std::unique_ptr<TH1D> mHistoBCMinBias2 = nullptr; // histogram of BC positions to check LHC filling scheme
59+
std::unique_ptr<TH1D> mHistoDecodeError = nullptr; // histogram of erros from decoder
5960
int mRunNumber;
6061
int indexMB1 = -1;
6162
int indexMB2 = -1;

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/RawDataQcTask.cxx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,18 @@ void CTPRawDataReaderTask::initialize(o2::framework::InitContext& /*ctx*/)
5151
mHistoBCMinBias2 = std::make_unique<TH1D>("bcMinBias2", "BC position MB2", norbits, 0, norbits);
5252
mHistoInputRatios = std::make_unique<TH1DRatio>("inputRatio", "Input Ratio to MTVX; Input; Ratio;", ninps, 0, ninps, true);
5353
mHistoClassRatios = std::make_unique<TH1DRatio>("classRatio", "Class Ratio to MB; Class; Ratio", nclasses, 0, nclasses, true);
54+
mHistoDecodeError = std::make_unique<TH1D>("decodeError", "Errors from decoder", 10, 1, 11);
5455
getObjectsManager()->startPublishing(mHistoInputs.get());
5556
getObjectsManager()->startPublishing(mHistoClasses.get());
5657
getObjectsManager()->startPublishing(mHistoClassRatios.get());
5758
getObjectsManager()->startPublishing(mHistoInputRatios.get());
5859
getObjectsManager()->startPublishing(mHistoBCMinBias1.get());
5960
getObjectsManager()->startPublishing(mHistoBCMinBias2.get());
61+
getObjectsManager()->startPublishing(mHistoDecodeError.get());
6062

6163
mDecoder.setDoLumi(1);
64+
mDecoder.setDecodeInps(1);
65+
mDecoder.setCheckConsistency(1);
6266
mDecoder.setDoDigits(1);
6367
for (size_t i = 0; i < nclasses; i++) {
6468
classNames[i] = "";
@@ -76,6 +80,7 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity)
7680
mHistoInputRatios->Reset();
7781
mHistoBCMinBias1->Reset();
7882
mHistoBCMinBias2->Reset();
83+
mHistoDecodeError->Reset();
7984

8085
mRunNumber = activity.mId;
8186
mTimestamp = activity.mValidity.getMin();
@@ -115,6 +120,7 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity)
115120
break;
116121
}
117122
}
123+
mDecoder.setCTPConfig(*ctpconfigdb);
118124
} else {
119125
ILOG(Warning, Support) << "CTP config not found, run:" << run << ENDM;
120126
}
@@ -215,7 +221,10 @@ void CTPRawDataReaderTask::monitorData(o2::framework::ProcessingContext& ctx)
215221
std::vector<o2::ctp::CTPDigit> outputDigits;
216222

217223
o2::framework::InputRecord& inputs = ctx.inputs();
218-
mDecoder.decodeRaw(inputs, filter, outputDigits, lumiPointsHBF1);
224+
int ret = mDecoder.decodeRaw(inputs, filter, outputDigits, lumiPointsHBF1);
225+
if (ret > 0) {
226+
mHistoDecodeError->Fill(log2(ret) + 1.5);
227+
}
219228

220229
// reading the ctp inputs and ctp classes
221230
for (auto const digit : outputDigits) {
@@ -282,6 +291,7 @@ void CTPRawDataReaderTask::reset()
282291
mHistoClassRatios->Reset();
283292
mHistoBCMinBias1->Reset();
284293
mHistoBCMinBias2->Reset();
294+
mHistoDecodeError->Reset();
285295
}
286296

287297
} // namespace o2::quality_control_modules::ctp

Modules/CTP/src/RawDataReaderCheck.cxx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ Quality RawDataReaderCheck::check(std::map<std::string, std::shared_ptr<MonitorO
137137
result.set(setQualityResult(mVecIndexBad, mVecIndexMedium));
138138
}
139139
mHistClassRatioPrevious = (TH1D*)h->Clone();
140+
} else if (mo->getName() == "decodeError") {
141+
if (h->GetEntries() > 0) {
142+
result.set(Quality::Bad);
143+
} else {
144+
result.set(Quality::Good);
145+
}
140146
} else {
141147
ILOG(Info, Support) << "Unknown histo:" << moName << ENDM;
142148
}
@@ -186,6 +192,14 @@ int RawDataReaderCheck::checkChangeOfRatio(TH1D* mHist, TH1D* mHistPrev, TH1D* m
186192
}
187193
return 0;
188194
}
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+
}
189203

190204
std::string RawDataReaderCheck::getAcceptedType() { return "TH1"; }
191205

@@ -194,6 +208,10 @@ void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality che
194208
std::shared_ptr<TLatex> msg;
195209
if (mo->getName() == "bcMinBias1" || mo->getName() == "bcMinBias2") {
196210
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+
}
197215
h->SetMarkerStyle(20);
198216
h->SetMarkerSize(0.6);
199217
if (checkResult != Quality::Null) {
@@ -255,8 +273,47 @@ void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality che
255273
}
256274
h->SetStats(kFALSE);
257275
h->GetYaxis()->SetRangeUser(0, h->GetMaximum() * 1.5);
276+
} else if (mo->getName() == "decodeError") {
277+
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+
}
282+
if (checkResult != Quality::Null) {
283+
msg = std::make_shared<TLatex>(0.2, 0.85, Form("Quality: %s", (checkResult.getName()).c_str()));
284+
if (checkResult == Quality::Bad) {
285+
msg->SetTextColor(kRed);
286+
} else if (checkResult == Quality::Good) {
287+
msg->SetTextColor(kGreen + 1);
288+
}
289+
msg->SetTextSize(0.03);
290+
msg->SetNDC();
291+
h->GetListOfFunctions()->Add(msg->Clone());
292+
}
293+
if (checkResult == Quality::Bad) {
294+
float initialMessagePos = 0.8;
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+
}
309+
}
310+
}
258311
} else {
259312
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+
}
260317
h->SetStats(kFALSE);
261318
msg = std::make_shared<TLatex>(0.45, 0.8, Form("Quality: %s", (checkResult.getName()).c_str()));
262319
std::string groupName = "Input";

Modules/CTP/src/qc-ctp.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,22 @@
4848
"ccdbName": "https://alice-ccdb.cern.ch",
4949
"MBclassName" : "CMTVX-B-NOPF",
5050
"MB1inputName" : "MTVX",
51-
"MB2inputName" : "MTVA"
51+
"MB2inputName" : "MVBA"
5252
}
5353
},
5454
"PHYSICS": {
5555
"default": {
5656
"MBclassName" : "CMTVX-B-NOPF",
5757
"MB1inputName" : "MTVX",
58-
"MB2inputName" : "MTVA"
58+
"MB2inputName" : "MVBA"
5959
},
6060
"PROTON-PROTON": {
6161
"MBclassName" : "CMTVX-B-NOPF",
6262
"MB1inputName" : "MTVX",
6363
"MB2inputName" : "MTVA"
6464
},
6565
"Pb-Pb": {
66-
"MBclassName" : "CMTVX-B-NOPF",
66+
"MBclassName" : "CMTCE-B-NOPF",
6767
"MB1inputName" : "MTSC",
6868
"MB2inputName" : "MTCE"
6969
}
@@ -81,14 +81,14 @@
8181
"dataSource": [{
8282
"type": "Task",
8383
"name": "CTPRawData",
84-
"MOs": ["bcMinBias1","bcMinBias2","inputs","classes","inputRatio","classRatio"]
84+
"MOs": ["bcMinBias1","bcMinBias2","inputs","classes","inputRatio","classRatio","decodeError"]
8585
}],
8686
"checkParameters": {
8787
"thresholdRateBad": "3",
8888
"thresholdRateMedium": "2",
8989
"thresholdRateRatioBad": "3",
9090
"thresholdRateRatioMedium": "2",
91-
"mNSigBC": "2"
91+
"nSigmaBC": "1"
9292
}
9393
}
9494
}

0 commit comments

Comments
 (0)