Skip to content

Commit

Permalink
MFT: quality checker for the noise task (#2401)
Browse files Browse the repository at this point in the history
* MFT: quality checker for noise task

* MFT: new checker for noise task

* MFT: noise task checker
  • Loading branch information
Edingrast authored Aug 29, 2024
1 parent 7df0aa9 commit 071b915
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 4 deletions.
14 changes: 14 additions & 0 deletions Modules/MFT/include/MFT/QcMFTDigitCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ class QcMFTDigitCheck : public o2::quality_control::checker::CheckInterface
std::vector<int> mOldNoisyPix;
std::vector<int> mNewNoisyPix;

bool mQualityGood;
bool mQualityMedium;
bool mQualityBad;
int mNoiseTotalMediumMin;
int mNoiseTotalMediumMax;
int mNoiseTotalBadMin;
int mNoiseTotalBadMax;
int mNoiseNewMediumMin;
int mNoiseNewMediumMax;
int mNoiseNewBadMax;
int mNoiseDissMediumMin;
int mNoiseDissMediumMax;
int mNoiseDissBadMax;

// to form the name of the masked chips histograms
int mHalf[936] = { 0 };
int mDisk[936] = { 0 };
Expand Down
13 changes: 12 additions & 1 deletion Modules/MFT/mft-digits.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@
"LadderThresholdMedium" : "1",
"LadderThresholdBad" : "2",
"NoiseScan" : "1",
"NCyclesNoiseMap" : "3"
"NCyclesNoiseMap" : "3",
"NoiseTotalMediumMin" : "7500",
"NoiseTotalMediumMax" : "8500",
"NoiseTotalBadMin" : "7000",
"NoiseTotalBadMax" : "9000",
"NoiseNewMediumMin" : "100",
"NoiseNewMediumMax" : "500",
"NoiseNewBadMax" : "1000",
"NoiseDissMediumMin" : "100",
"NoiseDissMediumMax" : "500",
"NoiseDissBadMax" : "1000"

},
"dataSource" : [ {
"type" : "Task",
Expand Down
88 changes: 85 additions & 3 deletions Modules/MFT/src/QcMFTDigitCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,56 @@ void QcMFTDigitCheck::configure()
ILOG(Info, Support) << "Custom parameter - NCyclesNoiseMap: " << param->second << ENDM;
mNCyclesNoiseMap = stoi(param->second);
}
mNoiseTotalMediumMin = 7500;
if (auto param = mCustomParameters.find("NoiseTotalMediumMin"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseTotalMediumMin: " << param->second << ENDM;
mNoiseTotalMediumMin = stoi(param->second);
}
mNoiseTotalMediumMax = 8500;
if (auto param = mCustomParameters.find("NoiseTotalMediumMax"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseTotalMediumMax: " << param->second << ENDM;
mNoiseTotalMediumMax = stoi(param->second);
}
mNoiseTotalBadMin = 7000;
if (auto param = mCustomParameters.find("NoiseTotalBadMin"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseTotalBadMin: " << param->second << ENDM;
mNoiseTotalBadMin = stoi(param->second);
}
mNoiseTotalBadMax = 9000;
if (auto param = mCustomParameters.find("NoiseTotalBadMax"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseTotalBadMax: " << param->second << ENDM;
mNoiseTotalBadMax = stoi(param->second);
}
mNoiseNewMediumMin = 100;
if (auto param = mCustomParameters.find("NoiseNewMediumMin"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseNewMediumMin: " << param->second << ENDM;
mNoiseNewMediumMin = stoi(param->second);
}
mNoiseNewMediumMax = 500;
if (auto param = mCustomParameters.find("NoiseNewMediumMax"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseNewMediumMax: " << param->second << ENDM;
mNoiseNewMediumMax = stoi(param->second);
}
mNoiseNewBadMax = 1000;
if (auto param = mCustomParameters.find("NoiseNewBadMax"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseNewBadMax: " << param->second << ENDM;
mNoiseNewBadMax = stoi(param->second);
}
mNoiseDissMediumMin = 100;
if (auto param = mCustomParameters.find("NoiseDissMediumMin"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseNewMediumMin: " << param->second << ENDM;
mNoiseDissMediumMin = stoi(param->second);
}
mNoiseDissMediumMax = 500;
if (auto param = mCustomParameters.find("NoiseDissMediumMax"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseNewMediumMax: " << param->second << ENDM;
mNoiseDissMediumMax = stoi(param->second);
}
mNoiseDissBadMax = 1000;
if (auto param = mCustomParameters.find("NoiseDissBadMax"); param != mCustomParameters.end()) {
ILOG(Info, Support) << "Custom parameter - NoiseNewBadMax: " << param->second << ENDM;
mNoiseDissBadMax = stoi(param->second);
}

// no call to beautifier yet
mFirstCall = true;
Expand All @@ -80,6 +130,9 @@ void QcMFTDigitCheck::configure()

mEmptyCount = 0;
mAdjacentLaddersEmpty = false;
mQualityGood = false;
mQualityMedium = false;
mQualityBad = false;
}

Quality QcMFTDigitCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
Expand Down Expand Up @@ -293,6 +346,7 @@ void QcMFTDigitCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkR
}
}
}

if (mNoiseScan == 1) {
if (mNCycles == 1) {
long timestamp = mo->getValidity().getMin();
Expand All @@ -316,6 +370,17 @@ void QcMFTDigitCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkR
mTotalNoisy++;
}
}
// quality of a noise scan
if (((mTotalNoisy < mNoiseTotalMediumMax) && (mTotalNoisy > mNoiseTotalMediumMin)) && ((mNewNoisy < mNoiseNewMediumMax) && (mNewNoisy > mNoiseNewMediumMin)) && ((mDissNoisy < mNoiseDissMediumMax) && (mDissNoisy > mNoiseDissMediumMin))) {
mQualityGood = true;
}
if (((mTotalNoisy > mNoiseTotalMediumMax) && (mTotalNoisy < mNoiseTotalBadMax)) || ((mTotalNoisy > mNoiseTotalBadMin) && (mTotalNoisy < mNoiseTotalMediumMin)) || ((mNewNoisy < mNoiseNewMediumMin) || (mNewNoisy > mNoiseNewMediumMax && mNewNoisy < mNoiseNewBadMax)) || ((mDissNoisy < mNoiseDissMediumMin) || (mDissNoisy > mNoiseDissMediumMax && mDissNoisy < mNoiseDissBadMax))) {
mQualityMedium = true;
}
if ((mTotalNoisy > mNoiseTotalBadMax) || (mTotalNoisy < mNoiseTotalBadMin) || (mNewNoisy > mNoiseNewBadMax) || (mDissNoisy > mNoiseDissBadMax)) {
mQualityBad = true;
mQualityMedium = false;
}
}

if (mo->getName().find("mDigitChipOccupancy") != std::string::npos) {
Expand All @@ -324,25 +389,42 @@ void QcMFTDigitCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkR
TLatex* tl_total = new TLatex(0.14, 0.87, Form("Total noisy pixels: %i", mTotalNoisy));
TLatex* tl_new = new TLatex(0.14, 0.83, Form("New noisy pixels: %i", mNewNoisy));
TLatex* tl_dis = new TLatex(0.14, 0.79, Form("Disappeared noisy pixels: %i", mDissNoisy));
TPaveText* msg = new TPaveText(0.65, 0.9, 0.95, 1.0, "NDC NB");
Color_t QualityColor;
if (mQualityGood) {
QualityColor = kGreen;
msg->AddText("No action needed");
} else if (mQualityMedium) {
QualityColor = kOrange;
msg->AddText("Write a logbook entry tagging MFT");
} else if (mQualityBad) {
QualityColor = kRed;
msg->AddText("Call the on-call!");
} else {
QualityColor = kBlue;
}
tl_total->SetNDC();
tl_total->SetTextFont(42);
tl_total->SetTextSize(0.03);
tl_total->SetTextColor(kBlue);
tl_total->SetTextColor(QualityColor);
tl_new->SetNDC();
tl_new->SetTextFont(42);
tl_new->SetTextSize(0.03);
tl_new->SetTextColor(kBlue);
tl_new->SetTextColor(QualityColor);
tl_dis->SetNDC();
tl_dis->SetTextFont(42);
tl_dis->SetTextSize(0.03);
tl_dis->SetTextColor(kBlue);
tl_dis->SetTextColor(QualityColor);
msg->SetFillColor(QualityColor);
// add it to the histo
DigitOccupancy->GetListOfFunctions()->Add(tl_total);
DigitOccupancy->GetListOfFunctions()->Add(tl_new);
DigitOccupancy->GetListOfFunctions()->Add(tl_dis);
DigitOccupancy->GetListOfFunctions()->Add(msg);
tl_total->Draw();
tl_new->Draw();
tl_dis->Draw();
msg->Draw();
}
}
}
Expand Down

0 comments on commit 071b915

Please sign in to comment.