From 819f499c5a64cc57a3c6f5f4691d56a0d7d6e913 Mon Sep 17 00:00:00 2001 From: Deependra Sharma <38365215+deependra170598@users.noreply.github.com> Date: Tue, 10 Oct 2023 13:51:29 +0530 Subject: [PATCH] correction to check function (#1970) * trying to solve MAC OS error in crrection to check on TrackletPerTriggerCheck * updating value of initTrigger and updateTrigger --- Modules/TRD/TRDQC.json | 14 ++--- .../TRD/include/TRD/TrackletPerTriggerCheck.h | 5 +- Modules/TRD/src/TrackletPerTriggerCheck.cxx | 52 ++++++------------- 3 files changed, 25 insertions(+), 46 deletions(-) diff --git a/Modules/TRD/TRDQC.json b/Modules/TRD/TRDQC.json index afc2d298dc..9d02656e31 100644 --- a/Modules/TRD/TRDQC.json +++ b/Modules/TRD/TRDQC.json @@ -26,7 +26,7 @@ }, "infologger": { "filterDiscardDebug": "false", - "filterDiscardLevel": "11", + "filterDiscardLevel": "11" } }, "tasks": { @@ -123,7 +123,7 @@ "detectorName": "TRD", "dataSource": [{ "type": "Task", - "name": "TrackletsTask", + "name": "Tracklets", "MOs": [ "trackletsperevent" ] }], "checkParameters":{ @@ -157,7 +157,7 @@ "dataSources": [ { "type": "repository", - "path": "TRD/MO/TrackletsTask/", + "path": "TRD/MO/Tracklets/", "names": [ "trackletspertimeframe","trackletsperevent" ], "reductorName": "o2::quality_control_modules::common::TH1Reductor", "moduleName": "QcTRD" @@ -180,10 +180,10 @@ } ], "initTrigger": [ - "usercontrol" + "newobject:ccdb:TRD/MO/Tracklets/trackletsperevent" ], "updateTrigger": [ - "10 seconds" + "newobject:ccdb:TRD/MO/Tracklets/trackletsperevent","20 seconds" ], "stopTrigger": [ "usercontrol" @@ -229,10 +229,10 @@ } ], "initTrigger": [ - "userorcontrol","60sec","SOR" + "newobject:ccdb:TRD/QO/TrackletPerTriggerCheck" ], "updateTrigger": [ - "60 seconds" + "newobject:ccdb:TRD/QO/TrackletPerTriggerCheck","20 seconds" ], "stopTrigger": [ "userorcontrol","EOR" diff --git a/Modules/TRD/include/TRD/TrackletPerTriggerCheck.h b/Modules/TRD/include/TRD/TrackletPerTriggerCheck.h index 64103d0088..19093b2cc3 100644 --- a/Modules/TRD/include/TRD/TrackletPerTriggerCheck.h +++ b/Modules/TRD/include/TRD/TrackletPerTriggerCheck.h @@ -37,9 +37,8 @@ class TrackletPerTriggerCheck : public o2::quality_control::checker::CheckInterf Quality check(std::map>* moMap) override; void beautify(std::shared_ptr mo, Quality checkResult = Quality::Null) override; std::string getAcceptedType() override; - long int mTimeStamp; - std::pair mDesiredMeanRegion; - long int mStatThreshold; + float mThresholdMeanLow, mThresholdMeanHigh; + int mStatThreshold; ClassDefOverride(TrackletPerTriggerCheck, 2); }; diff --git a/Modules/TRD/src/TrackletPerTriggerCheck.cxx b/Modules/TRD/src/TrackletPerTriggerCheck.cxx index 29186fa5d8..5d57418af1 100644 --- a/Modules/TRD/src/TrackletPerTriggerCheck.cxx +++ b/Modules/TRD/src/TrackletPerTriggerCheck.cxx @@ -18,6 +18,7 @@ #include "QualityControl/MonitorObject.h" #include "QualityControl/Quality.h" #include "QualityControl/QcInfoLogger.h" +#include "Common/Utils.h" // ROOT #include #include @@ -28,48 +29,23 @@ using namespace std; using namespace o2::quality_control; +using namespace o2::quality_control_modules::common; namespace o2::quality_control_modules::trd { void TrackletPerTriggerCheck::configure() { - // ccdb setting - if (auto param = mCustomParameters.find("ccdbtimestamp"); param != mCustomParameters.end()) { - mTimeStamp = std::stol(mCustomParameters["ccdbtimestamp"]); - ILOG(Debug, Support) << "configure() : using ccdbtimestamp = " << mTimeStamp << ENDM; - } else { - mTimeStamp = o2::ccdb::getCurrentTimestamp(); - ILOG(Debug, Support) << "configure() : using default timestam of now = " << mTimeStamp << ENDM; - } - auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setTimestamp(mTimeStamp); - ILOG(Debug, Devel) << "initialize TrackletPertriggerCheck" << ENDM; // QcInfoLogger is used. FairMQ logs will go to there as well. - if (auto param = mCustomParameters.find("Lowerthreshold"); param != mCustomParameters.end()) { - mDesiredMeanRegion.first = stof(param->second); - ILOG(Debug, Support) << "configure() : using json Lowerthreshold" << mDesiredMeanRegion.first << ENDM; - } else { - mDesiredMeanRegion.first = 500.0; - ILOG(Debug, Support) << "configure() : using default Lowerthreshold" << mDesiredMeanRegion.first << ENDM; - } + mThresholdMeanHigh = getFromConfig(mCustomParameters, "Upperthreshold", 520.f); + ILOG(Debug, Support) << "using Upperthreshold = " << mThresholdMeanHigh << ENDM; - if (auto param = mCustomParameters.find("Upperthreshold"); param != mCustomParameters.end()) { - mDesiredMeanRegion.second = stof(param->second); - ILOG(Debug, Support) << "configure() : using json Upperthreshold" << mDesiredMeanRegion.second << ENDM; - } else { - mDesiredMeanRegion.second = 520.0; - ILOG(Debug, Support) << "configure() : using default Upperthreshold" << mDesiredMeanRegion.second << ENDM; - } + mThresholdMeanLow = getFromConfig(mCustomParameters, "Lowerthreshold", 500.f); + ILOG(Debug, Support) << "using Lowerthreshold = " << mThresholdMeanLow << ENDM; - if (auto param = mCustomParameters.find("StatThreshold"); param != mCustomParameters.end()) { - mStatThreshold = stod(param->second); - ILOG(Debug, Support) << "configure() : using json mStatThreshold" << mStatThreshold << ENDM; - } else { - mStatThreshold = 1000; - ILOG(Debug, Support) << "configure() : using default mStatThreshold" << mStatThreshold << ENDM; - } + mStatThreshold = getFromConfig(mCustomParameters, "StatThreshold", 1000); + ILOG(Debug, Support) << "using StatThreshold = " << mStatThreshold << ENDM; } Quality TrackletPerTriggerCheck::check(std::map>* moMap) @@ -90,22 +66,26 @@ Quality TrackletPerTriggerCheck::check(std::mapSetTextSize(10); int Entries = h->GetEntries(); if (Entries > mStatThreshold) { - msg1->AddText(TString::Format("Hist Can't be ignored. Stat is enough. Entries: %d > Threshold: %ld", Entries, mStatThreshold)); + msg1->AddText(TString::Format("Hist Can't be ignored. Stat is enough. Entries: %d > Threshold: %d", Entries, mStatThreshold)); // msg1->SetTextColor(kGreen); } else if (Entries > 0) { - msg1->AddText(TString::Format("Hist Can be ignored. Stat is low. Entries: %d < Threshold: %ld", Entries, mStatThreshold)); + msg1->AddText(TString::Format("Hist Can be ignored. Stat is low. Entries: %d < Threshold: %d", Entries, mStatThreshold)); // msg1->SetTextColor(kYellow); } else if (Entries == 0) { - msg1->AddText(TString::Format("Hist is empty. Entries: %d < Threshold: %ld", Entries, mStatThreshold)); + msg1->AddText(TString::Format("Hist is empty. Entries: %d < Threshold: %d", Entries, mStatThreshold)); msg1->SetTextColor(kRed); } // applying check float MeanTracletPertrigger = h->GetMean(); - if (MeanTracletPertrigger > mDesiredMeanRegion.second && MeanTracletPertrigger < mDesiredMeanRegion.first) { + if (MeanTracletPertrigger > mThresholdMeanLow && MeanTracletPertrigger < mThresholdMeanHigh) { + TText* Checkmsg = msg1->AddText("Mean is found in bound region: ok"); + Checkmsg->SetTextColor(kGreen); result = Quality::Good; } else { result = Quality::Bad; + TText* Checkmsg = msg1->AddText("Mean is not found in bound region: not ok"); + Checkmsg->SetTextColor(kRed); result.addReason(FlagReasonFactory::Unknown(), "MeanTracletPertrigger is not in bound region"); } }