]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCQAChecker.cxx
Removed cout statement that was accidentally added
[u/mrichter/AliRoot.git] / ZDC / AliZDCQAChecker.cxx
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 ---
18 #include <TH1F.h> 
19 #include <TIterator.h> 
20 #include <TString.h> 
21
22 // --- Standard library ---
23
24 // --- AliRoot header files ---
25 #include "AliLog.h"
26 #include "AliZDCQAChecker.h"
27
28 ClassImp(AliZDCQAChecker)
29
30 //____________________________________________________________________________
31 void AliZDCQAChecker::Check(Double_t *  test, AliQAv1::ALITASK_t index, TObjArray ** list,
32       const AliDetectorRecoParam * /*recoParam*/) 
33 {
34   // Checks the QA histograms on the input list: 
35   //
36   const char* taskName = AliQAv1::GetAliTaskName(index);
37   printf("\n\tAliZDCQAChecker -> checking QA histos for task %s\n",taskName);
38   //
39   for(Int_t specie = 0; specie<AliRecoParam::kNSpecies; specie++){
40     Int_t count = 0; 
41     //printf("\tAliZDCQAChecker -> specie %d\n\n",specie);
42     
43     if(!AliQAv1::Instance()->IsEventSpecieSet(specie))  continue; 
44     // ====================================================================
45     //  Checks for p-p events
46     // ====================================================================
47     if(specie == AliRecoParam::kLowMult){
48       if(list[specie]->GetEntries()==0){  
49         AliWarning("\t The list to be checked is empty!"); // nothing to check
50         return ;
51       }
52       //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
53       TIter next(list[specie]); 
54       count = 0; 
55       TH1 * hdata;        
56       Float_t res=0., percentageDiff=0.15;
57       while((hdata = dynamic_cast<TH1 *>(next()))){
58         if(hdata){ 
59           // -------------------------------------------------------------------
60           if(index == AliQAv1::kSIM){
61             //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
62             // Check HITS histos
63             Float_t sumZNA=0., sumZNC=0., sumZPA=0., sumZPC=0.;
64             Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
65             Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
66             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
67             Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
68             Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
69             Int_t ihitHisto=0, idigHisto=0;
70             //
71             if(!(strncmp(hdata->GetName(),"hHits",5))){
72               if(hdata->GetEntries()>0){
73                 if(ihitHisto==0)      sumZNC = hdata->GetMean();
74                 else if(ihitHisto==1) sumZNA = hdata->GetMean();
75                 else if(ihitHisto==2) sumZPC = hdata->GetMean();
76                 else if(ihitHisto==3) sumZPA = hdata->GetMean();
77                 else if(ihitHisto==4) pmQZNC = hdata->GetMean();
78                 else if(ihitHisto==5) pmQZNA = hdata->GetMean();
79                 else if(ihitHisto==6) pmQZPC = hdata->GetMean();
80                 else if(ihitHisto==7) pmQZPA = hdata->GetMean();
81                 else if(ihitHisto==8)  pmCZNC = hdata->GetMean();
82                 else if(ihitHisto==9)  pmCZNA = hdata->GetMean();
83                 else if(ihitHisto==10) pmCZPC = hdata->GetMean();
84                 else if(ihitHisto==11) pmCZPA = hdata->GetMean();
85               }
86               //
87               // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
88               if(ihitHisto==11){
89                 if(sumZNC!=0){
90                   if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
91                     res=1.;
92                   else 
93                     res=.5;
94                   test[specie] += res;
95                   count++;
96                 }
97                 if(sumZNA!=0){
98                   if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
99                     res=1.;
100                   else percentageDiff=
101                     res=.5;
102                   test[specie] += res;
103                   count++;
104                 }
105                 if(sumZPC!=0){
106                   if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
107                     res=1.;
108                   else 
109                     res=.5;
110                   test[specie] += res;
111                   count++;
112                 }
113                 if(sumZPA!=0){
114                   if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
115                     res=1.;
116                   else 
117                     res=.5;
118                   test[specie] += res;
119                   count++;
120                 }
121               }
122               ihitHisto++;
123             }
124             // Check DIGIT HIGH GAIN CHAIN histos
125             else if(!(strncmp(hdata->GetName(),"hDig",4))){ 
126               if(hdata->GetEntries()>0){
127                 if(idigHisto==0)      sumADCZNC = hdata->GetMean();
128                 else if(idigHisto==1) sumADCZNA = hdata->GetMean();
129                 else if(idigHisto==2) sumADCZPC = hdata->GetMean();
130                 else if(idigHisto==3) sumADCZPA = hdata->GetMean();
131                 else if(idigHisto==4) pmQZNC = hdata->GetMean();
132                 else if(idigHisto==5) pmQZNA = hdata->GetMean();
133                 else if(idigHisto==6) pmQZPC = hdata->GetMean();
134                 else if(idigHisto==7) pmQZPA = hdata->GetMean();
135                 else if(idigHisto==8)  pmCZNC = hdata->GetMean();
136                 else if(idigHisto==9)  pmCZNA = hdata->GetMean();
137                 else if(idigHisto==10) pmCZPC = hdata->GetMean();
138                 else if(idigHisto==11) pmCZPA = hdata->GetMean();
139               }
140               //
141               // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
142               if(idigHisto==11){
143                 if(sumADCZNC!=0){
144                   if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
145                     res=1.;
146                   else 
147                     res=.5;
148                   test[specie] += res;
149                   count++;
150                 }
151                 if(sumADCZNA!=0){
152                   if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
153                     res=1.;
154                   else 
155                     res=.5;
156                   test[specie] += res;
157                   count++;
158                 }
159                 if(sumADCZPC!=0){
160                   if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
161                     res=1.;
162                   else 
163                     res=.5;
164                   test[specie] += res;
165                   count++;
166                 }
167                 if(sumADCZPA!=0){
168                   if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
169                     res=1.;
170                   else 
171                     res=.5;
172                   test[specie] += res;
173                   count++;
174                 }
175               }
176               idigHisto++;            
177             }
178           } 
179           // -------------------------------------------------------------------
180           else if(index == AliQAv1::kRAW) {
181             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
182             Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
183             Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
184             Int_t irawHisto=0;
185             //
186             // Check RAW HIGH GAIN CHAIN histos
187             if(hdata->GetEntries()>0){
188               if(irawHisto==0)      sumADCZNC = hdata->GetMean();
189               else if(irawHisto==1) sumADCZNA = hdata->GetMean();
190               else if(irawHisto==2) sumADCZPC = hdata->GetMean();
191               else if(irawHisto==3) sumADCZPA = hdata->GetMean();
192               else if(irawHisto==6) adcQZNC = hdata->GetMean();
193               else if(irawHisto==7) adcQZNA = hdata->GetMean();
194               else if(irawHisto==8) adcQZPC = hdata->GetMean();
195               else if(irawHisto==9) adcQZPA = hdata->GetMean();
196               else if(irawHisto==10) adcCZNC = hdata->GetMean();
197               else if(irawHisto==11) adcCZNA = hdata->GetMean();
198               else if(irawHisto==12) adcCZPC = hdata->GetMean();
199               else if(irawHisto==13) adcCZPA = hdata->GetMean();
200             }
201             //
202             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
203             if(irawHisto==11){
204               if(sumADCZNC!=0){
205                 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
206                   res=1.;
207                 else 
208                   res=.5;
209                 test[specie] += res;
210                 count++;
211               }
212               if(sumADCZNA!=0){
213                 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
214                   res=1.;
215                 else 
216                   res=.5;
217                 test[specie] += res;
218                 count++;
219               }
220               if(sumADCZPC!=0){
221                 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
222                   res=1.;
223                 else 
224                   res=.5;
225                 test[specie] += res;
226                 count++;
227               }
228               if(sumADCZPA!=0){
229                 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
230                   res=1.;
231                 else 
232                   res=.5;
233                 test[specie] += res;
234                 count++;
235               }
236             }
237             irawHisto++;            
238           } 
239           // -------------------------------------------------------------------
240           else if(index == AliQAv1::kREC) {
241             Float_t sumZNA=0., sumZNC=0., sumZPA=0., sumZPC=0.;
242             Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
243             Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
244             Int_t irecHisto=0;
245             //
246             // Check REC HIGH GAIN CHAIN histos
247             if(hdata->GetEntries()>0){
248               if(irecHisto==0)       sumZNC = hdata->GetMean();
249               else if(irecHisto==1)  sumZNA = hdata->GetMean();
250               else if(irecHisto==2)  sumZPC = hdata->GetMean();
251               else if(irecHisto==3)  sumZPA = hdata->GetMean();
252               else if(irecHisto==4)  pmQZNC = hdata->GetMean();
253               else if(irecHisto==5)  pmQZNA = hdata->GetMean();
254               else if(irecHisto==6)  pmQZPC = hdata->GetMean();
255               else if(irecHisto==7)  pmQZPA = hdata->GetMean();
256               else if(irecHisto==8)  pmCZNC = hdata->GetMean();
257               else if(irecHisto==9)  pmCZNA = hdata->GetMean();
258               else if(irecHisto==10) pmCZPC = hdata->GetMean();
259               else if(irecHisto==11) pmCZPA = hdata->GetMean();
260             }
261             //
262             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
263             if(irecHisto==11){
264               if(sumZNC!=0){
265                 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
266                   res=1.;
267                 else 
268                   res=.5;
269                 test[specie] += res;
270                 count++;
271               }
272               if(sumZNA!=0){
273                 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
274                   res=1.;
275                 else 
276                   res=.5;
277                 test[specie] += res;
278                 count++;
279               }
280               if(sumZPC!=0){
281                 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
282                   res=1.;
283                 else 
284                   res=.5;
285                 test[specie] += res;
286                 count++;
287               }
288               if(sumZPA!=0){
289                 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
290                   res=1.;
291                 else 
292                   res=.5;
293                 test[specie] += res;
294                 count++;
295               }
296             }
297             irecHisto++;            
298           } 
299           // -------------------------------------------------------------------
300           else if(index == AliQAv1::kESD) {
301             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
302             Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
303             Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
304             Int_t esdInd=0;
305             //
306             // Check ESD HIGH GAIN CHAIN histos
307             if(hdata->GetEntries()!=0){
308               if(esdInd==2)      sumADCZNC = hdata->GetMean();
309               else if(esdInd==3) sumADCZNA = hdata->GetMean();
310               else if(esdInd==4) sumADCZPC = hdata->GetMean();
311               else if(esdInd==5) sumADCZPA = hdata->GetMean();
312               else if(esdInd==8) pmQZNC = hdata->GetMean();
313               else if(esdInd==9) pmQZNA = hdata->GetMean();
314               else if(esdInd==10) pmQZPC = hdata->GetMean();
315               else if(esdInd==11) pmQZPA = hdata->GetMean();
316               else if(esdInd==12) pmCZNC = hdata->GetMean();
317               else if(esdInd==13) pmCZNA = hdata->GetMean();
318               else if(esdInd==14) pmCZPC = hdata->GetMean();
319               else if(esdInd==15) pmCZPA = hdata->GetMean();
320             }
321             //
322             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
323             if(esdInd==13){
324               if(sumADCZNC!=0){
325                 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
326                   res=1.;
327                 else 
328                   res=.5;
329                 test[specie] += res;
330                 count++;
331               }
332               if(sumADCZNA!=0){
333                 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
334                   res=1.;
335                 else 
336                   res=.5;
337                 test[specie] += res;
338                 count++;
339               }
340               if(sumADCZPC!=0){
341                 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
342                   res=1.;
343                 else 
344                   res=.5;
345                 test[specie] += res;
346                 count++;
347               }
348               if(sumADCZPA!=0){
349                 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
350                   res=1.;
351                 else 
352                   res=.5;
353                 test[specie] += res;
354                 count++;
355               }
356             }
357             esdInd++;
358          }  
359          else {
360            AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName)); 
361            return ;
362          }
363         }//if(hdata) 
364         else AliError("AliZDCQAChecker-> No histos!!!\n");
365       }
366     } // LowMult (p-p)
367     // ====================================================================
368     //  Checks for A-A events
369     // ====================================================================
370     else if (specie == AliRecoParam::kHighMult) {
371       if(list[specie]->GetEntries()==0){  
372         AliWarning("\t The list to be checked is empty!");
373         return ;
374       }
375       //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
376       //
377       TIter next(list[specie]); 
378       count = 0; 
379       TH1 * hdata;        
380       Float_t res=0., percentageDiff=0.10;
381       while((hdata = dynamic_cast<TH1 *>(next()))){
382         if(hdata){ 
383           //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
384           // -------------------------------------------------------------------
385           if(index == AliQAv1::kSIM){
386             Float_t meanZNA=0., meanZNC=0., meanZPA=0., meanZPC=0.;
387             Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
388             Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
389             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
390             Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
391             Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
392             Int_t hitInd=0, digInd=0;
393             // Check HITS histos
394             if (!(strncmp(hdata->GetName(),"hHits",5))){
395               if(hdata->GetEntries()>0){
396                 if(hitInd==0)      meanZNC = hdata->GetMean();
397                 else if(hitInd==1) meanZNA = hdata->GetMean();
398                 else if(hitInd==2) meanZPC = hdata->GetMean();
399                 else if(hitInd==3) meanZPA = hdata->GetMean();
400                 else if(hitInd==4) pmQZNC = hdata->GetMean();
401                 else if(hitInd==5) pmQZNA = hdata->GetMean();
402                 else if(hitInd==6) pmQZPC = hdata->GetMean();
403                 else if(hitInd==7) pmQZPA = hdata->GetMean();
404                 else if(hitInd==8)  pmCZNC = hdata->GetMean();
405                 else if(hitInd==9)  pmCZNA = hdata->GetMean();
406                 else if(hitInd==10) pmCZPC = hdata->GetMean();
407                 else if(hitInd==11) pmCZPA = hdata->GetMean();
408               }
409               //
410               // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
411               // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
412               if(hitInd==3){
413                 if(meanZNC!=0 && meanZNA!=0){
414                   if((2*TMath::Abs(meanZNC-meanZNA)/(meanZNA+meanZNC))<percentageDiff) 
415                     res=1.;
416                   else 
417                     res=.5;
418                   test[specie] += res;
419                   count++;
420                 }
421                 if(meanZPC!=0 && meanZPA!=0){
422                   if((TMath::Abs(meanZPC-meanZPA)/(meanZPA+meanZPC))<percentageDiff) 
423                     res=1.;
424                   else 
425                     res=.5;
426                   test[specie] += res;
427                   count++;
428                 }
429               }
430               // --- Check whether (mean PMQi - PMC)/PMC < percentageDiff
431               if(hitInd==11){
432                 if(meanZNC!=0){
433                   if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
434                     res=1.;
435                   else 
436                     res=.5;
437                   test[specie] += res;
438                   count++;
439                 }
440                 if(meanZNA!=0){
441                   if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
442                     res=1.;
443                   else 
444                     res=.5;
445                   test[specie] += res;
446                   count++;
447                 }
448                 if(meanZPC!=0){
449                   if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
450                     res=1.;
451                   else 
452                     res=.5;
453                   test[specie] += res;
454                   count++;
455                 }
456                 if(meanZPA!=0){
457                   if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
458                     res=1.;
459                   else 
460                     res=.5;
461                   test[specie] += res;
462                   count++;
463                 }
464               }
465               hitInd++;
466             }
467             // Check DIGITS histos
468             else if (!(strncmp(hdata->GetName(),"hDig",4))){
469               if(hdata->GetEntries()>0){
470                 if(digInd==0)      sumADCZNC = hdata->GetMean();
471                 else if(digInd==1) sumADCZNA = hdata->GetMean();
472                 else if(digInd==2) sumADCZPC = hdata->GetMean();
473                 else if(digInd==3) sumADCZPA = hdata->GetMean();
474                 else if(digInd==4) adcQZNC = hdata->GetMean();
475                 else if(digInd==5) adcQZNA = hdata->GetMean();
476                 else if(digInd==6) adcQZPC = hdata->GetMean();
477                 else if(digInd==7) adcQZPA = hdata->GetMean();
478                 else if(digInd==8)  adcCZNC = hdata->GetMean();
479                 else if(digInd==9)  adcCZNA = hdata->GetMean();
480                 else if(digInd==10) adcCZPC = hdata->GetMean();
481                 else if(digInd==11) adcCZPA = hdata->GetMean();
482               }
483               //
484               // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
485               // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
486               if(digInd==3){
487                 if(sumADCZNC!=0 && sumADCZNA!=0){
488                   if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff) 
489                     res=1.;
490                   else 
491                     res=.5;
492                   test[specie] += res;
493                   count++;
494                 }
495                 if(sumADCZPC!=0 && sumADCZPA!=0){
496                   if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff) 
497                     res=1.;
498                   else 
499                     res=.5;
500                   test[specie] += res;
501                   count++;
502                 }
503               }
504               // --- Check whether (sumADC PMQi - PMC)/PMC < percentageDiff
505               if(digInd==11){
506                 if(sumADCZNC!=0){
507                   if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
508                     res=1.;
509                   else 
510                     res=.5;
511                   test[specie] += res;
512                   count++;
513                 }
514                 if(sumADCZNA!=0){
515                   if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
516                     res=1.;
517                   else 
518                     res=.5;
519                   test[specie] += res;
520                   count++;
521                 }
522                 if(sumADCZPC!=0){
523                   if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
524                     res=1.;
525                   else 
526                     res=.5;
527                   test[specie] += res;
528                   count++;
529                 }
530                 if(sumADCZPA!=0){
531                   if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
532                     res=1.;
533                   else 
534                     res=.5;
535                   test[specie] += res;
536                   count++;
537                 }
538               }
539               digInd++;
540             }
541           }
542           // -------------------------------------------------------------------
543           else if(index == AliQAv1::kRAW){
544             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
545             Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
546             Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
547             Int_t rawInd=0;
548             //
549             // Check RAW HIGH GAIN CHAIN histos
550             if(hdata->GetEntries()>0){
551               if(rawInd==0)      sumADCZNC = hdata->GetMean();
552               else if(rawInd==1) sumADCZNA = hdata->GetMean();
553               else if(rawInd==2) sumADCZPC = hdata->GetMean();
554               else if(rawInd==3) sumADCZPA = hdata->GetMean();
555               else if(rawInd==4) adcQZNC = hdata->GetMean();
556               else if(rawInd==5) adcQZNA = hdata->GetMean();
557               else if(rawInd==6) adcQZPC = hdata->GetMean();
558               else if(rawInd==7) adcQZPA = hdata->GetMean();
559               else if(rawInd==8)  adcCZNC = hdata->GetMean();
560               else if(rawInd==9)  adcCZNA = hdata->GetMean();
561               else if(rawInd==10) adcCZPC = hdata->GetMean();
562               else if(rawInd==11) adcCZPA = hdata->GetMean();
563             }
564             //
565             // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
566             // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
567             if(rawInd==3){
568               if(sumADCZNC!=0 && sumADCZNA!=0){
569                 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff) 
570                   res=1.;
571                 else 
572                   res=.5;
573                 test[specie] += res;
574                 count++;
575               }
576               if(sumADCZPC!=0 && sumADCZPA!=0){
577                 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff) 
578                   res=1.;
579                 else 
580                   res=.5;
581                 test[specie] += res;
582                 count++;
583               }
584             }
585             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
586             if(rawInd==11){
587               if(sumADCZNC!=0){
588                 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
589                   res=1.;
590                 else 
591                   res=.5;
592                 test[specie] += res;
593                 count++;
594               }
595               if(sumADCZNA!=0){
596                 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
597                   res=1.;
598                 else 
599                   res=.5;
600                 test[specie] += res;
601                 count++;
602               }
603               if(sumADCZPC!=0){
604                 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
605                   res=1.;
606                 else 
607                   res=.5;
608                 test[specie] += res;
609                 count++;
610               }
611               if(sumADCZPA!=0){
612                 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
613                   res=1.;
614                 else 
615                   res=.5;
616                 test[specie] += res;
617                 count++;
618               }
619             }
620             rawInd++;    
621           }   
622           // -------------------------------------------------------------------
623           else if(index == AliQAv1::kREC){
624             Float_t sumZNA=0., sumZNC=0., sumZPA=0., sumZPC=0.;
625             Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
626             Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
627             Int_t recInd=0;
628             //
629             // Check RAW HIGH GAIN CHAIN histos
630             if(hdata->GetEntries()>0){
631               if(recInd==0)       sumZNC = hdata->GetMean();
632               else if(recInd==1)  sumZNA = hdata->GetMean();
633               else if(recInd==2)  sumZPC = hdata->GetMean();
634               else if(recInd==3)  sumZPA = hdata->GetMean();
635               else if(recInd==4)  pmQZNC = hdata->GetMean();
636               else if(recInd==5)  pmQZNA = hdata->GetMean();
637               else if(recInd==6)  pmQZPC = hdata->GetMean();
638               else if(recInd==7)  pmQZPA = hdata->GetMean();
639               else if(recInd==8)  pmCZNC = hdata->GetMean();
640               else if(recInd==9)  pmCZNA = hdata->GetMean();
641               else if(recInd==10) pmCZPC = hdata->GetMean();
642               else if(recInd==11) pmCZPA = hdata->GetMean();
643             }
644             //
645             // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
646             // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
647             if(recInd==3){
648               if(sumZNC!=0 && sumZNA!=0){
649                 if((2*TMath::Abs(sumZNC-sumZNA)/(sumZNA+sumZNC))<percentageDiff) 
650                   res=1.;
651                 else 
652                   res=.5;
653                 test[specie] += res;
654                 count++;
655               }
656               if(sumZPC!=0 && sumZPA!=0){
657                 if((TMath::Abs(sumZPC-sumZPA)/(sumZPA+sumZPC))<percentageDiff) 
658                   res=1.;
659                 else 
660                   res=.5;
661                 test[specie] += res;
662                 count++;
663               }
664             }
665             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
666             if(recInd==11){
667               if(sumZNC!=0){
668                 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
669                   res=1.;
670                 else 
671                   res=.5;
672                 test[specie] += res;
673                 count++;
674               }
675               if(sumZNA!=0){
676                 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
677                   res=1.;
678                 else 
679                   res=.5;
680                 test[specie] += res;
681                 count++;
682               }
683               if(sumZPC!=0){
684                 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
685                   res=1.;
686                 else 
687                   res=.5;
688                 test[specie] += res;
689                 count++;
690               }
691               if(sumZPA!=0){
692                 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
693                   res=1.;
694                 else 
695                   res=.5;
696                 test[specie] += res;
697                 count++;
698               }
699             }
700             recInd++;    
701           }   
702           // -------------------------------------------------------------------
703           else if(index == AliQAv1::kESD){
704             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
705             Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
706             Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
707             Int_t esdInd=0;
708             //
709             // Check ESD HIGH GAIN CHAIN histos
710             if(hdata->GetEntries()!=0){
711               if(esdInd==2)      sumADCZNC = hdata->GetMean();
712               else if(esdInd==3) sumADCZNA = hdata->GetMean();
713               else if(esdInd==4) sumADCZPC = hdata->GetMean();
714               else if(esdInd==5) sumADCZPA = hdata->GetMean();
715               else if(esdInd==6) pmQZNC = hdata->GetMean();
716               else if(esdInd==7) pmQZNA = hdata->GetMean();
717               else if(esdInd==8) pmQZPC = hdata->GetMean();
718               else if(esdInd==9) pmQZPA = hdata->GetMean();
719               else if(esdInd==10) pmCZNC = hdata->GetMean();
720               else if(esdInd==11) pmCZNA = hdata->GetMean();
721               else if(esdInd==12) pmCZPC = hdata->GetMean();
722               else if(esdInd==13) pmCZPA = hdata->GetMean();
723             }
724             //
725             // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
726             // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
727             if(esdInd==5){
728               if(sumADCZNC!=0 && sumADCZNA!=0){
729                 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff) 
730                   res=1.;
731                 else 
732                   res=.5;
733                 test[specie] += res;
734                 count++;
735               }
736               if(sumADCZPC!=0 && sumADCZPA!=0){
737                 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff) 
738                   res=1.;
739                 else 
740                   res=.5;
741                 test[specie] += res;
742                 count++;
743               }
744             }
745             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
746             if(esdInd==13){
747               if(sumADCZNC!=0){
748                 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
749                   res=1.;
750                 else 
751                   res=.5;
752                 test[specie] += res;
753                 count++;
754               }
755               if(sumADCZNA!=0){
756                 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
757                   res=1.;
758                 else 
759                   res=.5;
760                 test[specie] += res;
761                 count++;
762               }
763               if(sumADCZPC!=0){
764                 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
765                   res=1.;
766                 else 
767                   res=.5;
768                 test[specie] += res;
769                 count++;
770               }
771               if(sumADCZPA!=0){
772                 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
773                   res=1.;
774                 else 
775                   res=.5;
776                 test[specie] += res;
777                 count++;
778               }
779             }
780             esdInd++;
781           }  
782           else {
783             AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName)); 
784             return ;
785           } 
786         }//if(hdata) 
787         else AliError("\t  No histos found for ZDC!!!\n");
788       }
789     } // HighMult (Pb-Pb) 
790     // ====================================================================
791     //  Checks for Calibration events
792     // ====================================================================
793     else if (specie == AliRecoParam::kCalib) {
794       AliWarning(Form("\n\t No check implemented in ZDC QA for %s task\n",taskName)); 
795       return ;
796     } // Calibration
797     // ====================================================================
798     //  Checks for cosmic events
799     // ====================================================================
800     else if (specie == AliRecoParam::kCosmic) {
801       AliWarning(Form("\n\t No check implemented in ZDC QA for %s task\n",taskName)); 
802       return ; 
803     } // Cosmic
804     if(count!=0) test[specie] = test[specie]/count;
805     AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\t ZDC QA check result = %1.2f\n",test[specie]));
806   } // Loop on species
807 }