Skip to content

Commit

Permalink
correction to check function (#1970)
Browse files Browse the repository at this point in the history
* trying to solve MAC OS error in crrection to check on TrackletPerTriggerCheck

* updating value of initTrigger and updateTrigger
  • Loading branch information
deependra170598 authored Oct 10, 2023
1 parent 98ce9d5 commit 819f499
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 46 deletions.
14 changes: 7 additions & 7 deletions Modules/TRD/TRDQC.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"infologger": {
"filterDiscardDebug": "false",
"filterDiscardLevel": "11",
"filterDiscardLevel": "11"
}
},
"tasks": {
Expand Down Expand Up @@ -123,7 +123,7 @@
"detectorName": "TRD",
"dataSource": [{
"type": "Task",
"name": "TrackletsTask",
"name": "Tracklets",
"MOs": [ "trackletsperevent" ]
}],
"checkParameters":{
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions Modules/TRD/include/TRD/TrackletPerTriggerCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ class TrackletPerTriggerCheck : public o2::quality_control::checker::CheckInterf
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;
long int mTimeStamp;
std::pair<float, float> mDesiredMeanRegion;
long int mStatThreshold;
float mThresholdMeanLow, mThresholdMeanHigh;
int mStatThreshold;

ClassDefOverride(TrackletPerTriggerCheck, 2);
};
Expand Down
52 changes: 16 additions & 36 deletions Modules/TRD/src/TrackletPerTriggerCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "QualityControl/MonitorObject.h"
#include "QualityControl/Quality.h"
#include "QualityControl/QcInfoLogger.h"
#include "Common/Utils.h"
// ROOT
#include <TH1.h>
#include <TString.h>
Expand All @@ -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<float>(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<float>(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<int>(mCustomParameters, "StatThreshold", 1000);
ILOG(Debug, Support) << "using StatThreshold = " << mStatThreshold << ENDM;
}

Quality TrackletPerTriggerCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
Expand All @@ -90,22 +66,26 @@ Quality TrackletPerTriggerCheck::check(std::map<std::string, std::shared_ptr<Mon
msg1->SetTextSize(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");
}
}
Expand Down

0 comments on commit 819f499

Please sign in to comment.