Fix coverity warnings in SDD QA (Melinda)
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Oct 2010 21:35:39 +0000 (21:35 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Oct 2010 21:35:39 +0000 (21:35 +0000)
ITS/AliITSQAChecker.cxx
ITS/AliITSQADataMakerRec.cxx
ITS/AliITSQASDDChecker.cxx
ITS/AliITSQASDDDataMakerRec.cxx

index 5244056..daec1ea 100644 (file)
@@ -132,7 +132,7 @@ void AliITSQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray *
         rv[specie] = 0.; // nothing to check
       }
       else {
-       Double_t *stepbit=new Double_t[AliQAv1::kNBIT];
+       Double_t stepbit[AliQAv1::kNBIT];
        Double_t histonumb= list[specie]->GetEntries();
        CreateStepForBit(histonumb,stepbit); 
         TIter next1(list[specie]);
@@ -141,16 +141,17 @@ void AliITSQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray *
         Bool_t skipped[6]={kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE};
         // look for layers that we wanted to skip
         while ( (hdata = dynamic_cast<TH1 *>(next1())) ) {
-          if(!hdata) continue;
-          TString hname = hdata->GetName();
-          if(!hname.Contains("hESDSkippedLayers")) continue;
-          for(Int_t k=1; k<7; k++) {
-            if(hdata->GetBinContent(k)>0) { 
-              nskipped++; 
-              skipped[k-1]=kTRUE; 
-            } 
-          } 
-        }
+          if(hdata){
+           TString hname = hdata->GetName();
+           if(!hname.Contains("hESDSkippedLayers")) continue;
+           for(Int_t k=1; k<7; k++) {
+             if(hdata->GetBinContent(k)>0) { 
+               nskipped++; 
+               skipped[k-1]=kTRUE; 
+             } 
+           } 
+         }
+       }
         TIter next(list[specie]);
         while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
           if(hdata){
@@ -172,8 +173,8 @@ void AliITSQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray *
                   AliDebug(AliQAv1::GetQADebugLevel(),Form("SA tracks have few points on layer %d - look at histogram hESDClustersSA",k));
                 }
               }  
-            }
-
+            }//end clustermapsa 
+           
             else if(hname.Contains("hESDClusterMapMI") && entries>0.){
               // Check if there are layers with anomalously low 
               // contributing points to MI reconstructed tracks
@@ -187,8 +188,8 @@ void AliITSQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray *
                   AliDebug(AliQAv1::GetQADebugLevel(),Form("MI tracks have few points on layer %d - look at histogram hESDClustersMI",k));
                 }
               }  
-            }
-
+            }//end clustermapmi
+           
             else if(hname.Contains("hESDClustersMI") && entries>0.){
               // Check if 6 clusters MI tracks are the majority
               AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
@@ -200,8 +201,8 @@ void AliITSQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray *
                   AliDebug(AliQAv1::GetQADebugLevel(),Form("MI Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersMI",k-1,6-nskipped));
                 }
               }
-            }
-
+            }//end clustersmi
+           
             else if(hname.Contains("hESDClustersSA") && entries>0.){
               // Check if 6 clusters SA tracks are the majority
               AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
@@ -213,8 +214,8 @@ void AliITSQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray *
                   AliDebug(AliQAv1::GetQADebugLevel(), Form("SA Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersSA",k-1,6-nskipped));
                 }
               }
-            }
-
+            }//end clusterssa
+           
             else if(hname.Contains("hSPDVertexZ") && entries>0.){
               // Check if average Z vertex coordinate is -5 < z < 5 cm
               AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
@@ -223,32 +224,32 @@ void AliITSQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray *
                 verSPDZ = kFALSE;
                 AliDebug(AliQAv1::GetQADebugLevel(),Form("Average z vertex coordinate is at z= %10.4g cm",hdata->GetMean()));
               }
-            }
-          }
-          else{
-            AliError("ESD Checker - invalid data type");
-          }
-       }
-       rv[specie] = 0.;
-       if(tested>0){
-         if(tested == empty){
-           rv[specie] = 2500.; // set to error
-           AliWarning(Form("All ESD histograms are empty - specie=%d",specie));
-         }
-         else {
-           rv[specie] = 2500.-1500.*(static_cast<Double_t>(tested-empty)/static_cast<Double_t>(tested)); // INFO if all histos are filled
-           if(cluMapSA)rv[specie]-=200.;
-           if(cluMapMI)rv[specie]-=200.;
-           if(cluMI)rv[specie]-=200.;
-           if(cluSA)rv[specie]-=200.;
-           if(verSPDZ)rv[specie]-=199.;  // down to 1 if everything is OK
-         }
-       }
+            }//end spdvertexz
+           
+           else{ AliError("ESD Checker - invalid data type");}//end else
+           
+           rv[specie] = 0.;
+           if(tested>0){
+             if(tested == empty){
+               rv[specie] = 2500.; // set to error
+               AliWarning(Form("All ESD histograms are empty - specie=%d",specie));
+             }
+             else {
+               rv[specie] = 2500.-1500.*(static_cast<Double_t>(tested-empty)/static_cast<Double_t>(tested)); // INFO if all histos are filled
+               if(cluMapSA)rv[specie]-=200.;
+               if(cluMapMI)rv[specie]-=200.;
+               if(cluMI)rv[specie]-=200.;
+               if(cluSA)rv[specie]-=200.;
+               if(verSPDZ)rv[specie]-=199.;  // down to 1 if everything is OK
+             }
+           }//end tested
+         }//end hdata
+       }//end while
+       //     AliDebug(AliQAv1::GetQADebugLevel(), Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
+       AliInfo(Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
       }
-      //     AliDebug(AliQAv1::GetQADebugLevel(), Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
-      AliInfo(Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
     }
-  }  // end of ESD QA
+  } // end of ESD QA
   else{
     
     //____________________________________________________________________________
index 20a793e..9945df2 100644 (file)
@@ -312,13 +312,9 @@ void AliITSQADataMakerRec::InitRecPoints()
          Int_t offset = fRecPointsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries();
          const Bool_t expert   = kTRUE ; 
          const Bool_t image    = kTRUE ; 
-         Char_t name[50];
-         Char_t title[50];
-         TH2F**hPhiEta = new TH2F*[6];
+         TH2F* hPhiEta[6];
          for (Int_t iLay=0;iLay<6;iLay++) {
-           sprintf(name,"Phi_vs_Eta_ITS_Layer%d",iLay+1);
-           sprintf(title,"Phi vs Eta - ITS Layer %d",iLay+1);
-           hPhiEta[iLay]=new TH2F(name,title,30,-1.5,1.5,200,0.,2*TMath::Pi());
+           hPhiEta[iLay]=new TH2F(Form("Phi_vs_Eta_ITS_Layer%d",iLay+1),Form("Phi_vs_Eta_ITS_Layer%d",iLay+1),30,-1.5,1.5,200,0.,2*TMath::Pi());
            hPhiEta[iLay]->GetXaxis()->SetTitle("Pseudorapidity");
            hPhiEta[iLay]->GetYaxis()->SetTitle("#varphi [rad]");
            Add2RecPointsList(hPhiEta[iLay], iLay + offset, !expert, image);
index c3eae58..4383af6 100644 (file)
@@ -107,15 +107,17 @@ 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 ");
 
@@ -130,6 +132,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
       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;   
@@ -175,21 +178,22 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
              if(hname.Contains("3"))layer1=0;
              else  if(hname.Contains("4"))layer1=1;
              TH2* htemp=dynamic_cast<TH2*>(hdata);
-             hlayer[layer1]=(TH2*)htemp->Clone();
-             char newname[50];
-             sprintf(newname,"%s_copy",hname.Data());
-             hlayer[layer1]->SetName(newname);
-             hlayer[layer1]->RebinX(2);
-             int modmay=hlayer[layer1]->GetNbinsY();
-             TH1D* hproj= hlayer[layer1]->ProjectionY();
-             Double_t ladcontent=0;
-             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
-             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
+             if(htemp){
+               hlayer[layer1]=(TH2*)htemp->Clone();
+               hlayer[layer1]->SetName(Form("%s_copy",hname.Data()));
+               hlayer[layer1]->RebinX(2);
+               int modmay=hlayer[layer1]->GetNbinsY();
+               TH1D* hproj= hlayer[layer1]->ProjectionY();
+               Double_t ladcontent=0;
+               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
+               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 if htemp
+           }//end else entries !=0
          }//end check on phiz        
        }//end if hdata 
       }//end while
@@ -206,7 +210,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++;
@@ -477,7 +481,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
   }//end switch
   
   fCalibration=NULL;
-  delete hdata;
+  if(hdata) delete hdata;
 
 
   return SDDQACheckerValue;    
index 1ad11a3..029d127 100644 (file)
@@ -342,11 +342,11 @@ Int_t AliITSQASDDDataMakerRec::InitRaws()
        Float_t hMax = 0.2;
        
        TH1F *oL3 = new TH1F("SDDL3_RelativeOccupancy","Layer 3 Relative Occupancy",200,0.,hMax);
-       rv = fAliITSQADataMakerRec->Add2RawsList(oL3,6+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); //6 
+       rv = fAliITSQADataMakerRec->Add2RawsList(oL3,6+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); //6  
        fSDDhRawsTask++;
        
        TH1F *oL4 = new TH1F("SDDL4_RelativeOccupancy","Layer 4 Relative Occupancy",200,0.,hMax);
-       rv = fAliITSQADataMakerRec->Add2RawsList(oL4,7+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); //7
+       rv = fAliITSQADataMakerRec->Add2RawsList(oL4,7+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); //7   
        fSDDhRawsTask++;
        
        fOnlineOffsetRaws = fSDDhRawsTask;
@@ -363,15 +363,10 @@ Int_t AliITSQASDDDataMakerRec::InitRaws()
       indexlast = 0;
       index1 = 0;
       indexlast1 = fSDDhRawsTask;
-      char *hname[3];
-      for(Int_t i=0; i<3; i++) hname[i]= new char[50];
       for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
                  for(Int_t iside=0;iside<fgknSide;iside++){
                          AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
-                         sprintf(hname[0],"SDDchargeMapFSE_L%d_%d_%d_%d",lay,lad,det,iside);
-                         sprintf(hname[1],"SDDChargeMapForSingleEvent_L%d_%d_%d_%d",lay,lad,det,iside);
-         //      sprintf(hname[2],"SDDhmonoDMap_L%d_%d_%d_%d",lay,lad,det,iside);
-                         TProfile2D *fModuleChargeMapFSE = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
+                         TProfile2D *fModuleChargeMapFSE = new TProfile2D(Form("SDDchargeMapFSE_L%d_%d_%d_%d",lay,lad,det,iside),Form("SDDChargeMapForSingleEvent_L%d_%d_%d_%d",lay,lad,det,iside)  ,256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
                          fModuleChargeMapFSE->GetXaxis()->SetTitle("Time Bin");
                          fModuleChargeMapFSE->GetYaxis()->SetTitle("Anode");
                          rv = fAliITSQADataMakerRec->Add2RawsList(fModuleChargeMapFSE,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);         
@@ -383,12 +378,10 @@ Int_t AliITSQASDDDataMakerRec::InitRaws()
       for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
                  for(Int_t iside=0;iside<fgknSide;iside++){
                          AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
-                         sprintf(hname[0],"SDDchargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
-                         sprintf(hname[1],"SDDChargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
-                         TProfile2D *fModuleChargeMap = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
+                         TProfile2D *fModuleChargeMap = new TProfile2D(Form("SDDchargeMap_L%d_%d_%d_%d",lay,lad,det,iside),Form("SDDChargeMap_L%d_%d_%d_%d",lay,lad,det,iside),256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
                          fModuleChargeMap->GetXaxis()->SetTitle("Time Bin");
                          fModuleChargeMap->GetYaxis()->SetTitle("Anode Number");
-                         rv = fAliITSQADataMakerRec->Add2RawsList(fModuleChargeMap,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
+                         rv = fAliITSQADataMakerRec->Add2RawsList(fModuleChargeMap,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); 
                          fSDDhRawsTask++;
                          index1++;      
                  }
@@ -399,7 +392,7 @@ Int_t AliITSQASDDDataMakerRec::InitRaws()
       hsize->SetBit(TH1::kCanRebin);
       hsize->GetXaxis()->SetTitle("Event Size [kB]");
       hsize->GetYaxis()->SetTitle("Entries");
-      rv = fAliITSQADataMakerRec->Add2RawsList(hsize,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
+      rv = fAliITSQADataMakerRec->Add2RawsList(hsize,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); 
       fSDDhRawsTask++;
          
     }  // kONLINE
@@ -455,9 +448,10 @@ Int_t AliITSQASDDDataMakerRec::MakeRaws(AliRawReader* rawReader)
   while(stream->Next()) {
     ildcID = rawReader->GetLDCId();
     iddl = rawReader->GetDDLID();// - fgkDDLIDshift;
+    if(iddl<0)isddmod=-1;
     //printf("----------------------iddl %i\n",iddl);
+    else isddmod = fDDLModuleMap->GetModuleNumber(iddl,stream->GetCarlosId());
 
-    isddmod = fDDLModuleMap->GetModuleNumber(iddl,stream->GetCarlosId());
     if(isddmod==-1){
       AliDebug(AliQAv1::GetQADebugLevel(),Form("Found module with iddl: %d, stream->GetCarlosId: %d \n",iddl,stream->GetCarlosId()));
       continue;
@@ -645,7 +639,6 @@ Int_t AliITSQASDDDataMakerRec::InitRecPoints()
   rv = fAliITSQADataMakerRec->Add2RecPointsList(h1, 1 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);//NON expert image
   fSDDhRecPointsTask++;
 
-  char hisnam[50];
   TH2F *h2 = new TH2F("SDDGlobalCoordDistribYX","YX Global Coord Distrib",56,-28,28,56,-28,28);//position number 2
   h2->GetYaxis()->SetTitle("Y[cm]");
   h2->GetXaxis()->SetTitle("X[cm]");
@@ -738,8 +731,7 @@ Int_t AliITSQASDDDataMakerRec::InitRecPoints()
   fSDDhRecPointsTask++;
   
   for(Int_t iLay=0; iLay<=1; iLay++){
-    sprintf(hisnam,"SDDphidistrib_Layer%d",iLay+3);
-    TH1F *h15 = new TH1F(hisnam,hisnam,180,-TMath::Pi(),TMath::Pi());//position number 15 (L3) and position number 16 (L4)
+    TH1F *h15 = new TH1F(Form("SDDphidistrib_Layer%d",iLay+3),Form("SDDphidistrib_Layer%d",iLay+3) ,180,-TMath::Pi(),TMath::Pi());//position number 15 (L3) and position number 16 (L4)
     h15->GetXaxis()->SetTitle("#varphi[rad]");
     h15->GetXaxis()->CenterTitle();
     h15->GetYaxis()->SetTitle("Entries");
@@ -748,8 +740,7 @@ Int_t AliITSQASDDDataMakerRec::InitRecPoints()
   }
   
   for(Int_t iLay=0; iLay<=1; iLay++){
-    sprintf(hisnam,"SDDdrifttime_Layer%d",iLay+3);
-    TH1F *h17 = new TH1F(hisnam,hisnam,45,-0.5,4499.5);//position number 17 (L3) and position number 18 (L4)
+    TH1F *h17 = new TH1F(Form("SDDdrifttime_Layer%d",iLay+3),Form("SDDdrifttime_Layer%d",iLay+3),45,-0.5,4499.5);//position number 17 (L3) and position number 18 (L4)
     h17->SetBit(TH1::kCanRebin);
     h17->GetXaxis()->SetTitle("drift time[ns]");
     h17->GetXaxis()->CenterTitle();
@@ -940,11 +931,13 @@ void AliITSQASDDDataMakerRec::CreateTheMap()
       fDDLModuleMap = NULL;
       //return rv;
     }
-  fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
-  if(!cacheStatus)ddlMapSDD->SetObject(NULL);
-  ddlMapSDD->SetOwner(kTRUE);
-  if(!cacheStatus){ delete ddlMapSDD;}
-  AliInfo("DDL Map Created\n ");
+  else{
+    fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
+    if(!cacheStatus)ddlMapSDD->SetObject(NULL);
+    ddlMapSDD->SetOwner(kTRUE);
+    if(!cacheStatus){ delete ddlMapSDD;}
+    AliInfo("DDL Map Created\n ");
+  }
 }
 
 //_______________________________________________________________
@@ -958,88 +951,89 @@ void AliITSQASDDDataMakerRec::CreateTheCalibration()
     if(!calibSDD)
       {
        AliError("Calibration object retrieval failed! SDD will not be processed");
-       fCalibration = NULL;;
+       fCalibration = NULL;
       }
-    fCalibration = (TObjArray *)calibSDD->GetObject();
-    
-    if(!cacheStatus)calibSDD->SetObject(NULL);
-    calibSDD->SetOwner(kTRUE);
-    if(!cacheStatus){delete calibSDD;}
-
-    AliITSCalibrationSDD * cal=NULL;
-    for(Int_t imod=0;imod<fgknSDDmodules;imod++)
-      {
-       //cal=NULL;
-       Int_t fillmodhisto1=fgkTotalNumberSDDAnodes;
-       Int_t fillmodhisto2side0=fgkNumberOfSDDAnodesperSide;
-       Int_t fillmodhisto2side1=fgkNumberOfSDDAnodesperSide;
-       Int_t fillmodhisto3side0=fgkNumberOfSDDAnodesperSide;
-       Int_t fillmodhisto3side1=fgkNumberOfSDDAnodesperSide;
-       
-       Int_t badmodhisto1=0;
-       Int_t badmodhisto2side0=0;
-       Int_t badmodhisto2side1=0;
-       Int_t badmodhisto3side0=0;
-       Int_t badmodhisto3side1=0;
-       //printf("imod %i\t ==== \t",imod);
-       Int_t module=imod + 240;
-       //printf("module %i\t ==== \t",module);
-       cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
-       Int_t lay,lad,det;
-       AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
-       Int_t index=1+(det-1)*2;
-       if(cal==0){continue;}
-       if (cal->IsBad()){continue;}//bad module check
-       else{
-         for(Int_t i=0;i<8;i++) //check on bad chips in good modules
-           {
-             if(lay==3){
-               if(cal->IsChipBad(i)){
-                 if(i<4){badmodhisto2side0+=64;}
-                 if(i>=4){badmodhisto2side1+=64;}
-               }//end if chip
-             }//end if  layer3
-             else if(lay==4){
-               if(cal->IsChipBad(i)){
-                 if(i<4){badmodhisto3side0+=64;}
-                 if(i>=4){badmodhisto3side1+=64;}               
-               }//end if  chip
-             }//ens if layer4
-           }//end for  chip
-         for(Int_t iAn=0; iAn<512; iAn++){//anodes loop 
-           Int_t ic=cal->GetChip(iAn);//chip with this anode number
-           if(!cal->IsChipBad(ic) && !cal->IsBad() && cal->IsBadChannel(iAn)){// good chip   good module   bad channel 
-             if(lay==3){
+    else{
+      fCalibration = (TObjArray *)calibSDD->GetObject();
+      
+      if(!cacheStatus)calibSDD->SetObject(NULL);
+      calibSDD->SetOwner(kTRUE);
+      if(!cacheStatus){delete calibSDD;}
+      
+      AliITSCalibrationSDD * cal=NULL;
+      for(Int_t imod=0;imod<fgknSDDmodules;imod++)
+       {
+         //cal=NULL;
+         Int_t fillmodhisto1=fgkTotalNumberSDDAnodes;
+         Int_t fillmodhisto2side0=fgkNumberOfSDDAnodesperSide;
+         Int_t fillmodhisto2side1=fgkNumberOfSDDAnodesperSide;
+         Int_t fillmodhisto3side0=fgkNumberOfSDDAnodesperSide;
+         Int_t fillmodhisto3side1=fgkNumberOfSDDAnodesperSide;
+         
+         Int_t badmodhisto1=0;
+         Int_t badmodhisto2side0=0;
+         Int_t badmodhisto2side1=0;
+         Int_t badmodhisto3side0=0;
+         Int_t badmodhisto3side1=0;
+         //printf("imod %i\t ==== \t",imod);
+         Int_t module=imod + 240;
+         //printf("module %i\t ==== \t",module);
+         cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
+         Int_t lay,lad,det;
+         AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
+         Int_t index=1+(det-1)*2;
+         if(cal==0){continue;}
+         if (cal->IsBad()){continue;}//bad module check
+         else{
+           for(Int_t i=0;i<8;i++) //check on bad chips in good modules
+             {
+               if(lay==3){
+                 if(cal->IsChipBad(i)){
+                   if(i<4){badmodhisto2side0+=64;}
+                   if(i>=4){badmodhisto2side1+=64;}
+                 }//end if chip
+               }//end if  layer3
+               else if(lay==4){
+                 if(cal->IsChipBad(i)){
+                   if(i<4){badmodhisto3side0+=64;}
+                   if(i>=4){badmodhisto3side1+=64;}             
+                 }//end if  chip
+               }//ens if layer4
+             }//end for  chip
+           for(Int_t iAn=0; iAn<512; iAn++){//anodes loop 
+             Int_t ic=cal->GetChip(iAn);//chip with this anode number
+             if(!cal->IsChipBad(ic) && !cal->IsBad() && cal->IsBadChannel(iAn)){// good chip   good module   bad channel 
+               if(lay==3){
                  if(ic<4) badmodhisto2side0++;
                  else if(ic>=4)badmodhisto2side1++;
                }//end if layer 3
-             else if(lay==4){
+               else if(lay==4){
                  if(ic<4) badmodhisto3side0++;
                  else if(ic>=4)badmodhisto3side1++;
                }//end if layer 4
-           }//end if chip module channel
-         }//end for anodes
-         if(lay==3){
-           badmodhisto1=badmodhisto2side0+badmodhisto2side1;
-           fillmodhisto1-=badmodhisto1;
-           fillmodhisto2side0-=badmodhisto2side0;
-           fillmodhisto2side1-=badmodhisto2side1;
-           ((TH1D*)(fHistoCalibration->At(0)))->SetBinContent(imod+1,fillmodhisto1);
-           ((TH2D*)(fHistoCalibration->At(1)))->SetBinContent(index,lad,fillmodhisto2side0);
-           ((TH2D*)(fHistoCalibration->At(1)))->SetBinContent(index+1,lad,fillmodhisto2side1);
-         }//end layer 3
-         else if(lay==4){
-           badmodhisto1=badmodhisto3side0+badmodhisto3side1;
-           fillmodhisto1-=badmodhisto1;
-           fillmodhisto3side0-=badmodhisto3side0;
-           fillmodhisto3side1-=badmodhisto3side1;
-           ((TH1D*)(fHistoCalibration->At(0)))->SetBinContent(imod+1,fillmodhisto1);
-           ((TH2D*)(fHistoCalibration->At(2)))->SetBinContent(index,lad,fillmodhisto3side0);
-           ((TH2D*)(fHistoCalibration->At(2)))->SetBinContent(index+1,lad,fillmodhisto2side1);
-         }//end layer 4
-       }//end else bad module
-      }//end module for
-
+             }//end if chip module channel
+           }//end for anodes
+           if(lay==3){
+             badmodhisto1=badmodhisto2side0+badmodhisto2side1;
+             fillmodhisto1-=badmodhisto1;
+             fillmodhisto2side0-=badmodhisto2side0;
+             fillmodhisto2side1-=badmodhisto2side1;
+             ((TH1D*)(fHistoCalibration->At(0)))->SetBinContent(imod+1,fillmodhisto1);
+             ((TH2D*)(fHistoCalibration->At(1)))->SetBinContent(index,lad,fillmodhisto2side0);
+             ((TH2D*)(fHistoCalibration->At(1)))->SetBinContent(index+1,lad,fillmodhisto2side1);
+           }//end layer 3
+           else if(lay==4){
+             badmodhisto1=badmodhisto3side0+badmodhisto3side1;
+             fillmodhisto1-=badmodhisto1;
+             fillmodhisto3side0-=badmodhisto3side0;
+             fillmodhisto3side1-=badmodhisto3side1;
+             ((TH1D*)(fHistoCalibration->At(0)))->SetBinContent(imod+1,fillmodhisto1);
+             ((TH2D*)(fHistoCalibration->At(2)))->SetBinContent(index,lad,fillmodhisto3side0);
+             ((TH2D*)(fHistoCalibration->At(2)))->SetBinContent(index+1,lad,fillmodhisto2side1);
+           }//end layer 4
+         }//end else bad module
+       }//end module for
+    }
 }
 
 //____________________________________________________________________
@@ -1069,8 +1063,9 @@ void AliITSQASDDDataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
   //reset the SDD calibration histograms
   AliInfo(Form("Reset detector in SDD called for task index %i", task));
   if(task== AliQAv1::kRAWS ){
-  fDDLModuleMap=NULL;
+    fDDLModuleMap=NULL;
   }
+
   fCalibration=NULL;
 
   ((TH1D*)(fHistoCalibration->At(0)))->Reset();