]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCQAChecker.cxx
Changes for report #56707: On the proper usage of syswatch.log (Marian)
[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       AliDetectorRecoParam * /*recoParam*/) 
33 {
34   // Checks the QA histograms on the input list: 
35   //
36   Double_t *  test   = new Double_t[AliRecoParam::kNSpecies] ;
37   Int_t *     ntests = new Int_t[AliRecoParam::kNSpecies]  ; 
38   const char* taskName = AliQAv1::GetAliTaskName(index);
39   //
40   for(Int_t specie = 0; specie < AliRecoParam::kNSpecies; specie++) {
41     test[specie] = 1.0; 
42     ntests[specie] = 0; 
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 test;
51       }
52       //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
53       TIter next(list[specie]); 
54       ntests[specie] = 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                   ntests[specie]++;
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                   ntests[specie]++;
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                   ntests[specie]++;
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                   ntests[specie]++;
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                   ntests[specie]++;
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                   ntests[specie]++;
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                   ntests[specie]++;
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                   ntests[specie]++;
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==4) adcQZNC = hdata->GetMean();
193               else if(irawHisto==5) adcQZNA = hdata->GetMean();
194               else if(irawHisto==6) adcQZPC = hdata->GetMean();
195               else if(irawHisto==7) adcQZPA = hdata->GetMean();
196               else if(irawHisto==8)  adcCZNC = hdata->GetMean();
197               else if(irawHisto==9)  adcCZNA = hdata->GetMean();
198               else if(irawHisto==10) adcCZPC = hdata->GetMean();
199               else if(irawHisto==11) 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                 ntests[specie]++;
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                 ntests[specie]++;
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                 ntests[specie]++;
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                 ntests[specie]++;
235               }
236             }
237             irawHisto++;            
238           } 
239           // -------------------------------------------------------------------
240           else if(index == AliQAv1::kESD) {
241             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=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 esdInd=0;
245             //
246             // Check ESD HIGH GAIN CHAIN histos
247             if(hdata->GetEntries()!=0){
248               if(esdInd==2)      sumADCZNC = hdata->GetMean();
249               else if(esdInd==3) sumADCZNA = hdata->GetMean();
250               else if(esdInd==4) sumADCZPC = hdata->GetMean();
251               else if(esdInd==5) sumADCZPA = hdata->GetMean();
252               else if(esdInd==6) pmQZNC = hdata->GetMean();
253               else if(esdInd==7) pmQZNA = hdata->GetMean();
254               else if(esdInd==8) pmQZPC = hdata->GetMean();
255               else if(esdInd==9) pmQZPA = hdata->GetMean();
256               else if(esdInd==10) pmCZNC = hdata->GetMean();
257               else if(esdInd==11) pmCZNA = hdata->GetMean();
258               else if(esdInd==12) pmCZPC = hdata->GetMean();
259               else if(esdInd==13) pmCZPA = hdata->GetMean();
260             }
261             //
262             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
263             if(esdInd==13){
264               if(sumADCZNC!=0){
265                 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
266                   res=1.;
267                 else 
268                   res=.5;
269                 test[specie] += res;
270                 ntests[specie]++;
271               }
272               if(sumADCZNA!=0){
273                 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
274                   res=1.;
275                 else 
276                   res=.5;
277                 test[specie] += res;
278                 ntests[specie]++;
279               }
280               if(sumADCZPC!=0){
281                 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
282                   res=1.;
283                 else 
284                   res=.5;
285                 test[specie] += res;
286                 ntests[specie]++;
287               }
288               if(sumADCZPA!=0){
289                 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
290                   res=1.;
291                 else 
292                   res=.5;
293                 test[specie] += res;
294                 ntests[specie]++;
295               }
296             }
297             esdInd++;
298          }  
299          else {
300            AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName)); 
301            return NULL;
302          }
303         }//if(hdata) 
304         else AliError("AliZDCQAChecker-> No histos!!!\n");
305       }
306     } // LowMult (p-p)
307     // ====================================================================
308     //  Checks for A-A events
309     // ====================================================================
310     else if (specie == AliRecoParam::kHighMult) {
311       if(list[specie]->GetEntries()==0){  
312         AliWarning("\t The list to be checked is empty!");
313         return test;
314       }
315       //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
316       //
317       TIter next(list[specie]); 
318       ntests[specie] = 0; 
319       TH1 * hdata;        
320       Float_t res=0., percentageDiff=0.10;
321       while((hdata = dynamic_cast<TH1 *>(next()))){
322         if(hdata){ 
323           //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
324           // -------------------------------------------------------------------
325           if(index == AliQAv1::kSIM){
326             Float_t meanZNA=0., meanZNC=0., meanZPA=0., meanZPC=0.;
327             Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
328             Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
329             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
330             Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
331             Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
332             Int_t hitInd=0, digInd=0;
333             // Check HITS histos
334             if (!(strncmp(hdata->GetName(),"hHits",5))){
335               if(hdata->GetEntries()>0){
336                 if(hitInd==0)      meanZNC = hdata->GetMean();
337                 else if(hitInd==1) meanZNA = hdata->GetMean();
338                 else if(hitInd==2) meanZPC = hdata->GetMean();
339                 else if(hitInd==3) meanZPA = hdata->GetMean();
340                 else if(hitInd==4) pmQZNC = hdata->GetMean();
341                 else if(hitInd==5) pmQZNA = hdata->GetMean();
342                 else if(hitInd==6) pmQZPC = hdata->GetMean();
343                 else if(hitInd==7) pmQZPA = hdata->GetMean();
344                 else if(hitInd==8)  pmCZNC = hdata->GetMean();
345                 else if(hitInd==9)  pmCZNA = hdata->GetMean();
346                 else if(hitInd==10) pmCZPC = hdata->GetMean();
347                 else if(hitInd==11) pmCZPA = hdata->GetMean();
348               }
349               //
350               // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
351               // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
352               if(hitInd==3){
353                 if(meanZNC!=0 && meanZNA!=0){
354                   if((2*TMath::Abs(meanZNC-meanZNA)/(meanZNA+meanZNC))<percentageDiff) 
355                     res=1.;
356                   else 
357                     res=.5;
358                   test[specie] += res;
359                   ntests[specie]++;
360                 }
361                 if(meanZPC!=0 && meanZPA!=0){
362                   if((TMath::Abs(meanZPC-meanZPA)/(meanZPA+meanZPC))<percentageDiff) 
363                     res=1.;
364                   else 
365                     res=.5;
366                   test[specie] += res;
367                   ntests[specie]++;
368                 }
369               }
370               // --- Check whether (mean PMQi - PMC)/PMC < percentageDiff
371               if(hitInd==11){
372                 if(meanZNC!=0){
373                   if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
374                     res=1.;
375                   else 
376                     res=.5;
377                   test[specie] += res;
378                   ntests[specie]++;
379                 }
380                 if(meanZNA!=0){
381                   if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
382                     res=1.;
383                   else 
384                     res=.5;
385                   test[specie] += res;
386                   ntests[specie]++;
387                 }
388                 if(meanZPC!=0){
389                   if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
390                     res=1.;
391                   else 
392                     res=.5;
393                   test[specie] += res;
394                   ntests[specie]++;
395                 }
396                 if(meanZPA!=0){
397                   if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
398                     res=1.;
399                   else 
400                     res=.5;
401                   test[specie] += res;
402                   ntests[specie]++;
403                 }
404               }
405               hitInd++;
406             }
407             // Check DIGITS histos
408             else if (!(strncmp(hdata->GetName(),"hDig",4))){
409               if(hdata->GetEntries()>0){
410                 if(digInd==0)      sumADCZNC = hdata->GetMean();
411                 else if(digInd==1) sumADCZNA = hdata->GetMean();
412                 else if(digInd==2) sumADCZPC = hdata->GetMean();
413                 else if(digInd==3) sumADCZPA = hdata->GetMean();
414                 else if(digInd==4) adcQZNC = hdata->GetMean();
415                 else if(digInd==5) adcQZNA = hdata->GetMean();
416                 else if(digInd==6) adcQZPC = hdata->GetMean();
417                 else if(digInd==7) adcQZPA = hdata->GetMean();
418                 else if(digInd==8)  adcCZNC = hdata->GetMean();
419                 else if(digInd==9)  adcCZNA = hdata->GetMean();
420                 else if(digInd==10) adcCZPC = hdata->GetMean();
421                 else if(digInd==11) adcCZPA = hdata->GetMean();
422               }
423               //
424               // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
425               // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
426               if(digInd==3){
427                 if(sumADCZNC!=0 && sumADCZNA!=0){
428                   if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff) 
429                     res=1.;
430                   else 
431                     res=.5;
432                   test[specie] += res;
433                   ntests[specie]++;
434                 }
435                 if(sumADCZPC!=0 && sumADCZPA!=0){
436                   if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff) 
437                     res=1.;
438                   else 
439                     res=.5;
440                   test[specie] += res;
441                   ntests[specie]++;
442                 }
443               }
444               // --- Check whether (sumADC PMQi - PMC)/PMC < percentageDiff
445               if(digInd==11){
446                 if(sumADCZNC!=0){
447                   if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
448                     res=1.;
449                   else 
450                     res=.5;
451                   test[specie] += res;
452                   ntests[specie]++;
453                 }
454                 if(sumADCZNA!=0){
455                   if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
456                     res=1.;
457                   else 
458                     res=.5;
459                   test[specie] += res;
460                   ntests[specie]++;
461                 }
462                 if(sumADCZPC!=0){
463                   if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
464                     res=1.;
465                   else 
466                     res=.5;
467                   test[specie] += res;
468                   ntests[specie]++;
469                 }
470                 if(sumADCZPA!=0){
471                   if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
472                     res=1.;
473                   else 
474                     res=.5;
475                   test[specie] += res;
476                   ntests[specie]++;
477                 }
478               }
479               digInd++;
480             }
481           }
482           // -------------------------------------------------------------------
483           else if(index == AliQAv1::kRAW){
484             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
485             Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
486             Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
487             Int_t rawInd=0;
488             //
489             // Check RAW HIGH GAIN CHAIN histos
490             if(hdata->GetEntries()>0){
491               if(rawInd==0)      sumADCZNC = hdata->GetMean();
492               else if(rawInd==1) sumADCZNA = hdata->GetMean();
493               else if(rawInd==2) sumADCZPC = hdata->GetMean();
494               else if(rawInd==3) sumADCZPA = hdata->GetMean();
495               else if(rawInd==4) adcQZNC = hdata->GetMean();
496               else if(rawInd==5) adcQZNA = hdata->GetMean();
497               else if(rawInd==6) adcQZPC = hdata->GetMean();
498               else if(rawInd==7) adcQZPA = hdata->GetMean();
499               else if(rawInd==8)  adcCZNC = hdata->GetMean();
500               else if(rawInd==9)  adcCZNA = hdata->GetMean();
501               else if(rawInd==10) adcCZPC = hdata->GetMean();
502               else if(rawInd==11) adcCZPA = hdata->GetMean();
503             }
504             //
505             // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
506             // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
507             if(rawInd==3){
508               if(sumADCZNC!=0 && sumADCZNA!=0){
509                 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff) 
510                   res=1.;
511                 else 
512                   res=.5;
513                 test[specie] += res;
514                 ntests[specie]++;
515               }
516               if(sumADCZPC!=0 && sumADCZPA!=0){
517                 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff) 
518                   res=1.;
519                 else 
520                   res=.5;
521                 test[specie] += res;
522                 ntests[specie]++;
523               }
524             }
525             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
526             if(rawInd==11){
527               if(sumADCZNC!=0){
528                 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff) 
529                   res=1.;
530                 else 
531                   res=.5;
532                 test[specie] += res;
533                 ntests[specie]++;
534               }
535               if(sumADCZNA!=0){
536                 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff) 
537                   res=1.;
538                 else 
539                   res=.5;
540                 test[specie] += res;
541                 ntests[specie]++;
542               }
543               if(sumADCZPC!=0){
544                 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff) 
545                   res=1.;
546                 else 
547                   res=.5;
548                 test[specie] += res;
549                 ntests[specie]++;
550               }
551               if(sumADCZPA!=0){
552                 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff) 
553                   res=1.;
554                 else 
555                   res=.5;
556                 test[specie] += res;
557                 ntests[specie]++;
558               }
559             }
560             rawInd++;    
561           }   
562           // -------------------------------------------------------------------
563           else if(index == AliQAv1::kESD){
564             Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
565             Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
566             Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
567             Int_t esdInd=0;
568             //
569             // Check ESD HIGH GAIN CHAIN histos
570             if(hdata->GetEntries()!=0){
571               if(esdInd==2)      sumADCZNC = hdata->GetMean();
572               else if(esdInd==3) sumADCZNA = hdata->GetMean();
573               else if(esdInd==4) sumADCZPC = hdata->GetMean();
574               else if(esdInd==5) sumADCZPA = hdata->GetMean();
575               else if(esdInd==6) pmQZNC = hdata->GetMean();
576               else if(esdInd==7) pmQZNA = hdata->GetMean();
577               else if(esdInd==8) pmQZPC = hdata->GetMean();
578               else if(esdInd==9) pmQZPA = hdata->GetMean();
579               else if(esdInd==10) pmCZNC = hdata->GetMean();
580               else if(esdInd==11) pmCZNA = hdata->GetMean();
581               else if(esdInd==12) pmCZPC = hdata->GetMean();
582               else if(esdInd==13) pmCZPA = hdata->GetMean();
583             }
584             //
585             // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
586             // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
587             if(esdInd==5){
588               if(sumADCZNC!=0 && sumADCZNA!=0){
589                 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff) 
590                   res=1.;
591                 else 
592                   res=.5;
593                 test[specie] += res;
594                 ntests[specie]++;
595               }
596               if(sumADCZPC!=0 && sumADCZPA!=0){
597                 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff) 
598                   res=1.;
599                 else 
600                   res=.5;
601                 test[specie] += res;
602                 ntests[specie]++;
603               }
604             }
605             // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
606             if(esdInd==13){
607               if(sumADCZNC!=0){
608                 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff) 
609                   res=1.;
610                 else 
611                   res=.5;
612                 test[specie] += res;
613                 ntests[specie]++;
614               }
615               if(sumADCZNA!=0){
616                 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff) 
617                   res=1.;
618                 else 
619                   res=.5;
620                 test[specie] += res;
621                 ntests[specie]++;
622               }
623               if(sumADCZPC!=0){
624                 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff) 
625                   res=1.;
626                 else 
627                   res=.5;
628                 test[specie] += res;
629                 ntests[specie]++;
630               }
631               if(sumADCZPA!=0){
632                 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff) 
633                   res=1.;
634                 else 
635                   res=.5;
636                 test[specie] += res;
637                 ntests[specie]++;
638               }
639             }
640             esdInd++;
641           }  
642           else {
643             AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName)); 
644             return NULL;
645           } 
646         }//if(hdata) 
647         else AliError("\t  No histos found for ZDC!!!\n");
648       }
649     } // HighMult (Pb-Pb) 
650     else {
651        AliError(Form("Checking not implemented for %s, %s", 
652                     AliRecoParam::GetEventSpecieName(AliRecoParam::kCosmic), 
653                     AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ; 
654     }
655   } // Loop on species
656    
657   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
658     if(ntests[specie]!=0) test[specie] = test[specie]/ntests[specie];
659     AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\t ZDC QA check result = %1.2f\n",test[specie]));
660   }
661   delete [] ntests ; 
662   return test; 
663 }  
664