]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDCQAChecker.cxx
AliTriggerAnalisys:
[u/mrichter/AliRoot.git] / ZDC / AliZDCQAChecker.cxx
CommitLineData
075a0e70 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
17// --- ROOT system ---
075a0e70 18#include <TH1F.h>
075a0e70 19#include <TIterator.h>
fdc38bb2 20#include <TString.h>
891ddd89 21#include <TPaveText.h>
22#include <TObjArray.h>
23#include "TList.h"
075a0e70 24
25// --- Standard library ---
26
27// --- AliRoot header files ---
28#include "AliLog.h"
075a0e70 29#include "AliZDCQAChecker.h"
30
31ClassImp(AliZDCQAChecker)
32
075a0e70 33//____________________________________________________________________________
a42ceb0e 34void AliZDCQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list,
486788fc 35 const AliDetectorRecoParam * /*recoParam*/)
075a0e70 36{
57acd2d2 37 // Checks the QA histograms on the input list:
38 //
4e25ac79 39 const char* taskName = AliQAv1::GetAliTaskName(index);
2d9c70ab 40 //printf("\n\tAliZDCQAChecker -> checking QA histos for task %s\n",taskName);
57acd2d2 41 //
c473b43d 42 Int_t ihitHisto=0, idigHisto=0;
43 Int_t irecHisto=0, irawHisto=0, esdInd=0;
44
891ddd89 45 TObjArray messages;
46 messages.SetOwner(kTRUE);
47
f5e4ee59 48 for(Int_t specie = 0; specie<AliRecoParam::kNSpecies; specie++){
a42ceb0e 49 Int_t count = 0;
c473b43d 50 if(!AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)))
51 continue ;
52 //printf("\tAliZDCQAChecker -> specie %d, AliRecoParam::ConvertIndex(specie) %d, AliRecoParam::kLowMult %d, IsEventSpecieSet(specie) %d\n",
53 // specie, AliRecoParam::ConvertIndex(specie) ,AliRecoParam::kLowMult,
54 // AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)));
f5e4ee59 55
57acd2d2 56 // ====================================================================
57 // Checks for p-p events
58 // ====================================================================
c473b43d 59 if(AliRecoParam::ConvertIndex(specie) == AliRecoParam::kLowMult){
57acd2d2 60 if(list[specie]->GetEntries()==0){
213a7d34 61 AliWarning("\t The list to be checked is empty!"); // nothing to check
c473b43d 62 return;
12b9729c 63 }
5379c4a3 64 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
57acd2d2 65 TIter next(list[specie]);
a42ceb0e 66 count = 0;
57acd2d2 67 TH1 * hdata;
c473b43d 68
331464fb 69 Float_t res=0., percentageDiff=0.30;
c473b43d 70 Float_t meanZNA=0., meanZNC=0., meanZPA=0., meanZPC=0.;
71 Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
72 Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
73 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
74 Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
75 Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
76
57acd2d2 77 while((hdata = dynamic_cast<TH1 *>(next()))){
78 if(hdata){
79 // -------------------------------------------------------------------
4e25ac79 80 if(index == AliQAv1::kSIM){
5379c4a3 81 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
57acd2d2 82 // Check HITS histos
213a7d34 83 //
84 if(!(strncmp(hdata->GetName(),"hHits",5))){
57acd2d2 85 if(hdata->GetEntries()>0){
c473b43d 86 if(ihitHisto==0) meanZNC = hdata->GetMean();
87 else if(ihitHisto==1) meanZNA = hdata->GetMean();
88 else if(ihitHisto==2) meanZPC = hdata->GetMean();
89 else if(ihitHisto==3) meanZPA = hdata->GetMean();
213a7d34 90 else if(ihitHisto==4) pmQZNC = hdata->GetMean();
91 else if(ihitHisto==5) pmQZNA = hdata->GetMean();
92 else if(ihitHisto==6) pmQZPC = hdata->GetMean();
93 else if(ihitHisto==7) pmQZPA = hdata->GetMean();
94 else if(ihitHisto==8) pmCZNC = hdata->GetMean();
95 else if(ihitHisto==9) pmCZNA = hdata->GetMean();
96 else if(ihitHisto==10) pmCZPC = hdata->GetMean();
97 else if(ihitHisto==11) pmCZPA = hdata->GetMean();
98 }
99 //
100 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
101 if(ihitHisto==11){
c473b43d 102 if(TMath::Abs(meanZNC)>1.e-10){
213a7d34 103 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
104 res=1.;
105 else
106 res=.5;
107 test[specie] += res;
a42ceb0e 108 count++;
213a7d34 109 }
c473b43d 110 if(TMath::Abs(meanZNA)>1.e-10){
213a7d34 111 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
112 res=1.;
113 else percentageDiff=
114 res=.5;
115 test[specie] += res;
a42ceb0e 116 count++;
213a7d34 117 }
c473b43d 118 if(TMath::Abs(meanZPC)>1.e-10){
213a7d34 119 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
120 res=1.;
121 else
122 res=.5;
123 test[specie] += res;
a42ceb0e 124 count++;
213a7d34 125 }
c473b43d 126 if(TMath::Abs(meanZPA)>1.e-10){
213a7d34 127 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
128 res=1.;
129 else
130 res=.5;
131 test[specie] += res;
a42ceb0e 132 count++;
213a7d34 133 }
134 }
135 ihitHisto++;
fdc38bb2 136 }
213a7d34 137 // Check DIGIT HIGH GAIN CHAIN histos
138 else if(!(strncmp(hdata->GetName(),"hDig",4))){
139 if(hdata->GetEntries()>0){
140 if(idigHisto==0) sumADCZNC = hdata->GetMean();
141 else if(idigHisto==1) sumADCZNA = hdata->GetMean();
142 else if(idigHisto==2) sumADCZPC = hdata->GetMean();
143 else if(idigHisto==3) sumADCZPA = hdata->GetMean();
144 else if(idigHisto==4) pmQZNC = hdata->GetMean();
145 else if(idigHisto==5) pmQZNA = hdata->GetMean();
146 else if(idigHisto==6) pmQZPC = hdata->GetMean();
147 else if(idigHisto==7) pmQZPA = hdata->GetMean();
148 else if(idigHisto==8) pmCZNC = hdata->GetMean();
149 else if(idigHisto==9) pmCZNA = hdata->GetMean();
150 else if(idigHisto==10) pmCZPC = hdata->GetMean();
151 else if(idigHisto==11) pmCZPA = hdata->GetMean();
152 }
153 //
154 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
155 if(idigHisto==11){
c473b43d 156 if(TMath::Abs(sumADCZNC)>1.e-10){
213a7d34 157 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff)
158 res=1.;
159 else
160 res=.5;
161 test[specie] += res;
a42ceb0e 162 count++;
213a7d34 163 }
c473b43d 164 if(TMath::Abs(sumADCZNA)>1.e-10){
213a7d34 165 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff)
166 res=1.;
167 else
168 res=.5;
169 test[specie] += res;
a42ceb0e 170 count++;
213a7d34 171 }
c473b43d 172 if(TMath::Abs(sumADCZPC)>1.e-10){
213a7d34 173 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff)
174 res=1.;
175 else
176 res=.5;
177 test[specie] += res;
a42ceb0e 178 count++;
213a7d34 179 }
c473b43d 180 if(TMath::Abs(sumADCZPA)>1.e-10){
213a7d34 181 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff)
182 res=1.;
183 else
184 res=.5;
185 test[specie] += res;
a42ceb0e 186 count++;
213a7d34 187 }
188 }
189 idigHisto++;
fdc38bb2 190 }
213a7d34 191 }
192 // -------------------------------------------------------------------
193 else if(index == AliQAv1::kRAW) {
213a7d34 194 //
195 // Check RAW HIGH GAIN CHAIN histos
891ddd89 196
197 messages.Clear();
198
199 Bool_t iDetPM = kTRUE;
200 // --- Checks
201 if(irawHisto==22){
202 Float_t resADC=0.;
203 for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
204 if((hdata->GetBinContent(ibin))>10.){
205 res=1.;
206 }
17ffe44a 207 else if((hdata->GetBinContent(ibin))<10.){
891ddd89 208 res=0.5;
17ffe44a 209 if(ibin==1 || ibin==6 || ibin==11 || ibin==12 || ibin==13 || ibin==18){
210 iDetPM = kFALSE;
211 }
891ddd89 212 }
213 //
214 resADC += res;
215 test[specie] += res;
216 count++;
217 }
218 Float_t rv=1.;
219 if(hdata->GetNbinsX() != 0) rv = resADC/hdata->GetNbinsX();
220 if(rv == 1.) messages.Add(new TObjString("ADCs are OK!"));
221 else if(iDetPM==kFALSE){
222 messages.Add(new TObjString("Problem with ADCs!"));
9d397f52 223 messages.Add(new TObjString("IF THIS IS NOT A TECHNICAL"));
224 messages.Add(new TObjString("OR A STANDALONE_PEDESTAL RUN"));
891ddd89 225 }
226 else if(iDetPM==kTRUE) messages.Add(new TObjString("Minor problem with ADCs"));
227 SetupHisto(messages, *hdata, rv);
213a7d34 228 }
891ddd89 229 else if(irawHisto==23){
47b57c27 230 Double_t refTDCs = -319.5;
891ddd89 231 Float_t resTDC=0.;
17ffe44a 232 for(int ibin=5; ibin<=6; ibin++){
233 if(TMath::Abs((hdata->GetBinContent(ibin))-refTDCs)<2.){
891ddd89 234 res=1.;
235 }
17ffe44a 236 else if((TMath::Abs((hdata->GetBinContent(ibin))-refTDCs)>=2.) &&
237 (TMath::Abs((hdata->GetBinContent(ibin))-refTDCs)<=3.)){
238 res=0.9;
239 }
891ddd89 240 else{
241 res=0.5;
242 }
243 //
244 resTDC += res;
245 test[specie] += res;
246 count++;
247 }
248 Float_t rv=1.;
17ffe44a 249 if(hdata->GetNbinsX() != 0) rv = resTDC/2;
891ddd89 250 if(rv == 1.) messages.Add(new TObjString("TDCs are OK!"));
17ffe44a 251 else if(rv<1 && rv>=0.9) messages.Add(new TObjString("Minor problem with TDCs"));
891ddd89 252 else{
253 messages.Add(new TObjString("Serious problem in ZDC timing"));
254 messages.Add(new TObjString("IF THIS IS NOT A TECHNICAL RUN"));
9d397f52 255 messages.Add(new TObjString("OR A STANDALONE_PEDESTAL RUN"));
891ddd89 256 }
257 SetupHisto(messages, *hdata, rv);
258 }
891ddd89 259 irawHisto++;
260
213a7d34 261 }
262 // -------------------------------------------------------------------
f5e4ee59 263 else if(index == AliQAv1::kREC) {
f5e4ee59 264 //
265 // Check REC HIGH GAIN CHAIN histos
266 if(hdata->GetEntries()>0){
c473b43d 267 if(irecHisto==0) meanZNC = hdata->GetMean();
268 else if(irecHisto==1) meanZNA = hdata->GetMean();
269 else if(irecHisto==2) meanZPC = hdata->GetMean();
270 else if(irecHisto==3) meanZPA = hdata->GetMean();
f5e4ee59 271 else if(irecHisto==4) pmQZNC = hdata->GetMean();
272 else if(irecHisto==5) pmQZNA = hdata->GetMean();
273 else if(irecHisto==6) pmQZPC = hdata->GetMean();
274 else if(irecHisto==7) pmQZPA = hdata->GetMean();
275 else if(irecHisto==8) pmCZNC = hdata->GetMean();
276 else if(irecHisto==9) pmCZNA = hdata->GetMean();
277 else if(irecHisto==10) pmCZPC = hdata->GetMean();
278 else if(irecHisto==11) pmCZPA = hdata->GetMean();
279 }
280 //
281 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
282 if(irecHisto==11){
c473b43d 283 if(TMath::Abs(meanZNC)>1.e-10){
f5e4ee59 284 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
285 res=1.;
286 else
287 res=.5;
288 test[specie] += res;
a42ceb0e 289 count++;
f5e4ee59 290 }
c473b43d 291 if(TMath::Abs(meanZNA)>1.e-10){
f5e4ee59 292 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
293 res=1.;
294 else
295 res=.5;
296 test[specie] += res;
a42ceb0e 297 count++;
f5e4ee59 298 }
c473b43d 299 if(TMath::Abs(meanZPC)>1.e-10){
f5e4ee59 300 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
301 res=1.;
302 else
303 res=.5;
304 test[specie] += res;
a42ceb0e 305 count++;
f5e4ee59 306 }
c473b43d 307 if(TMath::Abs(meanZPA)>1.e-10){
f5e4ee59 308 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
309 res=1.;
310 else
311 res=.5;
312 test[specie] += res;
a42ceb0e 313 count++;
f5e4ee59 314 }
315 }
316 irecHisto++;
317 }
318 // -------------------------------------------------------------------
213a7d34 319 else if(index == AliQAv1::kESD) {
213a7d34 320 //
321 // Check ESD HIGH GAIN CHAIN histos
c473b43d 322 if(hdata->GetEntries()>0){
213a7d34 323 if(esdInd==2) sumADCZNC = hdata->GetMean();
324 else if(esdInd==3) sumADCZNA = hdata->GetMean();
325 else if(esdInd==4) sumADCZPC = hdata->GetMean();
326 else if(esdInd==5) sumADCZPA = hdata->GetMean();
c473b43d 327 else if(esdInd==8) pmQZNC = hdata->GetMean();
328 else if(esdInd==9) pmQZNA = hdata->GetMean();
796c8b58 329 else if(esdInd==10) pmQZPC = hdata->GetMean();
330 else if(esdInd==11) pmQZPA = hdata->GetMean();
331 else if(esdInd==12) pmCZNC = hdata->GetMean();
332 else if(esdInd==13) pmCZNA = hdata->GetMean();
333 else if(esdInd==14) pmCZPC = hdata->GetMean();
334 else if(esdInd==15) pmCZPA = hdata->GetMean();
213a7d34 335 }
336 //
337 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
c473b43d 338 if(esdInd==15){
339 if(TMath::Abs(sumADCZNC)>1.e-10){
213a7d34 340 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
341 res=1.;
342 else
343 res=.5;
344 test[specie] += res;
a42ceb0e 345 count++;
213a7d34 346 }
c473b43d 347 if(TMath::Abs(sumADCZNA)>1.e-10){
213a7d34 348 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
349 res=1.;
350 else
351 res=.5;
352 test[specie] += res;
a42ceb0e 353 count++;
213a7d34 354 }
c473b43d 355 if(TMath::Abs(sumADCZPC)>1.e-10){
213a7d34 356 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
357 res=1.;
358 else
359 res=.5;
360 test[specie] += res;
a42ceb0e 361 count++;
213a7d34 362 }
c473b43d 363 if(TMath::Abs(sumADCZPA)>1.e-10){
213a7d34 364 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
365 res=1.;
366 else
367 res=.5;
368 test[specie] += res;
a42ceb0e 369 count++;
213a7d34 370 }
fdc38bb2 371 }
57acd2d2 372 esdInd++;
213a7d34 373 }
374 else {
57acd2d2 375 AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName));
a42ceb0e 376 return ;
57acd2d2 377 }
213a7d34 378 }//if(hdata)
379 else AliError("AliZDCQAChecker-> No histos!!!\n");
075a0e70 380 }
213a7d34 381 } // LowMult (p-p)
57acd2d2 382 // ====================================================================
383 // Checks for A-A events
384 // ====================================================================
c473b43d 385 else if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kHighMult) {
57acd2d2 386 if(list[specie]->GetEntries()==0){
213a7d34 387 AliWarning("\t The list to be checked is empty!");
a42ceb0e 388 return ;
57acd2d2 389 }
5379c4a3 390 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
213a7d34 391 //
57acd2d2 392 TIter next(list[specie]);
a42ceb0e 393 count = 0;
57acd2d2 394 TH1 * hdata;
c473b43d 395
213a7d34 396 Float_t res=0., percentageDiff=0.10;
c473b43d 397 Float_t meanZNA=0., meanZNC=0., meanZPA=0., meanZPC=0.;
398 Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
399 Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
400 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
401 Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
402 Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
403
57acd2d2 404 while((hdata = dynamic_cast<TH1 *>(next()))){
405 if(hdata){
5379c4a3 406 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
57acd2d2 407 // -------------------------------------------------------------------
4e25ac79 408 if(index == AliQAv1::kSIM){
213a7d34 409 // Check HITS histos
410 if (!(strncmp(hdata->GetName(),"hHits",5))){
411 if(hdata->GetEntries()>0){
c473b43d 412 if(ihitHisto==0) meanZNC = hdata->GetMean();
413 else if(ihitHisto==1) meanZNA = hdata->GetMean();
414 else if(ihitHisto==2) meanZPC = hdata->GetMean();
415 else if(ihitHisto==3) meanZPA = hdata->GetMean();
416 else if(ihitHisto==4) pmQZNC = hdata->GetMean();
417 else if(ihitHisto==5) pmQZNA = hdata->GetMean();
418 else if(ihitHisto==6) pmQZPC = hdata->GetMean();
419 else if(ihitHisto==7) pmQZPA = hdata->GetMean();
420 else if(ihitHisto==8) pmCZNC = hdata->GetMean();
421 else if(ihitHisto==9) pmCZNA = hdata->GetMean();
422 else if(ihitHisto==10) pmCZPC = hdata->GetMean();
423 else if(ihitHisto==11) pmCZPA = hdata->GetMean();
213a7d34 424 }
425 //
426 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
427 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
c473b43d 428 if(ihitHisto==3){
429 if(TMath::Abs(meanZNC)>1.e-10 && TMath::Abs(meanZNA)>1.e-10){
213a7d34 430 if((2*TMath::Abs(meanZNC-meanZNA)/(meanZNA+meanZNC))<percentageDiff)
431 res=1.;
432 else
433 res=.5;
434 test[specie] += res;
a42ceb0e 435 count++;
213a7d34 436 }
c473b43d 437 if(TMath::Abs(meanZPC)>1.e-10 && TMath::Abs(meanZPA)>1.e-10){
213a7d34 438 if((TMath::Abs(meanZPC-meanZPA)/(meanZPA+meanZPC))<percentageDiff)
439 res=1.;
440 else
441 res=.5;
442 test[specie] += res;
a42ceb0e 443 count++;
213a7d34 444 }
57acd2d2 445 }
213a7d34 446 // --- Check whether (mean PMQi - PMC)/PMC < percentageDiff
c473b43d 447 if(ihitHisto==11){
448 if(TMath::Abs(meanZNC)>1.e-10){
213a7d34 449 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
57acd2d2 450 res=1.;
451 else
213a7d34 452 res=.5;
57acd2d2 453 test[specie] += res;
a42ceb0e 454 count++;
213a7d34 455 }
c473b43d 456 if(TMath::Abs(meanZNA)>1.e-10){
213a7d34 457 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
57acd2d2 458 res=1.;
459 else
213a7d34 460 res=.5;
57acd2d2 461 test[specie] += res;
a42ceb0e 462 count++;
213a7d34 463 }
c473b43d 464 if(TMath::Abs(meanZPC)>1.e-10){
213a7d34 465 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
57acd2d2 466 res=1.;
467 else
213a7d34 468 res=.5;
57acd2d2 469 test[specie] += res;
a42ceb0e 470 count++;
213a7d34 471 }
c473b43d 472 if(TMath::Abs(meanZPA)>1.e-10){
213a7d34 473 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
57acd2d2 474 res=1.;
475 else
213a7d34 476 res=.5;
57acd2d2 477 test[specie] += res;
a42ceb0e 478 count++;
213a7d34 479 }
480 }
c473b43d 481 ihitHisto++;
fdc38bb2 482 }
213a7d34 483 // Check DIGITS histos
484 else if (!(strncmp(hdata->GetName(),"hDig",4))){
485 if(hdata->GetEntries()>0){
c473b43d 486 if(idigHisto==0) sumADCZNC = hdata->GetMean();
487 else if(idigHisto==1) sumADCZNA = hdata->GetMean();
488 else if(idigHisto==2) sumADCZPC = hdata->GetMean();
489 else if(idigHisto==3) sumADCZPA = hdata->GetMean();
490 else if(idigHisto==4) adcQZNC = hdata->GetMean();
491 else if(idigHisto==5) adcQZNA = hdata->GetMean();
492 else if(idigHisto==6) adcQZPC = hdata->GetMean();
493 else if(idigHisto==7) adcQZPA = hdata->GetMean();
494 else if(idigHisto==8) adcCZNC = hdata->GetMean();
495 else if(idigHisto==9) adcCZNA = hdata->GetMean();
496 else if(idigHisto==10) adcCZPC = hdata->GetMean();
497 else if(idigHisto==11) adcCZPA = hdata->GetMean();
213a7d34 498 }
499 //
500 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
501 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
c473b43d 502 if(idigHisto==3){
503 if(TMath::Abs(sumADCZNC)>1.e-10 && TMath::Abs(sumADCZNA)>1.e-10){
213a7d34 504 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff)
57acd2d2 505 res=1.;
506 else
507 res=.5;
508 test[specie] += res;
a42ceb0e 509 count++;
213a7d34 510 }
c473b43d 511 if(TMath::Abs(sumADCZPC)>1.e-10 && TMath::Abs(sumADCZPA)>1.e-10){
213a7d34 512 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff)
57acd2d2 513 res=1.;
514 else
515 res=.5;
516 test[specie] += res;
a42ceb0e 517 count++;
213a7d34 518 }
57acd2d2 519 }
213a7d34 520 // --- Check whether (sumADC PMQi - PMC)/PMC < percentageDiff
c473b43d 521 if(idigHisto==11){
522 if(TMath::Abs(sumADCZNC)>1.e-10){
213a7d34 523 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff)
57acd2d2 524 res=1.;
525 else
213a7d34 526 res=.5;
57acd2d2 527 test[specie] += res;
a42ceb0e 528 count++;
213a7d34 529 }
c473b43d 530 if(TMath::Abs(sumADCZNA)>1.e-10){
213a7d34 531 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff)
57acd2d2 532 res=1.;
533 else
213a7d34 534 res=.5;
57acd2d2 535 test[specie] += res;
a42ceb0e 536 count++;
213a7d34 537 }
c473b43d 538 if(TMath::Abs(sumADCZPC)>1.e-10){
213a7d34 539 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff)
57acd2d2 540 res=1.;
541 else
213a7d34 542 res=.5;
57acd2d2 543 test[specie] += res;
a42ceb0e 544 count++;
213a7d34 545 }
c473b43d 546 if(TMath::Abs(sumADCZPA)>1.e-10){
213a7d34 547 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff)
57acd2d2 548 res=1.;
549 else
213a7d34 550 res=.5;
57acd2d2 551 test[specie] += res;
a42ceb0e 552 count++;
213a7d34 553 }
554 }
c473b43d 555 idigHisto++;
fdc38bb2 556 }
557 }
213a7d34 558 // -------------------------------------------------------------------
559 else if(index == AliQAv1::kRAW){
213a7d34 560 //
561 // Check RAW HIGH GAIN CHAIN histos
891ddd89 562
563 messages.Clear();
564
565 Bool_t iDetPM = kTRUE;
566 // --- Checks
567 if(irawHisto==22){
568 Float_t resADC=0.;
569 for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
570 if((hdata->GetBinContent(ibin))>10.){
571 res=1.;
572 }
573 else if((hdata->GetBinContent(ibin))<10. &&
574 (ibin==1 || ibin==6 || ibin==11 || ibin==12 || ibin==13 || ibin==18)){
575 res=0.5;
576 iDetPM = kFALSE;
577 }
578 //
579 resADC += res;
580 test[specie] += res;
581 count++;
582 }
583 Float_t rv=1.;
584 if(hdata->GetNbinsX() != 0) rv = resADC/hdata->GetNbinsX();
585 if(rv == 1.) messages.Add(new TObjString("ADCs are OK!"));
586 else if(iDetPM==kFALSE){
587 messages.Add(new TObjString("Problem with ADCs!"));
588 messages.Add(new TObjString("IF THIS IS NOT A TECHNICAL RUN"));
589 }
590 else if(iDetPM==kTRUE) messages.Add(new TObjString("Minor problem with ADCs"));
591 SetupHisto(messages, *hdata, rv);
213a7d34 592 }
891ddd89 593 else if(irawHisto==23){
594 Double_t refTDCs[6] = {-83.0,-78.1,-80.2,-79.3,-81.0,-80.9};
595 Float_t resTDC=0.;
596 for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
597 if(TMath::Abs((hdata->GetBinContent(ibin))-refTDCs[ibin-1])<4.){
598 res=1.;
599 }
600 else{
601 res=0.5;
602 }
603 //
604 resTDC += res;
605 test[specie] += res;
606 count++;
607 }
608 Float_t rv=1.;
609 if(hdata->GetNbinsX() != 0) rv = resTDC/hdata->GetNbinsX();
610 if(rv == 1.) messages.Add(new TObjString("TDCs are OK!"));
611 else if(rv<1 && rv>0.9) messages.Add(new TObjString("Minor problem with TDCs"));
612 else{
613 messages.Add(new TObjString("Serious problem in ZDC timing"));
614 messages.Add(new TObjString("IF THIS IS NOT A TECHNICAL RUN"));
615 }
616 SetupHisto(messages, *hdata, rv);
617 }
618 else if(irawHisto==26){
619 Double_t yZNC=hdata->GetBinContent(2);
620 Double_t yZNA=hdata->GetBinContent(4);
621 if(TMath::Abs(yZNC)<0.4 && TMath::Abs(yZNA)<0.4) res=1.;
622 else res=0.5;
623 test[specie] += res;
624 count++;
625 //
626 printf(" yZNC = %1.2f yZNA = %1.2f -> res %1.2f\n",yZNC, yZNA,res);
627 if(res == 1.) messages.Add(new TObjString("ZN positions are OK!"));
628 else{
629 messages.Add(new TObjString("Problem in ZN positions!"));
630 messages.Add(new TObjString("IF THIS IS NOT A TECHNICAL RUN"));
213a7d34 631 }
891ddd89 632 SetupHisto(messages, *hdata, res);
213a7d34 633 }
891ddd89 634 irawHisto++;
635
213a7d34 636 }
637 // -------------------------------------------------------------------
f5e4ee59 638 else if(index == AliQAv1::kREC){
f5e4ee59 639 //
640 // Check RAW HIGH GAIN CHAIN histos
641 if(hdata->GetEntries()>0){
c473b43d 642 if(irecHisto==0) meanZNC = hdata->GetMean();
643 else if(irecHisto==1) meanZNA = hdata->GetMean();
644 else if(irecHisto==2) meanZPC = hdata->GetMean();
645 else if(irecHisto==3) meanZPA = hdata->GetMean();
646 else if(irecHisto==4) pmQZNC = hdata->GetMean();
647 else if(irecHisto==5) pmQZNA = hdata->GetMean();
648 else if(irecHisto==6) pmQZPC = hdata->GetMean();
649 else if(irecHisto==7) pmQZPA = hdata->GetMean();
650 else if(irecHisto==8) pmCZNC = hdata->GetMean();
651 else if(irecHisto==9) pmCZNA = hdata->GetMean();
652 else if(irecHisto==10) pmCZPC = hdata->GetMean();
653 else if(irecHisto==11) pmCZPA = hdata->GetMean();
f5e4ee59 654 }
655 //
656 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
657 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
c473b43d 658 if(irecHisto==3){
659 if(TMath::Abs(meanZNC)>1.e-10 && TMath::Abs(meanZNA)>1.e-10){
660 if((2*TMath::Abs(meanZNC-meanZNA)/(meanZNA+meanZNC))<percentageDiff)
f5e4ee59 661 res=1.;
662 else
663 res=.5;
664 test[specie] += res;
a42ceb0e 665 count++;
f5e4ee59 666 }
c473b43d 667 if(TMath::Abs(meanZPC)>1.e-10 && TMath::Abs(meanZPA)>1.e-10){
668 if((TMath::Abs(meanZPC-meanZPA)/(meanZPA+meanZPC))<percentageDiff)
f5e4ee59 669 res=1.;
670 else
671 res=.5;
672 test[specie] += res;
a42ceb0e 673 count++;
f5e4ee59 674 }
675 }
676 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
c473b43d 677 if(irecHisto==11){
9e05925b 678 if((TMath::Abs(meanZNC)>1.e-10) && (pmCZNC>1.e-10)){
f5e4ee59 679 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
680 res=1.;
681 else
682 res=.5;
683 test[specie] += res;
a42ceb0e 684 count++;
f5e4ee59 685 }
9e05925b 686 if((TMath::Abs(meanZNA)>1.e-10) && (pmCZNA>1.e-10)){
f5e4ee59 687 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
688 res=1.;
689 else
690 res=.5;
691 test[specie] += res;
a42ceb0e 692 count++;
f5e4ee59 693 }
9e05925b 694 if((TMath::Abs(meanZPC)>1.e-10) && (pmCZPC>1.e-10)){
f5e4ee59 695 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
696 res=1.;
697 else
698 res=.5;
699 test[specie] += res;
a42ceb0e 700 count++;
f5e4ee59 701 }
9e05925b 702 if((TMath::Abs(meanZPA)>1.e-10) && (pmCZPA>1.e-10)){
f5e4ee59 703 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
704 res=1.;
705 else
706 res=.5;
707 test[specie] += res;
a42ceb0e 708 count++;
f5e4ee59 709 }
710 }
c473b43d 711 irecHisto++;
f5e4ee59 712 }
713 // -------------------------------------------------------------------
213a7d34 714 else if(index == AliQAv1::kESD){
213a7d34 715 //
716 // Check ESD HIGH GAIN CHAIN histos
c473b43d 717 if(hdata->GetEntries()>0){
213a7d34 718 if(esdInd==2) sumADCZNC = hdata->GetMean();
719 else if(esdInd==3) sumADCZNA = hdata->GetMean();
720 else if(esdInd==4) sumADCZPC = hdata->GetMean();
721 else if(esdInd==5) sumADCZPA = hdata->GetMean();
c473b43d 722 else if(esdInd==8) pmQZNC = hdata->GetMean();
723 else if(esdInd==9) pmQZNA = hdata->GetMean();
724 else if(esdInd==10) pmQZPC = hdata->GetMean();
725 else if(esdInd==11) pmQZPA = hdata->GetMean();
726 else if(esdInd==12) pmCZNC = hdata->GetMean();
727 else if(esdInd==13) pmCZNA = hdata->GetMean();
728 else if(esdInd==14) pmCZPC = hdata->GetMean();
729 else if(esdInd==15) pmCZPA = hdata->GetMean();
213a7d34 730 }
731 //
732 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
733 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
734 if(esdInd==5){
c473b43d 735 if(TMath::Abs(sumADCZNC)>1.e-10 && TMath::Abs(sumADCZNA)>1.e-10){
213a7d34 736 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff)
737 res=1.;
738 else
739 res=.5;
740 test[specie] += res;
a42ceb0e 741 count++;
213a7d34 742 }
c473b43d 743 if(TMath::Abs(sumADCZPC)>1.e-10 && TMath::Abs(sumADCZPA)>1.e-10){
213a7d34 744 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff)
745 res=1.;
746 else
747 res=.5;
748 test[specie] += res;
a42ceb0e 749 count++;
213a7d34 750 }
751 }
752 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
c473b43d 753 if(esdInd==15){
754 if(TMath::Abs(sumADCZNC)>1.e-10){
213a7d34 755 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
756 res=1.;
757 else
758 res=.5;
759 test[specie] += res;
a42ceb0e 760 count++;
213a7d34 761 }
c473b43d 762 if(TMath::Abs(sumADCZNA)>1.e-10){
213a7d34 763 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
764 res=1.;
765 else
766 res=.5;
767 test[specie] += res;
a42ceb0e 768 count++;
213a7d34 769 }
32e2fda5 770/* if(TMath::Abs(sumADCZPC)>1.e-10){
213a7d34 771 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
772 res=1.;
773 else
774 res=.5;
775 test[specie] += res;
a42ceb0e 776 count++;
213a7d34 777 }
c473b43d 778 if(TMath::Abs(sumADCZPA)>1.e-10){
213a7d34 779 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
780 res=1.;
781 else
782 res=.5;
783 test[specie] += res;
a42ceb0e 784 count++;
213a7d34 785 }
32e2fda5 786*/
213a7d34 787 }
788 esdInd++;
789 }
790 else {
791 AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName));
a42ceb0e 792 return ;
213a7d34 793 }
794 }//if(hdata)
795 else AliError("\t No histos found for ZDC!!!\n");
796 }
797 } // HighMult (Pb-Pb)
f5e4ee59 798 // ====================================================================
799 // Checks for Calibration events
800 // ====================================================================
c473b43d 801 else if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCalib) {
f5e4ee59 802 AliWarning(Form("\n\t No check implemented in ZDC QA for %s task\n",taskName));
a42ceb0e 803 return ;
f5e4ee59 804 } // Calibration
805 // ====================================================================
806 // Checks for cosmic events
807 // ====================================================================
c473b43d 808 else if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCosmic) {
f5e4ee59 809 AliWarning(Form("\n\t No check implemented in ZDC QA for %s task\n",taskName));
a42ceb0e 810 return ;
f5e4ee59 811 } // Cosmic
c473b43d 812 if(TMath::Abs(count)>1.e-10) test[specie] = test[specie]/count;
213a7d34 813 AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\t ZDC QA check result = %1.2f\n",test[specie]));
a42ceb0e 814 } // Loop on species
075a0e70 815}
891ddd89 816
817//___________________________________________________________________
818void AliZDCQAChecker::SetupHisto(const TObjArray& messages, TH1& histo, Float_t& code)
819{
820 //
821 /// Add text to histos
822 //
823
9d397f52 824 TPaveText* text = new TPaveText(0.70,0.70,0.99,0.99,"NDC");
891ddd89 825
826 TIter next(&messages);
827 TObjString* str;
828
829 while ( ( str = static_cast<TObjString*>(next()) ) ){
830 text->AddText(str->String());
831 }
832
833 TString defaultText = "";
834
835 Int_t color = 0;
836 if(code==1.){
837 color = kGreen;
838 defaultText = "Everything is fine!";
839 }
840 else if(code<1. && code>=0.9){
841 color = kYellow;
842 defaultText = "To be monitored in next runs";
843 }
844 else if(code<0.9 && code>=0.6){
845 color = kOrange;
846 defaultText = "notify the expert DURING THE DAY!";
847 }
9d397f52 848 else if(code<0.6){
891ddd89 849 color = kRed;
850 defaultText = "CALL THE EXPERT!!!!";
851 }
852
853
854 text->AddText(defaultText.Data());
855 text->SetFillColor(color);
856
857 //histo.SetFillStyle(1001);
858 //histo.SetFillColor(color);
859
860 histo.SetStats(kFALSE);
861
862 histo.GetListOfFunctions()->Add(text);
863}