]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
OADB file containing the reference calibration parameters used each year, final calib...
authorgconesab <gustavo.conesa.balbastre@cern.ch>
Tue, 8 Apr 2014 14:05:59 +0000 (16:05 +0200)
committergconesab <gustavo.conesa.balbastre@cern.ch>
Tue, 8 Apr 2014 15:12:38 +0000 (17:12 +0200)
EMCAL/macros/OADB/CreateEMCAL_OADB_CalibReference.C [new file with mode: 0644]
OADB/EMCAL/EMCALCalibOnlineRef.root [new file with mode: 0644]

diff --git a/EMCAL/macros/OADB/CreateEMCAL_OADB_CalibReference.C b/EMCAL/macros/OADB/CreateEMCAL_OADB_CalibReference.C
new file mode 100644 (file)
index 0000000..53601fc
--- /dev/null
@@ -0,0 +1,118 @@
+TH2* GetHistogramExample(int run=153323){ //In order to get consistent binning
+  
+/*
+For 2012-13:  /alice/data/2012/OCDB/EMCAL/Calib/Data/Run177115_999999999_v2_s0.root
+For 2011:  /alice/data/2011/OCDB/EMCAL/Calib/Data/Run144484_999999999_v3_s0.root
+For 2010: /alice/data/2010/OCDB/EMCAL/Calib/Data/Run113461_999999999_v3_s0.root
+*/
+  TString pathOADB = "$ALICE_ROOT/OADB/EMCAL";
+  AliOADBContainer *contRF=new AliOADBContainer("");
+  contRF->InitFromFile(Form("%s/EMCALRecalib.root",pathOADB.Data()),"AliEMCALRecalib");
+  
+  TH2F *h;
+  TString pass = "pass1";
+  TObjArray *recal=(TObjArray*)contRF->GetObject(run);
+  if(!recal)
+  {
+    printf("Energy recalibration OADB not found  3\n");
+    return;
+  }
+  
+  TObjArray *recalpass=(TObjArray*)recal->FindObject(pass);
+  if(!recalpass)
+  {
+    printf("Energy recalibration OADB not found 2\n");
+    return;
+  }
+  
+  TObjArray *recalib=(TObjArray*)recalpass->FindObject("Recalib");
+  if(!recalib)
+  {
+    printf("Energy recalibration OADB not found 1\n");
+    return;
+  }
+  h = (TH2F*)recalib->FindObject("EMCALRecalFactors_SM1");
+  h->SetName("hbuffer");
+  h->Reset();
+  return h;
+}
+
+TObjArray *GetArrayEnergy(Int_t run=153323,TString name="Run113461_999999999_v3_s0.root",TString arrname="array",Float_t divFactor=1){
+
+  TString pathOADB = "$ALICE_ROOT/OADB/EMCAL";
+  gSystem->Load("libOADB");  
+  gROOT->LoadMacro("LoadLibraries.C");
+  LoadLibraries();  
+  // **** Loading the root files with Recalibration Factors:
+  TFile* f     = new TFile(name);
+  // Instantiate EMCAL geometry for the first time
+  AliEMCALGeometry *geom;
+  if     (run < 140000) geom = new AliEMCALGeometry("EMCAL_FIRSTYEARV1","EMCAL"); // 2010
+  else if(run < 198000) geom = new AliEMCALGeometry("EMCAL_COMPLETEV1","EMCAL");  // 2011-2012-2013
+  else                  geom = new AliEMCALGeometry("EMCAL_COMPLETE12SMV1_DCAL_8SM","EMCAL"); // Run2
+  const Int_t nSM = static_cast<const Int_t> (geom->GetNumberOfSuperModules());
+  TObjArray *array = new TObjArray(nSM);
+  array->SetName(arrname);
+  TH2F *hbuffer = GetHistogramExample(153323); //Just for the binning
+  TH2F *h[12];
+  hbuffer->SetName("hb");
+  for(int i=0;i<nSM;i++){
+       h[i] = (TH2F*)hbuffer->Clone(Form("EMCALRecalFactors_SM%d",i));
+       h[i]->SetTitle(Form("EMCALRecalFactors_SM%d",i));
+  }
+  
+  AliCDBEntry * cdb = (AliCDBEntry*) f->Get("AliCDBEntry");
+  AliEMCALCalibData* cparam = (AliEMCALCalibData*) cdb->GetObject();   
+  Int_t nDiff = 0;
+  Int_t iCol = -1, iRow = -1, iSM =-1, iMod = -1,iIphi =-1,iIeta = -1;
+  for(Int_t i=0;i < nSM*24*48; i++)
+  {
+    //printf("AbsID %d\n",i);
+    geom->GetCellIndex(i,iSM,iMod,iIphi,iIeta);
+    geom->GetCellPhiEtaIndexInSModule(iSM,iMod, iIphi, iIeta,iRow,iCol);
+    Float_t paramOCDB = -1;
+    Float_t paramOADB = -1;
+    if(cparam) {
+       paramOCDB = cparam->GetADCchannel(iSM,iCol,iRow);
+               //paramOADB = divFactor!=1?paramOCDB/divFactor:paramOCDB;
+               //printf("\n OCDB=%f and OADB=%f",paramOCDB,paramOADB);
+    }
+       if(h[iSM]) h[iSM]->SetBinContent(iCol,iRow,paramOCDB);
+  }
+  
+  for(int i=0;i<nSM;i++){
+        array->Add(h[i]);
+  }
+  delete geom;
+  delete cparam;
+  delete cdb;
+  f->Close();
+  return array;  
+}
+
+void CreateEMCAL_OADB_CalibReference(){ 
+ TObjArray *array12 = GetArrayEnergy(178000,"Run177115_999999999_v2_s0.root","Recalib",1); //last one is division factor
+ TObjArray *array10 = GetArrayEnergy(113461,"Run113461_999999999_v3_s0.root","Recalib",1); 
+ TObjArray *array11 = GetArrayEnergy(153323,"Run144484_999999999_v3_s0.root","Recalib",1);
+ // Creating Container 
+ AliOADBContainer* con = new AliOADBContainer("AliEMCALRecalib");
+
+ con->AddDefaultObject(*&array10);
+ con->AddDefaultObject(*&array11);
+ con->AddDefaultObject(*&array12);
+
+// Appending objects to their specific Run number
+ con->AppendObject(*&array10,113461,139517);
+ con->AppendObject(*&array11,144484,170593);
+ con->AppendObject(*&array12,177115,197692);
+
+ con->WriteToFile("EMCALCalibOnlineRef.root");
+
+}
diff --git a/OADB/EMCAL/EMCALCalibOnlineRef.root b/OADB/EMCAL/EMCALCalibOnlineRef.root
new file mode 100644 (file)
index 0000000..ec1d267
Binary files /dev/null and b/OADB/EMCAL/EMCALCalibOnlineRef.root differ