Skip to content

Commit 368fc27

Browse files
zz951JianLIUhepiravasen
authored
ITS cluster task: Emptylane_Fraction (#1832)
* deadchip * camel case for phi and eta bins * empty lane fraction * empty lane * empty lane fraction * empty lane fraction * empty lane fraction * empty lane fraction --------- Co-authored-by: JianLIUhep <jian@cern.ch> Co-authored-by: iravasen <ivan.ravasenga@cern.ch>
1 parent 7ddff64 commit 368fc27

5 files changed

Lines changed: 98 additions & 4 deletions

File tree

Modules/ITS/include/ITS/ITSClusterCheck.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "QualityControl/CheckInterface.h"
2323
#include <TLatex.h>
24+
#include <TLine.h>
2425
#include <TH2Poly.h>
2526
#include <vector>
2627
#include <string>
@@ -67,13 +68,17 @@ class ITSClusterCheck : public o2::quality_control::checker::CheckInterface
6768
private:
6869
ClassDefOverride(ITSClusterCheck, 2);
6970

71+
std::shared_ptr<TLatex> tInfoSummary;
72+
std::shared_ptr<TLatex> tInfo;
73+
std::shared_ptr<TLine> tInfoLine;
7074
std::shared_ptr<TLatex> msg;
7175
std::shared_ptr<TLatex> text[14];
7276
std::shared_ptr<TLatex> text2[14];
7377
static constexpr int NLayer = 7;
7478
const int mNStaves[NLayer] = { 12, 16, 20, 24, 30, 42, 48 };
7579
const int StaveBoundary[NLayer + 1] = { 0, 12, 28, 48, 72, 102, 144, 192 };
7680
float maxcluocc[NLayer] = { 5, 4, 3, 2, 1, 1, 1 };
81+
double MaxEmptyLaneFraction = 0.1;
7782
};
7883

7984
} // namespace o2::quality_control_modules::its

Modules/ITS/include/ITS/ITSClusterTask.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
#include <ITSBase/GeometryTGeo.h>
2929
#include <Framework/TimingInfo.h>
3030

31+
#include <TLine.h>
32+
#include <TLatex.h>
33+
3134
class TH1F;
3235
class TH2F;
3336

@@ -91,6 +94,7 @@ class ITSClusterTask : public TaskInterface
9194
TH2F* hAverageClusterSizeSummaryOB[NLayer] = { nullptr };
9295

9396
int mClusterOccupancyOB[NLayer][48][28] = { { { 0 } } };
97+
int mNLaneEmpty[4] = { 0 }; // IB, ML, OL, TOTAL empty lane
9498

9599
// Layer synnary
96100
TH1F* hClusterSizeLayerSummary[NLayer] = { nullptr };
@@ -108,6 +112,8 @@ class ITSClusterTask : public TaskInterface
108112
TH2F* hAverageClusterOccupancySummaryZPhi[NLayer] = { nullptr };
109113
TH2F* hAverageClusterSizeSummaryZPhi[NLayer] = { nullptr };
110114

115+
TH1D* hEmptyLaneFractionGlobal;
116+
111117
int mClusterSize[NLayer][48][28] = { { { 0 } } }; //[#layers][max staves][max lanes / chips]
112118
int nClusters[NLayer][48][28] = { { { 0 } } };
113119

@@ -121,14 +127,17 @@ class ITSClusterTask : public TaskInterface
121127
int nRphiBinsIB = 1;
122128
int nRphiBinsOB = 1;
123129
int nZBinsOB = 1;
130+
static constexpr int NFlags = 4;
124131

125132
const int mOccUpdateFrequency = 100000;
133+
const int mNLanes[4] = { 432, 864, 2520, 3816 }; // IB, ML, OL, TOTAL lane
126134
int mDoPublish1DSummary = 0;
127135
int mNThreads = 1;
128136
int mNRofs = 0;
129137
int nBCbins = 103;
130138
long int mTimestamp = -1;
131139
TString xLabel;
140+
std::string mLaneStatusFlag[NFlags] = { "IB", "ML", "OL", "Total" };
132141
int mDoPublishDetailedSummary = 0;
133142

134143
const int mNStaves[NLayer] = { 12, 16, 20, 24, 30, 42, 48 };

Modules/ITS/itsCluster.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"maxcluoccL4": "1",
7373
"maxcluoccL5": "1",
7474
"maxcluoccL6": "1",
75+
"MaxEmptyLaneFraction": "0.1",
7576
"skipxbinsoccupancy": "",
7677
"skipybinsoccupancy": "",
7778
"plotWithTextMessage": "",
@@ -90,6 +91,7 @@
9091
"Layer4/AverageClusterSize",
9192
"Layer5/AverageClusterSize",
9293
"Layer6/AverageClusterSize",
94+
"EmptyLaneFractionGlobal",
9395
"General/General_Occupancy"
9496
]
9597
}

Modules/ITS/src/ITSClusterCheck.cxx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <TH2.h>
2525
#include <string.h>
2626
#include <TLatex.h>
27+
#include <TLine.h>
2728
#include <iostream>
2829
#include "Common/Utils.h"
2930

@@ -50,6 +51,17 @@ Quality ITSClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorObje
5051
}
5152
}
5253

54+
if (iter->second->getName().find("EmptyLaneFractionGlobal") != std::string::npos) {
55+
auto* h = dynamic_cast<TH1D*>(iter->second->getObject());
56+
result.addMetadata("EmptyLaneFractionGlobal", "good");
57+
MaxEmptyLaneFraction = o2::quality_control_modules::common::getFromConfig<float>(mCustomParameters, "MaxEmptyLaneFraction", MaxEmptyLaneFraction);
58+
if (h->GetBinContent(1) + h->GetBinContent(2) + h->GetBinContent(3) > MaxEmptyLaneFraction) {
59+
result.updateMetadata("EmptyLaneFractionGlobal", "bad");
60+
result.set(Quality::Bad);
61+
result.addReason(o2::quality_control::FlagReasonFactory::Unknown(), Form("BAD:>%.0f %% of the lanes are empty", (h->GetBinContent(1) + h->GetBinContent(2) + h->GetBinContent(3)) * 100));
62+
}
63+
} // end summary loop
64+
5365
if (iter->second->getName().find("General_Occupancy") != std::string::npos) {
5466
auto* hp = dynamic_cast<TH2F*>(iter->second->getObject());
5567
std::vector<int> skipxbins = convertToArray<int>(o2::quality_control_modules::common::getFromConfig<string>(mCustomParameters, "skipxbinsoccupancy", ""));
@@ -163,6 +175,44 @@ void ITSClusterCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkR
163175
h->GetListOfFunctions()->Add(tShifterInfo->Clone());
164176
}
165177

178+
if (mo->getName().find("EmptyLaneFractionGlobal") != std::string::npos) {
179+
auto* h = dynamic_cast<TH1D*>(mo->getObject());
180+
if (checkResult == Quality::Good) {
181+
status = "Quality::GOOD";
182+
textColor = kGreen;
183+
positionX = 0.05;
184+
positionY = 0.91;
185+
} else if (checkResult == Quality::Bad) {
186+
status = "Quality::BAD (call expert)";
187+
textColor = kRed;
188+
if (strcmp(checkResult.getMetadata("EmptyLaneFractionGlobal").c_str(), "bad") == 0) {
189+
MaxEmptyLaneFraction = o2::quality_control_modules::common::getFromConfig<float>(mCustomParameters, "MaxEmptyLaneFraction", MaxEmptyLaneFraction);
190+
tInfoSummary = std::make_shared<TLatex>(0.12, 0.5, Form(">%.0f %% of the lanes are empty", MaxEmptyLaneFraction * 100));
191+
tInfoSummary->SetTextColor(kRed);
192+
tInfoSummary->SetTextSize(0.05);
193+
tInfoSummary->SetTextFont(43);
194+
tInfoSummary->SetNDC();
195+
h->GetListOfFunctions()->Add(tInfoSummary->Clone());
196+
}
197+
}
198+
tInfo = std::make_shared<TLatex>(0.1, 0.11, Form("#bf{%s}", "Threshold value"));
199+
tInfo->SetTextColor(kRed);
200+
tInfo->SetTextSize(0.05);
201+
tInfo->SetTextFont(43);
202+
h->GetListOfFunctions()->Add(tInfo->Clone());
203+
tInfoLine = std::make_shared<TLine>(0, 0.1, 4, 0.1);
204+
tInfoLine->SetLineColor(kRed);
205+
tInfoLine->SetLineStyle(9);
206+
h->GetListOfFunctions()->Add(tInfoLine->Clone());
207+
msg = std::make_shared<TLatex>(positionX, positionY, Form("#bf{%s}", status.Data()));
208+
msg->SetTextColor(textColor);
209+
msg->SetTextSize(0.06);
210+
msg->SetTextFont(43);
211+
msg->SetNDC();
212+
h->GetListOfFunctions()->Add(msg->Clone());
213+
if (ShifterInfoText[mo->getName()] != "")
214+
h->GetListOfFunctions()->Add(tShifterInfo->Clone());
215+
}
166216
if (mo->getName().find("General_Occupancy") != std::string::npos) {
167217
auto* h = dynamic_cast<TH2F*>(mo->getObject());
168218
if (checkResult == Quality::Good) {

Modules/ITS/src/ITSClusterTask.cxx

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "ITS/ITSClusterTask.h"
2020

2121
#include <sstream>
22-
#include <TCanvas.h>
2322
#include <DataFormatsParameters/GRPObject.h>
2423
#include <ITSMFTReconstruction/DigitPixelReader.h>
2524
#include <DataFormatsITSMFT/ROFRecord.h>
@@ -54,6 +53,7 @@ ITSClusterTask::ITSClusterTask() : TaskInterface() {}
5453
ITSClusterTask::~ITSClusterTask()
5554
{
5655
delete hClusterVsBunchCrossing;
56+
delete hEmptyLaneFractionGlobal;
5757
for (int iLayer = 0; iLayer < NLayer; iLayer++) {
5858

5959
if (!mEnableLayers[iLayer])
@@ -221,7 +221,6 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
221221
nClustersForBunchCrossing++;
222222

223223
if (lay < NLayerIB) {
224-
225224
mClusterOccupancyIB[lay][sta][chip]++;
226225

227226
mClusterSize[lay][sta][chip] += npix;
@@ -236,7 +235,6 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
236235
hGroupedClusterSizeLayerSummary[lay]->Fill(npix);
237236
}
238237
} else {
239-
240238
mClusterOccupancyOB[lay][sta][lane]++;
241239

242240
mClusterSize[lay][sta][lane] += npix;
@@ -275,11 +273,14 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
275273

276274
if (!mEnableLayers[iLayer])
277275
continue;
278-
279276
for (int iStave = 0; iStave < mNStaves[iLayer]; iStave++) {
280277

281278
if (iLayer < NLayerIB) {
282279
for (int iChip = 0; iChip < mNChipsPerHic[iLayer]; iChip++) {
280+
if (!mClusterOccupancyIB[iLayer][iStave][iChip]) {
281+
mNLaneEmpty[0]++;
282+
mNLaneEmpty[3]++;
283+
}
283284
hAverageClusterOccupancySummaryIB[iLayer]->SetBinContent(iChip + 1, iStave + 1, 1. * mClusterOccupancyIB[iLayer][iStave][iChip] / mNRofs);
284285
hAverageClusterOccupancySummaryIB[iLayer]->SetBinError(iChip + 1, iStave + 1, 1e-15);
285286
hAverageClusterSizeSummaryIB[iLayer]->SetBinContent(iChip + 1, iStave + 1, nClusters[iLayer][iStave][iChip] != 0 ? (double)mClusterSize[iLayer][iStave][iChip] / nClusters[iLayer][iStave][iChip] : 0.);
@@ -292,6 +293,17 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
292293
} else {
293294

294295
for (int iLane = 0; iLane < mNLanePerHic[iLayer] * mNHicPerStave[iLayer]; iLane++) {
296+
if (iLayer < 5) {
297+
if (!mClusterOccupancyOB[iLayer][iStave][iLane]) {
298+
mNLaneEmpty[1]++;
299+
mNLaneEmpty[3]++;
300+
}
301+
} else {
302+
if (!mClusterOccupancyOB[iLayer][iStave][iLane]) {
303+
mNLaneEmpty[2]++;
304+
mNLaneEmpty[3]++;
305+
}
306+
}
295307
hAverageClusterOccupancySummaryOB[iLayer]->SetBinContent(iLane + 1, iStave + 1, 1. * mClusterOccupancyOB[iLayer][iStave][iLane] / mNRofs / (mNChipsPerHic[iLayer] / mNLanePerHic[iLayer])); // 14 To have occupation per chip -> 7 because we're considering lanes
296308
hAverageClusterOccupancySummaryOB[iLayer]->SetBinError(iLane + 1, iStave + 1, 1e-15); // 14 To have occupation per chip
297309
hAverageClusterSizeSummaryOB[iLayer]->SetBinContent(iLane + 1, iStave + 1, nClusters[iLayer][iStave][iLane] != 0 ? (double)mClusterSize[iLayer][iStave][iLane] / nClusters[iLayer][iStave][iLane] : 0.);
@@ -325,6 +337,9 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
325337
}
326338
}
327339
}
340+
for (int iflag = 0; iflag < NFlags; iflag++) {
341+
hEmptyLaneFractionGlobal->SetBinContent(iflag + 1, 1. * mNLaneEmpty[iflag] / mNLanes[iflag]);
342+
}
328343
}
329344

330345
end = std::chrono::high_resolution_clock::now();
@@ -346,6 +361,7 @@ void ITSClusterTask::reset()
346361
{
347362
ILOG(Debug, Devel) << "Resetting the histograms" << ENDM;
348363
hClusterVsBunchCrossing->Reset();
364+
hEmptyLaneFractionGlobal->Reset();
349365
mGeneralOccupancy->Reset();
350366

351367
for (int iLayer = 0; iLayer < NLayer; iLayer++) {
@@ -392,6 +408,18 @@ void ITSClusterTask::createAllHistos()
392408
formatAxes(hClusterVsBunchCrossing, "Bunch Crossing ID", "Number of clusters with npix > 2 in ROF", 1, 1.10);
393409
hClusterVsBunchCrossing->SetStats(0);
394410

411+
hEmptyLaneFractionGlobal = new TH1D("EmptyLaneFractionGlobal", "Empty Lane Fraction Global", 4, 0, 4);
412+
hEmptyLaneFractionGlobal->SetTitle("Empty Lane /All Lane ");
413+
addObject(hEmptyLaneFractionGlobal);
414+
formatAxes(hEmptyLaneFractionGlobal, "", "Fraction of empty lane");
415+
for (int i = 0; i < NFlags; i++) {
416+
hEmptyLaneFractionGlobal->GetXaxis()->SetBinLabel(i + 1, mLaneStatusFlag[i].c_str());
417+
}
418+
hEmptyLaneFractionGlobal->GetXaxis()->CenterLabels();
419+
hEmptyLaneFractionGlobal->SetMaximum(1);
420+
hEmptyLaneFractionGlobal->SetMinimum(0);
421+
hEmptyLaneFractionGlobal->SetStats(0);
422+
395423
for (int iLayer = 0; iLayer < NLayer; iLayer++) {
396424
if (!mEnableLayers[iLayer])
397425
continue;

0 commit comments

Comments
 (0)