]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSQASDDChecker.cxx
bugfix: correct range of DDL for specified detector
[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*)htemp->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                                 ptext->SetFillColor(color);
526               } else if(hname.Contains("SDDRawDataCheck")) {
527                     
528                           //AliInfo("========================================Found histo\n");
529                           ((TH1F*)hdata)->SetBinContent(5,active);
530                           ((TH1F*)hdata)->SetBinContent(6,filled);
531                           ((TH1F*)hdata)->SetBinContent(7,activedriftregion);
532                           ((TH1F*)hdata)->SetBinContent(8,filleddr);
533                           ((TH1F*)hdata)->SetBinContent(9,excluded);
534                           ((TH1F*)hdata)->SetBinContent(10,empty);
535                           ((TH1F*)hdata)->SetBinContent(11,excludeddriftregion);
536                           ((TH1F*)hdata)->SetBinContent(12,emptydr);
537                           ((TH1F*)hdata)->SetBinContent(13,exactive);
538                           ((TH1F*)hdata)->SetBinContent(14,emptydiff);
539                           ((TH1F*)hdata)->SetBinContent(15,exactivedriftregion);
540                           ((TH1F*)hdata)->SetBinContent(16,emptydrdiff);
541                     
542                           //layer 3
543                           ((TH1F*)hdata)->SetBinContent(19,activemoduleperlayer[0]);
544                           ((TH1F*)hdata)->SetBinContent(20,filledmodules[0]);
545                           ((TH1F*)hdata)->SetBinContent(21,activedrperlayer[0]);
546                           ((TH1F*)hdata)->SetBinContent(22,filleddriftregion[0]);
547                           ((TH1F*)hdata)->SetBinContent(23,excludedmoduleperlayer[0]);
548                           ((TH1F*)hdata)->SetBinContent(24,emptymodules[0]);
549                           ((TH1F*)hdata)->SetBinContent(25,excludeddrperlayer[0]);
550                           ((TH1F*)hdata)->SetBinContent(26,emptydriftregion[0]);
551                           ((TH1F*)hdata)->SetBinContent(27,exactivemoduleperlayer[0]);
552                           ((TH1F*)hdata)->SetBinContent(28,emptyactivemoduleperlayer[0]);
553                           ((TH1F*)hdata)->SetBinContent(29,exactivedrperlayer[0]);
554                           ((TH1F*)hdata)->SetBinContent(30,emptyactivedrperlayer[0]);
555                     
556                           //layer 4
557                           ((TH1F*)hdata)->SetBinContent(33,activemoduleperlayer[1]);
558                           ((TH1F*)hdata)->SetBinContent(34,filledmodules[1]);
559                           ((TH1F*)hdata)->SetBinContent(35,activedrperlayer[1]);
560                           ((TH1F*)hdata)->SetBinContent(36,filleddriftregion[1]);
561                           ((TH1F*)hdata)->SetBinContent(37,excludedmoduleperlayer[1]);
562                           ((TH1F*)hdata)->SetBinContent(38,emptymodules[1]);
563                           ((TH1F*)hdata)->SetBinContent(39,excludeddrperlayer[1]);
564                           ((TH1F*)hdata)->SetBinContent(40,emptydriftregion[1]);
565                           ((TH1F*)hdata)->SetBinContent(41,exactivemoduleperlayer[1]);
566                           ((TH1F*)hdata)->SetBinContent(42,emptyactivemoduleperlayer[1]);
567                           ((TH1F*)hdata)->SetBinContent(43,exactivedrperlayer[1]);
568                           ((TH1F*)hdata)->SetBinContent(44,emptyactivedrperlayer[1]);
569                           //break; 
570                         }
571                 }//if hdata
572             
573         }//end while 
574         
575       }//end else 
576       delete hmodule;
577       hmodule=NULL;
578       for(Int_t i=0;i<2;i++) {
579         delete hlayer[i];
580         hlayer[i]=NULL;
581       }//end for
582
583     }//end raw
584       
585       break;
586       
587   case AliQAv1::kNULLTASK:{
588     AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
589     sddQACheckerValue=1.;
590   }
591     break;
592     
593   case AliQAv1::kREC:
594     {
595       Int_t uidrec=list->GetUniqueID();
596       AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index))); 
597       if(uidrec==20){
598         //recpoints
599         if (list->GetEntries() == 0){ //check if the list is empty
600           //printf("sddQACheckerValue = %f \t value %f\n",sddQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
601           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL]; 
602           //break;                      
603         }//end if getentries
604       
605
606       TH1 *hmodule=NULL;
607       TH2 *hlayer[2]; 
608       hdata=NULL;
609       for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
610
611       //check counters
612       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];
613       Int_t excluded=0;            //excluded modules  
614       Int_t excludeddriftregion=0; //excluded single drift region
615       Int_t active=0;              //active modules  
616       Int_t activedriftregion=0;   //active single drift region
617       Int_t exactive=0;            //excluded modules but taking data
618       Int_t exactivedriftregion=0; //excluded single drift region but taking data   
619       Int_t empty=0;
620       Int_t filled=0;
621       Int_t emptydr=0;
622       Int_t filleddr=0;
623       //Int_t emptyactivemodule=0;
624       Int_t emptyactivemoduleperlayer[2];
625       //Int_t emptydractivemodule=0;
626       Int_t emptyactivedrperlayer[2];
627       Int_t emptysum=0;
628       Int_t emptydiff=0;
629       Int_t emptydrsum=0;
630       Int_t emptydrdiff=0;
631
632     for(Int_t i=0;i<2;i++)
633       {
634         emptymodules[i]=0; 
635         filledmodules[i]=0; 
636         emptyladders[i]=0; 
637         filledladders[i]=0; 
638         emptydriftregion[i]=0;
639         filleddriftregion[i]=0; 
640         excludedmoduleperlayer[i]=0;
641         excludeddrperlayer[i]=0;
642         activemoduleperlayer[i]=0;
643         activedrperlayer[i]=0;
644         exactivemoduleperlayer[i]=0;
645         exactivedrperlayer[i]=0;
646         emptyactivemoduleperlayer[i]=0;
647         emptyactivedrperlayer[i]=0;
648       }  
649
650     Int_t neventsrecpoints=0;
651
652       while( (hdata = dynamic_cast<TH1* >(next())) ){
653         if (hdata){
654           TString hname=hdata->GetName();
655
656           if(hname.Contains("SDDRecPointCheck"))
657             { 
658               neventsrecpoints=(Int_t)hdata->GetBinContent(1); 
659               //break;
660             }
661           else{continue;}
662         }//end if hdata
663       }//end while
664
665       next.Begin();
666
667         while((hdata=dynamic_cast<TH1* >(next()))){
668           if (hdata){
669             TString hname=hdata->GetName();
670             if(hname.Contains("_RelativeOccupancy")) {
671               Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
672               if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
673               if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
674               Int_t aboveThreshold = 0;
675               for(Int_t k=0; k<= ((Int_t)hdata->GetNbinsX()); k++) {
676                 if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(hdata->GetBinContent(k));
677               }
678               Float_t fractionAboveThreshold=0.;
679               if(hdata->GetEntries()>0.) fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries();
680               if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
681               if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
682               if(fractionAboveThreshold > fThresholdForRelativeOccupancy) { 
683                 sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
684                 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)"));
685                 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)"));
686               }
687             }
688             if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) {
689               //Float_t threshold = 0.;
690               if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
691               if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
692               Int_t belowThreshold = 0;
693               for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) {
694                 if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k));
695               }
696               Double_t fractionBelowThreshold =0.;
697               Double_t entries3=((TH1F *)hdata)->GetEntries();
698               if(entries3>0.001)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries3;
699               else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); }
700               if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
701               if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
702               if(fractionBelowThreshold > fThresholdForRelativeOccupancy) { 
703                 sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
704                 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)"));
705                 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)"));
706               }
707             }
708             if(hname.Contains("dedx")) {
709               if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
710               if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
711             }//end if dedx
712           if(hname.Contains("SDDModPatternRP")){
713             if(hname.Contains("NORM")) continue;
714             hmodule=(TH1*)hdata->Clone();
715             entries= hdata->GetEntries();
716             if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
717             else{
718               int modmax=hdata->GetNbinsX();
719               Double_t content=0;
720               Int_t llay=0;
721               for(Int_t i=1;i<=modmax;i++)
722                 {
723                   if(i<85)llay=0;
724                   else llay=1;
725                   content=hdata->GetBinContent(i);
726                   if(AliITSQADataMakerRec::AreEqual(content,0.))
727                     {
728                     empty++;
729                     emptymodules[llay]++;
730                     } 
731                   else 
732                     {
733                       filled++;
734                       filledmodules[llay]++;
735                     }
736                 }//end for
737               //output of the check at the level of the modules. Drift region in the following checks
738
739               AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
740               AliInfo(Form(" %s : Layer 3 empty modules %i \t filled modules %i",hname.Data(), emptymodules[0], filledmodules[0]));
741               AliInfo(Form(" %s : Layer 4 empty modules %i \t filled modules %i",hname.Data(), emptymodules[1], filledmodules[1]));
742             }//end else pattern entries !=0
743           } //modpattern (1d histogram)                 
744
745           if(hname.Contains("SDDModPatternL3RP") || hname.Contains("SDDModPatternL4RP")){if(hname.Contains("NORM"))continue;
746             Int_t layer=0;
747             if(hname.Contains("3"))layer=0;
748             else  if(hname.Contains("4"))layer=1;
749             entries2[layer]=hdata->GetEntries();
750             if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));
751               sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
752             else{
753               Int_t layer1=0;
754               if(hname.Contains("3"))layer1=0;
755               else  if(hname.Contains("4"))layer1=1;
756               TH2* htemp=dynamic_cast<TH2*>(hdata);
757               if(htemp){
758                 hlayer[layer1]=(TH2*)htemp->Clone();
759                 hlayer[layer1]->SetName(Form("%s_copy",hname.Data()));
760                 //hlayer[layer1]->RebinX(2);
761                 int modmay=hlayer[layer1]->GetNbinsY();
762                 TH1D* hproj= hlayer[layer1]->ProjectionY();
763                 Double_t ladcontent=0;
764                 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
765                   ladcontent=hproj->GetBinContent(i);
766                   if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
767                   else filledladders[layer1]++;}//end for
768                 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer1], filledladders[layer1]));//end else layer 3
769                 delete hproj;
770                 hproj=NULL;
771               }//end if htemp
772             }//end else entries !=0
773           }//end check on phiz
774           }//end if hdata
775         }//end while                            
776       for(Int_t ii=0;ii<2;ii++)
777         {
778           filledmodules[ii]=0;
779           emptymodules[ii]=0;
780         }
781       filled=0;
782       empty=0;
783       if(AliITSQADataMakerRec::AreEqual(entries,0.)&& AliITSQADataMakerRec::AreEqual(entries2[0],0.)&& AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
784       //else{
785       if(hmodule || (hlayer[0] && hlayer[1])){
786         for(Int_t imod=0;imod<fgknSDDmodules;imod++){
787           Int_t lay=0;
788           Int_t lad=0;
789           Int_t det=0;
790           Int_t module=0;
791           module=imod+fgkmodoffset;
792           AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
793           if(cal==0) { continue;}
794           AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
795           if (cal->IsBad()){
796             excluded++;
797             excludedmoduleperlayer[lay-3]++;
798             Double_t content=0.;
799             //Double_t contentlayer[2];
800             //for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
801             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
802             //      if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
803             if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE) {
804               filledmodules[lay-3]++;
805               filled++;
806               AliError(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition,has recpoints \n ",module,lay,lad,det));
807               exactive++;
808               exactivemoduleperlayer[lay-3]++;
809             } else if(AliITSQADataMakerRec::AreEqual(content,0.)) 
810               {
811                 emptymodules[lay-3]++; //it has to be empty
812                 empty++;
813               }
814           } else {
815             Int_t totside=0;
816             Int_t totactiveside=0;
817             //Int_t totbadside=0;
818             Double_t contentgood=0.;
819
820             for(Int_t i=0;i<2;i++){
821               if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(2*det+i-1,lad);
822               if(cal->IsWingBad(i))
823                 { 
824                   excludeddriftregion++; 
825                   excludeddrperlayer[lay-3]++; 
826                   if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kFALSE){
827                     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));
828                     exactivedriftregion++; 
829                     exactivedrperlayer[lay-3]++;
830                     filleddr++;
831                     filleddriftregion[lay-3]++;
832                   }
833                 }//end wingbad
834               else{
835                 if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kTRUE)
836                   {
837                     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));
838                   }
839                 else 
840                   {
841                     totside++;
842                   }
843                 totactiveside++;
844               }
845             }//end for
846             if(totside==0){
847             AliWarning(Form("The  module %d (layer %i, ladder %i det %i ) is in acquisition, but no recpoints are present \n ",module, lay, lad, det));
848               emptymodules[lay-3]++;
849               empty++;
850
851             }
852               else 
853                 if(totside==2){
854                 filledmodules[lay-3]++;
855                 filled++;
856                 }
857                 else
858                   if(totside==1)
859                     {
860                       //                      emptydr++;
861                       //emptydriftregion[lay-3]++; //it has to be empty
862                       emptydriftregion[lay-3]++; 
863                       emptydr++;
864                       filleddr++;
865                       filleddriftregion[lay-3]++;
866                     }
867             if(totactiveside==1)
868               {
869                 activedriftregion++;
870                 activedrperlayer[lay-3]++;
871               }else if(totactiveside==2)
872               {
873                 active++;
874                 activemoduleperlayer[lay-3]++;
875               }
876
877           }
878         }//end for
879         AliInfo(Form("In total %d modules and %d single drift regions have recpoints.\n ",filled, filleddr));
880         AliInfo(Form("In total %d modules and %d single drift regions are empty\n",empty, emptydr));
881         for(Int_t i=0;i<2;i++)
882           {
883             AliInfo(Form("Layer %i   \tempty modules %i             \t filled modules %i\n", i+3,emptymodules[i], filledmodules[i]));
884             AliInfo(Form("Layer %i   \tempty single drift regions %i \t filled single drift regions %i\n",i+3,emptydriftregion[i], filleddriftregion[i]));
885           }//end else layers
886         emptysum=emptymodules[0]+emptymodules[1];
887         emptydiff=emptysum-excluded;
888         emptyactivemoduleperlayer[0]=emptymodules[0]- excludedmoduleperlayer[0];
889         emptyactivemoduleperlayer[1]=emptymodules[1]- excludedmoduleperlayer[1];
890
891         emptydrsum=emptydriftregion[0]+emptydriftregion[1];
892         emptydrdiff=emptydrsum-excludeddriftregion;
893         emptyactivedrperlayer[0]=emptydriftregion[0]- excludeddrperlayer[0];
894         emptyactivedrperlayer[1]=emptydriftregion[1]- excludeddrperlayer[1];
895
896         Int_t numlimit=1000;
897         if(emptysum>excluded||emptydrsum>excludeddriftregion){ 
898           AliWarning(Form(" %i good module(s) and %i good single drift regions have not recpoints! \n",emptydiff,emptydrdiff));
899           AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions have not recpoints! \n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
900           AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions have not recpoints! \n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
901           
902           //sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
903           Int_t numlimits=1000;   
904
905           results1.Form("%i good module(s) and %i good drift region(s) have not recpoints!",emptydiff,emptydrdiff);
906           //      if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kFALSE)
907           if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())!=AliRecoParam::kCosmic){     
908             
909               if(neventsrecpoints<numlimits)
910                 {
911                   results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsrecpoints);
912                   color=5;
913                   sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
914                 }
915               else
916                 {
917                   results2.Form(" Events %d .If PHYSICS, follow the TWiki instruction and call the Expert ",neventsrecpoints);
918                   color=2;
919                   sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
920                 }
921             }
922           else
923             //if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kTRUE)
924             if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())==AliRecoParam::kCosmic){     
925                 numlimit=10000;
926                 if( neventsrecpoints<numlimit)
927                   {
928                     AliWarning(Form("This is a cosmic run. Some module and drift region are empty but all is OK. "));
929                     results1.Form("OK. Thi is a cosmic run. You need a lot of events. Events %i",neventsrecpoints);
930                     results2.Form("%i good module(s) and %i good drift are empty! DO NOT CALL THE EXPERT",emptydiff,emptydrdiff);
931                     color=5;
932                     sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
933                   }
934                 else
935                   {
936                     results1.Form("%i good module(s) and %i good drift region(s) have not recpoints!",emptydiff,emptydrdiff);
937                     results2.Form("Cosmic Events %d .Follow the TWiki instruction and call the Expert ",neventsrecpoints);
938                     color=2;
939                     sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
940                   }
941               }
942         }
943         
944       
945
946         if(exactive==0 && emptydiff==0 && exactivedriftregion==0 && emptydrdiff==0){
947           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));
948           results1.Form("OK.");
949           results2.Form(" All active modules have recpoints");
950           color=3;
951           sddQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
952         }
953         if(exactive!=0||exactivedriftregion!=0){
954           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));
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[0],exactivedrperlayer[0],activemoduleperlayer[0],activedrperlayer[0]));
956           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]));
957           results1.Form("%i modules and %i drift region excluded from the acquisition have recpoints",exactive,exactivedriftregion);
958           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
959           color=2;      
960           sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
961         }
962         if(excluded==exactive||excludeddriftregion==exactivedriftregion){
963           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));
964           results1.Form("All the modules (%d) or drift regions (%d) excluded from the acquisition have recpoints!",excluded,excludeddriftregion );
965           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
966           color=6;
967           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
968         }
969         if(active==0||activedriftregion==0){
970           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)); 
971           results1.Form("No modules or drift region have recpoints: excluded modules %i  excluded drift regions %i ", excluded, excludeddriftregion );
972           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
973           color=6;
974           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
975         }
976
977         //TPaveText *pave[2]={0,0};
978         next.Begin();
979
980         while( (hdata=dynamic_cast<TH1* >(next())) )
981           {
982             if (hdata){
983               TString hname=hdata->GetName();
984               if(hname.Contains("SDDModPatternL3RP") || hname.Contains("SDDModPatternL4RP")){
985                 if(hname.Contains("NORM"))continue;
986                 //AliInfo("========================================Found histo 11\n");
987                           TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave"));
988                           ptext->Clear();
989                           ptext->AddText(results1.Data());
990                           ptext->AddText(results2.Data());
991                           ptext->SetFillColor(color);
992               }
993               else
994                 if(hname.Contains("SDDRecPointCheck"))
995                   {
996                     
997                     //AliInfo("========================================Found histo\n");
998                     ((TH1F*)hdata)->SetBinContent(5,active);
999                     ((TH1F*)hdata)->SetBinContent(6,filled);
1000                     ((TH1F*)hdata)->SetBinContent(7,activedriftregion);
1001                     ((TH1F*)hdata)->SetBinContent(8,filleddr);
1002                     ((TH1F*)hdata)->SetBinContent(9,excluded);
1003                     ((TH1F*)hdata)->SetBinContent(10,empty);
1004                     ((TH1F*)hdata)->SetBinContent(11,excludeddriftregion);
1005                     ((TH1F*)hdata)->SetBinContent(12,emptydr);
1006                     ((TH1F*)hdata)->SetBinContent(13,exactive);
1007                     ((TH1F*)hdata)->SetBinContent(14,emptydiff);
1008                     ((TH1F*)hdata)->SetBinContent(15,exactivedriftregion);
1009                     ((TH1F*)hdata)->SetBinContent(16,emptydrdiff);
1010                     
1011                     //layer 3
1012                     ((TH1F*)hdata)->SetBinContent(19,activemoduleperlayer[0]);
1013                     ((TH1F*)hdata)->SetBinContent(20,filledmodules[0]);
1014                     ((TH1F*)hdata)->SetBinContent(21,activedrperlayer[0]);
1015                     ((TH1F*)hdata)->SetBinContent(22,filleddriftregion[0]);
1016                     ((TH1F*)hdata)->SetBinContent(23,excludedmoduleperlayer[0]);
1017                     ((TH1F*)hdata)->SetBinContent(24,emptymodules[0]);
1018                     ((TH1F*)hdata)->SetBinContent(25,excludeddrperlayer[0]);
1019                     ((TH1F*)hdata)->SetBinContent(26,emptydriftregion[0]);
1020                     ((TH1F*)hdata)->SetBinContent(27,exactivemoduleperlayer[0]);
1021                     ((TH1F*)hdata)->SetBinContent(28,emptyactivemoduleperlayer[0]);
1022                     ((TH1F*)hdata)->SetBinContent(29,exactivedrperlayer[0]);
1023                     ((TH1F*)hdata)->SetBinContent(30,emptyactivedrperlayer[0]);
1024                     
1025                     //layer 4
1026                     ((TH1F*)hdata)->SetBinContent(35,activemoduleperlayer[1]);
1027                     ((TH1F*)hdata)->SetBinContent(36,filledmodules[1]);
1028                     ((TH1F*)hdata)->SetBinContent(37,activedrperlayer[1]);
1029                     ((TH1F*)hdata)->SetBinContent(38,filleddriftregion[1]);
1030                     ((TH1F*)hdata)->SetBinContent(39,excludedmoduleperlayer[1]);
1031                     ((TH1F*)hdata)->SetBinContent(40,emptymodules[1]);
1032                     ((TH1F*)hdata)->SetBinContent(41,excludeddrperlayer[1]);
1033                     ((TH1F*)hdata)->SetBinContent(42,emptydriftregion[1]);
1034                     ((TH1F*)hdata)->SetBinContent(43,exactivemoduleperlayer[1]);
1035                     ((TH1F*)hdata)->SetBinContent(44,emptyactivemoduleperlayer[1]);
1036                     ((TH1F*)hdata)->SetBinContent(45,exactivedrperlayer[1]);
1037                     ((TH1F*)hdata)->SetBinContent(46,emptyactivedrperlayer[1]);
1038                     //hdata->GetListOfFunctions()->Add(pave[0]);
1039                     
1040                   }
1041             }//if hadata
1042             
1043           }//end while 
1044         
1045       }//end else 
1046       delete hmodule;
1047       hmodule=NULL;
1048       for(Int_t i=0;i<2;i++) {
1049         delete hlayer[i];
1050         hlayer[i]=NULL;
1051       }//end for      
1052
1053
1054       //sddQACheckerValue=1.;
1055       }//end recpoint list uid = 20
1056       if(uidrec==40)
1057         {
1058           //digitsr
1059           if (list->GetEntries() == 0){ 
1060             sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1061             break;
1062           } else{
1063         
1064             while( (hdata = dynamic_cast<TH1* >(next())) ){
1065               if (hdata){
1066                 if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1067                 else {
1068                   TString hname=hdata->GetName();
1069                   if(hname.Contains("SDD DIGITS Module Pattern")) {
1070                     //see raws
1071                 
1072                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1073                   } else if(hname.Contains("SDD Anode Distribution")) {
1074                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1075                   } else if(hname.Contains("SDD Tbin Distribution")) {
1076                     //to do as rp
1077                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1078                   } else if(hname.Contains("SDD ADC Counts Distribution")) {
1079                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1080                   }//end adc counts
1081               
1082                 }//end entries !=0
1083               }//end hdata
1084             }//end while
1085           }//end else
1086           sddQACheckerValue=1.;
1087         }
1088
1089     }
1090     break;
1091   case AliQAv1::kANA:
1092     {
1093       AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
1094       sddQACheckerValue=1.; 
1095     }
1096     break;
1097   case AliQAv1::kESD:
1098     {
1099       AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index)));
1100       sddQACheckerValue=1.;
1101     } 
1102     break;
1103   case AliQAv1::kNTASK:{
1104     AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
1105     sddQACheckerValue=1.;
1106   }
1107     break;
1108   case AliQAv1::kSIM:{
1109     AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index))); 
1110     Int_t uid=list->GetUniqueID();
1111     if(uid==60) {
1112       //digits
1113       if (list->GetEntries() == 0){ 
1114         sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1115         break;
1116       } else{
1117         
1118         while( (hdata = dynamic_cast<TH1* >(next())) ){
1119           if (hdata){
1120             if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1121             else {
1122               TString hname=hdata->GetName();
1123               if(hname.Contains("SDDDIGITSModulePattern")) {
1124                 //see raws
1125                 
1126                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1127               } else if(hname.Contains("SDDAnodeDistribution")) {
1128                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1129               } else if(hname.Contains("SDDTbinDistribution")) {
1130                 //to do as rp
1131                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1132               } else if(hname.Contains("SDDADCCountsDistribution")) {
1133                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1134               }//end adc counts
1135               
1136             }//end entries !=0
1137           }//end hdata
1138         }//end while
1139       }//end else
1140     } else if(uid==50) 
1141       {
1142         //hits
1143         if (list->GetEntries() == 0){ 
1144           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1145           break;
1146         } 
1147         else{
1148           
1149           while( (hdata = dynamic_cast<TH1* >(next())) ){
1150             if (hdata){
1151               if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1152               else {
1153                 TString hname=hdata->GetName();
1154                 if(hname.Contains("SDDHITSModulePattern")) {
1155                   //to do as raws
1156                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1157                 } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
1158                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1159                 } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
1160                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1161                 } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
1162                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1163                 }//end deposited energy
1164                 
1165               }//end entries !=0
1166             }//end hdata
1167           }//end while
1168         }//end else
1169       } else if(uid==70) 
1170       {
1171         //sdigits
1172         if (list->GetEntries() == 0){ 
1173           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1174           break;
1175         } else{
1176           
1177           while( (hdata = dynamic_cast<TH1* >(next())) ){
1178             if (hdata){
1179               if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1180               else {
1181                 TString hname=hdata->GetName();
1182                 if(hname.Contains("SDDSDIGITSModulePattern")) {
1183                   //to do as raws
1184                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1185                 } else if(hname.Contains("SDDAnodeDistribution")) {
1186                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1187                 } else if(hname.Contains("SDDTbinDistribution")) {
1188                   //to do as rp
1189                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1190                 } else if(hname.Contains("SDDADCCountsDistribution")) {
1191                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1192                 }//end adc counts bindistribution
1193               }//end entries !=0
1194                         
1195             }//end hdata
1196           }//end while
1197         }//end else
1198       }//end sdigits
1199     sddQACheckerValue=1.;
1200   }
1201     break;
1202     
1203   }//end switch
1204   
1205   fCalibration=NULL;
1206   return sddQACheckerValue;     
1207 }
1208
1209 //__________________________________________________________________
1210 void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
1211 {
1212   //set the number of the histograms already present in the list before the SDD histograms
1213   fSubDetOffset = taskoffset;
1214 }
1215
1216
1217 //__________________________________________________________________
1218 void AliITSQASDDChecker::SetStepBit(const Double_t *steprange)
1219 {
1220   //set the values of the step bit for each QA bit range calculated in the AliITSQAChecker class
1221   //if(fStepBitSDD){/*delete fStepBitSDD;*/ fStepBitSDD=NULL;}
1222   //fStepBitSDD = new Double_t[AliQAv1::kNBIT];
1223   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
1224     {
1225       fStepBitSDD[bit]=steprange[bit];
1226     }
1227 }
1228
1229 //__________________________________________________________________
1230 void  AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue)
1231 {
1232   //set the low and high values in for each QA bit range calculated in the AliITSQAChecker class
1233   //  fLowSDDValue = new Float_t[AliQAv1::kNBIT];
1234   //  fHighSDDValue= new Float_t[AliQAv1::kNBIT];
1235
1236   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
1237     {
1238       fLowSDDValue[bit]=lowvalue[bit];
1239       fHighSDDValue[bit]= highvalue[bit];
1240     }
1241
1242 }
1243 //__________________________________________________________________
1244 Bool_t  AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
1245 {
1246   //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used
1247   //
1248         Bool_t rval=kFALSE;
1249     fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
1250   switch(task)
1251     {
1252     case AliQAv1::kRAWS:{
1253       rval=MakeSDDRawsImage(list, task,mode);
1254     }
1255       break;
1256     case AliQAv1::kRECPOINTS:{ rval=MakeSDDRecPointsImage(list, task,mode); }
1257       break;
1258     case AliQAv1::kHITS:; case AliQAv1::kESDS:; case AliQAv1::kDIGITS:;case AliQAv1::kDIGITSR:;case AliQAv1::kSDIGITS:;case AliQAv1::kTRACKSEGMENTS:;case AliQAv1::kRECPARTICLES:; default:
1259     {
1260        rval=kFALSE;
1261        //AliQAChecker::Instance()->GetDetQAChecker(0)->MakeImage(list,task,mode);
1262     }
1263     break;
1264     case AliQAv1::kNULLTASKINDEX:; case  AliQAv1::kNTASKINDEX: 
1265       {AliWarning(Form("No histograms for this task ( %s ) \n", AliQAv1::GetTaskName(task).Data())); rval=kFALSE;}
1266       break;
1267     }
1268 return rval;  
1269 }
1270
1271
1272 //_______________________________________________________________________
1273 Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
1274 {
1275   // MakeSDDRawsImage: raw data QA plots
1276
1277         for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
1278                 //printf("-------------------------> %i \n", esIndex);
1279                 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0)  {
1280                         //printf ("Nothing for %s \n", AliRecoParam::GetEventSpecieName(esIndex));
1281                         continue;
1282                 } else {
1283                         const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
1284                         if ( !fImage[esIndex] ) {
1285                                 fImage[esIndex] = new TCanvas(title, title,1280,980) ;
1286                         }
1287                         fImage[esIndex]->Clear() ; 
1288                         fImage[esIndex]->SetTitle(title) ; 
1289                         fImage[esIndex]->cd();
1290                         fPaveText[esIndex] = new TPaveText(0.015, 0.015, 0.98, 0.98);
1291                         fPaveText[esIndex]->AddText(title);
1292                         fPaveText[esIndex]->Draw(); 
1293                         fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1294                         fImage[esIndex]->Clear() ; 
1295                         Int_t nx =2;//TMath::Nint(TMath::Sqrt(nImages));//2
1296                         Int_t ny =3;//nx  ; //2
1297                         // if (nx < TMath::Sqrt(nImages))
1298                         // ny++ ;  
1299                         fImage[esIndex]->Divide(nx, ny) ; 
1300                         TIter nexthist(list[esIndex]) ; 
1301                         Int_t npad = 1 ; 
1302                         fImage[esIndex]->cd(npad); 
1303                         fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
1304                         Int_t nhist = 0;
1305                         while ( 1 ) {
1306                                 TH1* hist = static_cast<TH1*>(nexthist());
1307                                 if(hist == NULL) break;
1308                                 nhist++;
1309                                 TString hname(hist->GetName());
1310
1311                                 //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
1312                                 TString cln(hist->ClassName()) ; 
1313                                 if ( ! cln.Contains("TH") )
1314                                         continue ;
1315           
1316                                 if(hist->TestBit(AliQAv1::GetImageBit())) {
1317                                         hist->GetXaxis()->SetTitleSize(0.04);
1318                                         hist->GetYaxis()->SetTitleSize(0.04);
1319                                         hist->GetXaxis()->SetLabelSize(0.02);
1320                                         hist->GetYaxis()->SetLabelSize(0.02);
1321                                         if(cln.Contains("TH2")) {
1322                                                 gPad->SetRightMargin(0.15);
1323                                                 gPad->SetLeftMargin(0.05);
1324                                                 hist->SetStats(0);
1325                                                 hist->SetOption("colz") ;
1326
1327                                                 ////hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025);
1328                                                 //gPad->Update();
1329                                         }
1330                                         hist->DrawCopy(); 
1331                                         fImage[esIndex]->cd(++npad) ; 
1332                                         fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
1333                                 } 
1334                         }
1335                         fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1336                 }
1337         }
1338         return kTRUE;
1339 }
1340
1341
1342
1343
1344 //_______________________________________________________________________
1345 Bool_t AliITSQASDDChecker::MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
1346 {
1347   // MakeSDDRecPointsImage: rec point QA plots
1348
1349     for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
1350       if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) 
1351         {
1352         //printf ("Nothing for %s \n", AliQAv1::GetTaskName(task).Data()); 
1353         continue;
1354         }
1355       const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
1356       if ( !fImage[esIndex] ) {
1357         fImage[esIndex] = new TCanvas(title, title,1280,980) ;
1358       }
1359       fImage[esIndex]->Clear() ; 
1360       fImage[esIndex]->SetTitle(title) ; 
1361       fImage[esIndex]->cd();
1362       fImage[esIndex]->SetBorderMode(0) ;  
1363       TPaveText someText(0.015, 0.015, 0.98, 0.98);
1364       someText.AddText(title);
1365       someText.Draw(); 
1366       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1367       fImage[esIndex]->Clear() ; 
1368       Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
1369       Int_t ny =6; // nx  ; 
1370       //if (nx < TMath::Sqrt(nImages))
1371       //ny++ ;  
1372       fImage[esIndex]->Divide(nx, ny) ; 
1373       TIter nexthist(list[esIndex]) ; 
1374       TH1* hist = NULL ;
1375       Int_t npad = 1 ; 
1376       fImage[esIndex]->cd(npad) ; 
1377       fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
1378       while ( (hist=static_cast<TH1*>(nexthist())) ) {
1379         //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
1380         TString cln(hist->ClassName()) ;
1381
1382         TString hname(hist->GetName());
1383                   
1384                   //printf("=====================> Class name %s \n",cln.Data()); 
1385         if ( ! cln.Contains("TH") )
1386           continue ;
1387         if(hist->TestBit(AliQAv1::GetImageBit())) {
1388             hist->GetXaxis()->SetTitleSize(0.04);
1389             hist->GetYaxis()->SetTitleSize(0.04);
1390             hist->GetXaxis()->SetLabelSize(0.02);
1391             hist->GetYaxis()->SetLabelSize(0.02);
1392           if(cln.Contains("TH1"))
1393             {
1394               if(!hname.Contains("Check")) hist->SetFillColor(kOrange+7);
1395               //SetFrameFillColor(kAzure-9);
1396               //hist->DrawCopy() ; 
1397             }
1398           if(cln.Contains("TH2"))
1399             {
1400               gPad->SetRightMargin(0.15);
1401               gPad->SetLeftMargin(0.05);
1402               hist->SetStats(0);
1403               hist->SetOption("colz") ;
1404               ////            TPaletteAxis *paletta =(TPaletteAxis*)hist->GetListOfFunctions()->FindObject("palette");
1405               //paletta->SetLabelSize(0.025);
1406               //gPad->Update(); 
1407             }
1408
1409                         hist->DrawCopy(); 
1410                         fImage[esIndex]->cd(++npad) ; 
1411                         fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
1412                 }
1413       }
1414       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1415     }
1416    return kTRUE;
1417 }
1418