Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MFT: fix for not correctly working ladder checker for MFT #2434

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading