|
16 | 16 | /// \author Katarina Krizkova Gajdosova |
17 | 17 | /// \author Diana Maria Krupova |
18 | 18 | /// \author David Grund |
| 19 | +/// \author Sara Haidlova |
19 | 20 | /// |
20 | 21 |
|
21 | 22 | // C++ |
@@ -123,51 +124,77 @@ Quality QcMFTClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorOb |
123 | 124 | return Quality::Null; |
124 | 125 | } |
125 | 126 | } |
126 | | - |
127 | 127 | // checker for empty ladders |
128 | 128 | QcMFTUtilTables MFTTable; |
129 | 129 | for (int i = 0; i < 20; i++) { |
130 | 130 | if (mo->getName() == MFTTable.mClusterChipMapNames[i]) { |
131 | 131 | adjacentCount = 0; |
132 | 132 | auto* hClusterChipOccupancyMap = dynamic_cast<TH2F*>(mo->getObject()); |
133 | 133 | if (hClusterChipOccupancyMap == nullptr) { |
134 | | - ILOG(Error, Support) << "Could not cast mClusterChipMap to TH2F." << ENDM; |
135 | 134 | return Quality::Null; |
136 | 135 | } |
137 | | - // loop over bins in each chip map |
| 136 | + // loop over bins in occupancy maps |
138 | 137 | for (int iBinX = 0; iBinX < hClusterChipOccupancyMap->GetNbinsX(); iBinX++) { |
139 | | - isEmpty = true; |
| 138 | + int emptyValidChips = 0; |
| 139 | + bool hasNonEmptyChip = false; |
| 140 | + |
140 | 141 | for (int iBinY = 0; iBinY < hClusterChipOccupancyMap->GetNbinsY(); iBinY++) { |
| 142 | + // Check if the bin contains data before further checks |
141 | 143 | if (hClusterChipOccupancyMap->GetBinContent(iBinX + 1, iBinY + 1) != 0) { |
142 | | - isEmpty = false; // if there is an unempty bin, the ladder is not empty |
143 | | - break; |
144 | | - } else { |
145 | | - // check if empty ladders are masked |
146 | | - for (int i = 0; i < mMaskedChips.size(); i++) { |
147 | | - if (mo->getName().find(mChipMapName[i]) != std::string::npos) { |
148 | | - if (iBinX + 1 == hClusterChipOccupancyMap->GetXaxis()->FindBin(mX[mMaskedChips[i]]) && iBinY + 1 == hClusterChipOccupancyMap->GetYaxis()->FindBin(mY[mMaskedChips[i]])) { |
149 | | - isEmpty = false; |
150 | | - } else { |
151 | | - isEmpty = true; |
| 144 | + hasNonEmptyChip = true; |
| 145 | + break; // Exit early if a non-empty chip is found (most of them should be non-empty) |
| 146 | + } |
| 147 | + |
| 148 | + bool isMasked = false; |
| 149 | + bool isOutsideAcc = false; |
| 150 | + |
| 151 | + // Check if chip is outside acceptance |
| 152 | + for (int k = 0; k < 21; k++) { |
| 153 | + if (mo->getName().find(MFTTable.mClusterChipMapNames[i]) != std::string::npos) { |
| 154 | + if (iBinX + 1 == MFTTable.mBinX[i][k] && iBinY + 1 == MFTTable.mBinY[i][k]) { |
| 155 | + isOutsideAcc = true; |
| 156 | + break; |
| 157 | + } |
| 158 | + } |
| 159 | + } |
| 160 | + |
| 161 | + // Check if chip is masked if it is in detector acceptance |
| 162 | + if (!isOutsideAcc) { |
| 163 | + for (int j = 0; j < mMaskedChips.size(); j++) { |
| 164 | + if (mo->getName().find(mChipMapName[j]) != std::string::npos) { |
| 165 | + int maskedX = hClusterChipOccupancyMap->GetXaxis()->FindBin(mX[mMaskedChips[j]]); |
| 166 | + int maskedY = hClusterChipOccupancyMap->GetYaxis()->FindBin(mY[mMaskedChips[j]]); |
| 167 | + if (iBinX + 1 == maskedX && iBinY + 1 == maskedY) { |
| 168 | + isMasked = true; |
| 169 | + break; // break the loop if you find the bin in the masked list |
152 | 170 | } |
153 | 171 | } |
154 | 172 | } |
155 | 173 | } |
| 174 | + |
| 175 | + // If chip is not masked and not outside acceptance, count it |
| 176 | + if (!isMasked && !isOutsideAcc) { |
| 177 | + emptyValidChips++; |
| 178 | + } |
156 | 179 | } |
157 | | - // count empty ladders |
| 180 | + |
| 181 | + // Determine if column is empty |
| 182 | + isEmpty = (emptyValidChips > 0 && !hasNonEmptyChip); |
| 183 | + |
158 | 184 | if (isEmpty) { |
159 | 185 | mEmptyCount++; |
160 | 186 | adjacentCount++; |
161 | 187 | } else { |
162 | 188 | adjacentCount = 0; |
163 | 189 | } |
164 | | - // set bool for adjacent ladders |
| 190 | + |
165 | 191 | if (adjacentCount >= mLadderThresholdBad) { |
166 | 192 | mAdjacentLaddersEmpty = true; |
167 | 193 | } |
168 | 194 | } |
169 | 195 | } |
170 | 196 | } |
| 197 | + |
171 | 198 | if (mo->getName() == "mClusterOccupancySummary") { |
172 | 199 | auto* hClusterOccupancySummary = dynamic_cast<TH2F*>(mo->getObject()); |
173 | 200 | if (hClusterOccupancySummary == nullptr) { |
|
0 commit comments