@@ -42,8 +42,8 @@ void DecodingCheck::startOfActivity(const Activity& activity)
4242 mGoodFracHistName = getConfigurationParameter<std::string>(mCustomParameters , " GoodFracHistName" , mGoodFracHistName , activity);
4343 mSyncFracHistName = getConfigurationParameter<std::string>(mCustomParameters , " SyncFracHistName" , mSyncFracHistName , activity);
4444
45- mMinGoodErrorFrac = getConfigurationParameter< double > (mCustomParameters , " MinGoodErrorFrac" , mMinGoodErrorFrac , activity );
46- mMinGoodSyncFrac = getConfigurationParameter< double > (mCustomParameters , " MinGoodSyncFrac" , mMinGoodSyncFrac , activity );
45+ getThresholdsPerStation (mCustomParameters , activity, " MinGoodErrorFrac" , mMinGoodErrorFracPerStation , mMinGoodErrorFrac );
46+ getThresholdsPerStation (mCustomParameters , activity, " MinGoodSyncFrac" , mMinGoodSyncFracPerStation , mMinGoodSyncFrac );
4747
4848 mMaxBadST12 = getConfigurationParameter<int >(mCustomParameters , " MaxBadDE_ST12" , mMaxBadST12 , activity);
4949 mMaxBadST345 = getConfigurationParameter<int >(mCustomParameters , " MaxBadDE_ST345" , mMaxBadST345 , activity);
@@ -70,9 +70,24 @@ Quality DecodingCheck::check(std::map<std::string, std::shared_ptr<MonitorObject
7070 return result;
7171 }
7272
73- for (int deId = 0 ; deId < getNumDE (); deId++) {
73+ for (auto de : o2::mch::constants::deIdsForAllMCH) {
74+ int chamberId = (de - 100 ) / 100 ;
75+ int stationId = chamberId / 2 ;
76+
77+ int deId = getDEindex (de);
78+ if (deId < 0 ) {
79+ continue ;
80+ }
81+
82+ auto minGoodErrorFrac = mMinGoodErrorFrac ;
83+ if (stationId >= 0 && stationId < 5 ) {
84+ if (mMinGoodErrorFracPerStation [stationId]) {
85+ minGoodErrorFrac = mMinGoodErrorFracPerStation [stationId].value ();
86+ }
87+ }
88+
7489 double val = h->GetBinContent (deId + 1 );
75- if (val < mMinGoodErrorFrac ) {
90+ if (val < minGoodErrorFrac ) {
7691 errorsQuality[deId] = Quality::Bad;
7792 } else {
7893 errorsQuality[deId] = Quality::Good;
@@ -87,9 +102,24 @@ Quality DecodingCheck::check(std::map<std::string, std::shared_ptr<MonitorObject
87102 return result;
88103 }
89104
90- for (int deId = 0 ; deId < getNumDE (); deId++) {
105+ for (auto de : o2::mch::constants::deIdsForAllMCH) {
106+ int chamberId = (de - 100 ) / 100 ;
107+ int stationId = chamberId / 2 ;
108+
109+ int deId = getDEindex (de);
110+ if (deId < 0 ) {
111+ continue ;
112+ }
113+
114+ auto minGoodSyncFrac = mMinGoodSyncFrac ;
115+ if (stationId >= 0 && stationId < 5 ) {
116+ if (mMinGoodSyncFracPerStation [stationId]) {
117+ minGoodSyncFrac = mMinGoodSyncFracPerStation [stationId].value ();
118+ }
119+ }
120+
91121 double val = h->GetBinContent (deId + 1 );
92- if (val < mMinGoodSyncFrac ) {
122+ if (val < minGoodSyncFrac ) {
93123 syncQuality[deId] = Quality::Bad;
94124 } else {
95125 syncQuality[deId] = Quality::Good;
@@ -103,37 +133,8 @@ Quality DecodingCheck::check(std::map<std::string, std::shared_ptr<MonitorObject
103133
104134std::string DecodingCheck::getAcceptedType () { return " TH1" ; }
105135
106- static void updateTitle (TH1 * hist, std::string suffix)
107- {
108- if (!hist) {
109- return ;
110- }
111- TString title = hist->GetTitle ();
112- title.Append (" " );
113- title.Append (suffix.c_str ());
114- hist->SetTitle (title);
115- }
116-
117- static std::string getCurrentTime ()
118- {
119- time_t t;
120- time (&t);
121-
122- struct tm * tmp;
123- tmp = localtime (&t);
124-
125- char timestr[500 ];
126- strftime (timestr, sizeof (timestr), " (%d/%m/%Y - %R)" , tmp);
127-
128- std::string result = timestr;
129- return result;
130- }
131-
132136void DecodingCheck::beautify (std::shared_ptr<MonitorObject> mo, Quality checkResult)
133137{
134- auto currentTime = getCurrentTime ();
135- updateTitle (dynamic_cast <TH1 *>(mo->getObject ()), currentTime);
136-
137138 if (mo->getName ().find (" DecodingErrorsPerDE" ) != std::string::npos) {
138139 auto * h = dynamic_cast <TH2F *>(mo->getObject ());
139140 if (!h) {
@@ -193,21 +194,22 @@ void DecodingCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkRes
193194 h->GetYaxis ()->SetTitle (" good boards fraction" );
194195
195196 addChamberDelimiters (h, scaleMin, scaleMax);
197+ addDEBinLabels (h);
196198
197- // draw horizontal limits
198- TLine* l = new TLine (0 , mMinGoodErrorFrac , h->GetXaxis ()->GetXmax (), mMinGoodErrorFrac );
199- l->SetLineColor (kBlue );
200- l->SetLineStyle (kDashed );
201- h->GetListOfFunctions ()->Add (l);
202-
203- if (checkResult == Quality::Good) {
204- h->SetFillColor (kGreen );
205- } else if (checkResult == Quality::Bad) {
206- h->SetFillColor (kRed );
207- } else if (checkResult == Quality::Medium) {
208- h->SetFillColor (kOrange );
199+ // only the plot used for the check is beautified by changing the color
200+ // and adding the horizontal lines corresponding to the thresholds
201+ if (matchHistName (mo->getName (), mGoodFracHistName )) {
202+ if (checkResult == Quality::Good) {
203+ h->SetFillColor (kGreen );
204+ } else if (checkResult == Quality::Bad) {
205+ h->SetFillColor (kRed );
206+ } else if (checkResult == Quality::Medium) {
207+ h->SetFillColor (kOrange );
208+ }
209+ h->SetLineColor (kBlack );
210+
211+ drawThresholdsPerStation (h, mMinGoodErrorFracPerStation , mMinGoodErrorFrac );
209212 }
210- h->SetLineColor (kBlack );
211213 }
212214
213215 if (mo->getName ().find (" SyncedBoardsFractionPerDE" ) != std::string::npos) {
@@ -222,21 +224,22 @@ void DecodingCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkRes
222224 h->SetMaximum (scaleMax);
223225
224226 addChamberDelimiters (h, scaleMin, scaleMax);
227+ addDEBinLabels (h);
228+
229+ // only the plot used for the check is beautified by changing the color
230+ // and adding the horizontal lines corresponding to the thresholds
231+ if (matchHistName (mo->getName (), mSyncFracHistName )) {
232+ if (checkResult == Quality::Good) {
233+ h->SetFillColor (kGreen );
234+ } else if (checkResult == Quality::Bad) {
235+ h->SetFillColor (kRed );
236+ } else if (checkResult == Quality::Medium) {
237+ h->SetFillColor (kOrange );
238+ }
239+ h->SetLineColor (kBlack );
225240
226- // draw horizontal limits
227- TLine* l = new TLine (0 , mMinGoodSyncFrac , h->GetXaxis ()->GetXmax (), mMinGoodSyncFrac );
228- l->SetLineColor (kBlue );
229- l->SetLineStyle (kDashed );
230- h->GetListOfFunctions ()->Add (l);
231-
232- if (checkResult == Quality::Good) {
233- h->SetFillColor (kGreen );
234- } else if (checkResult == Quality::Bad) {
235- h->SetFillColor (kRed );
236- } else if (checkResult == Quality::Medium) {
237- h->SetFillColor (kOrange );
241+ drawThresholdsPerStation (h, mMinGoodSyncFracPerStation , mMinGoodSyncFrac );
238242 }
239- h->SetLineColor (kBlack );
240243 }
241244}
242245
0 commit comments