]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSQASDDChecker.cxx
Coverity + TPaveText added to histograms at creation time (PG Cerello)
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDChecker.cxx
1 /**************************************************************************
2  * Copyright(c) 2007-2009, 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 /* $Id$ */
17
18 // *****************************************
19 //  Checks the quality assurance 
20 //  by comparing with reference data
21 //  P. Cerello Apr 2008
22 //  INFN Torino
23
24 // --- ROOT system ---
25 #include "TH1.h"
26 #include <TH1D.h>
27 #include <TH2.h>
28 #include "TCanvas.h"
29 #include "TPaveText.h"
30 #include "TPad.h"
31 //#include "TPaletteAxis.h"
32 // --- AliRoot header files ---
33 #include "AliITSQADataMakerRec.h"
34 #include "AliITSQASDDChecker.h"
35 #include "AliLog.h"
36 #include "AliCDBEntry.h"
37 #include "AliCDBManager.h"
38 #include "AliITSCalibrationSDD.h"
39 #include "AliITSgeomTGeo.h"
40 #include "AliQAManager.h"
41 #include "AliQAv1.h"
42 #include "AliQAChecker.h"
43 #include "AliQACheckerBase.h"
44
45
46 ClassImp(AliITSQASDDChecker)
47
48
49
50 //_____________________________________________________________________
51
52 AliITSQASDDChecker::AliITSQASDDChecker():
53 fSubDetOffset(0),
54   fStepBitSDD(NULL),
55   fLowSDDValue(NULL),
56   fHighSDDValue(NULL),
57   fCalibration(NULL),
58   fThresholdForRelativeOccupancy(0.01),
59   fThresholdForRecToRawRatio(0.04),
60 fImage(NULL),
61   fESforCheck(0)
62 {
63 // Default constructor
64         fStepBitSDD=new Double_t[AliQAv1::kNBIT];
65         fLowSDDValue=new Float_t[AliQAv1::kNBIT];
66         fHighSDDValue=new Float_t[AliQAv1::kNBIT];
67
68         for(Int_t ibit=0;ibit<AliQAv1::kNBIT;ibit++)
69           {
70             fStepBitSDD[ibit]=0.;
71             fLowSDDValue[ibit]=0.;
72             fHighSDDValue[ibit]=0.;
73           }
74         for(Int_t i=0;i<AliRecoParam::kNSpecies;i++) fPaveText[i] = NULL;
75 }          // ctor
76
77
78
79 AliITSQASDDChecker::~AliITSQASDDChecker() 
80 {
81
82   //destructor
83   if(fStepBitSDD) 
84     {
85       delete[] fStepBitSDD ;
86       fStepBitSDD = NULL;
87     }
88   if(fLowSDDValue)
89     {
90       delete[]fLowSDDValue;
91       fLowSDDValue=NULL;
92     }
93   if(fHighSDDValue)
94     { 
95       delete[]fHighSDDValue;
96       fHighSDDValue=NULL;
97     }
98   if(fCalibration)
99     {
100       delete fCalibration;
101       fCalibration=NULL;
102     }
103         if(fImage)
104     {
105                 delete []fImage; 
106                 fImage=NULL;
107     }
108         for(Int_t i=0;i<AliRecoParam::kNSpecies;i++) {
109                 if(fPaveText[i])
110                 {
111                         delete fPaveText[i]; 
112                         fPaveText[i]=NULL;
113                 }
114         }
115 } // dtor
116
117 //__________________________________________________________________
118 Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * list, const AliDetectorRecoParam * /*recoparam*/) 
119 {
120   //check histograms of the different lists  
121   AliInfo(Form("AliITSQASDDChecker called with offset: %d \t and specie %d\n", fSubDetOffset,fESforCheck));
122
123   AliDebug(1,Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset));
124
125   Double_t sddQACheckerValue = 0.;
126   TH1 *hdata=NULL;
127   Double_t entries=0.;
128   Double_t entries2[2];
129   for(Int_t i=0;i<2;i++)entries2[i]=0.;
130
131   if(!fCalibration){
132     AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
133     Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
134     if(!calibSDD)
135       {
136         AliError("Calibration object retrieval failed! SDD will not be processed");
137         fCalibration = NULL;
138         sddQACheckerValue= fHighSDDValue[AliQAv1::kWARNING];
139       }
140     else{
141       fCalibration = (TObjArray *)calibSDD->GetObject();
142       
143       if(!cacheStatus)calibSDD->SetObject(NULL);
144       calibSDD->SetOwner(kTRUE);
145       if(!cacheStatus)
146         {
147           delete calibSDD;
148         }
149     }//end calibsdd 
150   }//end f calibration
151
152   AliInfo("Calib SDD Created\n ");
153
154   TIter next(list);
155   TString results1;
156   TString results2;
157   Int_t color=1;
158
159   switch(index) {
160     case AliQAv1::kRAW:{
161       AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
162 //       if(fRawModulePattern) { delete fRawModulePattern; fRawModulePattern = 0; }
163 //       if(fRawL3Pattern) { delete fRawL3Pattern; fRawL3Pattern = 0; }
164 //       if(fRawL4Pattern) { delete fRawL4Pattern; fRawL4Pattern = 0; }
165       if (list->GetEntries() == 0){AliError("Raw List for SDD is empty \n");sddQACheckerValue += fHighSDDValue[AliQAv1::kFATAL];        break;}
166       TH1 *hmodule=NULL;
167       TH2 *hlayer[2]; 
168       hdata=NULL;
169       for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
170
171       //check counters
172       Int_t emptymodules[2], filledmodules[2],emptyladders[2],filledladders[2],emptydriftregion[2], filleddriftregion[2], excludedmoduleperlayer[2], excludeddrperlayer[2], activemoduleperlayer[2],activedrperlayer[2],exactivemoduleperlayer[2],exactivedrperlayer[2];
173       Int_t excluded=0;            //excluded modules  
174       Int_t excludeddriftregion=0; //excluded single drift region
175       Int_t active=0;              //active modules  
176       Int_t activedriftregion=0;   //active single drift region
177       Int_t exactive=0;            //excluded modules but taking data
178       Int_t exactivedriftregion=0; //excluded single drift region but taking data   
179       Int_t empty=0;
180       Int_t filled=0;
181       Int_t emptydr=0;
182       Int_t filleddr=0;
183       //Int_t emptyactivemodule=0;
184       Int_t emptyactivemoduleperlayer[2];
185       //Int_t emptydractivemodule=0;
186       Int_t emptyactivedrperlayer[2];
187       Int_t emptysum=0;
188       Int_t emptydiff=0;
189       Int_t emptydrsum=0;
190       Int_t emptydrdiff=0;
191
192     for(Int_t i=0;i<2;i++)
193       {
194         emptymodules[i]=0; 
195         filledmodules[i]=0; 
196         emptyladders[i]=0; 
197         filledladders[i]=0; 
198         emptydriftregion[i]=0;
199         filleddriftregion[i]=0; 
200         excludedmoduleperlayer[i]=0;
201         excludeddrperlayer[i]=0;
202         activemoduleperlayer[i]=0;
203         activedrperlayer[i]=0;
204         exactivemoduleperlayer[i]=0;
205         exactivedrperlayer[i]=0;
206         emptyactivemoduleperlayer[i]=0;
207         emptyactivedrperlayer[i]=0;
208       }  
209
210     Int_t neventsraw=0;
211
212     //take the number of events
213
214       while( (hdata = dynamic_cast<TH1* >(next())) ){
215         if (hdata){
216           TString hname=hdata->GetName();
217
218           if(hname.Contains("SDDRawDataCheck"))
219             { 
220               neventsraw=(Int_t)hdata->GetBinContent(1); 
221               //break;
222             }
223           else continue;
224         }//end if hdata
225       }//end while
226
227       next.Begin();
228       while( (hdata = dynamic_cast<TH1* >(next())) ){
229         if (hdata){
230                 TString hname=hdata->GetName();
231           if(hname.Contains("SDDchargeMap"))continue;
232           if(hname.Contains("SDDDDLPattern"))continue;
233           if(hname.Contains("SDDEventSize"))continue;
234           if(hname.Contains("_RelativeOccupancy"))continue;
235           if(hname.Contains("SDDModPattern")){
236             if(hname.Contains("NORM")) continue;
237             hmodule=(TH1*)hdata->Clone();
238             entries= hdata->GetEntries();
239             if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
240             else{
241               int modmax=hdata->GetNbinsX();
242               Double_t content=0;
243               Int_t llay=0;
244               for(Int_t i=1;i<=modmax;i++)
245                 {
246                   if(i<85)llay=0;
247                   else llay=1;
248                   content=hdata->GetBinContent(i);
249                   if(AliITSQADataMakerRec::AreEqual(content,0.))
250                     {
251                     empty++;
252                     emptymodules[llay]++;
253                     } 
254                   else 
255                     {
256                       filled++;
257                       filledmodules[llay]++;
258                     }
259                 }//end for
260               //output of the check at the level of the modules. Drift region in the following checks
261
262               AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
263               AliInfo(Form(" %s : Layer 3 empty modules %i \t filled modules %i",hname.Data(), emptymodules[0], filledmodules[0]));
264               AliInfo(Form(" %s : Layer 4 empty modules %i \t filled modules %i",hname.Data(), emptymodules[1], filledmodules[1]));
265             }//end else pattern entries !=0
266           } //modpattern (1d histogram)                 
267           if(hname.Contains("_RelativeOccupancy")) {
268             //fRawModulePattern = (TH1F *) hdata;
269             Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
270             if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
271             if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
272             Int_t aboveThreshold = 0;
273             for(Int_t k=0; k<= hdata->GetNbinsX(); k++) {if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (int)(hdata->GetBinContent(k));}
274             Float_t fractionAboveThreshold=0.;
275             if(hdata->GetEntries()>0.)fractionAboveThreshold=((Float_t) aboveThreshold)/hdata->GetEntries();
276             if(hname.Contains("L3")) AliInfo(Form("SDD check number 1, L3: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
277             if(hname.Contains("L4")) AliInfo(Form("SDD check number 2, L4: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
278             if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
279               if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: Set Warning (L3 Raw)"));
280               if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: Set Warning (L4 Raw)")); } }//relativeoccupancy
281
282           if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){if(hname.Contains("NORM"))continue;
283             Int_t layer=0;
284             if(hname.Contains("3"))layer=0;
285             else  if(hname.Contains("4"))layer=1;
286             entries2[layer]=hdata->GetEntries();
287             if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));
288               sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
289             else{
290               Int_t layer1=0;
291               if(hname.Contains("3"))layer1=0;
292               else  if(hname.Contains("4"))layer1=1;
293                         TH2* htemp=dynamic_cast<TH2*>(hdata);
294                         if(htemp){
295                                 hlayer[layer1]=(TH2*)((dynamic_cast<TH2*>(hdata))->Clone());
296                                 hlayer[layer1]->SetName(Form("%s_copy",hname.Data()));
297                                 int modmay=hlayer[layer1]->GetNbinsY();
298                                 TH1D* hproj= hlayer[layer1]->ProjectionY();
299                                 Double_t ladcontent=0;
300                                 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
301                                         ladcontent=hproj->GetBinContent(i);
302                                         if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
303                                         else filledladders[layer1]++;}//end for
304                                         AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer1], filledladders[layer1]));//end else layer 3
305                                         delete hproj;
306                                         hproj=NULL;
307                         }//end if htemp
308             }//end else entries !=0
309           }//end check on phiz        
310                 
311         }//end if hdata 
312       
313           }//end while
314       for(Int_t ii=0;ii<2;ii++)
315         {
316           filledmodules[ii]=0;
317           emptymodules[ii]=0;
318         }
319       filled=0;
320       empty=0;
321       if(AliITSQADataMakerRec::AreEqual(entries,0.)&& AliITSQADataMakerRec::AreEqual(entries2[0],0.)&& AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
322       //else{
323       if(hmodule || (hlayer[0] && hlayer[1])){
324         for(Int_t imod=0;imod<fgknSDDmodules;imod++){
325           Int_t lay=0;
326           Int_t lad=0;
327           Int_t det=0;
328           Int_t module=0;
329           module=imod+fgkmodoffset;
330           AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
331           if(cal==0) { continue;}
332           AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
333           if (cal->IsBad()){
334             excluded++;
335             excludedmoduleperlayer[lay-3]++;
336             Double_t content=0.;
337             //Double_t contentlayer[2];
338             //for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
339             if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram will be stored in the QA file otherwise the histogram will not be written on the logbook
340             //      if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
341             if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE) {
342               filledmodules[lay-3]++;
343               filled++;
344               AliError(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
345               exactive++;
346               exactivemoduleperlayer[lay-3]++;
347             } else if(AliITSQADataMakerRec::AreEqual(content,0.)) 
348               {
349                 emptymodules[lay-3]++; //it has to be empty
350                 empty++;
351               }
352           } else {
353             Int_t totside=0;
354             Int_t totactiveside=0;
355             //Int_t totbadside=0;
356             Double_t contentgood=0.;
357
358             for(Int_t i=0;i<2;i++){
359               if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(2*det+i-1,lad);
360               if(cal->IsWingBad(i))
361                 { 
362                   excludeddriftregion++; 
363                   excludeddrperlayer[lay-3]++; 
364                   if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kFALSE){
365                     AliError(Form("The side %d of the module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",i,module,lay,lad,det));
366                     exactivedriftregion++; 
367                     exactivedrperlayer[lay-3]++;
368                     filleddr++;
369                     filleddriftregion[lay-3]++;
370                   }
371                 }//end wingbad
372               else{
373                 if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kTRUE)
374                   {
375                     AliWarning(Form("The side %d of the module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data\n ",i,module, lay, lad, det));
376                   }
377                 else 
378                   {
379                     totside++;
380                   }
381                 totactiveside++;
382               }
383             }//end for
384             if(totside==0){
385             AliWarning(Form("The  module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data\n ",module, lay, lad, det));
386               emptymodules[lay-3]++;
387               empty++;
388
389             }
390               else 
391                 if(totside==2){
392                 filledmodules[lay-3]++;
393                 filled++;
394                 }
395                 else
396                   if(totside==1)
397                     {
398                       //                      emptydr++;
399                       //emptydriftregion[lay-3]++; //it has to be empty
400                       emptydriftregion[lay-3]++; 
401                       emptydr++;
402                       filleddr++;
403                       filleddriftregion[lay-3]++;
404                     }
405             if(totactiveside==1)
406               {
407                 activedriftregion++;
408                 activedrperlayer[lay-3]++;
409               }else if(totactiveside==2)
410               {
411                 active++;
412                 activemoduleperlayer[lay-3]++;
413               }
414
415           }
416         }//end for
417         AliInfo(Form("In total %d modules and %d single drift regions took data.\n ",filled, filleddr));
418         AliInfo(Form("In total %d modules and %d single drift regions were empty\n",empty, emptydr));
419         for(Int_t i=0;i<2;i++)
420           {
421             AliInfo(Form("Layer %i   \tempty modules %i             \t filled modules %i\n", i+3,emptymodules[i], filledmodules[i]));
422             AliInfo(Form("Layer %i   \tempty single drift regions %i \t filled single drift regions %i\n",i+3,emptydriftregion[i], filleddriftregion[i]));
423           }//end else layers
424         emptysum=emptymodules[0]+emptymodules[1];
425         emptydiff=emptysum-excluded;
426         emptyactivemoduleperlayer[0]=emptymodules[0]- excludedmoduleperlayer[0];
427         emptyactivemoduleperlayer[1]=emptymodules[1]- excludedmoduleperlayer[1];
428
429         emptydrsum=emptydriftregion[0]+emptydriftregion[1];
430         emptydrdiff=emptydrsum-excludeddriftregion;
431         emptyactivedrperlayer[0]=emptydriftregion[0]- excludeddrperlayer[0];
432         emptyactivedrperlayer[1]=emptydriftregion[1]- excludeddrperlayer[1];
433
434         Int_t numlimit=1000;
435
436         if(emptysum>excluded||emptydrsum>excludeddriftregion){
437           AliWarning(Form(" %i good module(s) and %i good single drift regions didn't take data! \n",emptydiff,emptydrdiff));
438           AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions didn't take data! \n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
439           AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions didn't take data! \n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
440           //printf("========================= %d",AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::kCosmic));
441           //      if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kFALSE){     
442           if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())!=AliRecoParam::kCosmic){     
443             
444             results1.Form("%i good module(s) and %i good drift regions didn't take data!",emptydiff,emptydrdiff);
445             if(neventsraw<numlimit)
446               {
447                 results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsraw);
448                 color=5;
449                 sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
450               }
451             else
452               {
453                 results2.Form(" Events %d. If PHYSICS, follow the TWiki instruction and call the Expert ",neventsraw);
454                 color=2;
455                 sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
456               }
457           }
458           else
459             //      if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kTRUE)
460             if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())==AliRecoParam::kCosmic)
461               {     
462                 numlimit=10000;
463                 if(neventsraw<numlimit)
464                   {
465                     AliWarning(Form("This is a cosmic run. Some module and drift region are empty but all is OK. "));
466                     results1.Form("OK. This is a cosmic run. you need a lot of events. Events %i",neventsraw);
467                     results2.Form("%i good module(s) and %i good drift are empty! DO NOT CALL THE EXPERT",emptydiff,emptydrdiff);
468                     color=5;
469                     sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
470                   }
471                 else
472                   {
473                     results1.Form("%i good module(s) and %i good drift region(s) have no data!",emptydiff,emptydrdiff);
474                     results2.Form(" Cosmic Events %d .Follow the TWiki instruction and call the Expert ",neventsraw);
475                     color=2;
476                     sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
477                   }
478               }
479         }
480         
481         if(exactive==0 && emptydiff==0 && exactivedriftregion==0 && emptydrdiff==0){
482           AliInfo(Form("All the active modules (%i) and single drift regions (%i) are in acquisition. The number of excluded modules are %i and the excluded single drift regions are %i\n",active,activedriftregion,excluded,excludeddriftregion));
483           results1.Form("OK.");
484           results2.Form(" All active modules and drift regions in acquisition");
485           color=3;
486           sddQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
487         }
488         if(exactive!=0||exactivedriftregion!=0){
489           AliError(Form("%i modules and %i single  drift regions excluded from the acquisition took data. Active modules%i single drift region %i \n ",exactive,exactivedriftregion,active,activedriftregion));
490           AliError(Form("Layer 3: %i modules and %i single  drift regions excluded from the acquisition took data. Active modules%i single drift region %i \n ",exactivemoduleperlayer[0],exactivedrperlayer[0],activemoduleperlayer[0],activedrperlayer[0]));
491           AliError(Form("Layer 3: %i modules and %i single  drift regions excluded from the acquisition took data. Active modules%i single drift region %i \n ",exactivemoduleperlayer[1],exactivedrperlayer[1],activemoduleperlayer[1],activedrperlayer[1]));
492           results1.Form("%i modules and %i drift region excluded from the acquisition took data",exactive,exactivedriftregion);
493           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
494           color=2;      
495           sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
496         }
497         if(excluded==exactive||excludeddriftregion==exactivedriftregion){
498           AliError(Form("All the modules (%d) or single drift regions (%d) excluded from the acquisition  took data!\n  Active modules %i \t Active drfift regions %i\n",excluded,excludeddriftregion,active,activedriftregion));
499           results1.Form("All the modules (%d) or drift regions (%d) excluded from the acquisition took data!",excluded,excludeddriftregion );
500           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
501           color=6;
502           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
503         }
504         if(active==0||activedriftregion==0){
505           AliError(Form("No modules or single drift regions took data: excluded %i \t excluded active %i \n\t\t excluded single drift regions %i \t excluded active drift regions %i \n", excluded, exactive, excludeddriftregion, exactivedriftregion)); 
506           results1.Form("No modules or drift region took data: excluded modules %i  excluded drift regions %i ", excluded, excludeddriftregion );
507           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
508           color=6;
509           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
510         }
511
512         //TPaveText *pave[2]={0,0};
513         next.Begin();
514
515         while( (hdata=dynamic_cast<TH1* >(next())) ) {
516             if (hdata){
517                         TString hname=hdata->GetName();
518                         if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){
519                           if(hname.Contains("NORM"))continue;
520                           //AliInfo("========================================Found histo 11\n");
521                                 TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave"));
522                                 ptext->Clear();
523                                 ptext->AddText(results1.Data());
524                                 ptext->AddText(results2.Data());
525               } else if(hname.Contains("SDDRawDataCheck")) {
526                     
527                           //AliInfo("========================================Found histo\n");
528                           ((TH1F*)hdata)->SetBinContent(5,active);
529                           ((TH1F*)hdata)->SetBinContent(6,filled);
530                           ((TH1F*)hdata)->SetBinContent(7,activedriftregion);
531                           ((TH1F*)hdata)->SetBinContent(8,filleddr);
532                           ((TH1F*)hdata)->SetBinContent(9,excluded);
533                           ((TH1F*)hdata)->SetBinContent(10,empty);
534                           ((TH1F*)hdata)->SetBinContent(11,excludeddriftregion);
535                           ((TH1F*)hdata)->SetBinContent(12,emptydr);
536                           ((TH1F*)hdata)->SetBinContent(13,exactive);
537                           ((TH1F*)hdata)->SetBinContent(14,emptydiff);
538                           ((TH1F*)hdata)->SetBinContent(15,exactivedriftregion);
539                           ((TH1F*)hdata)->SetBinContent(16,emptydrdiff);
540                     
541                           //layer 3
542                           ((TH1F*)hdata)->SetBinContent(19,activemoduleperlayer[0]);
543                           ((TH1F*)hdata)->SetBinContent(20,filledmodules[0]);
544                           ((TH1F*)hdata)->SetBinContent(21,activedrperlayer[0]);
545                           ((TH1F*)hdata)->SetBinContent(22,filleddriftregion[0]);
546                           ((TH1F*)hdata)->SetBinContent(23,excludedmoduleperlayer[0]);
547                           ((TH1F*)hdata)->SetBinContent(24,emptymodules[0]);
548                           ((TH1F*)hdata)->SetBinContent(25,excludeddrperlayer[0]);
549                           ((TH1F*)hdata)->SetBinContent(26,emptydriftregion[0]);
550                           ((TH1F*)hdata)->SetBinContent(27,exactivemoduleperlayer[0]);
551                           ((TH1F*)hdata)->SetBinContent(28,emptyactivemoduleperlayer[0]);
552                           ((TH1F*)hdata)->SetBinContent(29,exactivedrperlayer[0]);
553                           ((TH1F*)hdata)->SetBinContent(30,emptyactivedrperlayer[0]);
554                     
555                           //layer 4
556                           ((TH1F*)hdata)->SetBinContent(33,activemoduleperlayer[1]);
557                           ((TH1F*)hdata)->SetBinContent(34,filledmodules[1]);
558                           ((TH1F*)hdata)->SetBinContent(35,activedrperlayer[1]);
559                           ((TH1F*)hdata)->SetBinContent(36,filleddriftregion[1]);
560                           ((TH1F*)hdata)->SetBinContent(37,excludedmoduleperlayer[1]);
561                           ((TH1F*)hdata)->SetBinContent(38,emptymodules[1]);
562                           ((TH1F*)hdata)->SetBinContent(39,excludeddrperlayer[1]);
563                           ((TH1F*)hdata)->SetBinContent(40,emptydriftregion[1]);
564                           ((TH1F*)hdata)->SetBinContent(41,exactivemoduleperlayer[1]);
565                           ((TH1F*)hdata)->SetBinContent(42,emptyactivemoduleperlayer[1]);
566                           ((TH1F*)hdata)->SetBinContent(43,exactivedrperlayer[1]);
567                           ((TH1F*)hdata)->SetBinContent(44,emptyactivedrperlayer[1]);
568                           //break; 
569                         }
570                 }//if hdata
571             
572         }//end while 
573         
574       }//end else 
575       delete hmodule;
576       hmodule=NULL;
577       for(Int_t i=0;i<2;i++) {
578         delete hlayer[i];
579         hlayer[i]=NULL;
580       }//end for
581
582     }//end raw
583       
584       break;
585       
586   case AliQAv1::kNULLTASK:{
587     AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
588     sddQACheckerValue=1.;
589   }
590     break;
591     
592   case AliQAv1::kREC:
593     {
594       Int_t uidrec=list->GetUniqueID();
595       AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index))); 
596       if(uidrec==20){
597         //recpoints
598         if (list->GetEntries() == 0){ //check if the list is empty
599           //printf("sddQACheckerValue = %f \t value %f\n",sddQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
600           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL]; 
601           //break;                      
602         }//end if getentries
603       
604
605       TH1 *hmodule=NULL;
606       TH2 *hlayer[2]; 
607       hdata=NULL;
608       for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
609
610       //check counters
611       Int_t emptymodules[2], filledmodules[2],emptyladders[2],filledladders[2],emptydriftregion[2], filleddriftregion[2], excludedmoduleperlayer[2], excludeddrperlayer[2], activemoduleperlayer[2],activedrperlayer[2],exactivemoduleperlayer[2],exactivedrperlayer[2];
612       Int_t excluded=0;            //excluded modules  
613       Int_t excludeddriftregion=0; //excluded single drift region
614       Int_t active=0;              //active modules  
615       Int_t activedriftregion=0;   //active single drift region
616       Int_t exactive=0;            //excluded modules but taking data
617       Int_t exactivedriftregion=0; //excluded single drift region but taking data   
618       Int_t empty=0;
619       Int_t filled=0;
620       Int_t emptydr=0;
621       Int_t filleddr=0;
622       //Int_t emptyactivemodule=0;
623       Int_t emptyactivemoduleperlayer[2];
624       //Int_t emptydractivemodule=0;
625       Int_t emptyactivedrperlayer[2];
626       Int_t emptysum=0;
627       Int_t emptydiff=0;
628       Int_t emptydrsum=0;
629       Int_t emptydrdiff=0;
630
631     for(Int_t i=0;i<2;i++)
632       {
633         emptymodules[i]=0; 
634         filledmodules[i]=0; 
635         emptyladders[i]=0; 
636         filledladders[i]=0; 
637         emptydriftregion[i]=0;
638         filleddriftregion[i]=0; 
639         excludedmoduleperlayer[i]=0;
640         excludeddrperlayer[i]=0;
641         activemoduleperlayer[i]=0;
642         activedrperlayer[i]=0;
643         exactivemoduleperlayer[i]=0;
644         exactivedrperlayer[i]=0;
645         emptyactivemoduleperlayer[i]=0;
646         emptyactivedrperlayer[i]=0;
647       }  
648
649     Int_t neventsrecpoints=0;
650
651       while( (hdata = dynamic_cast<TH1* >(next())) ){
652         if (hdata){
653           TString hname=hdata->GetName();
654
655           if(hname.Contains("SDDRecPointCheck"))
656             { 
657               neventsrecpoints=(Int_t)hdata->GetBinContent(1); 
658               //break;
659             }
660           else{continue;}
661         }//end if hdata
662       }//end while
663
664       next.Begin();
665
666         while((hdata=dynamic_cast<TH1* >(next()))){
667           if (hdata){
668             TString hname=hdata->GetName();
669             if(hname.Contains("_RelativeOccupancy")) {
670               Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
671               if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
672               if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
673               Int_t aboveThreshold = 0;
674               for(Int_t k=0; k<= ((Int_t)hdata->GetNbinsX()); k++) {
675                 if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(hdata->GetBinContent(k));
676               }
677               Float_t fractionAboveThreshold=0.;
678               if(hdata->GetEntries()>0.) fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries();
679               if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
680               if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
681               if(fractionAboveThreshold > fThresholdForRelativeOccupancy) { 
682                 sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
683                 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)"));
684                 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)"));
685               }
686             }
687             if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) {
688               //Float_t threshold = 0.;
689               if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
690               if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
691               Int_t belowThreshold = 0;
692               for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) {
693                 if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k));
694               }
695               Double_t fractionBelowThreshold =0.;
696               Double_t entries3=((TH1F *)hdata)->GetEntries();
697               if(entries3>0.001)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries3;
698               else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); }
699               if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
700               if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
701               if(fractionBelowThreshold > fThresholdForRelativeOccupancy) { 
702                 sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
703                 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)"));
704                 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)"));
705               }
706             }
707             if(hname.Contains("dedx")) {
708               if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
709               if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
710             }//end if dedx
711           if(hname.Contains("SDDModPatternRP")){
712             if(hname.Contains("NORM")) continue;
713             hmodule=(TH1*)hdata->Clone();
714             entries= hdata->GetEntries();
715             if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
716             else{
717               int modmax=hdata->GetNbinsX();
718               Double_t content=0;
719               Int_t llay=0;
720               for(Int_t i=1;i<=modmax;i++)
721                 {
722                   if(i<85)llay=0;
723                   else llay=1;
724                   content=hdata->GetBinContent(i);
725                   if(AliITSQADataMakerRec::AreEqual(content,0.))
726                     {
727                     empty++;
728                     emptymodules[llay]++;
729                     } 
730                   else 
731                     {
732                       filled++;
733                       filledmodules[llay]++;
734                     }
735                 }//end for
736               //output of the check at the level of the modules. Drift region in the following checks
737
738               AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
739               AliInfo(Form(" %s : Layer 3 empty modules %i \t filled modules %i",hname.Data(), emptymodules[0], filledmodules[0]));
740               AliInfo(Form(" %s : Layer 4 empty modules %i \t filled modules %i",hname.Data(), emptymodules[1], filledmodules[1]));
741             }//end else pattern entries !=0
742           } //modpattern (1d histogram)                 
743
744           if(hname.Contains("SDDModPatternL3RP") || hname.Contains("SDDModPatternL4RP")){if(hname.Contains("NORM"))continue;
745             Int_t layer=0;
746             if(hname.Contains("3"))layer=0;
747             else  if(hname.Contains("4"))layer=1;
748             entries2[layer]=hdata->GetEntries();
749             if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));
750               sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
751             else{
752               Int_t layer1=0;
753               if(hname.Contains("3"))layer1=0;
754               else  if(hname.Contains("4"))layer1=1;
755               TH2* htemp=dynamic_cast<TH2*>(hdata);
756               if(htemp){
757                 hlayer[layer1]=(TH2*)htemp->Clone();
758                 hlayer[layer1]->SetName(Form("%s_copy",hname.Data()));
759                 //hlayer[layer1]->RebinX(2);
760                 int modmay=hlayer[layer1]->GetNbinsY();
761                 TH1D* hproj= hlayer[layer1]->ProjectionY();
762                 Double_t ladcontent=0;
763                 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
764                   ladcontent=hproj->GetBinContent(i);
765                   if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
766                   else filledladders[layer1]++;}//end for
767                 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer1], filledladders[layer1]));//end else layer 3
768                 delete hproj;
769                 hproj=NULL;
770               }//end if htemp
771             }//end else entries !=0
772           }//end check on phiz
773           }//end if hdata
774         }//end while                            
775       for(Int_t ii=0;ii<2;ii++)
776         {
777           filledmodules[ii]=0;
778           emptymodules[ii]=0;
779         }
780       filled=0;
781       empty=0;
782       if(AliITSQADataMakerRec::AreEqual(entries,0.)&& AliITSQADataMakerRec::AreEqual(entries2[0],0.)&& AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
783       //else{
784       if(hmodule || (hlayer[0] && hlayer[1])){
785         for(Int_t imod=0;imod<fgknSDDmodules;imod++){
786           Int_t lay=0;
787           Int_t lad=0;
788           Int_t det=0;
789           Int_t module=0;
790           module=imod+fgkmodoffset;
791           AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
792           if(cal==0) { continue;}
793           AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
794           if (cal->IsBad()){
795             excluded++;
796             excludedmoduleperlayer[lay-3]++;
797             Double_t content=0.;
798             //Double_t contentlayer[2];
799             //for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
800             if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram will be stored in the QA file otherwise the histogram will not be written on the logbook
801             //      if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
802             if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE) {
803               filledmodules[lay-3]++;
804               filled++;
805               AliError(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition,has recpoints \n ",module,lay,lad,det));
806               exactive++;
807               exactivemoduleperlayer[lay-3]++;
808             } else if(AliITSQADataMakerRec::AreEqual(content,0.)) 
809               {
810                 emptymodules[lay-3]++; //it has to be empty
811                 empty++;
812               }
813           } else {
814             Int_t totside=0;
815             Int_t totactiveside=0;
816             //Int_t totbadside=0;
817             Double_t contentgood=0.;
818
819             for(Int_t i=0;i<2;i++){
820               if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(2*det+i-1,lad);
821               if(cal->IsWingBad(i))
822                 { 
823                   excludeddriftregion++; 
824                   excludeddrperlayer[lay-3]++; 
825                   if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kFALSE){
826                     AliError(Form("The side %d of the module %d (layer %i, ladder %i det %i ) excluded from the acquisition, has recpoints \n ",i,module,lay,lad,det));
827                     exactivedriftregion++; 
828                     exactivedrperlayer[lay-3]++;
829                     filleddr++;
830                     filleddriftregion[lay-3]++;
831                   }
832                 }//end wingbad
833               else{
834                 if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kTRUE)
835                   {
836                     AliWarning(Form("The side %d of the module %d (layer %i, ladder %i det %i ) is in acquisition, but no recpoints are present\n ",i,module, lay, lad, det));
837                   }
838                 else 
839                   {
840                     totside++;
841                   }
842                 totactiveside++;
843               }
844             }//end for
845             if(totside==0){
846             AliWarning(Form("The  module %d (layer %i, ladder %i det %i ) is in acquisition, but no recpoints are present \n ",module, lay, lad, det));
847               emptymodules[lay-3]++;
848               empty++;
849
850             }
851               else 
852                 if(totside==2){
853                 filledmodules[lay-3]++;
854                 filled++;
855                 }
856                 else
857                   if(totside==1)
858                     {
859                       //                      emptydr++;
860                       //emptydriftregion[lay-3]++; //it has to be empty
861                       emptydriftregion[lay-3]++; 
862                       emptydr++;
863                       filleddr++;
864                       filleddriftregion[lay-3]++;
865                     }
866             if(totactiveside==1)
867               {
868                 activedriftregion++;
869                 activedrperlayer[lay-3]++;
870               }else if(totactiveside==2)
871               {
872                 active++;
873                 activemoduleperlayer[lay-3]++;
874               }
875
876           }
877         }//end for
878         AliInfo(Form("In total %d modules and %d single drift regions have recpoints.\n ",filled, filleddr));
879         AliInfo(Form("In total %d modules and %d single drift regions are empty\n",empty, emptydr));
880         for(Int_t i=0;i<2;i++)
881           {
882             AliInfo(Form("Layer %i   \tempty modules %i             \t filled modules %i\n", i+3,emptymodules[i], filledmodules[i]));
883             AliInfo(Form("Layer %i   \tempty single drift regions %i \t filled single drift regions %i\n",i+3,emptydriftregion[i], filleddriftregion[i]));
884           }//end else layers
885         emptysum=emptymodules[0]+emptymodules[1];
886         emptydiff=emptysum-excluded;
887         emptyactivemoduleperlayer[0]=emptymodules[0]- excludedmoduleperlayer[0];
888         emptyactivemoduleperlayer[1]=emptymodules[1]- excludedmoduleperlayer[1];
889
890         emptydrsum=emptydriftregion[0]+emptydriftregion[1];
891         emptydrdiff=emptydrsum-excludeddriftregion;
892         emptyactivedrperlayer[0]=emptydriftregion[0]- excludeddrperlayer[0];
893         emptyactivedrperlayer[1]=emptydriftregion[1]- excludeddrperlayer[1];
894
895         Int_t numlimit=1000;
896         if(emptysum>excluded||emptydrsum>excludeddriftregion){ 
897           AliWarning(Form(" %i good module(s) and %i good single drift regions have not recpoints! \n",emptydiff,emptydrdiff));
898           AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions have not recpoints! \n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
899           AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions have not recpoints! \n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
900           
901           //sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
902           Int_t numlimits=1000;   
903
904           results1.Form("%i good module(s) and %i good drift region(s) have not recpoints!",emptydiff,emptydrdiff);
905           //      if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kFALSE)
906           if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())!=AliRecoParam::kCosmic){     
907             
908               if(neventsrecpoints<numlimits)
909                 {
910                   results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsrecpoints);
911                   color=5;
912                   sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
913                 }
914               else
915                 {
916                   results2.Form(" Events %d .If PHYSICS, follow the TWiki instruction and call the Expert ",neventsrecpoints);
917                   color=2;
918                   sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
919                 }
920             }
921           else
922             //if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kTRUE)
923             if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())==AliRecoParam::kCosmic){     
924                 numlimit=10000;
925                 if( neventsrecpoints<numlimit)
926                   {
927                     AliWarning(Form("This is a cosmic run. Some module and drift region are empty but all is OK. "));
928                     results1.Form("OK. Thi is a cosmic run. You need a lot of events. Events %i",neventsrecpoints);
929                     results2.Form("%i good module(s) and %i good drift are empty! DO NOT CALL THE EXPERT",emptydiff,emptydrdiff);
930                     color=5;
931                     sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
932                   }
933                 else
934                   {
935                     results1.Form("%i good module(s) and %i good drift region(s) have not recpoints!",emptydiff,emptydrdiff);
936                     results2.Form("Cosmic Events %d .Follow the TWiki instruction and call the Expert ",neventsrecpoints);
937                     color=2;
938                     sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
939                   }
940               }
941         }
942         
943       
944
945         if(exactive==0 && emptydiff==0 && exactivedriftregion==0 && emptydrdiff==0){
946           AliInfo(Form("All the active modules (%i) and single drift regions (%i) are in acquisition. The number of excluded modules are %i and the excluded single drift regions are %i\n",active,activedriftregion,excluded,excludeddriftregion));
947           results1.Form("OK.");
948           results2.Form(" All active modules have recpoints");
949           color=3;
950           sddQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
951         }
952         if(exactive!=0||exactivedriftregion!=0){
953           AliError(Form("%i modules and %i single  drift regions excluded from the acquisition have recpoints. Active modules %i single drift region %i \n ",exactive,exactivedriftregion,active,activedriftregion));
954           AliError(Form("Layer 3: %i modules and %i single  drift regions excluded from the acquisition have recpoints. Active modules %i single drift region %i \n ",exactivemoduleperlayer[0],exactivedrperlayer[0],activemoduleperlayer[0],activedrperlayer[0]));
955           AliError(Form("Layer 3: %i modules and %i single  drift regions excluded from the acquisition have recpoints. Active modules %i single drift region %i \n ",exactivemoduleperlayer[1],exactivedrperlayer[1],activemoduleperlayer[1],activedrperlayer[1]));
956           results1.Form("%i modules and %i drift region excluded from the acquisition have recpoints",exactive,exactivedriftregion);
957           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
958           color=2;      
959           sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
960         }
961         if(excluded==exactive||excludeddriftregion==exactivedriftregion){
962           AliError(Form("All the modules (%d) or single drift regions (%d) excluded from the acquisition have recpoints!\n  Active modules %i \t Active drfift regions %i\n",excluded,excludeddriftregion,active,activedriftregion));
963           results1.Form("All the modules (%d) or drift regions (%d) excluded from the acquisition have recpoints!",excluded,excludeddriftregion );
964           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
965           color=6;
966           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
967         }
968         if(active==0||activedriftregion==0){
969           AliError(Form("No modules or single drift regions have recpoints: excluded %i \t excluded active %i \n\t\t excluded single drift regions %i \t excluded active drift regions %i \n", excluded, exactive, excludeddriftregion, exactivedriftregion)); 
970           results1.Form("No modules or drift region have recpoints: excluded modules %i  excluded drift regions %i ", excluded, excludeddriftregion );
971           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
972           color=6;
973           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
974         }
975
976         //TPaveText *pave[2]={0,0};
977         next.Begin();
978
979         while( (hdata=dynamic_cast<TH1* >(next())) )
980           {
981             if (hdata){
982               TString hname=hdata->GetName();
983               if(hname.Contains("SDDModPatternL3RP") || hname.Contains("SDDModPatternL4RP")){
984                 if(hname.Contains("NORM"))continue;
985                 //AliInfo("========================================Found histo 11\n");
986                           TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave"));
987                           ptext->Clear();
988                           ptext->AddText(results1.Data());
989                           ptext->AddText(results2.Data());
990               }
991               else
992                 if(hname.Contains("SDDRecPointCheck"))
993                   {
994                     
995                     //AliInfo("========================================Found histo\n");
996                     ((TH1F*)hdata)->SetBinContent(5,active);
997                     ((TH1F*)hdata)->SetBinContent(6,filled);
998                     ((TH1F*)hdata)->SetBinContent(7,activedriftregion);
999                     ((TH1F*)hdata)->SetBinContent(8,filleddr);
1000                     ((TH1F*)hdata)->SetBinContent(9,excluded);
1001                     ((TH1F*)hdata)->SetBinContent(10,empty);
1002                     ((TH1F*)hdata)->SetBinContent(11,excludeddriftregion);
1003                     ((TH1F*)hdata)->SetBinContent(12,emptydr);
1004                     ((TH1F*)hdata)->SetBinContent(13,exactive);
1005                     ((TH1F*)hdata)->SetBinContent(14,emptydiff);
1006                     ((TH1F*)hdata)->SetBinContent(15,exactivedriftregion);
1007                     ((TH1F*)hdata)->SetBinContent(16,emptydrdiff);
1008                     
1009                     //layer 3
1010                     ((TH1F*)hdata)->SetBinContent(19,activemoduleperlayer[0]);
1011                     ((TH1F*)hdata)->SetBinContent(20,filledmodules[0]);
1012                     ((TH1F*)hdata)->SetBinContent(21,activedrperlayer[0]);
1013                     ((TH1F*)hdata)->SetBinContent(22,filleddriftregion[0]);
1014                     ((TH1F*)hdata)->SetBinContent(23,excludedmoduleperlayer[0]);
1015                     ((TH1F*)hdata)->SetBinContent(24,emptymodules[0]);
1016                     ((TH1F*)hdata)->SetBinContent(25,excludeddrperlayer[0]);
1017                     ((TH1F*)hdata)->SetBinContent(26,emptydriftregion[0]);
1018                     ((TH1F*)hdata)->SetBinContent(27,exactivemoduleperlayer[0]);
1019                     ((TH1F*)hdata)->SetBinContent(28,emptyactivemoduleperlayer[0]);
1020                     ((TH1F*)hdata)->SetBinContent(29,exactivedrperlayer[0]);
1021                     ((TH1F*)hdata)->SetBinContent(30,emptyactivedrperlayer[0]);
1022                     
1023                     //layer 4
1024                     ((TH1F*)hdata)->SetBinContent(35,activemoduleperlayer[1]);
1025                     ((TH1F*)hdata)->SetBinContent(36,filledmodules[1]);
1026                     ((TH1F*)hdata)->SetBinContent(37,activedrperlayer[1]);
1027                     ((TH1F*)hdata)->SetBinContent(38,filleddriftregion[1]);
1028                     ((TH1F*)hdata)->SetBinContent(39,excludedmoduleperlayer[1]);
1029                     ((TH1F*)hdata)->SetBinContent(40,emptymodules[1]);
1030                     ((TH1F*)hdata)->SetBinContent(41,excludeddrperlayer[1]);
1031                     ((TH1F*)hdata)->SetBinContent(42,emptydriftregion[1]);
1032                     ((TH1F*)hdata)->SetBinContent(43,exactivemoduleperlayer[1]);
1033                     ((TH1F*)hdata)->SetBinContent(44,emptyactivemoduleperlayer[1]);
1034                     ((TH1F*)hdata)->SetBinContent(45,exactivedrperlayer[1]);
1035                     ((TH1F*)hdata)->SetBinContent(46,emptyactivedrperlayer[1]);
1036                     //hdata->GetListOfFunctions()->Add(pave[0]);
1037                     
1038                   }
1039             }//if hadata
1040             
1041           }//end while 
1042         
1043       }//end else 
1044       delete hmodule;
1045       hmodule=NULL;
1046       for(Int_t i=0;i<2;i++) {
1047         delete hlayer[i];
1048         hlayer[i]=NULL;
1049       }//end for      
1050
1051
1052       //sddQACheckerValue=1.;
1053       }//end recpoint list uid = 20
1054       if(uidrec==40)
1055         {
1056           //digitsr
1057           if (list->GetEntries() == 0){ 
1058             sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1059             break;
1060           } else{
1061         
1062             while( (hdata = dynamic_cast<TH1* >(next())) ){
1063               if (hdata){
1064                 if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1065                 else {
1066                   TString hname=hdata->GetName();
1067                   if(hname.Contains("SDD DIGITS Module Pattern")) {
1068                     //see raws
1069                 
1070                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1071                   } else if(hname.Contains("SDD Anode Distribution")) {
1072                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1073                   } else if(hname.Contains("SDD Tbin Distribution")) {
1074                     //to do as rp
1075                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1076                   } else if(hname.Contains("SDD ADC Counts Distribution")) {
1077                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1078                   }//end adc counts
1079               
1080                 }//end entries !=0
1081               }//end hdata
1082             }//end while
1083           }//end else
1084           sddQACheckerValue=1.;
1085         }
1086
1087     }
1088     break;
1089   case AliQAv1::kANA:
1090     {
1091       AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
1092       sddQACheckerValue=1.; 
1093     }
1094     break;
1095   case AliQAv1::kESD:
1096     {
1097       AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index)));
1098       sddQACheckerValue=1.;
1099     } 
1100     break;
1101   case AliQAv1::kNTASK:{
1102     AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
1103     sddQACheckerValue=1.;
1104   }
1105     break;
1106   case AliQAv1::kSIM:{
1107     AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index))); 
1108     Int_t uid=list->GetUniqueID();
1109     if(uid==60) {
1110       //digits
1111       if (list->GetEntries() == 0){ 
1112         sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1113         break;
1114       } else{
1115         
1116         while( (hdata = dynamic_cast<TH1* >(next())) ){
1117           if (hdata){
1118             if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1119             else {
1120               TString hname=hdata->GetName();
1121               if(hname.Contains("SDDDIGITSModulePattern")) {
1122                 //see raws
1123                 
1124                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1125               } else if(hname.Contains("SDDAnodeDistribution")) {
1126                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1127               } else if(hname.Contains("SDDTbinDistribution")) {
1128                 //to do as rp
1129                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1130               } else if(hname.Contains("SDDADCCountsDistribution")) {
1131                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1132               }//end adc counts
1133               
1134             }//end entries !=0
1135           }//end hdata
1136         }//end while
1137       }//end else
1138     } else if(uid==50) 
1139       {
1140         //hits
1141         if (list->GetEntries() == 0){ 
1142           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1143           break;
1144         } 
1145         else{
1146           
1147           while( (hdata = dynamic_cast<TH1* >(next())) ){
1148             if (hdata){
1149               if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1150               else {
1151                 TString hname=hdata->GetName();
1152                 if(hname.Contains("SDDHITSModulePattern")) {
1153                   //to do as raws
1154                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1155                 } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
1156                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1157                 } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
1158                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1159                 } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
1160                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1161                 }//end deposited energy
1162                 
1163               }//end entries !=0
1164             }//end hdata
1165           }//end while
1166         }//end else
1167       } else if(uid==70) 
1168       {
1169         //sdigits
1170         if (list->GetEntries() == 0){ 
1171           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1172           break;
1173         } else{
1174           
1175           while( (hdata = dynamic_cast<TH1* >(next())) ){
1176             if (hdata){
1177               if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1178               else {
1179                 TString hname=hdata->GetName();
1180                 if(hname.Contains("SDDSDIGITSModulePattern")) {
1181                   //to do as raws
1182                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1183                 } else if(hname.Contains("SDDAnodeDistribution")) {
1184                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1185                 } else if(hname.Contains("SDDTbinDistribution")) {
1186                   //to do as rp
1187                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1188                 } else if(hname.Contains("SDDADCCountsDistribution")) {
1189                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1190                 }//end adc counts bindistribution
1191               }//end entries !=0
1192                         
1193             }//end hdata
1194           }//end while
1195         }//end else
1196       }//end sdigits
1197     sddQACheckerValue=1.;
1198   }
1199     break;
1200     
1201   }//end switch
1202   
1203   fCalibration=NULL;
1204   return sddQACheckerValue;     
1205 }
1206
1207 //__________________________________________________________________
1208 void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
1209 {
1210   //set the number of the histograms already present in the list before the SDD histograms
1211   fSubDetOffset = taskoffset;
1212 }
1213
1214
1215 //__________________________________________________________________
1216 void AliITSQASDDChecker::SetStepBit(const Double_t *steprange)
1217 {
1218   //set the values of the step bit for each QA bit range calculated in the AliITSQAChecker class
1219   //if(fStepBitSDD){/*delete fStepBitSDD;*/ fStepBitSDD=NULL;}
1220   //fStepBitSDD = new Double_t[AliQAv1::kNBIT];
1221   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
1222     {
1223       fStepBitSDD[bit]=steprange[bit];
1224     }
1225 }
1226
1227 //__________________________________________________________________
1228 void  AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue)
1229 {
1230   //set the low and high values in for each QA bit range calculated in the AliITSQAChecker class
1231   //  fLowSDDValue = new Float_t[AliQAv1::kNBIT];
1232   //  fHighSDDValue= new Float_t[AliQAv1::kNBIT];
1233
1234   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
1235     {
1236       fLowSDDValue[bit]=lowvalue[bit];
1237       fHighSDDValue[bit]= highvalue[bit];
1238     }
1239
1240 }
1241 //__________________________________________________________________
1242 Bool_t  AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
1243 {
1244   //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used
1245   //
1246         Bool_t rval=kFALSE;
1247     fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
1248   switch(task)
1249     {
1250     case AliQAv1::kRAWS:{
1251       rval=MakeSDDRawsImage(list, task,mode);
1252     }
1253       break;
1254     case AliQAv1::kRECPOINTS:{ rval=MakeSDDRecPointsImage(list, task,mode); }
1255       break;
1256     case AliQAv1::kHITS:; case AliQAv1::kESDS:; case AliQAv1::kDIGITS:;case AliQAv1::kDIGITSR:;case AliQAv1::kSDIGITS:;case AliQAv1::kTRACKSEGMENTS:;case AliQAv1::kRECPARTICLES:; default:
1257     {
1258        rval=kFALSE;
1259        //AliQAChecker::Instance()->GetDetQAChecker(0)->MakeImage(list,task,mode);
1260     }
1261     break;
1262     case AliQAv1::kNULLTASKINDEX:; case  AliQAv1::kNTASKINDEX: 
1263       {AliWarning(Form("No histograms for this task ( %s ) \n", AliQAv1::GetTaskName(task).Data())); rval=kFALSE;}
1264       break;
1265     }
1266 return rval;  
1267 }
1268
1269
1270 //_______________________________________________________________________
1271 Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
1272 {
1273   // MakeSDDRawsImage: raw data QA plots
1274
1275         for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
1276                 //printf("-------------------------> %i \n", esIndex);
1277                 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0)  {
1278                         //printf ("Nothing for %s \n", AliRecoParam::GetEventSpecieName(esIndex));
1279                         continue;
1280                 } else {
1281                         const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
1282                         if ( !fImage[esIndex] ) {
1283                                 fImage[esIndex] = new TCanvas(title, title,1280,980) ;
1284                         }
1285                         fImage[esIndex]->Clear() ; 
1286                         fImage[esIndex]->SetTitle(title) ; 
1287                         fImage[esIndex]->cd();
1288                         fPaveText[esIndex] = new TPaveText(0.015, 0.015, 0.98, 0.98);
1289                         fPaveText[esIndex]->AddText(title);
1290                         fPaveText[esIndex]->Draw(); 
1291                         fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1292                         fImage[esIndex]->Clear() ; 
1293                         Int_t nx =2;//TMath::Nint(TMath::Sqrt(nImages));//2
1294                         Int_t ny =3;//nx  ; //2
1295                         // if (nx < TMath::Sqrt(nImages))
1296                         // ny++ ;  
1297                         fImage[esIndex]->Divide(nx, ny) ; 
1298                         TIter nexthist(list[esIndex]) ; 
1299                         Int_t npad = 1 ; 
1300                         fImage[esIndex]->cd(npad); 
1301                         fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
1302                         Int_t nhist = 0;
1303                         while ( 1 ) {
1304                                 TH1* hist = static_cast<TH1*>(nexthist());
1305                                 if(hist == NULL) break;
1306                                 nhist++;
1307                                 TString hname(hist->GetName());
1308
1309                                 //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
1310                                 TString cln(hist->ClassName()) ; 
1311                                 if ( ! cln.Contains("TH") )
1312                                         continue ;
1313           
1314                                 if(hist->TestBit(AliQAv1::GetImageBit())) {
1315                                         hist->GetXaxis()->SetTitleSize(0.04);
1316                                         hist->GetYaxis()->SetTitleSize(0.04);
1317                                         hist->GetXaxis()->SetLabelSize(0.02);
1318                                         hist->GetYaxis()->SetLabelSize(0.02);
1319                                         if(cln.Contains("TH2")) {
1320                                                 gPad->SetRightMargin(0.15);
1321                                                 gPad->SetLeftMargin(0.05);
1322                                                 hist->SetStats(0);
1323                                                 hist->SetOption("colz") ;
1324
1325                                                 ////hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025);
1326                                                 //gPad->Update();
1327                                         }
1328                                         hist->DrawCopy(); 
1329                                         fImage[esIndex]->cd(++npad) ; 
1330                                         fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
1331                                 } 
1332                         }
1333                         fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1334                 }
1335         }
1336         return kTRUE;
1337 }
1338
1339
1340
1341
1342 //_______________________________________________________________________
1343 Bool_t AliITSQASDDChecker::MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
1344 {
1345   // MakeSDDRecPointsImage: rec point QA plots
1346
1347     for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
1348       if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) 
1349         {
1350         //printf ("Nothing for %s \n", AliQAv1::GetTaskName(task).Data()); 
1351         continue;
1352         }
1353       const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
1354       if ( !fImage[esIndex] ) {
1355         fImage[esIndex] = new TCanvas(title, title,1280,980) ;
1356       }
1357       fImage[esIndex]->Clear() ; 
1358       fImage[esIndex]->SetTitle(title) ; 
1359       fImage[esIndex]->cd();
1360       fImage[esIndex]->SetBorderMode(0) ;  
1361       TPaveText someText(0.015, 0.015, 0.98, 0.98);
1362       someText.AddText(title);
1363       someText.Draw(); 
1364       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1365       fImage[esIndex]->Clear() ; 
1366       Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
1367       Int_t ny =6; // nx  ; 
1368       //if (nx < TMath::Sqrt(nImages))
1369       //ny++ ;  
1370       fImage[esIndex]->Divide(nx, ny) ; 
1371       TIter nexthist(list[esIndex]) ; 
1372       TH1* hist = NULL ;
1373       Int_t npad = 1 ; 
1374       fImage[esIndex]->cd(npad) ; 
1375       fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
1376       while ( (hist=static_cast<TH1*>(nexthist())) ) {
1377         //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
1378         TString cln(hist->ClassName()) ;
1379
1380         TString hname(hist->GetName());
1381                   
1382                   //printf("=====================> Class name %s \n",cln.Data()); 
1383         if ( ! cln.Contains("TH") )
1384           continue ;
1385         if(hist->TestBit(AliQAv1::GetImageBit())) {
1386             hist->GetXaxis()->SetTitleSize(0.04);
1387             hist->GetYaxis()->SetTitleSize(0.04);
1388             hist->GetXaxis()->SetLabelSize(0.02);
1389             hist->GetYaxis()->SetLabelSize(0.02);
1390           if(cln.Contains("TH1"))
1391             {
1392               if(!hname.Contains("Check")) hist->SetFillColor(kOrange+7);
1393               //SetFrameFillColor(kAzure-9);
1394               //hist->DrawCopy() ; 
1395             }
1396           if(cln.Contains("TH2"))
1397             {
1398               gPad->SetRightMargin(0.15);
1399               gPad->SetLeftMargin(0.05);
1400               hist->SetStats(0);
1401               hist->SetOption("colz") ;
1402               ////            TPaletteAxis *paletta =(TPaletteAxis*)hist->GetListOfFunctions()->FindObject("palette");
1403               //paletta->SetLabelSize(0.025);
1404               //gPad->Update(); 
1405             }
1406
1407                         hist->DrawCopy(); 
1408                         fImage[esIndex]->cd(++npad) ; 
1409                         fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
1410                 }
1411       }
1412       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1413     }
1414    return kTRUE;
1415 }