Skip to content

Commit

Permalink
ITS - Fixes and improvement on FEE Task checker (#2016)
Browse files Browse the repository at this point in the history
* ITS - Fixes and improvement on FEE Task checker

* ITS - Fixes and improvement on FEE Task checker

---------

Co-authored-by: Nicolo Valle <nicolo.valle@cern.ch>
  • Loading branch information
nicolovalle and nicolovalle authored Oct 16, 2023
1 parent 56a4afc commit 808c9b6
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 16 deletions.
1 change: 1 addition & 0 deletions Modules/ITS/include/ITS/ITSFeeCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion Modules/ITS/itsFee.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
67 changes: 52 additions & 15 deletions Modules/ITS/src/ITSFeeCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -135,37 +135,74 @@ Quality ITSFeeCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>
if (mo->getName() == "TriggerVsFeeid") {
result.set(Quality::Good);
auto* h = dynamic_cast<TH2I*>(mo->getObject());
int counttrgflags[NTrg] = { 0 };
int cutvalue[NTrg] = { 432, 432, 0, 0, 432, 0, 0, 0, 0, 432, 0, 432, 0 };

std::vector<int> skipbins = convertToArray<int>(o2::quality_control_modules::common::getFromConfig<string>(mCustomParameters, "skipbinstrg", skipbinstrg));
std::vector<int> skipfeeid = convertToArray<int>(o2::quality_control_modules::common::getFromConfig<string>(mCustomParameters, "skipfeeids", skipfeeids));
maxtfdifference = o2::quality_control_modules::common::getFromConfig<int>(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()));
}
}
}

Expand Down

0 comments on commit 808c9b6

Please sign in to comment.