Skip to content

Commit c26d762

Browse files
EdingrastBarthelemy
authored andcommitted
MFT: patch for wrong quality in summary plots (#2395)
* MFT: patch for code errors * MFT: patch for new ladder checker * MFT: patch for new ladder checker_v3
1 parent aa1cca2 commit c26d762

6 files changed

Lines changed: 53 additions & 56 deletions

File tree

Modules/MFT/include/MFT/QcMFTClusterCheck.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ class QcMFTClusterCheck : public o2::quality_control::checker::CheckInterface
4747
int mLadderThresholdBad;
4848

4949
// ladder checker
50-
bool mIsEmpty;
51-
bool mAdjacentLadders;
50+
bool mAdjacentLaddersEmpty;
5251
int mEmptyCount;
53-
int mAdjacentCount;
5452

5553
// masked chips part
5654
bool mFirstCall;

Modules/MFT/include/MFT/QcMFTDigitCheck.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ class QcMFTDigitCheck : public o2::quality_control::checker::CheckInterface
4646
int mLadderThresholdBad;
4747

4848
// ladder checker
49-
bool mIsEmpty;
50-
bool mAdjacentLadders;
49+
bool mAdjacentLaddersEmpty;
5150
int mEmptyCount;
52-
int mAdjacentCount;
5351

5452
// masked chips part
5553
bool mFirstCall;

Modules/MFT/mft-clusters.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"dataSource" : [ {
6262
"type" : "Task",
6363
"name" : "Clusters",
64-
"MOs" : ["mClusterOccupancy","mClusterPatternIndex","mClusterSizeSummary", "mGroupedClusterSizeSummary", "mClusterOccupancySummary",
64+
"MOs" : ["mClusterOccupancy","mClusterPatternIndex","mClusterSizeSummary", "mGroupedClusterSizeSummary",
6565
"ChipOccupancyMaps/Half_0/Disk_0/Face_1/mClusterChipOccupancyMap",
6666
"ChipOccupancyMaps/Half_0/Disk_0/Face_0/mClusterChipOccupancyMap",
6767
"ChipOccupancyMaps/Half_0/Disk_1/Face_1/mClusterChipOccupancyMap",
@@ -81,7 +81,8 @@
8181
"ChipOccupancyMaps/Half_1/Disk_3/Face_1/mClusterChipOccupancyMap",
8282
"ChipOccupancyMaps/Half_1/Disk_3/Face_0/mClusterChipOccupancyMap",
8383
"ChipOccupancyMaps/Half_1/Disk_4/Face_1/mClusterChipOccupancyMap",
84-
"ChipOccupancyMaps/Half_1/Disk_4/Face_0/mClusterChipOccupancyMap"
84+
"ChipOccupancyMaps/Half_1/Disk_4/Face_0/mClusterChipOccupancyMap",
85+
"mClusterOccupancySummary"
8586
]
8687
} ],
8788
"checkParameters" : {

Modules/MFT/mft-digits.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"dataSource" : [ {
7272
"type" : "Task",
7373
"name" : "Digits",
74-
"MOs" : ["mDigitChipOccupancy","mDigitOccupancySummary",
74+
"MOs" : ["mDigitChipOccupancy",
7575
"ChipOccupancyMaps/Half_0/Disk_0/Face_1/mDigitChipOccupancyMap",
7676
"ChipOccupancyMaps/Half_0/Disk_0/Face_0/mDigitChipOccupancyMap",
7777
"ChipOccupancyMaps/Half_0/Disk_1/Face_1/mDigitChipOccupancyMap",
@@ -91,7 +91,8 @@
9191
"ChipOccupancyMaps/Half_1/Disk_3/Face_1/mDigitChipOccupancyMap",
9292
"ChipOccupancyMaps/Half_1/Disk_3/Face_0/mDigitChipOccupancyMap",
9393
"ChipOccupancyMaps/Half_1/Disk_4/Face_1/mDigitChipOccupancyMap",
94-
"ChipOccupancyMaps/Half_1/Disk_4/Face_0/mDigitChipOccupancyMap"
94+
"ChipOccupancyMaps/Half_1/Disk_4/Face_0/mDigitChipOccupancyMap",
95+
"mDigitOccupancySummary"
9596
]
9697
} ]
9798
}

Modules/MFT/src/QcMFTClusterCheck.cxx

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,17 @@ void QcMFTClusterCheck::configure()
6464

6565
// no call to beautifier yet
6666
mFirstCall = true;
67-
mIsEmpty = true;
68-
mAdjacentLadders = false;
69-
7067
mEmptyCount = 0;
68+
mAdjacentLaddersEmpty = false;
7169
}
7270

7371
Quality QcMFTClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
7472
{
7573
Quality result = Quality::Null;
7674

75+
bool isEmpty = true;
76+
int adjacentCount = 0;
77+
7778
for (auto& [moName, mo] : *moMap) {
7879

7980
(void)moName;
@@ -127,44 +128,41 @@ Quality QcMFTClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorOb
127128
QcMFTUtilTables MFTTable;
128129
for (int i = 0; i < 20; i++) {
129130
if (mo->getName() == MFTTable.mClusterChipMapNames[i]) {
130-
mAdjacentCount = 0;
131+
adjacentCount = 0;
131132
auto* hClusterChipOccupancyMap = dynamic_cast<TH2F*>(mo->getObject());
132133
if (hClusterChipOccupancyMap == nullptr) {
133134
ILOG(Error, Support) << "Could not cast mClusterChipMap to TH2F." << ENDM;
134135
return Quality::Null;
135136
}
136137
// loop over bins in each chip map
137138
for (int iBinX = 0; iBinX < hClusterChipOccupancyMap->GetNbinsX(); iBinX++) {
138-
mIsEmpty = true;
139+
isEmpty = true;
139140
for (int iBinY = 0; iBinY < hClusterChipOccupancyMap->GetNbinsY(); iBinY++) {
140141
if (hClusterChipOccupancyMap->GetBinContent(iBinX + 1, iBinY + 1) != 0) {
141-
mIsEmpty = false; // if there is an unempty bin, the ladder is not empty
142+
isEmpty = false; // if there is an unempty bin, the ladder is not empty
142143
break;
143144
} else {
144145
// check if empty ladders are masked
145146
for (int i = 0; i < mMaskedChips.size(); i++) {
146147
if (mo->getName().find(mChipMapName[i]) != std::string::npos) {
147148
if (iBinX + 1 == hClusterChipOccupancyMap->GetXaxis()->FindBin(mX[mMaskedChips[i]]) && iBinY + 1 == hClusterChipOccupancyMap->GetYaxis()->FindBin(mY[mMaskedChips[i]])) {
148-
mIsEmpty = false;
149+
isEmpty = false;
149150
} else {
150-
mIsEmpty = true;
151+
isEmpty = true;
151152
}
152153
}
153154
}
154155
}
155156
}
156157
// count empty ladders
157-
if (mIsEmpty) {
158+
if (isEmpty) {
158159
mEmptyCount++;
159-
mAdjacentCount++;
160+
adjacentCount++;
160161
} else {
161-
mAdjacentCount = 0;
162+
adjacentCount = 0;
162163
}
163-
// set bool for adjacent ladders
164-
if (mAdjacentCount >= mLadderThresholdBad) {
165-
if (!mAdjacentLadders) {
166-
mAdjacentLadders = true;
167-
}
164+
if (adjacentCount >= mLadderThresholdBad) {
165+
mAdjacentLaddersEmpty = true;
168166
}
169167
}
170168
}
@@ -177,15 +175,16 @@ Quality QcMFTClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorOb
177175
return Quality::Null;
178176
}
179177

180-
if (!mAdjacentLadders && mEmptyCount < mLadderThresholdMedium) {
181-
result = Quality::Good;
182-
}
183-
if (!mAdjacentLadders && mEmptyCount >= mLadderThresholdMedium) {
184-
result = Quality::Medium;
185-
}
186-
if (mAdjacentLadders) {
178+
if (mAdjacentLaddersEmpty) {
187179
result = Quality::Bad;
180+
} else if (mEmptyCount >= mLadderThresholdMedium) {
181+
result = Quality::Medium;
182+
} else {
183+
result = Quality::Good;
188184
}
185+
// We rely on 'mClusterOccupancySummary' being run after chip maps in the list of MOs in the config file
186+
mEmptyCount = 0;
187+
mAdjacentLaddersEmpty = false;
189188
}
190189
}
191190
return result;

Modules/MFT/src/QcMFTDigitCheck.cxx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,23 @@ void QcMFTDigitCheck::configure()
7272

7373
// no call to beautifier yet
7474
mFirstCall = true;
75-
mIsEmpty = true;
76-
mAdjacentLadders = false;
7775

7876
mNCycles = 0;
7977
mNewNoisy = 0;
8078
mDissNoisy = 0;
8179
mTotalNoisy = 0;
80+
8281
mEmptyCount = 0;
82+
mAdjacentLaddersEmpty = false;
8383
}
8484

8585
Quality QcMFTDigitCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
8686
{
8787
Quality result = Quality::Null;
8888

89+
bool isEmpty = true;
90+
int adjacentCount = 0;
91+
8992
for (auto& [moName, mo] : *moMap) {
9093

9194
(void)moName;
@@ -115,44 +118,42 @@ Quality QcMFTDigitCheck::check(std::map<std::string, std::shared_ptr<MonitorObje
115118
QcMFTUtilTables MFTTable;
116119
for (int i = 0; i < 20; i++) {
117120
if (mo->getName() == MFTTable.mDigitChipMapNames[i]) {
118-
mAdjacentCount = 0;
121+
adjacentCount = 0;
119122
auto* hDigitChipOccupancyMap = dynamic_cast<TH2F*>(mo->getObject());
120123
if (hDigitChipOccupancyMap == nullptr) {
121124
ILOG(Error, Support) << "Could not cast mDigitChipMap to TH2F." << ENDM;
122125
return Quality::Null;
123126
}
124127
// loop over bins in each chip map
125128
for (int iBinX = 0; iBinX < hDigitChipOccupancyMap->GetNbinsX(); iBinX++) {
126-
mIsEmpty = true;
129+
isEmpty = true;
127130
for (int iBinY = 0; iBinY < hDigitChipOccupancyMap->GetNbinsY(); iBinY++) {
128131
if (hDigitChipOccupancyMap->GetBinContent(iBinX + 1, iBinY + 1) != 0) {
129-
mIsEmpty = false; // if there is an unempty bin, the ladder is not empty
132+
isEmpty = false; // if there is an unempty bin, the ladder is not empty
130133
break;
131134
} else {
132135
// check if empty ladders are masked
133136
for (int i = 0; i < mMaskedChips.size(); i++) {
134137
if (mo->getName().find(mChipMapName[i]) != std::string::npos) {
135138
if (iBinX + 1 == hDigitChipOccupancyMap->GetXaxis()->FindBin(mX[mMaskedChips[i]]) && iBinY + 1 == hDigitChipOccupancyMap->GetYaxis()->FindBin(mY[mMaskedChips[i]])) {
136-
mIsEmpty = false;
139+
isEmpty = false;
137140
} else {
138-
mIsEmpty = true;
141+
isEmpty = true;
139142
}
140143
}
141144
}
142145
}
143146
}
144147
// count empty ladders
145-
if (mIsEmpty) {
148+
if (isEmpty) {
146149
mEmptyCount++;
147-
mAdjacentCount++;
150+
adjacentCount++;
148151
} else {
149-
mAdjacentCount = 0;
152+
adjacentCount = 0;
150153
}
151154
// set bool for adjacent ladders
152-
if (mAdjacentCount >= 2) {
153-
if (!mAdjacentLadders) {
154-
mAdjacentLadders = true;
155-
}
155+
if (adjacentCount >= mLadderThresholdBad) {
156+
mAdjacentLaddersEmpty = true;
156157
}
157158
}
158159
}
@@ -165,20 +166,20 @@ Quality QcMFTDigitCheck::check(std::map<std::string, std::shared_ptr<MonitorObje
165166
return Quality::Null;
166167
}
167168

168-
if (!mAdjacentLadders && mEmptyCount < 1) {
169-
result = Quality::Good;
170-
}
171-
if (!mAdjacentLadders && mEmptyCount >= 1) {
172-
result = Quality::Medium;
173-
}
174-
if (mAdjacentLadders) {
169+
if (mAdjacentLaddersEmpty) {
175170
result = Quality::Bad;
171+
} else if (mEmptyCount >= mLadderThresholdMedium) {
172+
result = Quality::Medium;
173+
} else {
174+
result = Quality::Good;
176175
}
176+
// We rely on 'mDigitOccupancySummary' being run after chip maps in the list of MOs in the config file
177+
mEmptyCount = 0;
178+
mAdjacentLaddersEmpty = false;
177179
}
178180
}
179181
return result;
180182
}
181-
182183
std::string QcMFTDigitCheck::getAcceptedType() { return "TH1"; }
183184

184185
void QcMFTDigitCheck::readMaskedChips(std::shared_ptr<MonitorObject> mo)
@@ -387,5 +388,4 @@ void QcMFTDigitCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkR
387388
}
388389
}
389390
}
390-
391391
} // namespace o2::quality_control_modules::mft

0 commit comments

Comments
 (0)