From eaf2fd5af51ba8c5c7c62d00b21e5a8cfe1408c3 Mon Sep 17 00:00:00 2001 From: Sara Haidlova Date: Mon, 23 Sep 2024 23:49:34 +0200 Subject: [PATCH] MFT: fix for not correctly working ladder checker for MFT --- Modules/MFT/src/QcMFTClusterCheck.cxx | 21 ++++++++++++++++++--- Modules/MFT/src/QcMFTDigitCheck.cxx | 22 +++++++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Modules/MFT/src/QcMFTClusterCheck.cxx b/Modules/MFT/src/QcMFTClusterCheck.cxx index 334630a27c..4775ebc0e9 100644 --- a/Modules/MFT/src/QcMFTClusterCheck.cxx +++ b/Modules/MFT/src/QcMFTClusterCheck.cxx @@ -16,6 +16,7 @@ /// \author Katarina Krizkova Gajdosova /// \author Diana Maria Krupova /// \author David Grund +/// \author Sara Haidlova /// // C++ @@ -126,23 +127,37 @@ Quality QcMFTClusterCheck::check(std::mapgetName() == MFTTable.mClusterChipMapNames[i]) { + for (int j = 0; j < 20; j++) { + if (mo->getName() == MFTTable.mClusterChipMapNames[j]) { adjacentCount = 0; auto* hClusterChipOccupancyMap = dynamic_cast(mo->getObject()); if (hClusterChipOccupancyMap == nullptr) { ILOG(Error, Support) << "Could not cast mClusterChipMap to TH2F." << ENDM; return Quality::Null; } + // loop over bins in each chip map + bool isOutsideAcc = false; for (int iBinX = 0; iBinX < hClusterChipOccupancyMap->GetNbinsX(); iBinX++) { isEmpty = true; for (int iBinY = 0; iBinY < hClusterChipOccupancyMap->GetNbinsY(); iBinY++) { + isOutsideAcc = false; if (hClusterChipOccupancyMap->GetBinContent(iBinX + 1, iBinY + 1) != 0) { isEmpty = false; // if there is an unempty bin, the ladder is not empty break; } else { - // check if empty ladders are masked + // check if empty chips are outside acceptance + for (int k = 0; k < 21; k++) { + if (mo->getName().find(MFTTable.mClusterChipMapNames[j]) != std::string::npos) { + if (iBinX + 1 == MFTTable.mBinX[j][k] && iBinY + 1 == MFTTable.mBinY[j][k]) { + isOutsideAcc = true; + continue; + } + } + } + } + // if the chip is still empty and not outside acceptance, check if it is masked + if (isEmpty && !isOutsideAcc) { 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]])) { diff --git a/Modules/MFT/src/QcMFTDigitCheck.cxx b/Modules/MFT/src/QcMFTDigitCheck.cxx index 782af665c9..f37b91ca49 100644 --- a/Modules/MFT/src/QcMFTDigitCheck.cxx +++ b/Modules/MFT/src/QcMFTDigitCheck.cxx @@ -16,6 +16,7 @@ /// \author Katarina Krizkova Gajdosova /// \author Diana Maria Krupova /// \author David Grund +/// \author Sara Haidlova /// // C++ @@ -169,23 +170,37 @@ Quality QcMFTDigitCheck::check(std::mapgetName() == MFTTable.mDigitChipMapNames[i]) { + for (int j = 0; j < 20; j++) { + if (mo->getName() == MFTTable.mDigitChipMapNames[j]) { adjacentCount = 0; auto* hDigitChipOccupancyMap = dynamic_cast(mo->getObject()); if (hDigitChipOccupancyMap == nullptr) { ILOG(Error, Support) << "Could not cast mDigitChipMap to TH2F." << ENDM; return Quality::Null; } + // loop over bins in each chip map + bool isOutsideAcc = false; for (int iBinX = 0; iBinX < hDigitChipOccupancyMap->GetNbinsX(); iBinX++) { isEmpty = true; for (int iBinY = 0; iBinY < hDigitChipOccupancyMap->GetNbinsY(); iBinY++) { + isOutsideAcc = false; if (hDigitChipOccupancyMap->GetBinContent(iBinX + 1, iBinY + 1) != 0) { isEmpty = false; // if there is an unempty bin, the ladder is not empty break; } else { - // check if empty ladders are masked + // check if empty chips are outside acceptance + for (int k = 0; k < 21; k++) { + if (mo->getName().find(MFTTable.mDigitChipMapNames[j]) != std::string::npos) { + if (iBinX + 1 == MFTTable.mBinX[j][k] && iBinY + 1 == MFTTable.mBinY[j][k]) { + isOutsideAcc = true; + continue; + } + } + } + } + // if the chip is still empty and not outside acceptance, check if it is masked + if (isEmpty && !isOutsideAcc) { 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]])) { @@ -197,6 +212,7 @@ Quality QcMFTDigitCheck::check(std::map