]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCQAChecker.cxx
Correct energy calibration in case of p-p data
[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 Double_t * AliZDCQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list) 
32 {
33   // Checks the QA histograms on the input list: 
34   //
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);
38   //
39   for(Int_t specie = 0; specie < AliRecoParam::kNSpecies; specie++) {
40     test[specie] = 1.0; 
41     ntests[specie] = 0; 
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
49         return test;
50       }
51       //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
52       TIter next(list[specie]); 
53       ntests[specie] = 0; 
54       TH1 * hdata;        
55       Float_t res=0., percentageDiff=0.15;
56       while((hdata = dynamic_cast<TH1 *>(next()))){
57         if(hdata){ 
58           // -------------------------------------------------------------------
59           if(index == AliQAv1::kSIM){
60             //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
61             // Check HITS histos
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;
69             //
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();
84               }
85               //
86               // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
87               if(ihitHisto==11){
88                 if(sumZNC!=0){
89                   if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
90                     res=1.;
91                   else 
92                     res=.5;
93                   test[specie] += res;
94                   ntests[specie]++;
95                 }
96                 if(sumZNA!=0){
97                   if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
98                     res=1.;
99                   else percentageDiff=
100                     res=.5;
101                   test[specie] += res;
102                   ntests[specie]++;
103                 }
104                 if(sumZPC!=0){
105                   if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
106                     res=1.;
107                   else 
108                     res=.5;
109                   test[specie] += res;
110                   ntests[specie]++;
111                 }
112                 if(sumZPA!=0){
113                   if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
114                     res=1.;
115                   else 
116                     res=.5;
117                   test[specie] += res;
118                   ntests[specie]++;
119                 }
120               }
121               ihitHisto++;
122             }
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();
138               }
139               //
140               // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
141               if(idigHisto==11){
142                 if(sumADCZNC!=0){
143                   if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
144                     res=1.;
145                   else 
146                     res=.5;
147                   test[specie] += res;
148                   ntests[specie]++;
149                 }
150                 if(sumADCZNA!=0){
151                   if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
152                     res=1.;
153                   else 
154                     res=.5;
155                   test[specie] += res;
156                   ntests[specie]++;
157                 }
158                 if(sumADCZPC!=0){
159                   if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
160                     res=1.;
161                   else 
162                     res=.5;
163                   test[specie] += res;
164                   ntests[specie]++;
165                 }
166                 if(sumADCZPA!=0){
167                   if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
168                     res=1.;
169                   else 
170                     res=.5;
171                   test[specie] += res;
172                   ntests[specie]++;
173                 }
174               }
175               idigHisto++;            
176             }
177           } 
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.;
183             Int_t irawHisto=0;
184             //
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();
199             }
200             //
201             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
202             if(irawHisto==11){
203               if(sumADCZNC!=0){
204                 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
205                   res=1.;
206                 else 
207                   res=.5;
208                 test[specie] += res;
209                 ntests[specie]++;
210               }
211               if(sumADCZNA!=0){
212                 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
213                   res=1.;
214                 else 
215                   res=.5;
216                 test[specie] += res;
217                 ntests[specie]++;
218               }
219               if(sumADCZPC!=0){
220                 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
221                   res=1.;
222                 else 
223                   res=.5;
224                 test[specie] += res;
225                 ntests[specie]++;
226               }
227               if(sumADCZPA!=0){
228                 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
229                   res=1.;
230                 else 
231                   res=.5;
232                 test[specie] += res;
233                 ntests[specie]++;
234               }
235             }
236             irawHisto++;            
237           } 
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.;
243             Int_t esdInd=0;
244             //
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();
259             }
260             //
261             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
262             if(esdInd==13){
263               if(sumADCZNC!=0){
264                 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
265                   res=1.;
266                 else 
267                   res=.5;
268                 test[specie] += res;
269                 ntests[specie]++;
270               }
271               if(sumADCZNA!=0){
272                 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
273                   res=1.;
274                 else 
275                   res=.5;
276                 test[specie] += res;
277                 ntests[specie]++;
278               }
279               if(sumADCZPC!=0){
280                 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
281                   res=1.;
282                 else 
283                   res=.5;
284                 test[specie] += res;
285                 ntests[specie]++;
286               }
287               if(sumADCZPA!=0){
288                 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
289                   res=1.;
290                 else 
291                   res=.5;
292                 test[specie] += res;
293                 ntests[specie]++;
294               }
295             }
296             esdInd++;
297          }  
298          else {
299            AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName)); 
300            return NULL;
301          }
302         }//if(hdata) 
303         else AliError("AliZDCQAChecker-> No histos!!!\n");
304       }
305     } // LowMult (p-p)
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!");
312         return test;
313       }
314       //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
315       //
316       TIter next(list[specie]); 
317       ntests[specie] = 0; 
318       TH1 * hdata;        
319       Float_t res=0., percentageDiff=0.10;
320       while((hdata = dynamic_cast<TH1 *>(next()))){
321         if(hdata){ 
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;
332             // Check HITS histos
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();
347               }
348               //
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
351               if(hitInd==3){
352                 if(meanZNC!=0 && meanZNA!=0){
353                   if((2*TMath::Abs(meanZNC-meanZNA)/(meanZNA+meanZNC))<percentageDiff) 
354                     res=1.;
355                   else 
356                     res=.5;
357                   test[specie] += res;
358                   ntests[specie]++;
359                 }
360                 if(meanZPC!=0 && meanZPA!=0){
361                   if((TMath::Abs(meanZPC-meanZPA)/(meanZPA+meanZPC))<percentageDiff) 
362                     res=1.;
363                   else 
364                     res=.5;
365                   test[specie] += res;
366                   ntests[specie]++;
367                 }
368               }
369               // --- Check whether (mean PMQi - PMC)/PMC < percentageDiff
370               if(hitInd==11){
371                 if(meanZNC!=0){
372                   if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
373                     res=1.;
374                   else 
375                     res=.5;
376                   test[specie] += res;
377                   ntests[specie]++;
378                 }
379                 if(meanZNA!=0){
380                   if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
381                     res=1.;
382                   else 
383                     res=.5;
384                   test[specie] += res;
385                   ntests[specie]++;
386                 }
387                 if(meanZPC!=0){
388                   if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
389                     res=1.;
390                   else 
391                     res=.5;
392                   test[specie] += res;
393                   ntests[specie]++;
394                 }
395                 if(meanZPA!=0){
396                   if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
397                     res=1.;
398                   else 
399                     res=.5;
400                   test[specie] += res;
401                   ntests[specie]++;
402                 }
403               }
404               hitInd++;
405             }
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();
421               }
422               //
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
425               if(digInd==3){
426                 if(sumADCZNC!=0 && sumADCZNA!=0){
427                   if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff) 
428                     res=1.;
429                   else 
430                     res=.5;
431                   test[specie] += res;
432                   ntests[specie]++;
433                 }
434                 if(sumADCZPC!=0 && sumADCZPA!=0){
435                   if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff) 
436                     res=1.;
437                   else 
438                     res=.5;
439                   test[specie] += res;
440                   ntests[specie]++;
441                 }
442               }
443               // --- Check whether (sumADC PMQi - PMC)/PMC < percentageDiff
444               if(digInd==11){
445                 if(sumADCZNC!=0){
446                   if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
447                     res=1.;
448                   else 
449                     res=.5;
450                   test[specie] += res;
451                   ntests[specie]++;
452                 }
453                 if(sumADCZNA!=0){
454                   if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
455                     res=1.;
456                   else 
457                     res=.5;
458                   test[specie] += res;
459                   ntests[specie]++;
460                 }
461                 if(sumADCZPC!=0){
462                   if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
463                     res=1.;
464                   else 
465                     res=.5;
466                   test[specie] += res;
467                   ntests[specie]++;
468                 }
469                 if(sumADCZPA!=0){
470                   if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
471                     res=1.;
472                   else 
473                     res=.5;
474                   test[specie] += res;
475                   ntests[specie]++;
476                 }
477               }
478               digInd++;
479             }
480           }
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.;
486             Int_t rawInd=0;
487             //
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();
502             }
503             //
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
506             if(rawInd==3){
507               if(sumADCZNC!=0 && sumADCZNA!=0){
508                 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff) 
509                   res=1.;
510                 else 
511                   res=.5;
512                 test[specie] += res;
513                 ntests[specie]++;
514               }
515               if(sumADCZPC!=0 && sumADCZPA!=0){
516                 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff) 
517                   res=1.;
518                 else 
519                   res=.5;
520                 test[specie] += res;
521                 ntests[specie]++;
522               }
523             }
524             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
525             if(rawInd==11){
526               if(sumADCZNC!=0){
527                 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
528                   res=1.;
529                 else 
530                   res=.5;
531                 test[specie] += res;
532                 ntests[specie]++;
533               }
534               if(sumADCZNA!=0){
535                 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
536                   res=1.;
537                 else 
538                   res=.5;
539                 test[specie] += res;
540                 ntests[specie]++;
541               }
542               if(sumADCZPC!=0){
543                 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
544                   res=1.;
545                 else 
546                   res=.5;
547                 test[specie] += res;
548                 ntests[specie]++;
549               }
550               if(sumADCZPA!=0){
551                 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
552                   res=1.;
553                 else 
554                   res=.5;
555                 test[specie] += res;
556                 ntests[specie]++;
557               }
558             }
559             rawInd++;    
560           }   
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.;
566             Int_t esdInd=0;
567             //
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();
582             }
583             //
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
586             if(esdInd==5){
587               if(sumADCZNC!=0 && sumADCZNA!=0){
588                 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff) 
589                   res=1.;
590                 else 
591                   res=.5;
592                 test[specie] += res;
593                 ntests[specie]++;
594               }
595               if(sumADCZPC!=0 && sumADCZPA!=0){
596                 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff) 
597                   res=1.;
598                 else 
599                   res=.5;
600                 test[specie] += res;
601                 ntests[specie]++;
602               }
603             }
604             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
605             if(esdInd==13){
606               if(sumADCZNC!=0){
607                 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
608                   res=1.;
609                 else 
610                   res=.5;
611                 test[specie] += res;
612                 ntests[specie]++;
613               }
614               if(sumADCZNA!=0){
615                 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
616                   res=1.;
617                 else 
618                   res=.5;
619                 test[specie] += res;
620                 ntests[specie]++;
621               }
622               if(sumADCZPC!=0){
623                 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
624                   res=1.;
625                 else 
626                   res=.5;
627                 test[specie] += res;
628                 ntests[specie]++;
629               }
630               if(sumADCZPA!=0){
631                 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
632                   res=1.;
633                 else 
634                   res=.5;
635                 test[specie] += res;
636                 ntests[specie]++;
637               }
638             }
639             esdInd++;
640           }  
641           else {
642             AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName)); 
643             return NULL;
644           } 
645         }//if(hdata) 
646         else AliError("\t  No histos found for ZDC!!!\n");
647       }
648     } // HighMult (Pb-Pb) 
649     else {
650        AliError(Form("Checking not implemented for %s, %s", 
651                     AliRecoParam::GetEventSpecieName(AliRecoParam::kCosmic), 
652                     AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ; 
653     }
654   } // Loop on species
655    
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]));
659   }
660   delete [] ntests ; 
661   return test; 
662 }  
663