diff --git a/Modules/MFT/include/MFT/QcMFTClusterCheck.h b/Modules/MFT/include/MFT/QcMFTClusterCheck.h index 6fe064b490..eb1a2acde5 100644 --- a/Modules/MFT/include/MFT/QcMFTClusterCheck.h +++ b/Modules/MFT/include/MFT/QcMFTClusterCheck.h @@ -47,10 +47,8 @@ class QcMFTClusterCheck : public o2::quality_control::checker::CheckInterface int mLadderThresholdBad; // ladder checker - bool mIsEmpty; - bool mAdjacentLadders; + bool mAdjacentLaddersEmpty; int mEmptyCount; - int mAdjacentCount; // masked chips part bool mFirstCall; diff --git a/Modules/MFT/include/MFT/QcMFTDigitCheck.h b/Modules/MFT/include/MFT/QcMFTDigitCheck.h index f287ffce27..8cd7315ca6 100644 --- a/Modules/MFT/include/MFT/QcMFTDigitCheck.h +++ b/Modules/MFT/include/MFT/QcMFTDigitCheck.h @@ -46,10 +46,8 @@ class QcMFTDigitCheck : public o2::quality_control::checker::CheckInterface int mLadderThresholdBad; // ladder checker - bool mIsEmpty; - bool mAdjacentLadders; + bool mAdjacentLaddersEmpty; int mEmptyCount; - int mAdjacentCount; // masked chips part bool mFirstCall; diff --git a/Modules/MFT/mft-clusters.json b/Modules/MFT/mft-clusters.json index 3e17432b2d..ee6828bc9d 100644 --- a/Modules/MFT/mft-clusters.json +++ b/Modules/MFT/mft-clusters.json @@ -61,7 +61,7 @@ "dataSource" : [ { "type" : "Task", "name" : "Clusters", - "MOs" : ["mClusterOccupancy","mClusterPatternIndex","mClusterSizeSummary", "mGroupedClusterSizeSummary", "mClusterOccupancySummary", + "MOs" : ["mClusterOccupancy","mClusterPatternIndex","mClusterSizeSummary", "mGroupedClusterSizeSummary", "ChipOccupancyMaps/Half_0/Disk_0/Face_1/mClusterChipOccupancyMap", "ChipOccupancyMaps/Half_0/Disk_0/Face_0/mClusterChipOccupancyMap", "ChipOccupancyMaps/Half_0/Disk_1/Face_1/mClusterChipOccupancyMap", @@ -81,7 +81,8 @@ "ChipOccupancyMaps/Half_1/Disk_3/Face_1/mClusterChipOccupancyMap", "ChipOccupancyMaps/Half_1/Disk_3/Face_0/mClusterChipOccupancyMap", "ChipOccupancyMaps/Half_1/Disk_4/Face_1/mClusterChipOccupancyMap", - "ChipOccupancyMaps/Half_1/Disk_4/Face_0/mClusterChipOccupancyMap" + "ChipOccupancyMaps/Half_1/Disk_4/Face_0/mClusterChipOccupancyMap", + "mClusterOccupancySummary" ] } ], "checkParameters" : { diff --git a/Modules/MFT/mft-digits.json b/Modules/MFT/mft-digits.json index 11d966c09a..0f488cb18a 100644 --- a/Modules/MFT/mft-digits.json +++ b/Modules/MFT/mft-digits.json @@ -71,7 +71,7 @@ "dataSource" : [ { "type" : "Task", "name" : "Digits", - "MOs" : ["mDigitChipOccupancy","mDigitOccupancySummary", + "MOs" : ["mDigitChipOccupancy", "ChipOccupancyMaps/Half_0/Disk_0/Face_1/mDigitChipOccupancyMap", "ChipOccupancyMaps/Half_0/Disk_0/Face_0/mDigitChipOccupancyMap", "ChipOccupancyMaps/Half_0/Disk_1/Face_1/mDigitChipOccupancyMap", @@ -91,7 +91,8 @@ "ChipOccupancyMaps/Half_1/Disk_3/Face_1/mDigitChipOccupancyMap", "ChipOccupancyMaps/Half_1/Disk_3/Face_0/mDigitChipOccupancyMap", "ChipOccupancyMaps/Half_1/Disk_4/Face_1/mDigitChipOccupancyMap", - "ChipOccupancyMaps/Half_1/Disk_4/Face_0/mDigitChipOccupancyMap" + "ChipOccupancyMaps/Half_1/Disk_4/Face_0/mDigitChipOccupancyMap", + "mDigitOccupancySummary" ] } ] } diff --git a/Modules/MFT/src/QcMFTClusterCheck.cxx b/Modules/MFT/src/QcMFTClusterCheck.cxx index 838925ffc0..334630a27c 100644 --- a/Modules/MFT/src/QcMFTClusterCheck.cxx +++ b/Modules/MFT/src/QcMFTClusterCheck.cxx @@ -64,16 +64,17 @@ void QcMFTClusterCheck::configure() // no call to beautifier yet mFirstCall = true; - mIsEmpty = true; - mAdjacentLadders = false; - mEmptyCount = 0; + mAdjacentLaddersEmpty = false; } Quality QcMFTClusterCheck::check(std::map>* moMap) { Quality result = Quality::Null; + bool isEmpty = true; + int adjacentCount = 0; + for (auto& [moName, mo] : *moMap) { (void)moName; @@ -127,7 +128,7 @@ Quality QcMFTClusterCheck::check(std::mapgetName() == MFTTable.mClusterChipMapNames[i]) { - mAdjacentCount = 0; + adjacentCount = 0; auto* hClusterChipOccupancyMap = dynamic_cast(mo->getObject()); if (hClusterChipOccupancyMap == nullptr) { ILOG(Error, Support) << "Could not cast mClusterChipMap to TH2F." << ENDM; @@ -135,36 +136,33 @@ Quality QcMFTClusterCheck::check(std::mapGetNbinsX(); iBinX++) { - mIsEmpty = true; + isEmpty = true; for (int iBinY = 0; iBinY < hClusterChipOccupancyMap->GetNbinsY(); iBinY++) { if (hClusterChipOccupancyMap->GetBinContent(iBinX + 1, iBinY + 1) != 0) { - mIsEmpty = false; // if there is an unempty bin, the ladder is not empty + isEmpty = false; // if there is an unempty bin, the ladder is not empty break; } else { // check if empty ladders are masked for (int i = 0; i < mMaskedChips.size(); i++) { if (mo->getName().find(mChipMapName[i]) != std::string::npos) { if (iBinX + 1 == hClusterChipOccupancyMap->GetXaxis()->FindBin(mX[mMaskedChips[i]]) && iBinY + 1 == hClusterChipOccupancyMap->GetYaxis()->FindBin(mY[mMaskedChips[i]])) { - mIsEmpty = false; + isEmpty = false; } else { - mIsEmpty = true; + isEmpty = true; } } } } } // count empty ladders - if (mIsEmpty) { + if (isEmpty) { mEmptyCount++; - mAdjacentCount++; + adjacentCount++; } else { - mAdjacentCount = 0; + adjacentCount = 0; } - // set bool for adjacent ladders - if (mAdjacentCount >= mLadderThresholdBad) { - if (!mAdjacentLadders) { - mAdjacentLadders = true; - } + if (adjacentCount >= mLadderThresholdBad) { + mAdjacentLaddersEmpty = true; } } } @@ -177,15 +175,16 @@ Quality QcMFTClusterCheck::check(std::map= mLadderThresholdMedium) { - result = Quality::Medium; - } - if (mAdjacentLadders) { + if (mAdjacentLaddersEmpty) { result = Quality::Bad; + } else if (mEmptyCount >= mLadderThresholdMedium) { + result = Quality::Medium; + } else { + result = Quality::Good; } + // We rely on 'mClusterOccupancySummary' being run after chip maps in the list of MOs in the config file + mEmptyCount = 0; + mAdjacentLaddersEmpty = false; } } return result; diff --git a/Modules/MFT/src/QcMFTDigitCheck.cxx b/Modules/MFT/src/QcMFTDigitCheck.cxx index 0249e2d4dd..ec92355f27 100644 --- a/Modules/MFT/src/QcMFTDigitCheck.cxx +++ b/Modules/MFT/src/QcMFTDigitCheck.cxx @@ -72,20 +72,23 @@ void QcMFTDigitCheck::configure() // no call to beautifier yet mFirstCall = true; - mIsEmpty = true; - mAdjacentLadders = false; mNCycles = 0; mNewNoisy = 0; mDissNoisy = 0; mTotalNoisy = 0; + mEmptyCount = 0; + mAdjacentLaddersEmpty = false; } Quality QcMFTDigitCheck::check(std::map>* moMap) { Quality result = Quality::Null; + bool isEmpty = true; + int adjacentCount = 0; + for (auto& [moName, mo] : *moMap) { (void)moName; @@ -115,7 +118,7 @@ Quality QcMFTDigitCheck::check(std::mapgetName() == MFTTable.mDigitChipMapNames[i]) { - mAdjacentCount = 0; + adjacentCount = 0; auto* hDigitChipOccupancyMap = dynamic_cast(mo->getObject()); if (hDigitChipOccupancyMap == nullptr) { ILOG(Error, Support) << "Could not cast mDigitChipMap to TH2F." << ENDM; @@ -123,36 +126,34 @@ Quality QcMFTDigitCheck::check(std::mapGetNbinsX(); iBinX++) { - mIsEmpty = true; + isEmpty = true; for (int iBinY = 0; iBinY < hDigitChipOccupancyMap->GetNbinsY(); iBinY++) { if (hDigitChipOccupancyMap->GetBinContent(iBinX + 1, iBinY + 1) != 0) { - mIsEmpty = false; // if there is an unempty bin, the ladder is not empty + isEmpty = false; // if there is an unempty bin, the ladder is not empty break; } else { // check if empty ladders are masked for (int i = 0; i < mMaskedChips.size(); i++) { if (mo->getName().find(mChipMapName[i]) != std::string::npos) { if (iBinX + 1 == hDigitChipOccupancyMap->GetXaxis()->FindBin(mX[mMaskedChips[i]]) && iBinY + 1 == hDigitChipOccupancyMap->GetYaxis()->FindBin(mY[mMaskedChips[i]])) { - mIsEmpty = false; + isEmpty = false; } else { - mIsEmpty = true; + isEmpty = true; } } } } } // count empty ladders - if (mIsEmpty) { + if (isEmpty) { mEmptyCount++; - mAdjacentCount++; + adjacentCount++; } else { - mAdjacentCount = 0; + adjacentCount = 0; } // set bool for adjacent ladders - if (mAdjacentCount >= 2) { - if (!mAdjacentLadders) { - mAdjacentLadders = true; - } + if (adjacentCount >= mLadderThresholdBad) { + mAdjacentLaddersEmpty = true; } } } @@ -165,20 +166,20 @@ Quality QcMFTDigitCheck::check(std::map= 1) { - result = Quality::Medium; - } - if (mAdjacentLadders) { + if (mAdjacentLaddersEmpty) { result = Quality::Bad; + } else if (mEmptyCount >= mLadderThresholdMedium) { + result = Quality::Medium; + } else { + result = Quality::Good; } + // We rely on 'mDigitOccupancySummary' being run after chip maps in the list of MOs in the config file + mEmptyCount = 0; + mAdjacentLaddersEmpty = false; } } return result; } - std::string QcMFTDigitCheck::getAcceptedType() { return "TH1"; } void QcMFTDigitCheck::readMaskedChips(std::shared_ptr mo) @@ -387,5 +388,4 @@ void QcMFTDigitCheck::beautify(std::shared_ptr mo, Quality checkR } } } - } // namespace o2::quality_control_modules::mft