Skip to content

Commit

Permalink
MFT: fix for not correctly working ladder checker for MFT (#2434)
Browse files Browse the repository at this point in the history
  • Loading branch information
Edingrast authored Sep 24, 2024
1 parent ea62b68 commit a2716d8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
21 changes: 18 additions & 3 deletions Modules/MFT/src/QcMFTClusterCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/// \author Katarina Krizkova Gajdosova
/// \author Diana Maria Krupova
/// \author David Grund
/// \author Sara Haidlova
///

// C++
Expand Down Expand Up @@ -126,23 +127,37 @@ Quality QcMFTClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorOb

// checker for empty ladders
QcMFTUtilTables MFTTable;
for (int i = 0; i < 20; i++) {
if (mo->getName() == MFTTable.mClusterChipMapNames[i]) {
for (int j = 0; j < 20; j++) {
if (mo->getName() == MFTTable.mClusterChipMapNames[j]) {
adjacentCount = 0;
auto* hClusterChipOccupancyMap = dynamic_cast<TH2F*>(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]])) {
Expand Down
22 changes: 19 additions & 3 deletions Modules/MFT/src/QcMFTDigitCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/// \author Katarina Krizkova Gajdosova
/// \author Diana Maria Krupova
/// \author David Grund
/// \author Sara Haidlova
///

// C++
Expand Down Expand Up @@ -169,23 +170,37 @@ Quality QcMFTDigitCheck::check(std::map<std::string, std::shared_ptr<MonitorObje

// checker for empty ladders
QcMFTUtilTables MFTTable;
for (int i = 0; i < 20; i++) {
if (mo->getName() == MFTTable.mDigitChipMapNames[i]) {
for (int j = 0; j < 20; j++) {
if (mo->getName() == MFTTable.mDigitChipMapNames[j]) {
adjacentCount = 0;
auto* hDigitChipOccupancyMap = dynamic_cast<TH2F*>(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]])) {
Expand All @@ -197,6 +212,7 @@ Quality QcMFTDigitCheck::check(std::map<std::string, std::shared_ptr<MonitorObje
}
}
}

// count empty ladders
if (isEmpty) {
mEmptyCount++;
Expand Down

0 comments on commit a2716d8

Please sign in to comment.