]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSQASDDDataMakerRec.cxx
new centrality selection
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDDataMakerRec.cxx
index 65999c5d2438776d1ce831eb4a0fa18ce78cf2c7..029d1272e33e3e9fb6b5c9d4b15133e9065e5c3a 100644 (file)
@@ -309,13 +309,13 @@ Int_t AliITSQASDDDataMakerRec::InitRaws()
   TH2D *hphil3 = new TH2D("SDDphizL3","SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);//1
   hphil3->GetXaxis()->SetTitle("z[Module Number L3 ]");
   hphil3->GetYaxis()->SetTitle("#varphi[ Ladder Number L3]");
-  rv = fAliITSQADataMakerRec->Add2RawsList(hphil3,1+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr); 
+  rv = fAliITSQADataMakerRec->Add2RawsList(hphil3,1+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); 
   fSDDhRawsTask++;
   
   TH2D *hphil4 = new TH2D("SDDphizL4","SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5); //2
   hphil4->GetXaxis()->SetTitle("z[Module Number L4]");
   hphil4->GetYaxis()->SetTitle("#varphi[Ladder Number L4]");
-   rv = fAliITSQADataMakerRec->Add2RawsList(hphil4,2+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr); 
+   rv = fAliITSQADataMakerRec->Add2RawsList(hphil4,2+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); 
   fSDDhRawsTask++;
   
   //normalized histograms
@@ -329,24 +329,24 @@ Int_t AliITSQASDDDataMakerRec::InitRaws()
   TH2D *hphil3norm = new TH2D("SDDphizL3NORM","NORM SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);//4
   hphil3norm->GetXaxis()->SetTitle("z[Module Number L3 ]");
   hphil3norm->GetYaxis()->SetTitle("#varphi[ Ladder Number L3]");
-  rv = fAliITSQADataMakerRec->Add2RawsList(hphil3norm,4+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); 
+  rv = fAliITSQADataMakerRec->Add2RawsList(hphil3norm,4+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr); 
   fSDDhRawsTask++;
   
   TH2D *hphil4norm = new TH2D("SDDphizL4NORM","NORM SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5); //5
   hphil4norm->GetXaxis()->SetTitle("z[Module Number L4]");
   hphil4norm->GetYaxis()->SetTitle("#varphi[Ladder Number L4]");
-   rv = fAliITSQADataMakerRec->Add2RawsList(hphil4norm,5+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr); 
+   rv = fAliITSQADataMakerRec->Add2RawsList(hphil4norm,5+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr); 
   fSDDhRawsTask++;
 
        
        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
+    }
 }
 
 //____________________________________________________________________
@@ -1048,14 +1042,17 @@ void AliITSQASDDDataMakerRec::InitCalibrationArray()
 {
   //create the histograms with the calibration informations. The histograms are stored in a TObjArray
     TH1D *pattern1  = new TH1D("CALSDDModPattern","Calibration HW Modules pattern",fgknSDDmodules,239.5,499.5);
+    pattern1->SetDirectory(0) ;
     TH2D *patternl3 = new TH2D("CALSDDphizL3","Calibration SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);
+    patternl3->SetDirectory(0) ;
     TH2D *patternl4 = new TH2D("CALSDDphizL4"," Calibration SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5);
+    patternl4->SetDirectory(0) ;
 
-    fHistoCalibration = new TObjArray(3); 
+    if(!fHistoCalibration)fHistoCalibration = new TObjArray(3);
     fHistoCalibration->AddAtAndExpand(pattern1,0);
     fHistoCalibration->AddAtAndExpand(patternl3,1);
     fHistoCalibration->AddAtAndExpand(patternl4,2);
-
+    fHistoCalibration->SetOwner(kTRUE); 
     //    printf("Calibration Histograms created!\n");
 }
 
@@ -1066,13 +1063,16 @@ 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();
   ((TH2D*)(fHistoCalibration->At(1)))->Reset();
   ((TH2D*)(fHistoCalibration->At(2)))->Reset();
+  //delete fHistoCalibration;
+  //fHistoCalibration=NULL;
   
 }