]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSQASDDChecker.cxx
defects from coverity fixed
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDChecker.cxx
index 593553f617869a0cbb9a22cc2cfad1b5759aa801..06092d744329ce9229ea583c9d008f103ac6dcf1 100644 (file)
 #include "TH1.h"
 #include <TH1D.h>
 #include <TH2.h>
+#include "TCanvas.h"
+#include "TPaveText.h"
+#include "TPad.h"
+//#include "TPaletteAxis.h"
 // --- AliRoot header files ---
 #include "AliITSQADataMakerRec.h"
 #include "AliITSQASDDChecker.h"
 #include "AliCDBManager.h"
 #include "AliITSCalibrationSDD.h"
 #include "AliITSgeomTGeo.h"
+#include "AliQAManager.h"
+#include "AliQAv1.h"
+#include "AliQAChecker.h"
+#include "AliQACheckerBase.h"
 
 
 ClassImp(AliITSQASDDChecker)
@@ -69,6 +77,11 @@ AliITSQASDDChecker::~AliITSQASDDChecker()
       delete fCalibration;
       fCalibration=NULL;
     }
+  if(fImage)
+    {
+      delete []fImage; 
+      fImage=NULL;
+    }
 } // dtor
 
 //__________________________________________________________________
@@ -94,120 +107,81 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
        fCalibration = NULL;
        SDDQACheckerValue= fHighSDDValue[AliQAv1::kWARNING];
       }
-    fCalibration = (TObjArray *)calibSDD->GetObject();
-    
-    if(!cacheStatus)calibSDD->SetObject(NULL);
-    calibSDD->SetOwner(kTRUE);
-    if(!cacheStatus)
-      {
-       delete calibSDD;
-      }
-  }
+    else{
+      fCalibration = (TObjArray *)calibSDD->GetObject();
+      
+      if(!cacheStatus)calibSDD->SetObject(NULL);
+      calibSDD->SetOwner(kTRUE);
+      if(!cacheStatus)
+       {
+         delete calibSDD;
+       }
+    }//end calibsdd 
+  }//end f calibration
 
   AliInfo("Calib SDD Created\n ");
 
   TIter next(list);
-  TH1 *hmodule=NULL;
-  TH2 *hlayer[2];
 
-  switch(index) 
-    {
-
-    case AliQAv1::kRAW:
+  switch(index) {
+    case AliQAv1::kRAW:{
       AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
-      if(fRawModulePattern) { delete fRawModulePattern; fRawModulePattern = 0; }
-      if(fRawL3Pattern) { delete fRawL3Pattern; fRawL3Pattern = 0; }
-      if(fRawL4Pattern) { delete fRawL4Pattern; fRawL4Pattern = 0; }
-      if (list->GetEntries() == 0){ 
-       SDDQACheckerValue += fHighSDDValue[AliQAv1::kFATAL];
-       break;
-      }
-      Int_t emptymodules[2];
-      Int_t filledmodules[2];
-      Int_t emptyladders[2];
-      Int_t filledladders[2];
-      for(Int_t i=0;i<2;i++){
-       emptymodules[i]=0;
-       filledmodules[i]=0;
-       emptyladders[i]=0;
-       filledladders[i]=0;
-      }
-      for(Int_t i=0;i<2;i++)hlayer[i]=NULL;    
+//       if(fRawModulePattern) { delete fRawModulePattern; fRawModulePattern = 0; }
+//       if(fRawL3Pattern) { delete fRawL3Pattern; fRawL3Pattern = 0; }
+//       if(fRawL4Pattern) { delete fRawL4Pattern; fRawL4Pattern = 0; }
+      if (list->GetEntries() == 0){SDDQACheckerValue += fHighSDDValue[AliQAv1::kFATAL];        break;}
+      TH1 *hmodule=NULL;
+      TH2 *hlayer[2]; 
+      hdata=NULL;
+      Int_t emptymodules[2], filledmodules[2],emptyladders[2],filledladders[2];
+      for(Int_t i=0;i<2;i++){emptymodules[i]=0; filledmodules[i]=0; emptyladders[i]=0; filledladders[i]=0; }
+      for(Int_t i=0;i<2;i++)hlayer[i]=NULL;   
       while( (hdata = dynamic_cast<TH1* >(next())) ){
-       if (hdata){
-         TString hname=hdata->GetName();
+       if (hdata){TString hname=hdata->GetName();
          if(hname.Contains("SDDchargeMap"))continue;
          if(hname.Contains("SDDModPattern")){
-           if(hname.Contains("NORM")) {
-                                       
-             hmodule=hdata;
-             entries= hdata->GetEntries();
-             if(AliITSQADataMakerRec::AreEqual(entries,0.)){
-               AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));
-               SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
-             }//endif entries
-             else{
-               int modmax=hdata->GetNbinsX();
-               Int_t empty=0;
-               Int_t filled=0;
-               Double_t content=0;
-               for(Int_t i=1;i<=modmax;i++){
-                 content=hdata->GetBinContent(i);
-                 if(AliITSQADataMakerRec::AreEqual(content,0.)) empty++;
-                 else filled++;
-               }//end for
-               AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
-             }//end else pattern entries !=0
-           } 
-         }
-
+           if(hname.Contains("NORM")) continue;
+           hmodule=(TH1*)hdata->Clone();
+           entries= hdata->GetEntries();
+           if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
+           else{int modmax=hdata->GetNbinsX();
+             Int_t empty=0;
+             Int_t filled=0;
+             Double_t content=0;
+             for(Int_t i=1;i<=modmax;i++){content=hdata->GetBinContent(i);if(AliITSQADataMakerRec::AreEqual(content,0.)) empty++; else filled++; }//end for
+             AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));}//end else pattern entries !=0
+         }             
          if(hname.Contains("_RelativeOccupancy")) {
-           fRawModulePattern = (TH1F *) hdata;
-           Float_t threshold = fRawModulePattern->GetMean() + 4*fRawModulePattern->GetRMS();
-           if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: L3 mean: %f, rms: ,%f",fRawModulePattern->GetMean(),fRawModulePattern->GetRMS()));
-           if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: L4 mean: %f, rms: ,%f",fRawModulePattern->GetMean(),fRawModulePattern->GetRMS()));
+           //fRawModulePattern = (TH1F *) hdata;
+           Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
+           if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
+           if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
            Int_t aboveThreshold = 0;
-           for(Int_t k=0; k<= fRawModulePattern->GetNbinsX(); k++) {
-             if(fRawModulePattern->GetBinLowEdge(k) > threshold) aboveThreshold += (int)(fRawModulePattern->GetBinContent(k));
-           }
-           Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/fRawModulePattern->GetEntries();
+           for(Int_t k=0; k<= hdata->GetNbinsX(); k++) {if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (int)(hdata->GetBinContent(k));}
+           Float_t fractionAboveThreshold=0.;
+           if(hdata->GetEntries()>0.)fractionAboveThreshold=((Float_t) aboveThreshold)/hdata->GetEntries();
            if(hname.Contains("L3")) AliInfo(Form("SDD check number 1, L3: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
            if(hname.Contains("L4")) AliInfo(Form("SDD check number 2, L4: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
-           if(fractionAboveThreshold > fThresholdForRelativeOccupancy) { 
-             SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+           if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
              if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: Set Warning (L3 Raw)"));
-             if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: Set Warning (L4 Raw)"));
-           }
-         }
-                                       
-         if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){
-           if(!hname.Contains("NORM")) {
-             if(hname.Contains("L3")) {
-               fRawL3Pattern = (TH2F *) hdata;
-             }
-             if(hname.Contains("L4")) {
-               fRawL4Pattern = (TH2F *) hdata;
-             }
-           } else{
-             Int_t layer=0;
-             if(hname.Contains("3"))layer=0;
-             else  if(hname.Contains("4"))layer=1;
-             entries2[layer]=hdata->GetEntries();
-             if(entries2[layer]==0){
-               AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));
-               SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
-               if(AliITSQADataMakerRec::AreEqual(entries,0.)){ 
-               }
-             }//end if getentries
-             else{
-               Int_t layer1=0;
-               if(hname.Contains("3"))layer1=0;
-               else  if(hname.Contains("4"))layer1=1;
-               TH2* htemp=dynamic_cast<TH2*>(hdata);
+             if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: Set Warning (L4 Raw)")); } }
+         if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){if(hname.Contains("NORM"))continue;
+           //if(hname.Contains("L3")) {fRawL3Pattern = (TH2F *) hdata;}
+           //if(hname.Contains("L4")) {fRawL4Pattern = (TH2F *) hdata;}
+           Int_t layer=0;
+           if(hname.Contains("3"))layer=0;
+           else  if(hname.Contains("4"))layer=1;
+           entries2[layer]=hdata->GetEntries();
+           if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));
+             SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
+           else{
+             Int_t layer1=0;
+             if(hname.Contains("3"))layer1=0;
+             else  if(hname.Contains("4"))layer1=1;
+             TH2* htemp=dynamic_cast<TH2*>(hdata);
+             if(htemp){
                hlayer[layer1]=(TH2*)htemp->Clone();
-               char newname[50];
-               sprintf(newname,"%s_copy",hname.Data());
-               hlayer[layer1]->SetName(newname);
+               hlayer[layer1]->SetName(Form("%s_copy",hname.Data()));
                hlayer[layer1]->RebinX(2);
                int modmay=hlayer[layer1]->GetNbinsY();
                TH1D* hproj= hlayer[layer1]->ProjectionY();
@@ -215,14 +189,13 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
                for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
                  ladcontent=hproj->GetBinContent(i);
                  if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
-                 else filledladders[layer1]++; 
-               }//end for
+                 else filledladders[layer1]++;}//end for
                AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer], filledladders[layer]));//end else layer 3
                delete hproj;
-               hproj=NULL;     
-             }//end else entries !=0
-           }//end check on norm              
-         }//end if layer 3
+               hproj=NULL;
+             }//end if htemp
+           }//end else entries !=0
+         }//end check on phiz        
        }//end if hdata 
       }//end while
       if(AliITSQADataMakerRec::AreEqual(entries,0.)&&AliITSQADataMakerRec::AreEqual(entries2[0],0.)&&AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
@@ -238,7 +211,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
          Int_t module=0;
          module=imod+fgkmodoffset;
          AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
-         if(cal==0) { delete cal; continue;}
+         if(cal==0) { continue;}
          AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
          if (cal->IsBad()){
            excluded++;
@@ -246,7 +219,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
            Double_t contentlayer[2];
            for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
            if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram has been created 
-           contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
+           if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
            if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE || AliITSQADataMakerRec::AreEqual(contentlayer[lay-3],0.)==kFALSE) {
              filledmodules[lay-3]++;
              AliWarning(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
@@ -256,7 +229,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
          } else {
            Double_t contentgood=0.;
            active++;
-           contentgood=hlayer[lay-3]->GetBinContent(det,lad);
+           if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(det,lad);
            if(AliITSQADataMakerRec::AreEqual(contentgood,0.)) 
              emptymodules[lay-3]++;
            else 
@@ -280,112 +253,215 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
          AliWarning(Form("No modules took data: excluded %i \t exactive %i \n", excluded, exactive)); 
          SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
        }
-       for(Int_t i=0;i<2;i++) {
-         delete hlayer[i];
-         hlayer[i]=NULL;
-       }
+       
       }//end else 
-      //}
-      
-      break;
+      delete hmodule;
+      hmodule=NULL;
+      for(Int_t i=0;i<2;i++) {
+       delete hlayer[i];
+       hlayer[i]=NULL;
+      }
 
-    case AliQAv1::kNULLTASK:
-      AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
-      SDDQACheckerValue=1.;
+    }
+      
       break;
-               
-    case AliQAv1::kREC:
+      
+  case AliQAv1::kNULLTASK:{
+    AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
+    SDDQACheckerValue=1.;
+  }
+    break;
+    
+  case AliQAv1::kREC:
+    {
+      Int_t uidrec=list->GetUniqueID();
       AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index))); 
-      if(fRecModulePattern) { delete fRecModulePattern; fRecModulePattern = 0; }
-      if(fRecL3Pattern) { delete fRecL3Pattern; fRecL3Pattern = 0; }
-      if(fRecL4Pattern) { delete fRecL4Pattern; fRecL4Pattern = 0; }
-      if(fModulePatternRatio) { delete fModulePatternRatio; fModulePatternRatio = 0; }
-      if (list->GetEntries() == 0){ //check if the list is empty
-       //printf("SDDQACheckerValue = %f \t value %f\n",SDDQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
-       SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
-                               
-      }//end if getentries
-         
-      while((hdata=dynamic_cast<TH1* >(next()))){
-       if (hdata){
-         TString hname=hdata->GetName();
-         if(hname.Contains("_RelativeOccupancy")) {
-           fRecModulePattern = (TH1F *) hdata;
-           Float_t threshold = fRecModulePattern->GetMean() + 4*fRecModulePattern->GetRMS();
-           if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",fRecModulePattern->GetMean(),fRecModulePattern->GetRMS()));
-           if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",fRecModulePattern->GetMean(),fRecModulePattern->GetRMS()));
-           Int_t aboveThreshold = 0;
-           for(Int_t k=0; k<= ((Int_t)fRecModulePattern->GetNbinsX()); k++) {
-             if(fRecModulePattern->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(fRecModulePattern->GetBinContent(k));
-           }
-           Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/fRecModulePattern->GetEntries();
-           if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
-           if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
-           if(fractionAboveThreshold > fThresholdForRelativeOccupancy) { 
-             SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
-             if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)"));
-             if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)"));
+      if(uidrec==20){
+       //recpoints
+       if (list->GetEntries() == 0){ //check if the list is empty
+         //printf("SDDQACheckerValue = %f \t value %f\n",SDDQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
+         SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL]; 
+         break;                        
+       }//end if getentries
+      
+       while((hdata=dynamic_cast<TH1* >(next()))){
+         if (hdata){
+           TString hname=hdata->GetName();
+           if(hname.Contains("_RelativeOccupancy")) {
+             Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
+             if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
+             if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
+             Int_t aboveThreshold = 0;
+             for(Int_t k=0; k<= ((Int_t)hdata->GetNbinsX()); k++) {
+               if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(hdata->GetBinContent(k));
+             }
+             Float_t fractionAboveThreshold=0.;
+             if(hdata->GetEntries()>0.) fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries();
+             if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
+             if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
+             if(fractionAboveThreshold > fThresholdForRelativeOccupancy) { 
+               SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+               if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)"));
+               if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)"));
+             }
            }
-         }
-         if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) {
-           //Float_t threshold = 0.;
-           if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
-           if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
-           Int_t belowThreshold = 0;
-           for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) {
-             if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k));
+           if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) {
+             //Float_t threshold = 0.;
+             if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
+             if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
+             Int_t belowThreshold = 0;
+             for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) {
+               if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k));
+             }
+             Double_t fractionBelowThreshold =0.;
+             Double_t entries3=((TH1F *)hdata)->GetEntries();
+             if(entries3>0.001)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries3;
+             else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); }
+             if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
+             if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
+             if(fractionBelowThreshold > fThresholdForRelativeOccupancy) { 
+               SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+               if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)"));
+               if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)"));
+             }
            }
-           Double_t fractionBelowThreshold =0.;
-           Double_t entries=((TH1F *)hdata)->GetEntries();
-           if(entries!=0.)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries;
-           else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); }
-           if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
-           if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
-           if(fractionBelowThreshold > fThresholdForRelativeOccupancy) { 
-             SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
-             if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)"));
-             if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)"));
+           if(hname.Contains("dedx")) {
+             if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
+             if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
            }
          }
-         if(hname.Contains("dedx")) {
-           if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
-           if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
-         }
+       }                               
+      
+       SDDQACheckerValue=1.;
+      }
+      else if(uidrec==40)
+       {
+         //digitsr
+         if (list->GetEntries() == 0){ 
+           SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+           break;
+         } else{
+       
+           while( (hdata = dynamic_cast<TH1* >(next())) ){
+             if (hdata){
+               if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
+               else {
+                 TString hname=hdata->GetName();
+                 if(hname.Contains("SDD DIGITS Module Pattern")) {
+                   //see raws
+               
+                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 } else if(hname.Contains("SDD Anode Distribution")) {
+                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 } else if(hname.Contains("SDD Tbin Distribution")) {
+                   //to do as rp
+                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 } else if(hname.Contains("SDD ADC Counts Distribution")) {
+                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 }//end adc counts
+             
+               }//end entries !=0
+             }//end hdata
+           }//end while
+         }//end else
+         SDDQACheckerValue=1.;
        }
-      }                                
-                              
-      SDDQACheckerValue=1.;
-      break;
-    case AliQAv1::kANA:
+
+    }
+    break;
+  case AliQAv1::kANA:
+    {
       AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
       SDDQACheckerValue=1.; 
-      break;
-    case AliQAv1::kESD:
+    }
+    break;
+  case AliQAv1::kESD:
+    {
       AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index)));
-      SDDQACheckerValue=1.; 
-      break;
-    case AliQAv1::kNTASK:
-      AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
       SDDQACheckerValue=1.;
-      break;
-    case AliQAv1::kSIM:
-      AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index))); 
-      Int_t uid=list->GetUniqueID();
-      if(uid==60) {
-       //digits
+    } 
+    break;
+  case AliQAv1::kNTASK:{
+    AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
+    SDDQACheckerValue=1.;
+  }
+    break;
+  case AliQAv1::kSIM:{
+    AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index))); 
+    Int_t uid=list->GetUniqueID();
+    if(uid==60) {
+      //digits
+      if (list->GetEntries() == 0){ 
+       SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+       break;
+      } else{
+       
+       while( (hdata = dynamic_cast<TH1* >(next())) ){
+         if (hdata){
+           if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
+           else {
+             TString hname=hdata->GetName();
+             if(hname.Contains("SDDDIGITSModulePattern")) {
+               //see raws
+               
+               SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+             } else if(hname.Contains("SDDAnodeDistribution")) {
+               SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+             } else if(hname.Contains("SDDTbinDistribution")) {
+               //to do as rp
+               SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+             } else if(hname.Contains("SDDADCCountsDistribution")) {
+               SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+             }//end adc counts
+             
+           }//end entries !=0
+         }//end hdata
+       }//end while
+      }//end else
+    } else if(uid==50) 
+      {
+       //hits
+       if (list->GetEntries() == 0){ 
+         SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+         break;
+       } 
+       else{
+         
+         while( (hdata = dynamic_cast<TH1* >(next())) ){
+           if (hdata){
+             if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
+             else {
+               TString hname=hdata->GetName();
+               if(hname.Contains("SDDHITSModulePattern")) {
+                 //to do as raws
+                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+               } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
+                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+               } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
+                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+               } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
+                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+               }//end deposited energy
+               
+             }//end entries !=0
+           }//end hdata
+         }//end while
+       }//end else
+      } else if(uid==70) 
+      {
+       //sdigits
        if (list->GetEntries() == 0){ 
          SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
-           
+         break;
        } else{
-           
+         
          while( (hdata = dynamic_cast<TH1* >(next())) ){
            if (hdata){
              if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
              else {
                TString hname=hdata->GetName();
-               if(hname.Contains("SDDDIGITSModulePattern")) {
-                 //see raws
-
+               if(hname.Contains("SDDSDIGITSModulePattern")) {
+                 //to do as raws
                  SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                } else if(hname.Contains("SDDAnodeDistribution")) {
                  SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
@@ -394,78 +470,25 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
                  SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                } else if(hname.Contains("SDDADCCountsDistribution")) {
                  SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
-               }//end adc counts
-
+               }//end adc counts bindistribution
              }//end entries !=0
            }//end hdata
          }//end while
        }//end else
-      } else if(uid==50) 
-       {
-         //hits
-         if (list->GetEntries() == 0){ 
-           SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
-         } 
-         else{
-           
-           while( (hdata = dynamic_cast<TH1* >(next())) ){
-             if (hdata){
-               if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
-               else {
-                 TString hname=hdata->GetName();
-                 if(hname.Contains("SDDHITSModulePattern")) {
-                   //to do as raws
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
-                 } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
-                 } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
-                 } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
-                 }//end deposited energy
+      }//end sdigits
+    SDDQACheckerValue=1.;
+  }
+    break;
+    
+  }//end switch
+  
+  fCalibration=NULL;
+  if(hdata) delete hdata;
 
-               }//end entries !=0
-             }//end hdata
-           }//end while
-         }//end else
-       } else if(uid==70) 
-       {
-         //sdigits
-         if (list->GetEntries() == 0){ 
-           SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
-         } else{
-           
-           while( (hdata = dynamic_cast<TH1* >(next())) ){
-             if (hdata){
-               if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
-               else {
-                 TString hname=hdata->GetName();
-                 if(hname.Contains("SDDSDIGITSModulePattern")) {
-                   //to do as raws
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
-                 } else if(hname.Contains("SDDAnodeDistribution")) {
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
-                 } else if(hname.Contains("SDDTbinDistribution")) {
-                   //to do as rp
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
-                 } else if(hname.Contains("SDDADCCountsDistribution")) {
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
-                 }//end adc counts bindistribution
-               }//end entries !=0
-             }//end hdata
-           }//end while
-         }//end else
-       }//end sdigits
-      SDDQACheckerValue=1.;
-      break;
-      
-    }//end switch
 
-  fCalibration=NULL;
-  delete hdata;
   return SDDQACheckerValue;    
 }
+
 //__________________________________________________________________
 void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
 {
@@ -499,4 +522,170 @@ void  AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t *
     }
 
 }
+//__________________________________________________________________
+Bool_t  AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
+{
+  Bool_t rval=kFALSE;
+  fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
+  //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used
+  switch(task)
+    {
+    case AliQAv1::kRAWS:{
+      rval=MakeSDDRawsImage(list, task,mode);
+    }
+      break;
+    case AliQAv1::kRECPOINTS:{ rval=MakeSDDRecPointsImage(list, task,mode); }
+      break;
+    case AliQAv1::kHITS:; case AliQAv1::kESDS:; case AliQAv1::kDIGITS:;case AliQAv1::kDIGITSR:;case AliQAv1::kSDIGITS:;case AliQAv1::kTRACKSEGMENTS:;case AliQAv1::kRECPARTICLES:; default:
+    {
+       rval=kFALSE;
+       //AliQAChecker::Instance()->GetDetQAChecker(0)->MakeImage(list,task,mode);
+    }
+    break;
+    case AliQAv1::kNULLTASKINDEX:; case  AliQAv1::kNTASKINDEX: 
+      {AliWarning(Form("No histograms for this task ( %s ) \n", AliQAv1::GetTaskName(task).Data())); rval=kFALSE;}
+      break;
+    }
+return rval;  
+}
+
+
+//_______________________________________________________________________
+Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
+{
+
+    for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
+      //printf("-------------------------> %i \n", esIndex);
+      if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) 
+          {//printf ("Nothing for %s \n", AliRecoParam::GetEventSpecieName(esIndex));
+        continue;
+       }
+      else{
+       const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
+       if ( !fImage[esIndex] ) {
+         fImage[esIndex] = new TCanvas(title, title,1280,980) ;
+       }
+       
+       fImage[esIndex]->Clear() ; 
+       fImage[esIndex]->SetTitle(title) ; 
+       fImage[esIndex]->cd();
+       TPaveText someText(0.015, 0.015, 0.98, 0.98);
+       someText.AddText(title);
+       someText.Draw(); 
+       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
+       fImage[esIndex]->Clear() ; 
+       Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
+       Int_t ny =1; // nx  ; 
+       //if (nx < TMath::Sqrt(nImages))
+       //ny++ ;  
+       fImage[esIndex]->Divide(nx, ny) ; 
+       TIter nexthist(list[esIndex]) ; 
+       TH1* hist = NULL ;
+       Int_t npad = 1 ; 
+       fImage[esIndex]->cd(npad); 
+       fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
+       while ( (hist=static_cast<TH1*>(nexthist())) ) {
+         //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
+         TString cln(hist->ClassName()) ; 
+         if ( ! cln.Contains("TH") )
+           continue ;
+         
+         if(hist->TestBit(AliQAv1::GetImageBit())) {
+           hist->GetXaxis()->SetTitleSize(0.02);
+           hist->GetYaxis()->SetTitleSize(0.02);
+           hist->GetXaxis()->SetLabelSize(0.02);
+           hist->GetYaxis()->SetLabelSize(0.02);
+           if(cln.Contains("TH2"))
+             {
+               gPad->SetRightMargin(0.15);
+               gPad->SetLeftMargin(0.05);
+               hist->SetStats(0);
+               hist->SetOption("colz") ;
+               //hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025);
+               //gPad->Update();
+             }
+           hist->DrawCopy() ; 
+           fImage[esIndex]->cd(++npad) ; 
+           fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
+         }
+       }
+       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
+      }
+    }
+   return kTRUE;
+}
+
 
+
+
+//_______________________________________________________________________
+Bool_t AliITSQASDDChecker::MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
+{
+
+    for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
+      if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) 
+        {
+       //printf ("Nothing for %s \n", AliQAv1::GetTaskName(task).Data()); 
+       continue;
+       }
+      const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
+      if ( !fImage[esIndex] ) {
+        fImage[esIndex] = new TCanvas(title, title,1280,980) ;
+      }
+      fImage[esIndex]->Clear() ; 
+      fImage[esIndex]->SetTitle(title) ; 
+      fImage[esIndex]->cd();
+      fImage[esIndex]->SetBorderMode(0) ;  
+      TPaveText someText(0.015, 0.015, 0.98, 0.98);
+      someText.AddText(title);
+      someText.Draw(); 
+      fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
+      fImage[esIndex]->Clear() ; 
+      Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
+      Int_t ny =4; // nx  ; 
+      //if (nx < TMath::Sqrt(nImages))
+      //ny++ ;  
+      fImage[esIndex]->Divide(nx, ny) ; 
+      TIter nexthist(list[esIndex]) ; 
+      TH1* hist = NULL ;
+      Int_t npad = 1 ; 
+      fImage[esIndex]->cd(npad) ; 
+      fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
+      while ( (hist=static_cast<TH1*>(nexthist())) ) {
+       //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
+        TString cln(hist->ClassName()) ;
+       //printf("=====================> Class name %s \n",cln.Data()); 
+        if ( ! cln.Contains("TH") )
+          continue ;
+        if(hist->TestBit(AliQAv1::GetImageBit())) {
+           hist->GetXaxis()->SetTitleSize(0.02);
+           hist->GetYaxis()->SetTitleSize(0.02);
+           hist->GetXaxis()->SetLabelSize(0.02);
+           hist->GetYaxis()->SetLabelSize(0.02);
+         if(cln.Contains("TH1"))
+           {
+             hist->SetFillColor(kOrange+7);
+             //SetFrameFillColor(kAzure-9);
+             //hist->DrawCopy() ; 
+           }
+         if(cln.Contains("TH2"))
+           {
+             gPad->SetRightMargin(0.15);
+             gPad->SetLeftMargin(0.05);
+             hist->SetStats(0);
+             hist->SetOption("colz") ;
+             //              TPaletteAxis *paletta =(TPaletteAxis*)hist->GetListOfFunctions()->FindObject("palette");
+             //paletta->SetLabelSize(0.025);
+             //gPad->Update(); 
+           }
+         hist->DrawCopy();
+          fImage[esIndex]->cd(++npad) ; 
+         fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
+        }
+      }
+      fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
+    }
+    // }  
+   return kTRUE;
+}