1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // --- ROOT system ---
19 #include <TIterator.h>
22 // --- Standard library ---
24 // --- AliRoot header files ---
26 #include "AliZDCQAChecker.h"
28 ClassImp(AliZDCQAChecker)
30 //____________________________________________________________________________
31 Double_t * AliZDCQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list)
33 // Checks the QA histograms on the input list:
35 Double_t * test = new Double_t[AliRecoParam::kNSpecies] ;
36 Int_t * ntests = new Int_t[AliRecoParam::kNSpecies] ;
37 const char* taskName = AliQAv1::GetAliTaskName(index);
39 for(Int_t specie = 0; specie < AliRecoParam::kNSpecies; specie++) {
42 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
43 // ====================================================================
44 // Checks for p-p events
45 // ====================================================================
46 if (specie == AliRecoParam::kLowMult) {
47 if(list[specie]->GetEntries()==0){
48 AliWarning("\t The list to be checked is empty!"); // nothing to check
51 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
52 TIter next(list[specie]);
55 Float_t res=0., percentageDiff=0.15;
56 while((hdata = dynamic_cast<TH1 *>(next()))){
58 // -------------------------------------------------------------------
59 if(index == AliQAv1::kSIM){
60 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
62 Float_t sumZNA=0., sumZNC=0., sumZPA=0., sumZPC=0.;
63 Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
64 Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
65 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
66 Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
67 Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
68 Int_t ihitHisto=0, idigHisto=0;
70 if(!(strncmp(hdata->GetName(),"hHits",5))){
71 if(hdata->GetEntries()>0){
72 if(ihitHisto==0) sumZNC = hdata->GetMean();
73 else if(ihitHisto==1) sumZNA = hdata->GetMean();
74 else if(ihitHisto==2) sumZPC = hdata->GetMean();
75 else if(ihitHisto==3) sumZPA = hdata->GetMean();
76 else if(ihitHisto==4) pmQZNC = hdata->GetMean();
77 else if(ihitHisto==5) pmQZNA = hdata->GetMean();
78 else if(ihitHisto==6) pmQZPC = hdata->GetMean();
79 else if(ihitHisto==7) pmQZPA = hdata->GetMean();
80 else if(ihitHisto==8) pmCZNC = hdata->GetMean();
81 else if(ihitHisto==9) pmCZNA = hdata->GetMean();
82 else if(ihitHisto==10) pmCZPC = hdata->GetMean();
83 else if(ihitHisto==11) pmCZPA = hdata->GetMean();
86 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
89 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
97 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
105 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
113 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
123 // Check DIGIT HIGH GAIN CHAIN histos
124 else if(!(strncmp(hdata->GetName(),"hDig",4))){
125 if(hdata->GetEntries()>0){
126 if(idigHisto==0) sumADCZNC = hdata->GetMean();
127 else if(idigHisto==1) sumADCZNA = hdata->GetMean();
128 else if(idigHisto==2) sumADCZPC = hdata->GetMean();
129 else if(idigHisto==3) sumADCZPA = hdata->GetMean();
130 else if(idigHisto==4) pmQZNC = hdata->GetMean();
131 else if(idigHisto==5) pmQZNA = hdata->GetMean();
132 else if(idigHisto==6) pmQZPC = hdata->GetMean();
133 else if(idigHisto==7) pmQZPA = hdata->GetMean();
134 else if(idigHisto==8) pmCZNC = hdata->GetMean();
135 else if(idigHisto==9) pmCZNA = hdata->GetMean();
136 else if(idigHisto==10) pmCZPC = hdata->GetMean();
137 else if(idigHisto==11) pmCZPA = hdata->GetMean();
140 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
143 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff)
151 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff)
159 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff)
167 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff)
178 // -------------------------------------------------------------------
179 else if(index == AliQAv1::kRAW) {
180 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
181 Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
182 Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
185 // Check RAW HIGH GAIN CHAIN histos
186 if(hdata->GetEntries()>0){
187 if(irawHisto==0) sumADCZNC = hdata->GetMean();
188 else if(irawHisto==1) sumADCZNA = hdata->GetMean();
189 else if(irawHisto==2) sumADCZPC = hdata->GetMean();
190 else if(irawHisto==3) sumADCZPA = hdata->GetMean();
191 else if(irawHisto==4) adcQZNC = hdata->GetMean();
192 else if(irawHisto==5) adcQZNA = hdata->GetMean();
193 else if(irawHisto==6) adcQZPC = hdata->GetMean();
194 else if(irawHisto==7) adcQZPA = hdata->GetMean();
195 else if(irawHisto==8) adcCZNC = hdata->GetMean();
196 else if(irawHisto==9) adcCZNA = hdata->GetMean();
197 else if(irawHisto==10) adcCZPC = hdata->GetMean();
198 else if(irawHisto==11) adcCZPA = hdata->GetMean();
201 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
204 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff)
212 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff)
220 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff)
228 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff)
238 // -------------------------------------------------------------------
239 else if(index == AliQAv1::kESD) {
240 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
241 Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
242 Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
245 // Check ESD HIGH GAIN CHAIN histos
246 if(hdata->GetEntries()!=0){
247 if(esdInd==2) sumADCZNC = hdata->GetMean();
248 else if(esdInd==3) sumADCZNA = hdata->GetMean();
249 else if(esdInd==4) sumADCZPC = hdata->GetMean();
250 else if(esdInd==5) sumADCZPA = hdata->GetMean();
251 else if(esdInd==6) pmQZNC = hdata->GetMean();
252 else if(esdInd==7) pmQZNA = hdata->GetMean();
253 else if(esdInd==8) pmQZPC = hdata->GetMean();
254 else if(esdInd==9) pmQZPA = hdata->GetMean();
255 else if(esdInd==10) pmCZNC = hdata->GetMean();
256 else if(esdInd==11) pmCZNA = hdata->GetMean();
257 else if(esdInd==12) pmCZPC = hdata->GetMean();
258 else if(esdInd==13) pmCZPA = hdata->GetMean();
261 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
264 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
272 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
280 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
288 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
299 AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName));
303 else AliError("AliZDCQAChecker-> No histos!!!\n");
306 // ====================================================================
307 // Checks for A-A events
308 // ====================================================================
309 else if (specie == AliRecoParam::kHighMult) {
310 if(list[specie]->GetEntries()==0){
311 AliWarning("\t The list to be checked is empty!");
314 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
316 TIter next(list[specie]);
319 Float_t res=0., percentageDiff=0.10;
320 while((hdata = dynamic_cast<TH1 *>(next()))){
322 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
323 // -------------------------------------------------------------------
324 if(index == AliQAv1::kSIM){
325 Float_t meanZNA=0., meanZNC=0., meanZPA=0., meanZPC=0.;
326 Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
327 Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
328 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
329 Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
330 Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
331 Int_t hitInd=0, digInd=0;
333 if (!(strncmp(hdata->GetName(),"hHits",5))){
334 if(hdata->GetEntries()>0){
335 if(hitInd==0) meanZNC = hdata->GetMean();
336 else if(hitInd==1) meanZNA = hdata->GetMean();
337 else if(hitInd==2) meanZPC = hdata->GetMean();
338 else if(hitInd==3) meanZPA = hdata->GetMean();
339 else if(hitInd==4) pmQZNC = hdata->GetMean();
340 else if(hitInd==5) pmQZNA = hdata->GetMean();
341 else if(hitInd==6) pmQZPC = hdata->GetMean();
342 else if(hitInd==7) pmQZPA = hdata->GetMean();
343 else if(hitInd==8) pmCZNC = hdata->GetMean();
344 else if(hitInd==9) pmCZNA = hdata->GetMean();
345 else if(hitInd==10) pmCZPC = hdata->GetMean();
346 else if(hitInd==11) pmCZPA = hdata->GetMean();
349 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
350 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
352 if(meanZNC!=0 && meanZNA!=0){
353 if((2*TMath::Abs(meanZNC-meanZNA)/(meanZNA+meanZNC))<percentageDiff)
360 if(meanZPC!=0 && meanZPA!=0){
361 if((TMath::Abs(meanZPC-meanZPA)/(meanZPA+meanZPC))<percentageDiff)
369 // --- Check whether (mean PMQi - PMC)/PMC < percentageDiff
372 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
380 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
388 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
396 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
406 // Check DIGITS histos
407 else if (!(strncmp(hdata->GetName(),"hDig",4))){
408 if(hdata->GetEntries()>0){
409 if(digInd==0) sumADCZNC = hdata->GetMean();
410 else if(digInd==1) sumADCZNA = hdata->GetMean();
411 else if(digInd==2) sumADCZPC = hdata->GetMean();
412 else if(digInd==3) sumADCZPA = hdata->GetMean();
413 else if(digInd==4) adcQZNC = hdata->GetMean();
414 else if(digInd==5) adcQZNA = hdata->GetMean();
415 else if(digInd==6) adcQZPC = hdata->GetMean();
416 else if(digInd==7) adcQZPA = hdata->GetMean();
417 else if(digInd==8) adcCZNC = hdata->GetMean();
418 else if(digInd==9) adcCZNA = hdata->GetMean();
419 else if(digInd==10) adcCZPC = hdata->GetMean();
420 else if(digInd==11) adcCZPA = hdata->GetMean();
423 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
424 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
426 if(sumADCZNC!=0 && sumADCZNA!=0){
427 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff)
434 if(sumADCZPC!=0 && sumADCZPA!=0){
435 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff)
443 // --- Check whether (sumADC PMQi - PMC)/PMC < percentageDiff
446 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff)
454 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff)
462 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff)
470 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff)
481 // -------------------------------------------------------------------
482 else if(index == AliQAv1::kRAW){
483 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
484 Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
485 Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
488 // Check RAW HIGH GAIN CHAIN histos
489 if(hdata->GetEntries()>0){
490 if(rawInd==0) sumADCZNC = hdata->GetMean();
491 else if(rawInd==1) sumADCZNA = hdata->GetMean();
492 else if(rawInd==2) sumADCZPC = hdata->GetMean();
493 else if(rawInd==3) sumADCZPA = hdata->GetMean();
494 else if(rawInd==4) adcQZNC = hdata->GetMean();
495 else if(rawInd==5) adcQZNA = hdata->GetMean();
496 else if(rawInd==6) adcQZPC = hdata->GetMean();
497 else if(rawInd==7) adcQZPA = hdata->GetMean();
498 else if(rawInd==8) adcCZNC = hdata->GetMean();
499 else if(rawInd==9) adcCZNA = hdata->GetMean();
500 else if(rawInd==10) adcCZPC = hdata->GetMean();
501 else if(rawInd==11) adcCZPA = hdata->GetMean();
504 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
505 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
507 if(sumADCZNC!=0 && sumADCZNA!=0){
508 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff)
515 if(sumADCZPC!=0 && sumADCZPA!=0){
516 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff)
524 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
527 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff)
535 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff)
543 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff)
551 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff)
561 // -------------------------------------------------------------------
562 else if(index == AliQAv1::kESD){
563 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
564 Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
565 Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
568 // Check ESD HIGH GAIN CHAIN histos
569 if(hdata->GetEntries()!=0){
570 if(esdInd==2) sumADCZNC = hdata->GetMean();
571 else if(esdInd==3) sumADCZNA = hdata->GetMean();
572 else if(esdInd==4) sumADCZPC = hdata->GetMean();
573 else if(esdInd==5) sumADCZPA = hdata->GetMean();
574 else if(esdInd==6) pmQZNC = hdata->GetMean();
575 else if(esdInd==7) pmQZNA = hdata->GetMean();
576 else if(esdInd==8) pmQZPC = hdata->GetMean();
577 else if(esdInd==9) pmQZPA = hdata->GetMean();
578 else if(esdInd==10) pmCZNC = hdata->GetMean();
579 else if(esdInd==11) pmCZNA = hdata->GetMean();
580 else if(esdInd==12) pmCZPC = hdata->GetMean();
581 else if(esdInd==13) pmCZPA = hdata->GetMean();
584 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
585 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
587 if(sumADCZNC!=0 && sumADCZNA!=0){
588 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff)
595 if(sumADCZPC!=0 && sumADCZPA!=0){
596 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff)
604 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
607 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
615 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
623 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
631 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
642 AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName));
646 else AliError("\t No histos found for ZDC!!!\n");
648 } // HighMult (Pb-Pb)
650 AliError(Form("Checking not implemented for %s, %s",
651 AliRecoParam::GetEventSpecieName(AliRecoParam::kCosmic),
652 AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ;
656 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
657 if(ntests[specie]!=0) test[specie] = test[specie]/ntests[specie];
658 AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\t ZDC QA check result = %1.2f\n",test[specie]));