@@ -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
8585Quality 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-
182183std::string QcMFTDigitCheck::getAcceptedType () { return " TH1" ; }
183184
184185void 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