]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSQASDDChecker.cxx
Coverity 19578
[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() 
79 {
80
81   //destructor
82   if(fStepBitSDD) 
83     {
84       delete[] fStepBitSDD ;
85       fStepBitSDD = NULL;
86     }
87   if(fLowSDDValue)
88     {
89       delete[]fLowSDDValue;
90       fLowSDDValue=NULL;
91     }
92   if(fHighSDDValue)
93     { 
94       delete[]fHighSDDValue;
95       fHighSDDValue=NULL;
96     }
97   if(fCalibration)
98     {
99       delete fCalibration;
100       fCalibration=NULL;
101     }
102   if(fImage)
103     {
104       delete []fImage; 
105       fImage=NULL;
106     }
107 } // dtor
108
109 //__________________________________________________________________
110 Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * list, const AliDetectorRecoParam * /*recoparam*/) 
111 {
112   //check histograms of the different lists  
113   AliInfo(Form("AliITSQASDDChecker called with offset: %d \t and specie %d\n", fSubDetOffset,fESforCheck));
114
115   AliDebug(1,Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset));
116
117   Double_t sddQACheckerValue = 0.;
118   TH1 *hdata=NULL;
119   Double_t entries=0.;
120   Double_t entries2[2];
121   for(Int_t i=0;i<2;i++)entries2[i]=0.;
122
123   if(!fCalibration){
124     AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
125     Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
126     if(!calibSDD)
127       {
128         AliError("Calibration object retrieval failed! SDD will not be processed");
129         fCalibration = NULL;
130         sddQACheckerValue= fHighSDDValue[AliQAv1::kWARNING];
131       }
132     else{
133       fCalibration = (TObjArray *)calibSDD->GetObject();
134       
135       if(!cacheStatus)calibSDD->SetObject(NULL);
136       calibSDD->SetOwner(kTRUE);
137       if(!cacheStatus)
138         {
139           delete calibSDD;
140         }
141     }//end calibsdd 
142   }//end f calibration
143
144   AliInfo("Calib SDD Created\n ");
145
146   TIter next(list);
147   TString results1;
148   TString results2;
149   Int_t color=1;
150
151   switch(index) {
152     case AliQAv1::kRAW:{
153       AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
154 //       if(fRawModulePattern) { delete fRawModulePattern; fRawModulePattern = 0; }
155 //       if(fRawL3Pattern) { delete fRawL3Pattern; fRawL3Pattern = 0; }
156 //       if(fRawL4Pattern) { delete fRawL4Pattern; fRawL4Pattern = 0; }
157       if (list->GetEntries() == 0){AliError("Raw List for SDD is empty \n");sddQACheckerValue += fHighSDDValue[AliQAv1::kFATAL];        break;}
158       TH1 *hmodule=NULL;
159       TH2 *hlayer[2]; 
160       hdata=NULL;
161       for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
162
163       //check counters
164       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];
165       Int_t excluded=0;            //excluded modules  
166       Int_t excludeddriftregion=0; //excluded single drift region
167       Int_t active=0;              //active modules  
168       Int_t activedriftregion=0;   //active single drift region
169       Int_t exactive=0;            //excluded modules but taking data
170       Int_t exactivedriftregion=0; //excluded single drift region but taking data   
171       Int_t empty=0;
172       Int_t filled=0;
173       Int_t emptydr=0;
174       Int_t filleddr=0;
175       //Int_t emptyactivemodule=0;
176       Int_t emptyactivemoduleperlayer[2];
177       //Int_t emptydractivemodule=0;
178       Int_t emptyactivedrperlayer[2];
179       Int_t emptysum=0;
180       Int_t emptydiff=0;
181       Int_t emptydrsum=0;
182       Int_t emptydrdiff=0;
183
184     for(Int_t i=0;i<2;i++)
185       {
186         emptymodules[i]=0; 
187         filledmodules[i]=0; 
188         emptyladders[i]=0; 
189         filledladders[i]=0; 
190         emptydriftregion[i]=0;
191         filleddriftregion[i]=0; 
192         excludedmoduleperlayer[i]=0;
193         excludeddrperlayer[i]=0;
194         activemoduleperlayer[i]=0;
195         activedrperlayer[i]=0;
196         exactivemoduleperlayer[i]=0;
197         exactivedrperlayer[i]=0;
198         emptyactivemoduleperlayer[i]=0;
199         emptyactivedrperlayer[i]=0;
200       }  
201
202     Int_t neventsraw=0;
203
204     //take the number of events
205
206       while( (hdata = dynamic_cast<TH1* >(next())) ){
207         if (hdata){
208           TString hname=hdata->GetName();
209
210           if(hname.Contains("SDDRawDataCheck"))
211             { 
212               neventsraw=(Int_t)hdata->GetBinContent(1); 
213               //break;
214             }
215           else continue;
216         }//end if hdata
217       }//end while
218
219       next.Begin();
220       while( (hdata = dynamic_cast<TH1* >(next())) ){
221         if (hdata){TString hname=hdata->GetName();
222           if(hname.Contains("SDDchargeMap"))continue;
223           if(hname.Contains("SDDDDLPattern"))continue;
224           if(hname.Contains("SDDEventSize"))continue;
225           if(hname.Contains("_RelativeOccupancy"))continue;
226           if(hname.Contains("SDDModPattern")){
227             if(hname.Contains("NORM")) continue;
228             hmodule=(TH1*)hdata->Clone();
229             entries= hdata->GetEntries();
230             if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
231             else{
232               int modmax=hdata->GetNbinsX();
233               Double_t content=0;
234               Int_t llay=0;
235               for(Int_t i=1;i<=modmax;i++)
236                 {
237                   if(i<85)llay=0;
238                   else llay=1;
239                   content=hdata->GetBinContent(i);
240                   if(AliITSQADataMakerRec::AreEqual(content,0.))
241                     {
242                     empty++;
243                     emptymodules[llay]++;
244                     } 
245                   else 
246                     {
247                       filled++;
248                       filledmodules[llay]++;
249                     }
250                 }//end for
251               //output of the check at the level of the modules. Drift region in the following checks
252
253               AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
254               AliInfo(Form(" %s : Layer 3 empty modules %i \t filled modules %i",hname.Data(), emptymodules[0], filledmodules[0]));
255               AliInfo(Form(" %s : Layer 4 empty modules %i \t filled modules %i",hname.Data(), emptymodules[1], filledmodules[1]));
256             }//end else pattern entries !=0
257           } //modpattern (1d histogram)                 
258           if(hname.Contains("_RelativeOccupancy")) {
259             //fRawModulePattern = (TH1F *) hdata;
260             Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
261             if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
262             if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
263             Int_t aboveThreshold = 0;
264             for(Int_t k=0; k<= hdata->GetNbinsX(); k++) {if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (int)(hdata->GetBinContent(k));}
265             Float_t fractionAboveThreshold=0.;
266             if(hdata->GetEntries()>0.)fractionAboveThreshold=((Float_t) aboveThreshold)/hdata->GetEntries();
267             if(hname.Contains("L3")) AliInfo(Form("SDD check number 1, L3: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
268             if(hname.Contains("L4")) AliInfo(Form("SDD check number 2, L4: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
269             if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
270               if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: Set Warning (L3 Raw)"));
271               if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: Set Warning (L4 Raw)")); } }//relativeoccupancy
272
273           if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){if(hname.Contains("NORM"))continue;
274             Int_t layer=0;
275             if(hname.Contains("3"))layer=0;
276             else  if(hname.Contains("4"))layer=1;
277             entries2[layer]=hdata->GetEntries();
278             if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));
279               sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
280             else{
281               Int_t layer1=0;
282               if(hname.Contains("3"))layer1=0;
283               else  if(hname.Contains("4"))layer1=1;
284               TH2* htemp=dynamic_cast<TH2*>(hdata);
285               if(htemp){
286                 hlayer[layer1]=(TH2*)htemp->Clone();
287                 hlayer[layer1]->SetName(Form("%s_copy",hname.Data()));
288                 //hlayer[layer1]->RebinX(2);
289                 int modmay=hlayer[layer1]->GetNbinsY();
290                 TH1D* hproj= hlayer[layer1]->ProjectionY();
291                 Double_t ladcontent=0;
292                 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
293                   ladcontent=hproj->GetBinContent(i);
294                   if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
295                   else filledladders[layer1]++;}//end for
296                 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer1], filledladders[layer1]));//end else layer 3
297                 delete hproj;
298                 hproj=NULL;
299               }//end if htemp
300             }//end else entries !=0
301           }//end check on phiz        
302         }//end if hdata 
303       }//end while
304       for(Int_t ii=0;ii<2;ii++)
305         {
306           filledmodules[ii]=0;
307           emptymodules[ii]=0;
308         }
309       filled=0;
310       empty=0;
311       if(AliITSQADataMakerRec::AreEqual(entries,0.)&& AliITSQADataMakerRec::AreEqual(entries2[0],0.)&& AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
312       //else{
313       if(hmodule || (hlayer[0] && hlayer[1])){
314         for(Int_t imod=0;imod<fgknSDDmodules;imod++){
315           Int_t lay=0;
316           Int_t lad=0;
317           Int_t det=0;
318           Int_t module=0;
319           module=imod+fgkmodoffset;
320           AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
321           if(cal==0) { continue;}
322           AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
323           if (cal->IsBad()){
324             excluded++;
325             excludedmoduleperlayer[lay-3]++;
326             Double_t content=0.;
327             //Double_t contentlayer[2];
328             //for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
329             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
330             //      if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
331             if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE) {
332               filledmodules[lay-3]++;
333               filled++;
334               AliError(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
335               exactive++;
336               exactivemoduleperlayer[lay-3]++;
337             } else if(AliITSQADataMakerRec::AreEqual(content,0.)) 
338               {
339                 emptymodules[lay-3]++; //it has to be empty
340                 empty++;
341               }
342           } else {
343             Int_t totside=0;
344             Int_t totactiveside=0;
345             //Int_t totbadside=0;
346             Double_t contentgood=0.;
347
348             for(Int_t i=0;i<2;i++){
349               if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(2*det+i-1,lad);
350               if(cal->IsWingBad(i))
351                 { 
352                   excludeddriftregion++; 
353                   excludeddrperlayer[lay-3]++; 
354                   if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kFALSE){
355                     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));
356                     exactivedriftregion++; 
357                     exactivedrperlayer[lay-3]++;
358                     filleddr++;
359                     filleddriftregion[lay-3]++;
360                   }
361                 }//end wingbad
362               else{
363                 if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kTRUE)
364                   {
365                     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));
366                   }
367                 else 
368                   {
369                     totside++;
370                   }
371                 totactiveside++;
372               }
373             }//end for
374             if(totside==0){
375             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));
376               emptymodules[lay-3]++;
377               empty++;
378
379             }
380               else 
381                 if(totside==2){
382                 filledmodules[lay-3]++;
383                 filled++;
384                 }
385                 else
386                   if(totside==1)
387                     {
388                       //                      emptydr++;
389                       //emptydriftregion[lay-3]++; //it has to be empty
390                       emptydriftregion[lay-3]++; 
391                       emptydr++;
392                       filleddr++;
393                       filleddriftregion[lay-3]++;
394                     }
395             if(totactiveside==1)
396               {
397                 activedriftregion++;
398                 activedrperlayer[lay-3]++;
399               }else if(totactiveside==2)
400               {
401                 active++;
402                 activemoduleperlayer[lay-3]++;
403               }
404
405           }
406         }//end for
407         AliInfo(Form("In total %d modules and %d single drift regions took data.\n ",filled, filleddr));
408         AliInfo(Form("In total %d modules and %d single drift regions were empty\n",empty, emptydr));
409         for(Int_t i=0;i<2;i++)
410           {
411             AliInfo(Form("Layer %i   \tempty modules %i             \t filled modules %i\n", i+3,emptymodules[i], filledmodules[i]));
412             AliInfo(Form("Layer %i   \tempty single drift regions %i \t filled single drift regions %i\n",i+3,emptydriftregion[i], filleddriftregion[i]));
413           }//end else layers
414         emptysum=emptymodules[0]+emptymodules[1];
415         emptydiff=emptysum-excluded;
416         emptyactivemoduleperlayer[0]=emptymodules[0]- excludedmoduleperlayer[0];
417         emptyactivemoduleperlayer[1]=emptymodules[1]- excludedmoduleperlayer[1];
418
419         emptydrsum=emptydriftregion[0]+emptydriftregion[1];
420         emptydrdiff=emptydrsum-excludeddriftregion;
421         emptyactivedrperlayer[0]=emptydriftregion[0]- excludeddrperlayer[0];
422         emptyactivedrperlayer[1]=emptydriftregion[1]- excludeddrperlayer[1];
423
424         Int_t numlimit=1000;
425
426         if(emptysum>excluded||emptydrsum>excludeddriftregion){
427           AliWarning(Form(" %i good module(s) and %i good single drift regions didn't take data! \n",emptydiff,emptydrdiff));
428           AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions didn't take data! \n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
429           AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions didn't take data! \n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
430           //printf("========================= %d",AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::kCosmic));
431           //      if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kFALSE){     
432           if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())!=AliRecoParam::kCosmic){     
433             
434             results1.Form("%i good module(s) and %i good drift regions didn't take data!",emptydiff,emptydrdiff);
435             if(neventsraw<numlimit)
436               {
437                 results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsraw);
438                 color=5;
439                 sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
440               }
441             else
442               {
443                 results2.Form(" Events %d. If PHYSICS, follow the TWiki instruction and call the Expert ",neventsraw);
444                 color=2;
445                 sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
446               }
447           }
448           else
449             //      if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kTRUE)
450             if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())==AliRecoParam::kCosmic)
451               {     
452                 numlimit=10000;
453                 if(neventsraw<numlimit)
454                   {
455                     AliWarning(Form("This is a cosmic run. Some module and drift region are empty but all is OK. "));
456                     results1.Form("OK. This is a cosmic run. you need a lot of events. Events %i",neventsraw);
457                     results2.Form("%i good module(s) and %i good drift are empty! DO NOT CALL THE EXPERT",emptydiff,emptydrdiff);
458                     color=5;
459                     sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
460                   }
461                 else
462                   {
463                     results1.Form("%i good module(s) and %i good drift region(s) have no data!",emptydiff,emptydrdiff);
464                     results2.Form(" Cosmic Events %d .Follow the TWiki instruction and call the Expert ",neventsraw);
465                     color=2;
466                     sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
467                   }
468               }
469         }
470         
471         if(exactive==0 && emptydiff==0 && exactivedriftregion==0 && emptydrdiff==0){
472           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));
473           results1.Form("OK.");
474           results2.Form(" All active modules and drift regions in acquisition");
475           color=3;
476           sddQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
477         }
478         if(exactive!=0||exactivedriftregion!=0){
479           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));
480           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]));
481           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]));
482           results1.Form("%i modules and %i drift region excluded from the acquisition took data",exactive,exactivedriftregion);
483           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
484           color=2;      
485           sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
486         }
487         if(excluded==exactive||excludeddriftregion==exactivedriftregion){
488           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));
489           results1.Form("All the modules (%d) or drift regions (%d) excluded from the acquisition took data!",excluded,excludeddriftregion );
490           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
491           color=6;
492           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
493         }
494         if(active==0||activedriftregion==0){
495           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)); 
496           results1.Form("No modules or drift region took data: excluded modules %i  excluded drift regions %i ", excluded, excludeddriftregion );
497           results2.Form("Follow the TWiki instructions and Call the SDD expert ");
498           color=6;
499           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
500         }
501
502         TPaveText *pave[2]={0,0};
503         next.Begin();
504
505         while( (hdata=dynamic_cast<TH1* >(next())) )
506           {
507             if (hdata){
508               TString hname=hdata->GetName();
509               if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){
510                 if(hname.Contains("NORM"))continue;
511                 //AliInfo("========================================Found histo 11\n");
512                 Int_t lay=0;
513                 if(hname.Contains("3"))lay=0;
514                 else if(hname.Contains("4"))lay=1;
515                 pave[lay]=new TPaveText(0.3,0.88,0.9,0.99,"NDC");
516                 pave[lay]->AddText(results1.Data());
517                 pave[lay]->AddText(results2.Data());
518                 pave[lay]->SetFillColor(color);
519                 pave[lay]->SetBorderSize(1);
520                 pave[lay]->SetLineWidth(1);
521                 hdata->GetListOfFunctions()->Add(pave[lay]);
522               }
523               else
524                 if(hname.Contains("SDDRawDataCheck"))
525                   {
526                     
527                     //AliInfo("========================================Found histo\n");
528                     ((TH1F*)hdata)->SetBinContent(5,active);
529                     ((TH1F*)hdata)->SetBinContent(6,filled);
530                     ((TH1F*)hdata)->SetBinContent(7,activedriftregion);
531                     ((TH1F*)hdata)->SetBinContent(8,filleddr);
532                     ((TH1F*)hdata)->SetBinContent(9,excluded);
533                     ((TH1F*)hdata)->SetBinContent(10,empty);
534                     ((TH1F*)hdata)->SetBinContent(11,excludeddriftregion);
535                     ((TH1F*)hdata)->SetBinContent(12,emptydr);
536                     ((TH1F*)hdata)->SetBinContent(13,exactive);
537                     ((TH1F*)hdata)->SetBinContent(14,emptydiff);
538                     ((TH1F*)hdata)->SetBinContent(15,exactivedriftregion);
539                     ((TH1F*)hdata)->SetBinContent(16,emptydrdiff);
540                     
541                     //layer 3
542                     ((TH1F*)hdata)->SetBinContent(19,activemoduleperlayer[0]);
543                     ((TH1F*)hdata)->SetBinContent(20,filledmodules[0]);
544                     ((TH1F*)hdata)->SetBinContent(21,activedrperlayer[0]);
545                     ((TH1F*)hdata)->SetBinContent(22,filleddriftregion[0]);
546                     ((TH1F*)hdata)->SetBinContent(23,excludedmoduleperlayer[0]);
547                     ((TH1F*)hdata)->SetBinContent(24,emptymodules[0]);
548                     ((TH1F*)hdata)->SetBinContent(25,excludeddrperlayer[0]);
549                     ((TH1F*)hdata)->SetBinContent(26,emptydriftregion[0]);
550                     ((TH1F*)hdata)->SetBinContent(27,exactivemoduleperlayer[0]);
551                     ((TH1F*)hdata)->SetBinContent(28,emptyactivemoduleperlayer[0]);
552                     ((TH1F*)hdata)->SetBinContent(29,exactivedrperlayer[0]);
553                     ((TH1F*)hdata)->SetBinContent(30,emptyactivedrperlayer[0]);
554                     
555                     //layer 4
556                     ((TH1F*)hdata)->SetBinContent(33,activemoduleperlayer[1]);
557                     ((TH1F*)hdata)->SetBinContent(34,filledmodules[1]);
558                     ((TH1F*)hdata)->SetBinContent(35,activedrperlayer[1]);
559                     ((TH1F*)hdata)->SetBinContent(36,filleddriftregion[1]);
560                     ((TH1F*)hdata)->SetBinContent(37,excludedmoduleperlayer[1]);
561                     ((TH1F*)hdata)->SetBinContent(38,emptymodules[1]);
562                     ((TH1F*)hdata)->SetBinContent(39,excludeddrperlayer[1]);
563                     ((TH1F*)hdata)->SetBinContent(40,emptydriftregion[1]);
564                     ((TH1F*)hdata)->SetBinContent(41,exactivemoduleperlayer[1]);
565                     ((TH1F*)hdata)->SetBinContent(42,emptyactivemoduleperlayer[1]);
566                     ((TH1F*)hdata)->SetBinContent(43,exactivedrperlayer[1]);
567                     ((TH1F*)hdata)->SetBinContent(44,emptyactivedrperlayer[1]);
568                     hdata->GetListOfFunctions()->Add(pave[0]);
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                 Int_t lay=0;
988                 if(hname.Contains("3"))lay=0;
989                 else if(hname.Contains("4"))lay=1;
990                 pave[lay]=new TPaveText(0.3,0.88,0.9,0.99,"NDC");
991                 pave[lay]->AddText(results1.Data());
992                 pave[lay]->AddText(results2.Data());
993                 pave[lay]->SetFillColor(color);
994                 pave[lay]->SetBorderSize(1);
995                 pave[lay]->SetLineWidth(1);
996                 hdata->GetListOfFunctions()->Add(pave[lay]);
997               }
998               else
999                 if(hname.Contains("SDDRecPointCheck"))
1000                   {
1001                     
1002                     //AliInfo("========================================Found histo\n");
1003                     ((TH1F*)hdata)->SetBinContent(5,active);
1004                     ((TH1F*)hdata)->SetBinContent(6,filled);
1005                     ((TH1F*)hdata)->SetBinContent(7,activedriftregion);
1006                     ((TH1F*)hdata)->SetBinContent(8,filleddr);
1007                     ((TH1F*)hdata)->SetBinContent(9,excluded);
1008                     ((TH1F*)hdata)->SetBinContent(10,empty);
1009                     ((TH1F*)hdata)->SetBinContent(11,excludeddriftregion);
1010                     ((TH1F*)hdata)->SetBinContent(12,emptydr);
1011                     ((TH1F*)hdata)->SetBinContent(13,exactive);
1012                     ((TH1F*)hdata)->SetBinContent(14,emptydiff);
1013                     ((TH1F*)hdata)->SetBinContent(15,exactivedriftregion);
1014                     ((TH1F*)hdata)->SetBinContent(16,emptydrdiff);
1015                     
1016                     //layer 3
1017                     ((TH1F*)hdata)->SetBinContent(19,activemoduleperlayer[0]);
1018                     ((TH1F*)hdata)->SetBinContent(20,filledmodules[0]);
1019                     ((TH1F*)hdata)->SetBinContent(21,activedrperlayer[0]);
1020                     ((TH1F*)hdata)->SetBinContent(22,filleddriftregion[0]);
1021                     ((TH1F*)hdata)->SetBinContent(23,excludedmoduleperlayer[0]);
1022                     ((TH1F*)hdata)->SetBinContent(24,emptymodules[0]);
1023                     ((TH1F*)hdata)->SetBinContent(25,excludeddrperlayer[0]);
1024                     ((TH1F*)hdata)->SetBinContent(26,emptydriftregion[0]);
1025                     ((TH1F*)hdata)->SetBinContent(27,exactivemoduleperlayer[0]);
1026                     ((TH1F*)hdata)->SetBinContent(28,emptyactivemoduleperlayer[0]);
1027                     ((TH1F*)hdata)->SetBinContent(29,exactivedrperlayer[0]);
1028                     ((TH1F*)hdata)->SetBinContent(30,emptyactivedrperlayer[0]);
1029                     
1030                     //layer 4
1031                     ((TH1F*)hdata)->SetBinContent(35,activemoduleperlayer[1]);
1032                     ((TH1F*)hdata)->SetBinContent(36,filledmodules[1]);
1033                     ((TH1F*)hdata)->SetBinContent(37,activedrperlayer[1]);
1034                     ((TH1F*)hdata)->SetBinContent(38,filleddriftregion[1]);
1035                     ((TH1F*)hdata)->SetBinContent(39,excludedmoduleperlayer[1]);
1036                     ((TH1F*)hdata)->SetBinContent(40,emptymodules[1]);
1037                     ((TH1F*)hdata)->SetBinContent(41,excludeddrperlayer[1]);
1038                     ((TH1F*)hdata)->SetBinContent(42,emptydriftregion[1]);
1039                     ((TH1F*)hdata)->SetBinContent(43,exactivemoduleperlayer[1]);
1040                     ((TH1F*)hdata)->SetBinContent(44,emptyactivemoduleperlayer[1]);
1041                     ((TH1F*)hdata)->SetBinContent(45,exactivedrperlayer[1]);
1042                     ((TH1F*)hdata)->SetBinContent(46,emptyactivedrperlayer[1]);
1043                     hdata->GetListOfFunctions()->Add(pave[0]);
1044                     
1045                   }
1046             }//if hadata
1047             
1048           }//end while 
1049         
1050       }//end else 
1051       delete hmodule;
1052       hmodule=NULL;
1053       for(Int_t i=0;i<2;i++) {
1054         delete hlayer[i];
1055         hlayer[i]=NULL;
1056       }//end for      
1057
1058
1059       //sddQACheckerValue=1.;
1060       }//end recpoint list uid = 20
1061       if(uidrec==40)
1062         {
1063           //digitsr
1064           if (list->GetEntries() == 0){ 
1065             sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1066             break;
1067           } else{
1068         
1069             while( (hdata = dynamic_cast<TH1* >(next())) ){
1070               if (hdata){
1071                 if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1072                 else {
1073                   TString hname=hdata->GetName();
1074                   if(hname.Contains("SDD DIGITS Module Pattern")) {
1075                     //see raws
1076                 
1077                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1078                   } else if(hname.Contains("SDD Anode Distribution")) {
1079                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1080                   } else if(hname.Contains("SDD Tbin Distribution")) {
1081                     //to do as rp
1082                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1083                   } else if(hname.Contains("SDD ADC Counts Distribution")) {
1084                     sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1085                   }//end adc counts
1086               
1087                 }//end entries !=0
1088               }//end hdata
1089             }//end while
1090           }//end else
1091           sddQACheckerValue=1.;
1092         }
1093
1094     }
1095     break;
1096   case AliQAv1::kANA:
1097     {
1098       AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
1099       sddQACheckerValue=1.; 
1100     }
1101     break;
1102   case AliQAv1::kESD:
1103     {
1104       AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index)));
1105       sddQACheckerValue=1.;
1106     } 
1107     break;
1108   case AliQAv1::kNTASK:{
1109     AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
1110     sddQACheckerValue=1.;
1111   }
1112     break;
1113   case AliQAv1::kSIM:{
1114     AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index))); 
1115     Int_t uid=list->GetUniqueID();
1116     if(uid==60) {
1117       //digits
1118       if (list->GetEntries() == 0){ 
1119         sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1120         break;
1121       } else{
1122         
1123         while( (hdata = dynamic_cast<TH1* >(next())) ){
1124           if (hdata){
1125             if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1126             else {
1127               TString hname=hdata->GetName();
1128               if(hname.Contains("SDDDIGITSModulePattern")) {
1129                 //see raws
1130                 
1131                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1132               } else if(hname.Contains("SDDAnodeDistribution")) {
1133                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1134               } else if(hname.Contains("SDDTbinDistribution")) {
1135                 //to do as rp
1136                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1137               } else if(hname.Contains("SDDADCCountsDistribution")) {
1138                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1139               }//end adc counts
1140               
1141             }//end entries !=0
1142           }//end hdata
1143         }//end while
1144       }//end else
1145     } else if(uid==50) 
1146       {
1147         //hits
1148         if (list->GetEntries() == 0){ 
1149           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1150           break;
1151         } 
1152         else{
1153           
1154           while( (hdata = dynamic_cast<TH1* >(next())) ){
1155             if (hdata){
1156               if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1157               else {
1158                 TString hname=hdata->GetName();
1159                 if(hname.Contains("SDDHITSModulePattern")) {
1160                   //to do as raws
1161                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1162                 } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
1163                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1164                 } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
1165                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1166                 } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
1167                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1168                 }//end deposited energy
1169                 
1170               }//end entries !=0
1171             }//end hdata
1172           }//end while
1173         }//end else
1174       } else if(uid==70) 
1175       {
1176         //sdigits
1177         if (list->GetEntries() == 0){ 
1178           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1179           break;
1180         } else{
1181           
1182           while( (hdata = dynamic_cast<TH1* >(next())) ){
1183             if (hdata){
1184               if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1185               else {
1186                 TString hname=hdata->GetName();
1187                 if(hname.Contains("SDDSDIGITSModulePattern")) {
1188                   //to do as raws
1189                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1190                 } else if(hname.Contains("SDDAnodeDistribution")) {
1191                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1192                 } else if(hname.Contains("SDDTbinDistribution")) {
1193                   //to do as rp
1194                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1195                 } else if(hname.Contains("SDDADCCountsDistribution")) {
1196                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
1197                 }//end adc counts bindistribution
1198               }//end entries !=0
1199             }//end hdata
1200           }//end while
1201         }//end else
1202       }//end sdigits
1203     sddQACheckerValue=1.;
1204   }
1205     break;
1206     
1207   }//end switch
1208   
1209   fCalibration=NULL;
1210   if(hdata) delete hdata;
1211
1212
1213   return sddQACheckerValue;     
1214 }
1215
1216 //__________________________________________________________________
1217 void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
1218 {
1219   //set the number of the histograms already present in the list before the SDD histograms
1220   fSubDetOffset = taskoffset;
1221 }
1222
1223
1224 //__________________________________________________________________
1225 void AliITSQASDDChecker::SetStepBit(const Double_t *steprange)
1226 {
1227   //set the values of the step bit for each QA bit range calculated in the AliITSQAChecker class
1228   //if(fStepBitSDD){/*delete fStepBitSDD;*/ fStepBitSDD=NULL;}
1229   //fStepBitSDD = new Double_t[AliQAv1::kNBIT];
1230   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
1231     {
1232       fStepBitSDD[bit]=steprange[bit];
1233     }
1234 }
1235
1236 //__________________________________________________________________
1237 void  AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue)
1238 {
1239   //set the low and high values in for each QA bit range calculated in the AliITSQAChecker class
1240   //  fLowSDDValue = new Float_t[AliQAv1::kNBIT];
1241   //  fHighSDDValue= new Float_t[AliQAv1::kNBIT];
1242
1243   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
1244     {
1245       fLowSDDValue[bit]=lowvalue[bit];
1246       fHighSDDValue[bit]= highvalue[bit];
1247     }
1248
1249 }
1250 //__________________________________________________________________
1251 Bool_t  AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
1252 {
1253   //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used
1254   //
1255   Bool_t rval=kFALSE;
1256   fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
1257
1258   switch(task)
1259     {
1260     case AliQAv1::kRAWS:{
1261       rval=MakeSDDRawsImage(list, task,mode);
1262     }
1263       break;
1264     case AliQAv1::kRECPOINTS:{ rval=MakeSDDRecPointsImage(list, task,mode); }
1265       break;
1266     case AliQAv1::kHITS:; case AliQAv1::kESDS:; case AliQAv1::kDIGITS:;case AliQAv1::kDIGITSR:;case AliQAv1::kSDIGITS:;case AliQAv1::kTRACKSEGMENTS:;case AliQAv1::kRECPARTICLES:; default:
1267     {
1268        rval=kFALSE;
1269        //AliQAChecker::Instance()->GetDetQAChecker(0)->MakeImage(list,task,mode);
1270     }
1271     break;
1272     case AliQAv1::kNULLTASKINDEX:; case  AliQAv1::kNTASKINDEX: 
1273       {AliWarning(Form("No histograms for this task ( %s ) \n", AliQAv1::GetTaskName(task).Data())); rval=kFALSE;}
1274       break;
1275     }
1276 return rval;  
1277 }
1278
1279
1280 //_______________________________________________________________________
1281 Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
1282 {
1283   // MakeSDDRawsImage: raw data QA plots
1284
1285     for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
1286       //printf("-------------------------> %i \n", esIndex);
1287       if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) 
1288           {//printf ("Nothing for %s \n", AliRecoParam::GetEventSpecieName(esIndex));
1289          continue;
1290         }
1291       else{
1292         const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
1293         if ( !fImage[esIndex] ) {
1294           fImage[esIndex] = new TCanvas(title, title,1280,980) ;
1295         }
1296         
1297         fImage[esIndex]->Clear() ; 
1298         fImage[esIndex]->SetTitle(title) ; 
1299         fImage[esIndex]->cd();
1300  
1301         TPaveText someText(0.015, 0.015, 0.98, 0.98);
1302         someText.AddText(title);
1303         someText.Draw(); 
1304         fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1305         fImage[esIndex]->Clear() ; 
1306         Int_t nx =2;//TMath::Nint(TMath::Sqrt(nImages));//2
1307         Int_t ny =3;//nx  ; //2
1308         // if (nx < TMath::Sqrt(nImages))
1309         // ny++ ;  
1310         fImage[esIndex]->Divide(nx, ny) ; 
1311         TIter nexthist(list[esIndex]) ; 
1312         TH1* hist = NULL ;
1313         Int_t npad = 1 ; 
1314         fImage[esIndex]->cd(npad); 
1315         fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
1316         while ( (hist=static_cast<TH1*>(nexthist())) ) {
1317           //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
1318           TString cln(hist->ClassName()) ; 
1319           if ( ! cln.Contains("TH") )
1320             continue ;
1321           
1322           if(hist->TestBit(AliQAv1::GetImageBit())) {
1323             hist->GetXaxis()->SetTitleSize(0.02);
1324             hist->GetYaxis()->SetTitleSize(0.02);
1325             hist->GetXaxis()->SetLabelSize(0.02);
1326             hist->GetYaxis()->SetLabelSize(0.02);
1327             if(cln.Contains("TH2"))
1328               {
1329                 gPad->SetRightMargin(0.15);
1330                 gPad->SetLeftMargin(0.05);
1331                 hist->SetStats(0);
1332                 hist->SetOption("colz") ;
1333                 //hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025);
1334                 //gPad->Update();
1335               }
1336             hist->DrawCopy() ; 
1337             fImage[esIndex]->cd(++npad) ; 
1338             fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
1339           }
1340         }
1341         fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1342       }
1343     }
1344    return kTRUE;
1345 }
1346
1347
1348
1349
1350 //_______________________________________________________________________
1351 Bool_t AliITSQASDDChecker::MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
1352 {
1353   // MakeSDDRecPointsImage: rec point QA plots
1354
1355     for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
1356       if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) 
1357         {
1358         //printf ("Nothing for %s \n", AliQAv1::GetTaskName(task).Data()); 
1359         continue;
1360         }
1361       const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
1362       if ( !fImage[esIndex] ) {
1363         fImage[esIndex] = new TCanvas(title, title,1280,980) ;
1364       }
1365       fImage[esIndex]->Clear() ; 
1366       fImage[esIndex]->SetTitle(title) ; 
1367       fImage[esIndex]->cd();
1368       fImage[esIndex]->SetBorderMode(0) ;  
1369       TPaveText someText(0.015, 0.015, 0.98, 0.98);
1370       someText.AddText(title);
1371       someText.Draw(); 
1372       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1373       fImage[esIndex]->Clear() ; 
1374       Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
1375       Int_t ny =6; // nx  ; 
1376       //if (nx < TMath::Sqrt(nImages))
1377       //ny++ ;  
1378       fImage[esIndex]->Divide(nx, ny) ; 
1379       TIter nexthist(list[esIndex]) ; 
1380       TH1* hist = NULL ;
1381       Int_t npad = 1 ; 
1382       fImage[esIndex]->cd(npad) ; 
1383       fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
1384       while ( (hist=static_cast<TH1*>(nexthist())) ) {
1385         //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
1386         TString cln(hist->ClassName()) ;
1387
1388         TString hname(hist->GetName());
1389         //printf("=====================> Class name %s \n",cln.Data()); 
1390         if ( ! cln.Contains("TH") )
1391           continue ;
1392         if(hist->TestBit(AliQAv1::GetImageBit())) {
1393             hist->GetXaxis()->SetTitleSize(0.02);
1394             hist->GetYaxis()->SetTitleSize(0.02);
1395             hist->GetXaxis()->SetLabelSize(0.02);
1396             hist->GetYaxis()->SetLabelSize(0.02);
1397           if(cln.Contains("TH1"))
1398             {
1399               if(!hname.Contains("Check")) hist->SetFillColor(kOrange+7);
1400               //SetFrameFillColor(kAzure-9);
1401               //hist->DrawCopy() ; 
1402             }
1403           if(cln.Contains("TH2"))
1404             {
1405               gPad->SetRightMargin(0.15);
1406               gPad->SetLeftMargin(0.05);
1407               hist->SetStats(0);
1408               hist->SetOption("colz") ;
1409               //              TPaletteAxis *paletta =(TPaletteAxis*)hist->GetListOfFunctions()->FindObject("palette");
1410               //paletta->SetLabelSize(0.025);
1411               //gPad->Update(); 
1412             }
1413           hist->DrawCopy();
1414           fImage[esIndex]->cd(++npad) ; 
1415           fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
1416         }
1417       }
1418       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
1419     }
1420     // }  
1421    return kTRUE;
1422 }