]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added run dependent corrections on T for calibration, removed old method
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 May 2012 15:15:58 +0000 (15:15 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 May 2012 15:15:58 +0000 (15:15 +0000)
ANALYSIS/TenderSupplies/AliEMCALTenderSupply.cxx
ANALYSIS/TenderSupplies/AliEMCALTenderSupply.h
EMCAL/AliEMCALRecoUtils.cxx
EMCAL/AliEMCALRecoUtils.h
PWG/CaloTrackCorrBase/AliCalorimeterUtils.cxx
PWG/CaloTrackCorrBase/AliCalorimeterUtils.h
PWGGA/CaloTasks/AliAnalysisTaskCaloFilter.cxx
PWGGA/EMCALTasks/AliAnalysisTaskEMCALClusterize.cxx
PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C

index f87948e85b56d20f0ec9c3a9d6a3be591529a515..5bd83bf8f57d20cf38c31db1d1af308ae6ee4c16 100644 (file)
@@ -492,7 +492,8 @@ void AliEMCALTenderSupply::ProcessEvent()
     }
 
     // init recalibration factors
-    if( needRecalib ) { 
+    if( needRecalib ) 
+    { 
       Int_t fInitRecalib = InitRecalib();
       if (fInitRecalib==0)
         AliError("InitRecalib returned false, returning");
@@ -500,9 +501,21 @@ void AliEMCALTenderSupply::ProcessEvent()
         AliWarning("InitRecalib OK");
       if (fInitRecalib>1)
         AliWarning(Form("No recalibration available: %d - %s", event->GetRunNumber(), fFilepass.Data()));
-        fReCalibCluster = kFALSE;
+      
+      Int_t fInitRunDepRecalib = InitRunDepRecalib();
+      if (fInitRunDepRecalib==0)
+        AliError("InitrunDepRecalib returned false, returning");
+      if (fInitRunDepRecalib==1)
+        AliWarning("InitRecalib OK");
+      if (fInitRunDepRecalib>1)
+        AliWarning(Form("No Temperature recalibration available: %d - %s", event->GetRunNumber(), fFilepass.Data()));
+      
+      fReCalibCluster = kFALSE;
+      
     }
     
+    
+    
     // init time calibration
     if( needTimecalib ){
       Int_t initTC = InitTimeCalibration();
@@ -1026,6 +1039,89 @@ Int_t AliEMCALTenderSupply::InitRecalib()
   return 1;
 }
 
+//_____________________________________________________
+Int_t AliEMCALTenderSupply::InitRunDepRecalib()
+{
+  // Initialising recalibration factors.
+  
+  AliVEvent *event = GetEvent();
+  
+  if (!event) 
+    return 0;
+  
+  if (fDebugLevel>0) 
+    AliInfo("Initialising recalibration factors");
+  
+  // init default maps first
+  if( !fEMCALRecoUtils->GetEMCALRecalibrationFactorsArray() )
+    fEMCALRecoUtils->InitEMCALRecalibrationFactors() ;
+  
+  Int_t runRC = event->GetRunNumber();
+  
+  AliOADBContainer *contRF=new AliOADBContainer("");
+  if (fBasePath!="") 
+  { //if fBasePath specified in the ->SetBasePath()
+    if (fDebugLevel>0)  AliInfo(Form("Loading Recalib OADB from given path %s",fBasePath.Data()));
+    
+    TFile *fRunDepRecalib= new TFile(Form("%s/EMCALTemperatureCorrCalib.root",fBasePath.Data()),"read");
+    if (!fRunDepRecalib || fRunDepRecalib->IsZombie()) 
+    {
+      AliFatal(Form("EMCALTemperatureCorrCalib.root not found in %s",fBasePath.Data()));
+      return 0;
+    }
+    
+    if (fRunDepRecalib) delete fRunDepRecalib;
+    
+    contRF->InitFromFile(Form("%s/EMCALTemperatureCorrCalib.root",fBasePath.Data()),"AliEMCALRunDepTempCalibCorrections");
+  }
+  else
+  { // Else choose the one in the $ALICE_ROOT directory
+    if (fDebugLevel>0)  AliInfo("Loading Recalib OADB from $ALICE_ROOT/OADB/EMCAL");
+    
+    TFile *fRunDepRecalib= new TFile("$ALICE_ROOT/OADB/EMCAL/EMCALTemperatureCorrCalib.root","read");
+    if (!fRunDepRecalib || fRunDepRecalib->IsZombie()) 
+    {
+      AliFatal("$ALICE_ROOT/OADB/EMCAL/EMCALTemperatureCorrCalib.root was not found");
+      return 0;
+    }
+    
+    if (fRunDepRecalib) delete fRunDepRecalib;
+    
+    contRF->InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALTemperatureCorrCalib.root","AliEMCALRunDepTempCalibCorrections");     
+  }
+  
+  TH1S *rundeprecal=(TH1S*)contRF->GetObject(runRC);
+  if (!rundeprecal)
+  {
+    AliError(Form("No Objects for run: %d",runRC));
+    return 2;
+  } 
+  
+  if (fDebugLevel>0) rundeprecal->Print();
+  
+  Int_t nSM = fEMCALGeo->GetEMCGeometry()->GetNumberOfSuperModules();
+  
+  for (Int_t ism=0; ism<nSM; ++ism) 
+  {        
+    for (Int_t icol=0; icol<48; ++icol) 
+    {        
+      for (Int_t irow=0; irow<24; ++irow) 
+      {
+        Float_t factor = fEMCALRecoUtils->GetEMCALChannelRecalibrationFactor(ism,icol,irow);
+        
+        Int_t absID = fEMCALGeo->GetAbsCellIdFromCellIndexes(ism, irow, icol); // original calibration factor
+        factor *= rundeprecal->GetBinContent(absID) / 10000. ; // correction dependent on T
+        //printf("\t ism %d, icol %d, irow %d,absID %d, corrA %2.3f, corrB %2.3f, corrAB %2.3f\n",ism, icol, irow, absID, 
+        //      GetEMCALChannelRecalibrationFactor(ism,icol,irow) , rundeprecal->GetBinContent(absID) / 10000., factor);
+        fEMCALRecoUtils->SetEMCALChannelRecalibrationFactor(ism,icol,irow,factor);
+      } // columns
+    } // rows 
+  } // SM loop
+  
+  return 1;
+}
+
+
 //_____________________________________________________
 Int_t AliEMCALTenderSupply::InitTimeCalibration()
 {
index 4c7d9f797b44236463c631a6642afc197f8bdce9..bf651b628d1e8e1fb894c9b7b95240efbdfe3ba6 100644 (file)
@@ -164,6 +164,7 @@ private:
   Int_t      InitRecParam();
   Bool_t     InitMisalignMatrix();
   Int_t      InitRecalib();
+  Int_t      InitRunDepRecalib();
   Int_t      InitTimeCalibration();
   void       Clusterize();
   void       FillDigitsArray();
index 459d70c3905979f36a239c99aca58be10d6a2e2e..7130fb1776ac58993da769d292ca3b7472a4f82b 100644 (file)
@@ -56,7 +56,6 @@
 #include "AliEMCALRecoUtils.h"
 #include "AliEMCALGeometry.h"
 #include "AliTrackerBase.h"
-#include "AliEMCALCalibTimeDepCorrection.h" // Run dependent
 #include "AliEMCALPIDUtils.h"
 
 
@@ -68,8 +67,7 @@ AliEMCALRecoUtils::AliEMCALRecoUtils():
   fNonLinearityFunction(0),               fNonLinearThreshold(0),
   fSmearClusterEnergy(kFALSE),            fRandom(),
   fCellsRecalibrated(kFALSE),             fRecalibration(kFALSE),                 fEMCALRecalibrationFactors(),
-  fTimeRecalibration(kFALSE),             fEMCALTimeRecalibrationFactors(),
-  fUseRunCorrectionFactors(kFALSE),       fRunCorrectionFactorsSet(kFALSE),
+  fTimeRecalibration(kFALSE),             fEMCALTimeRecalibrationFactors(),       fUseRunCorrectionFactors(kFALSE),       
   fRemoveBadChannels(kFALSE),             fRecalDistToBadChannels(kFALSE),        fEMCALBadChannelMap(),
   fNCellsFromEMCALBorder(0),              fNoEMCALBorderAtEta0(kTRUE),
   fRejectExoticCluster(kFALSE),           fRejectExoticCells(kFALSE), 
@@ -113,7 +111,7 @@ AliEMCALRecoUtils::AliEMCALRecoUtils(const AliEMCALRecoUtils & reco)
   fCellsRecalibrated(reco.fCellsRecalibrated),
   fRecalibration(reco.fRecalibration),                       fEMCALRecalibrationFactors(reco.fEMCALRecalibrationFactors),
   fTimeRecalibration(reco.fTimeRecalibration),               fEMCALTimeRecalibrationFactors(reco.fEMCALTimeRecalibrationFactors),
-  fUseRunCorrectionFactors(reco.fUseRunCorrectionFactors),   fRunCorrectionFactorsSet(reco.fRunCorrectionFactorsSet),
+  fUseRunCorrectionFactors(reco.fUseRunCorrectionFactors),   
   fRemoveBadChannels(reco.fRemoveBadChannels),               fRecalDistToBadChannels(reco.fRecalDistToBadChannels),
   fEMCALBadChannelMap(reco.fEMCALBadChannelMap),
   fNCellsFromEMCALBorder(reco.fNCellsFromEMCALBorder),       fNoEMCALBorderAtEta0(reco.fNoEMCALBorderAtEta0),
@@ -175,7 +173,6 @@ AliEMCALRecoUtils & AliEMCALRecoUtils::operator = (const AliEMCALRecoUtils & rec
   fEMCALTimeRecalibrationFactors = reco.fEMCALTimeRecalibrationFactors;
 
   fUseRunCorrectionFactors   = reco.fUseRunCorrectionFactors;
-  fRunCorrectionFactorsSet   = reco.fRunCorrectionFactorsSet;
   
   fRemoveBadChannels         = reco.fRemoveBadChannels;
   fRecalDistToBadChannels    = reco.fRecalDistToBadChannels;
@@ -2408,7 +2405,6 @@ void AliEMCALRecoUtils::SetTracksMatchedToCluster(const AliVEvent *event)
   AliDebug(2,"Cluster matched to tracks");  
 }
 
-
 //___________________________________________________
 void AliEMCALRecoUtils::Print(const Option_t *) const 
 {
@@ -2454,40 +2450,3 @@ void AliEMCALRecoUtils::Print(const Option_t *) const
   printf("DCSToVertex2D = %d, MaxDCAToVertexXY = %2.2f, MaxDCAToVertexZ = %2.2f\n",fCutDCAToVertex2D,fCutMaxDCAToVertexXY,fCutMaxDCAToVertexZ);
 }
 
-//_________________________________________________________________
-void AliEMCALRecoUtils::SetRunDependentCorrections(Int_t runnumber)
-{
-  //Get EMCAL time dependent corrections from file and put them in the recalibration histograms
-  //Do it only once and only if it is requested
-  
-  if(!fUseRunCorrectionFactors) return;
-  if(fRunCorrectionFactorsSet)  return;
-  
-  AliInfo(Form("AliEMCALRecoUtils::GetRunDependentCorrections() - Get Correction Factors for Run number %d\n",runnumber));
-  AliEMCALCalibTimeDepCorrection  *corr =  new AliEMCALCalibTimeDepCorrection();
-  corr->ReadRootInfo(Form("CorrectionFiles/Run%d_Correction.root",runnumber));
-  
-  SwitchOnRecalibration();
-  
-  AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance();
-  
-  for(Int_t ism = 0; ism < geom->GetNumberOfSuperModules(); ism++)
-  {
-    for(Int_t icol = 0; icol < 48; icol++)
-    {
-      for(Int_t irow = 0; irow < 24; irow++)
-      {
-        Float_t orgRecalFactor = GetEMCALChannelRecalibrationFactors(ism)->GetBinContent(icol,irow);
-        Float_t newRecalFactor = orgRecalFactor*corr->GetCorrection(ism, icol,irow,0);
-        GetEMCALChannelRecalibrationFactors(ism)->SetBinContent(icol,irow,newRecalFactor);
-        //printf("ism %d, icol %d, irow %d, corrections : org %f, time dep %f, final %f (org*time %f)\n",ism, icol, irow, 
-        //        orgRecalFactor, corr->GetCorrection(ism, icol,irow,0),
-        //       (GetEMCALChannelRecalibrationFactors(ism))->GetBinContent(icol,irow),newRecalFactor);
-      }
-    }
-  }
-  
-  fRunCorrectionFactorsSet = kTRUE;
-  
-}
index 206cff60764650b12039ebe44260b283f6e18bd0..9c54a7ebae73ea4e88e91758d32f864a9d73c017 100644 (file)
@@ -162,11 +162,11 @@ public:
     ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->SetBinContent(iCol,iRow,c) ; }
   
   //Recalibrate channels energy with run dependent corrections
+  Bool_t   IsRunDepRecalibrationOn()               const { return fUseRunCorrectionFactors ; }
+
   void     SwitchOffRunDepCorrection()                   { fUseRunCorrectionFactors = kFALSE ; }
   void     SwitchOnRunDepCorrection()                    { fUseRunCorrectionFactors = kTRUE  ; 
-                                                           SwitchOnRecalibration()           ; }
-  void     SetRunDependentCorrections(Int_t runnumber);
-      
+                                                           SwitchOnRecalibration()           ; }      
   // Time Recalibration  
   void     RecalibrateCellTime(const Int_t absId, const Int_t bc, Double_t & time) const;
   
@@ -395,7 +395,6 @@ private:
   
   // Recalibrate with run dependent corrections, energy
   Bool_t     fUseRunCorrectionFactors;   // Use Run Dependent Correction
-  Bool_t     fRunCorrectionFactorsSet;   // Run Correction set at leat once
     
   // Bad Channels
   Bool_t     fRemoveBadChannels;         // Check the channel status provided and remove clusters with bad channels
index a84e44edebcb1a8bbcfe66367e27c40c412598f6..ae30b82f841146bb9ce86ac5d306a4badd098243 100755 (executable)
@@ -61,7 +61,7 @@ ClassImp(AliCalorimeterUtils)
     fRemoveBadChannels(kFALSE),       fPHOSBadChannelMap(0x0), 
     fNCellsFromPHOSBorder(0),
     fNMaskCellColumns(0),             fMaskCellColumns(0x0),
-    fRecalibration(kFALSE),           fPHOSRecalibrationFactors(),
+    fRecalibration(kFALSE),           fRunDependentCorrection(kFALSE), fPHOSRecalibrationFactors(),
     fEMCALRecoUtils(new AliEMCALRecoUtils),
     fRecalculatePosition(kFALSE),     fCorrectELinearity(kFALSE),
     fRecalculateMatching(kFALSE),
@@ -202,10 +202,41 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
       }else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for run\n");  // run number array ok
       
       // once set, apply run dependent corrections if requested
-      fEMCALRecoUtils->SetRunDependentCorrections(runnumber);
-      
+      //fEMCALRecoUtils->SetRunDependentCorrections(runnumber);
+            
     } // Recalibration on
     
+    // Energy Recalibration, apply on top of previous calibration factors
+    if(fRunDependentCorrection)
+    {
+      AliOADBContainer *contRFTD=new AliOADBContainer("");
+      
+      contRFTD->InitFromFile(Form("%s/EMCALTemperatureCorrCalib.root",fOADBFilePathEMCAL.Data()),"AliEMCALRunDepTempCalibCorrections");
+      
+      TH1S *htd=(TH1S*)contRFTD->GetObject(runnumber); 
+      
+      if(htd)
+      {
+        printf("AliCalorimeterUtils::SetOADBParameters() - Recalibrate (Temperature) EMCAL \n");
+        
+        for (Int_t ism=0; ism<nSM; ++ism) 
+        {        
+          for (Int_t icol=0; icol<48; ++icol) 
+          {        
+            for (Int_t irow=0; irow<24; ++irow) 
+            {
+              Float_t factor = GetEMCALChannelRecalibrationFactor(ism,icol,irow);
+              
+              Int_t absID = fEMCALGeo->GetAbsCellIdFromCellIndexes(ism, irow, icol); // original calibration factor
+              factor *= htd->GetBinContent(absID) / 10000. ; // correction dependent on T
+              //printf("\t ism %d, icol %d, irow %d,absID %d, corrA %2.3f, corrB %2.3f, corrAB %2.3f\n",ism, icol, irow, absID, 
+              //      GetEMCALChannelRecalibrationFactor(ism,icol,irow) , htd->GetBinContent(absID) / 10000., factor);
+              SetEMCALChannelRecalibrationFactor(ism,icol,irow,factor);
+            } // columns
+          } // rows 
+        } // SM loop
+      }else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate EMCAL with T variations, no params TH1 \n"); 
+    } // Run by Run T calibration    
     
     // Time Recalibration
     if(fEMCALRecoUtils->IsTimeRecalibrationOn())
@@ -1279,7 +1310,7 @@ void AliCalorimeterUtils::Print(const Option_t * opt) const
   printf("Remove Clusters with max cell at less than %d cells from EMCAL border and %d cells from PHOS border\n",
          fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder(), fNCellsFromPHOSBorder);
   if(fEMCALRecoUtils->IsEMCALNoBorderAtEta0()) printf("Do not remove EMCAL clusters at Eta = 0\n");
-  printf("Recalibrate Clusters? %d\n",fRecalibration);
+  printf("Recalibrate Clusters? %d, run by run  %d\n",fRecalibration,fRunDependentCorrection);
   printf("Recalculate Clusters Position? %d\n",fRecalculatePosition);
   printf("Recalculate Clusters Energy? %d\n",fCorrectELinearity);
   printf("Matching criteria: dR < %2.2f[cm], dZ < %2.2f[cm]\n",fCutR,fCutZ);
index 9a555af188a2591166b26183a2ca8546c480a271..669d2c66be2d7b4160802ad382ac23d6a1bc9345 100755 (executable)
@@ -198,8 +198,8 @@ class AliCalorimeterUtils : public TObject {
 
   // Run dependent energy calibrations (EMCAL)
   
-  void          SwitchOffRunDepCorrection()                              { fEMCALRecoUtils->SwitchOffRunDepCorrection()    ; }
-  void          SwitchOnRunDepCorrection()                               { fEMCALRecoUtils->SwitchOnRunDepCorrection()     ; }
+  void          SwitchOffRunDepCorrection()                              {  fRunDependentCorrection = kFALSE  ; }
+  void          SwitchOnRunDepCorrection()                               {  fRunDependentCorrection = kTRUE   ; }
   
   // Time Recalibration (EMCAL)
   
@@ -303,6 +303,7 @@ class AliCalorimeterUtils : public TObject {
   Int_t              fNMaskCellColumns;      //  Number of masked columns
   Int_t*             fMaskCellColumns;       //[fNMaskCellColumns] list of masked cell collumn
   Bool_t             fRecalibration;         //  Switch on or off the recalibration
+  Bool_t             fRunDependentCorrection;//  Switch on or off the recalibration dependent on T
   TObjArray        * fPHOSRecalibrationFactors;  // Array of histograms with map of recalibration factors, PHOS
   AliEMCALRecoUtils* fEMCALRecoUtils;        //  EMCAL utils for cluster rereconstruction
   Bool_t             fRecalculatePosition;   //  Recalculate cluster position
@@ -324,7 +325,7 @@ class AliCalorimeterUtils : public TObject {
   AliCalorimeterUtils(              const AliCalorimeterUtils & cu) ; // cpy ctor
   AliCalorimeterUtils & operator = (const AliCalorimeterUtils & cu) ; // cpy assignment
   
-  ClassDef(AliCalorimeterUtils,13)
+  ClassDef(AliCalorimeterUtils,14)
 } ;
 
 
index 968e541e85830c3b2b95c134aee9c074c423cab7..96a9d7dc18073eaa42b9c4d935afa1eeb2b44be1 100644 (file)
@@ -340,13 +340,9 @@ void AliAnalysisTaskCaloFilter::UserExec(Option_t */*option*/)
           fGeoMatrixSet=kTRUE;
         }//ESD
       }//Load matrices from Data 
-      
-      //Recover time dependent corrections, put then in recalibration histograms. Do it once
-      fEMCALRecoUtils->SetRunDependentCorrections(InputEvent()->GetRunNumber());
 
     }//first event
     
-    
     //Cluster Loop
     for (Int_t iClust=0; iClust<nCaloClus; ++iClust) {
       
index 6e6d0ed749599da283158a6aa128c341e49597e4..c8d6d08563738c88c625643547212991881ee7e2 100644 (file)
@@ -261,12 +261,40 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
         }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL, no params object array \n"); // array ok
       }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for pass\n"); // array pass ok
     }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for run\n");  // run number array ok
-    
-    // once set, apply run dependent corrections if requested
-    fRecoUtils->SetRunDependentCorrections(runnumber);
-    
+        
   } // Recalibration on
   
+  // Energy Recalibration, apply on top of previous calibration factors
+  if(fRecoUtils->IsRunDepRecalibrationOn())
+  {
+    AliOADBContainer *contRFTD=new AliOADBContainer("");
+    
+    contRFTD->InitFromFile(Form("%s/EMCALTemperatureCorrCalib.root",fOADBFilePath.Data()),"AliEMCALRunDepTempCalibCorrections");
+    
+    TH1S *htd=(TH1S*)contRFTD->GetObject(runnumber); 
+    
+    if(htd)
+    {
+      printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Recalibrate (Temperature) EMCAL \n");
+      
+      for (Int_t ism=0; ism<nSM; ++ism) 
+      {        
+        for (Int_t icol=0; icol<48; ++icol) 
+        {        
+          for (Int_t irow=0; irow<24; ++irow) 
+          {
+            Float_t factor = fRecoUtils->GetEMCALChannelRecalibrationFactor(ism,icol,irow);
+            
+            Int_t absID = fGeom->GetAbsCellIdFromCellIndexes(ism, irow, icol); // original calibration factor
+            factor *= htd->GetBinContent(absID) / 10000. ; // correction dependent on T
+            //printf("\t ism %d, icol %d, irow %d,absID %d, corrA %2.3f, corrB %2.3f, corrAB %2.3f\n",ism, icol, irow, absID, 
+            //      GetEMCALChannelRecalibrationFactor(ism,icol,irow) , htd->GetBinContent(absID) / 10000., factor);
+            fRecoUtils->SetEMCALChannelRecalibrationFactor(ism,icol,irow,factor);
+          } // columns
+        } // rows 
+      } // SM loop
+    }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL with T variations, no params TH1 \n"); 
+  } // Run by Run T calibration
   
   // Time Recalibration
   if(fRecoUtils->IsTimeRecalibrationOn())
index 4073b6d8ef3abf736f980dd22e95d28af5807936..000dcf892f8e754c193248e1b7b633d6d89558bf 100644 (file)
@@ -31,6 +31,7 @@ void ConfigureEMCALRecoUtils(AliEMCALRecoUtils* reco,
   if(bRecalE && ! bMC)
   {
     reco->SwitchOnRecalibration();
+    reco->SwitchOnRunDepCorrection();    
   } 
 
   // Remove EMCAL hot channels