2020#include " QualityControl/QcInfoLogger.h"
2121// ROOT
2222#include < TH1.h>
23- #include " TString.h"
24- #include " TPaveText.h"
23+ #include < TString.h>
24+ #include < TPaveText.h>
2525
2626#include < DataFormatsQualityControl/FlagReasons.h>
27- #include " CCDB/BasicCCDBManager.h"
27+ #include < CCDB/BasicCCDBManager.h>
2828
2929using namespace std ;
3030using namespace o2 ::quality_control;
@@ -48,71 +48,66 @@ void TrackletPerTriggerCheck::configure()
4848 ILOG (Debug, Devel) << " initialize TrackletPertriggerCheck" << ENDM ; // QcInfoLogger is used. FairMQ logs will go to there as well.
4949
5050 if (auto param = mCustomParameters .find (" Lowerthreshold" ); param != mCustomParameters .end ()) {
51- DesiredMeanRegion .first = stof (param->second );
52- ILOG (Debug, Support) << " configure() : using json Lowerthreshold" << DesiredMeanRegion .first << ENDM ;
51+ mDesiredMeanRegion .first = stof (param->second );
52+ ILOG (Debug, Support) << " configure() : using json Lowerthreshold" << mDesiredMeanRegion .first << ENDM ;
5353 } else {
54- DesiredMeanRegion .first = 500.0 ;
55- ILOG (Debug, Support) << " configure() : using default Lowerthreshold" << DesiredMeanRegion .first << ENDM ;
54+ mDesiredMeanRegion .first = 500.0 ;
55+ ILOG (Debug, Support) << " configure() : using default Lowerthreshold" << mDesiredMeanRegion .first << ENDM ;
5656 }
5757
5858 if (auto param = mCustomParameters .find (" Upperthreshold" ); param != mCustomParameters .end ()) {
59- DesiredMeanRegion .second = stof (param->second );
60- ILOG (Debug, Support) << " configure() : using json Upperthreshold" << DesiredMeanRegion .second << ENDM ;
59+ mDesiredMeanRegion .second = stof (param->second );
60+ ILOG (Debug, Support) << " configure() : using json Upperthreshold" << mDesiredMeanRegion .second << ENDM ;
6161 } else {
62- DesiredMeanRegion .second = 520.0 ;
63- ILOG (Debug, Support) << " configure() : using default Upperthreshold" << DesiredMeanRegion .second << ENDM ;
62+ mDesiredMeanRegion .second = 520.0 ;
63+ ILOG (Debug, Support) << " configure() : using default Upperthreshold" << mDesiredMeanRegion .second << ENDM ;
6464 }
6565
6666 if (auto param = mCustomParameters .find (" StatThreshold" ); param != mCustomParameters .end ()) {
67- StatThreshold = stod (param->second );
68- ILOG (Debug, Support) << " configure() : using json StatThreshold " << StatThreshold << ENDM ;
67+ mStatThreshold = stod (param->second );
68+ ILOG (Debug, Support) << " configure() : using json mStatThreshold " << mStatThreshold << ENDM ;
6969 } else {
70- StatThreshold = 1000 ;
71- ILOG (Debug, Support) << " configure() : using default StatThreshold " << StatThreshold << ENDM ;
70+ mStatThreshold = 1000 ;
71+ ILOG (Debug, Support) << " configure() : using default mStatThreshold " << mStatThreshold << ENDM ;
7272 }
7373}
7474
7575Quality TrackletPerTriggerCheck::check (std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
7676{
7777 Quality result = Quality::Null;
7878
79- // you can get details about the activity via the object mActivity:
80- ILOG (Debug, Devel) << " Run " << getActivity ()->mId << " , type: " << getActivity ()->mType << " , beam: " << getActivity ()->mBeamType << ENDM ;
81- // and you can get your custom parameters:
82- ILOG (Debug, Devel) << " custom param physics.pp.myOwnKey1 : " << mCustomParameters .atOrDefaultValue (" myOwnKey1" , " physics" , " pp" , " default_value" ) << ENDM ;
83-
8479 for (auto & [moName, mo] : *moMap) {
85-
8680 (void )moName;
8781 if (mo->getName () == " trackletsperevent" ) {
8882 auto * h = dynamic_cast <TH1F *>(mo->getObject ());
89-
83+ if (h == nullptr ) {
84+ // ILOG(Debug, Support) << "Requested Histogram type does not match with the Histogram in source" << ENDM;
85+ continue ;
86+ }
9087 // writing text over hist
9188 TPaveText* msg1 = new TPaveText (0.3 , 0.7 , 0.7 , 0.9 , " NDC" ); // check option "br","NDC"
9289 h->GetListOfFunctions ()->Add (msg1);
9390 msg1->SetTextSize (10 );
9491 int Entries = h->GetEntries ();
95- if (Entries > StatThreshold ) {
96- msg1->AddText (TString::Format (" Hist Can't be ignored. Stat is enough. Entries: %d > Threshold: %d" , Entries, StatThreshold ));
92+ if (Entries > mStatThreshold ) {
93+ msg1->AddText (TString::Format (" Hist Can't be ignored. Stat is enough. Entries: %d > Threshold: %d" , Entries, mStatThreshold ));
9794 // msg1->SetTextColor(kGreen);
9895 } else if (Entries > 0 ) {
99- msg1->AddText (TString::Format (" Hist Can be ignored. Stat is low. Entries: %d < Threshold: %d" , Entries, StatThreshold ));
96+ msg1->AddText (TString::Format (" Hist Can be ignored. Stat is low. Entries: %d < Threshold: %d" , Entries, mStatThreshold ));
10097 // msg1->SetTextColor(kYellow);
10198 } else if (Entries == 0 ) {
102- msg1->AddText (TString::Format (" Hist is empty. Entries: %d < Threshold: %d" , Entries, StatThreshold ));
99+ msg1->AddText (TString::Format (" Hist is empty. Entries: %d < Threshold: %d" , Entries, mStatThreshold ));
103100 msg1->SetTextColor (kRed );
104101 }
105102
106103 // applying check
107104 float MeanTracletPertrigger = h->GetMean ();
108- if (MeanTracletPertrigger > DesiredMeanRegion .second && MeanTracletPertrigger < DesiredMeanRegion .first ) {
105+ if (MeanTracletPertrigger > mDesiredMeanRegion .second && MeanTracletPertrigger < mDesiredMeanRegion .first ) {
109106 result = Quality::Good;
110107 } else {
111108 result = Quality::Bad;
112109 result.addReason (FlagReasonFactory::Unknown (), " MeanTracletPertrigger is not in bound region" );
113110 }
114-
115- result.addMetadata (" mykey" , " myvalue" );
116111 }
117112 }
118113 return result;
@@ -124,7 +119,10 @@ void TrackletPerTriggerCheck::beautify(std::shared_ptr<MonitorObject> mo, Qualit
124119{
125120 if (mo->getName () == " trackletsperevent" ) {
126121 auto * h = dynamic_cast <TH1F *>(mo->getObject ());
127-
122+ if (h == nullptr ) {
123+ // ILOG(Debug, Support) << "Requested Histogram type does not match with the Histogram in source" << ENDM;
124+ return ;
125+ }
128126 if (checkResult == Quality::Good) {
129127 h->SetFillColor (kGreen );
130128 } else if (checkResult == Quality::Bad) {
@@ -138,4 +136,4 @@ void TrackletPerTriggerCheck::beautify(std::shared_ptr<MonitorObject> mo, Qualit
138136 }
139137}
140138
141- } // namespace o2::quality_control_modules::trd
139+ } // namespace o2::quality_control_modules::trd
0 commit comments