From 808c9b6693c52e068b1b3b83a03a0d337d929cac Mon Sep 17 00:00:00 2001 From: nicolovalle <35177278+nicolovalle@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:31:47 +0200 Subject: [PATCH] ITS - Fixes and improvement on FEE Task checker (#2016) * ITS - Fixes and improvement on FEE Task checker * ITS - Fixes and improvement on FEE Task checker --------- Co-authored-by: Nicolo Valle --- Modules/ITS/include/ITS/ITSFeeCheck.h | 1 + Modules/ITS/itsFee.json | 4 +- Modules/ITS/src/ITSFeeCheck.cxx | 67 +++++++++++++++++++++------ 3 files changed, 56 insertions(+), 16 deletions(-) diff --git a/Modules/ITS/include/ITS/ITSFeeCheck.h b/Modules/ITS/include/ITS/ITSFeeCheck.h index afc6ac8168..7cb9f33d33 100644 --- a/Modules/ITS/include/ITS/ITSFeeCheck.h +++ b/Modules/ITS/include/ITS/ITSFeeCheck.h @@ -90,6 +90,7 @@ class ITSFeeCheck : public o2::quality_control::checker::CheckInterface std::string skipbinstrg = ""; std::string skipfeeids = ""; + int maxtfdifference = -1; int minPayloadSize = 1400; int maxbadchipsIB = 2; int maxbadlanesML = 4; diff --git a/Modules/ITS/itsFee.json b/Modules/ITS/itsFee.json index fc2db38221..9e010542dd 100644 --- a/Modules/ITS/itsFee.json +++ b/Modules/ITS/itsFee.json @@ -55,9 +55,11 @@ "checkParameters": { "skipbinstrg": "", "skipfeeids": "", - "maxbadchipsIB": "2", + "maxTFdifferenceAllowed": "1000000000", + "maxbadchipsIB": "2", "maxbadlanesML": "4", "maxbadlanesOL": "7", + "minPayloadSize": "1400", "maxfractionbadlanes": "0.1", "expectedROFperOrbit": "18", "plotWithTextMessage": "", diff --git a/Modules/ITS/src/ITSFeeCheck.cxx b/Modules/ITS/src/ITSFeeCheck.cxx index a825036c8c..33d42b014c 100644 --- a/Modules/ITS/src/ITSFeeCheck.cxx +++ b/Modules/ITS/src/ITSFeeCheck.cxx @@ -135,37 +135,74 @@ Quality ITSFeeCheck::check(std::map> if (mo->getName() == "TriggerVsFeeid") { result.set(Quality::Good); auto* h = dynamic_cast(mo->getObject()); - int counttrgflags[NTrg] = { 0 }; - int cutvalue[NTrg] = { 432, 432, 0, 0, 432, 0, 0, 0, 0, 432, 0, 432, 0 }; std::vector skipbins = convertToArray(o2::quality_control_modules::common::getFromConfig(mCustomParameters, "skipbinstrg", skipbinstrg)); std::vector skipfeeid = convertToArray(o2::quality_control_modules::common::getFromConfig(mCustomParameters, "skipfeeids", skipfeeids)); + maxtfdifference = o2::quality_control_modules::common::getFromConfig(mCustomParameters, "maxTFdifferenceAllowed", maxtfdifference); + for (int itrg = 1; itrg <= h->GetNbinsY(); itrg++) { result.addMetadata(h->GetYaxis()->GetBinLabel(itrg), "good"); - for (int ifee = 1; ifee <= h->GetNbinsX(); ifee++) { - if (h->GetBinContent(ifee, itrg) > 0) { - counttrgflags[itrg - 1]++; - } - } } + TString TrgAtLeastOne = "ORBIT HB PHYSICS TF"; + TString TrgExactlyOne = "SOC"; + // The others are requested to have no entries + + int min_n_tf = INT_MAX, max_n_tf = 0; + for (int itrg = 0; itrg < h->GetNbinsY(); itrg++) { if (std::find(skipbins.begin(), skipbins.end(), itrg + 1) != skipbins.end()) { continue; } + bool badTrigger = false; - if ((itrg == 0 || itrg == 1 || itrg == 4 || itrg == 9 || itrg == 11) && counttrgflags[itrg] < cutvalue[itrg] - (int)skipfeeid.size()) { - result.updateMetadata(h->GetYaxis()->GetBinLabel(itrg + 1), "bad"); - result.set(Quality::Bad); + + TString trgname = (TString)(h->GetYaxis()->GetBinLabel(itrg + 1)); + + for (int ifee = 1; ifee <= h->GetNbinsX(); ifee++) { + + if (std::find(skipfeeid.begin(), skipfeeid.end(), ifee) != skipfeeid.end()) + continue; + + int bincontent = (int)(h->GetBinContent(ifee, itrg + 1)); + + // checking trigger flags supposed to have at least one entry + if (TrgAtLeastOne.Contains(trgname)) { + if (bincontent < 1) { + badTrigger = true; + break; + } + } + // checking trigger flags supposed to have exactly one entry + else if (TrgExactlyOne.Contains(trgname)) { + if (bincontent != 1) { + badTrigger = true; + break; + } + } + // checking trigger flags supposed to have no entries + else { + if (bincontent > 0) { + badTrigger = true; + break; + } + } + + if (trgname == "TF" && maxtfdifference > 0) { + min_n_tf = std::min(min_n_tf, bincontent); + max_n_tf = std::max(max_n_tf, bincontent); + } + } + + if (trgname == "TF" && maxtfdifference > 0 && (max_n_tf - min_n_tf > maxtfdifference)) badTrigger = true; - } else if ((itrg == 2 || itrg == 3 || itrg == 5 || itrg == 6 || itrg == 7 || itrg == 8 || itrg == 10 || itrg == 12) && counttrgflags[itrg] > cutvalue[itrg]) { + + if (badTrigger) { result.updateMetadata(h->GetYaxis()->GetBinLabel(itrg + 1), "bad"); result.set(Quality::Bad); - badTrigger = true; - } - std::string extraText = (!strcmp(h->GetYaxis()->GetBinLabel(itrg + 1), "PHYSICS")) ? "(OK if it's COSMICS/SYNTHETIC)" : ""; - if (badTrigger) + std::string extraText = (!strcmp(h->GetYaxis()->GetBinLabel(itrg + 1), "PHYSICS")) ? "(OK if it's COSMICS/SYNTHETIC)" : ""; result.addReason(o2::quality_control::FlagReasonFactory::Unknown(), Form("BAD:Trigger flag %s of bad quality %s", h->GetYaxis()->GetBinLabel(itrg + 1), extraText.c_str())); + } } }