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