2323#include < TH1.h>
2424#include < TPaveText.h>
2525#include < TList.h>
26+ #include < TObjArray.h>
2627
2728using namespace std ;
2829
@@ -80,73 +81,79 @@ Quality TOFCheckRawsMulti::check(std::map<std::string, std::shared_ptr<MonitorOb
8081 // h->SetBit(AliQAv1::GetImageBit(), kTRUE);
8182 // }
8283 // }
83- if (h->GetEntries () == 0 ) {
84+ if (h->GetEntries () == 0 ) { // Histogram is empty
8485 result = Quality::Medium;
8586 // flag = AliQAv1::kWARNING;
86- } else {
87+ shifter_msg = " No counts!" ;
88+ } else { // Histogram is non empty
8789 multiMean = h->GetMean ();
8890 zeroBinIntegral = h->Integral (1 , 1 );
8991 lowMIntegral = h->Integral (1 , 10 );
9092 totIntegral = h->Integral (2 , h->GetNbinsX ());
9193
9294 if (totIntegral == 0 ) { // if only "0 hits per event" bin is filled -> error
9395 if (h->GetBinContent (1 ) > 0 ) {
94- result = Quality::Medium ;
96+ result = Quality::Bad ;
9597 // flag = AliQAv1::kERROR;
98+ shifter_msg = " Only events at 0 filled!" ;
9699 }
97100 } else {
98101 // if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCosmic) {
99- if (0 ) {
102+ if (0 ) { // TODO: this is only for cosmics, how to check?
100103 if (multiMean < 10 .) {
101104 result = Quality::Good;
105+ shifter_msg = " Average within limits, OK!" ;
102106 // flag = AliQAv1::kINFO;
103107 } else {
104108 result = Quality::Medium;
109+ shifter_msg = " Average outside limits!" ;
105110 // flag = AliQAv1::kWARNING;
106111 }
107- } else {
108- Bool_t isZeroBinContentHigh = kFALSE ;
109- Bool_t isLowMultContentHigh = kFALSE ;
110- Bool_t isINT7AverageLow = kFALSE ;
111- Bool_t isINT7AverageHigh = kFALSE ;
112-
113- if (zeroBinIntegral > 0.75 * totIntegral)
114- isZeroBinContentHigh = kTRUE ;
115- if (lowMIntegral > 0.75 * totIntegral)
116- isLowMultContentHigh = kTRUE ;
117- if (multiMean < minTOFrawhits)
118- isINT7AverageLow = kTRUE ;
119- if (multiMean > maxTOFrawhits)
120- isINT7AverageHigh = kTRUE ;
112+ } else { // Running with collisions
113+ const Bool_t isZeroBinContentHigh = (zeroBinIntegral > fracAtZeroMult * totIntegral);
114+ const Bool_t isLowMultContentHigh = (lowMIntegral > fracAtLowMult * totIntegral);
115+ const Bool_t isINT7AverageLow = (multiMean < minTOFrawhits);
116+ const Bool_t isINT7AverageHigh = (multiMean > maxTOFrawhits);
121117
122118 // if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kLowMult) {
123- if (0 ) {
119+ if (0 ) { // TODO: Low multiplicity running, how to check if it is pp? Probably this can be simplified in the json
124120 if (isZeroBinContentHigh && (multiMean > 10 .)) {
125121
126122 } else {
127123 // if (!histname.Contains("INT7") && (multiMean > 100.)) {
128124 if ((multiMean > 100 .)) {
129125 result = Quality::Medium;
126+ shifter_msg = " Average outside limits!" ;
130127 // flag = AliQAv1::kWARNING;
131128 } else {
132129 // if (histname.Contains("INT7") && (isINT7AverageLow || isINT7AverageHigh)) {
133130 if ((isINT7AverageLow || isINT7AverageHigh)) {
134131 result = Quality::Medium;
132+ shifter_msg = " Average outside limits!" ;
135133 // flag = AliQAv1::kWARNING;
136134 } else {
137135 result = Quality::Good;
136+ shifter_msg = " Average within limits, OK!" ;
138137 // flag = AliQAv1::kINFO;
139138 }
140139 }
141140 }
142- // } else if ((AliRecoParam::ConvertIndex(specie) == AliRecoParam::kHighMult) && (isLowMultContentHigh || (multiMean > 500.))) {
143- } else if ((isLowMultContentHigh || (multiMean > 500 .))) {
144- // assume that good range of multi in PbPb goes from 20 to 500 tracks
145- result = Quality::Medium;
146- // flag = AliQAv1::kWARNING;
147- } else {
148- result = Quality::Good;
149- // flag = AliQAv1::kINFO;
141+ }
142+ // } else if ((AliRecoParam::ConvertIndex(specie) == AliRecoParam::kHighMult) && (isLowMultContentHigh || (multiMean > 500.))) {
143+ else { // High multiplicity running e.g. Pb-Pb
144+ if (isLowMultContentHigh) {
145+ result = Quality::Medium;
146+ shifter_msg = Form (" Low-multiplicity counts are high\n (%.2f higher than total)!" , fracAtLowMult);
147+ } else if (multiMean > maxTOFrawhitsPbPb) {
148+ // assume that good range of multi in PbPb goes from 20 to 500 tracks
149+ result = Quality::Medium;
150+ shifter_msg = Form (" Average higher than expected (%.2f)!" , maxTOFrawhitsPbPb);
151+ // flag = AliQAv1::kWARNING;
152+ } else {
153+ result = Quality::Good;
154+ shifter_msg = " Average within limits" ;
155+ // flag = AliQAv1::kINFO;
156+ }
150157 }
151158 }
152159 }
@@ -166,10 +173,13 @@ void TOFCheckRawsMulti::beautify(std::shared_ptr<MonitorObject> mo, Quality chec
166173 h->GetListOfFunctions ()->Add (msg);
167174 msg->Draw ();
168175 msg->SetName (Form (" %s_msg" , mo->GetName ()));
176+ msg->Clear ();
177+ TObjArray* txt_arr = shifter_msg.Tokenize (" \n " );
178+ for (Int_t i = 0 ; i < txt_arr->GetEntries (); i++) {
179+ msg->AddText (txt_arr->At (i)->GetName ());
180+ }
169181
170182 if (checkResult == Quality::Good) {
171- LOG (INFO ) << " Quality::Good, setting to green" ;
172- msg->Clear ();
173183 msg->AddText (Form (" Mean value = %5.2f" , multiMean));
174184 msg->AddText (Form (" Reference range: %5.2f-%5.2f" , minTOFrawhits, maxTOFrawhits));
175185 msg->AddText (Form (" Events with 0 hits = %5.2f%%" , zeroBinIntegral * 100 . / totIntegral));
@@ -178,20 +188,12 @@ void TOFCheckRawsMulti::beautify(std::shared_ptr<MonitorObject> mo, Quality chec
178188 //
179189 h->SetFillColor (kGreen );
180190 } else if (checkResult == Quality::Bad) {
181- LOG (INFO ) << " Quality::Bad, setting to red" ;
182- //
183- msg->Clear ();
184- msg->AddText (" No TOF hits for all events." );
185191 msg->AddText (" Call TOF on-call." );
186192 msg->SetFillColor (kRed );
187193 //
188194 h->SetFillColor (kRed );
189195 } else if (checkResult == Quality::Medium) {
190- LOG (INFO ) << " Quality::medium, setting to orange" ;
191- //
192- msg->Clear ();
193- msg->AddText (" No entries. IF TOF IN RUN" );
194- msg->AddText (" check the TOF TWiki" );
196+ msg->AddText (" IF TOF IN RUN check the TOF TWiki" );
195197 msg->SetFillColor (kYellow );
196198 //
197199 h->SetFillColor (kOrange );
0 commit comments