--- /dev/null
+#include "TGeoManager.h"
+
+/*
+The user needs to provide a vector int with the list of bad channels (by tower ID).
+This macro will create one rootfile for each desired list of badchannels. These root files can be used
+with CreateEMCAL_OADB_BadChannels, in order to create the OADB file.
+*/
+
+// ******* Create Histograms for BadChannels according to the EMCAL SM's
+
+void CreateEMCAL_BadChannelsHistos()
+{
+gSystem->Load("libOADB");
+gSystem->Load("libEMCALbase.so");
+gSystem->Load("libEMCALUtils.so");
+gSystem->Load("libEMCALrec.so");
+
+AliEMCALGeometry *fEMCALGeo=new AliEMCALGeometry(); //! EMCAL geometry
+AliEMCALRecoUtils *fEMCALRecoUtils=new AliEMCALRecoUtils(); //! Pointer to EMCAL utilities for clusterization
+TGeoManager::Import("geometry.root");
+fEMCALGeo = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
+
+// *********** List of Bad Channels *****
+
+// LHC11a (2.76 pp) pass1 from EMCALTenderSupply list (September 3rd 2011) AliRootTrunk revision 51405
+const Int_t nTowers11a1=89;
+Int_t hotChannels11a1[nTowers11a1]={74, 103, 152, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 368, 369, 370, 371, 372, 373, 374,375, 376, 377, 378, 379, 380, 381, 382, 383, 917, 1275, 1288, 1519, 1595, 1860, 1967, 2022, 2026, 2047, 2117, 2298, 2540, 2776, 3135, 3764, 6095, 6111, 6481, 6592, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 7371, 7425, 7430, 7457, 7491, 7709, 8352, 8353, 8356, 8357, 8808, 8810, 8812, 8814, 9056, 9769, 9815, 9837};
+Write_histo(nTowers11a1,hotChannels11a1,"11a_pass1",fEMCALGeo,fEMCALRecoUtils);
+
+// LHC11a (2.76 pp) pass2 from EMCALTenderSupply list (September 3rd 2011) AliRootTrunk revision 51405
+const Int_t nTowers11a2=24;
+Int_t hotChannels11a2[nTowers11a2]= {74, 103, 152, 917, 1059, 1175, 1276, 1288, 1376, 1382, 1595, 2022, 2026, 2210, 2540, 2778, 2793, 3135, 3764, 5767, 6481, 7371, 7878, 9769};
+Write_histo(nTowers11a2,hotChannels11a2,"11a_pass2",fEMCALGeo,fEMCALRecoUtils);
+
+// LHC11c (7 TeV pp) from EMCALTenderSupply list (September 3rd 2011) AliRootTrunk revision 51405
+const Int_t nTowers11c=231;
+Int_t hotChannels11c[nTowers11c]={74, 103, 152, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 368, 369, 370, 371, 372, 373, 374,375, 376, 377, 378, 379, 380, 381, 382, 383, 917, 1059, 1160, 1263, 1275, 1276, 1288, 1376, 1382, 1384, 1414,1519, 1595, 1860, 1720, 1912, 1961, 1967, 2016, 2017, 2019, 2022, 2023, 2026, 2027, 2047, 2065, 2071, 2074, 2079, 2112, 2114, 2115, 2116, 2117, 2120, 2123, 2145, 2160, 2190, 2298, 2506, 2540, 2776, 2778, 3135, 3544, 3567, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3764, 4026, 4121, 4157, 4208, 4209, 4568, 5560, 5767, 5969, 6065, 6076, 6084, 6087, 6095, 6111, 6128, 6129, 6130, 6131, 6133, 6136, 6137, 6138, 6139, 6140, 6141, 6142, 6143, 6340, 6369, 6425, 6481, 6561, 6592, 6678, 6907, 6925, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 7089, 7371, 7375, 7425, 7457, 7430, 7491, 7709, 7874, 8273, 8352, 8353, 8354, 8356, 8357, 8362, 8808, 8769, 8810, 8811, 8812, 8814, 9056, 9217, 9302, 9365, 9389, 9815, 9769, 9833, 9837, 9850, 9895, 9997, 10082, 10086, 10087, 10091, 10095, 10112, 10113, 10114, 10115, 10116, 10117, 10118, 10119, 10120, 10121, 10122, 10123, 10576, 10718, 10723, 10918, 10919, 10922, 10925, 10926, 10927, 11276, 1136};
+Write_histo(nTowers11c,hotChannels11c,"11c",fEMCALGeo,fEMCALRecoUtils);
+
+}
+
+void Write_histo(const Int_t nTowers,Int_t hotChannels[nTowers],const char *name="pass1",AliEMCALGeometry *fEMCALGeo,AliEMCALRecoUtils *fEMCALRecoUtils){
+
+TH2I *hBadChannels[10];
+char fileName11[50];
+char nameSM[50];
+sprintf(fileName11,"BadChannels2011_%s.root",name);
+
+for(int i=0;i<10;i++){
+ sprintf(nameSM,"EMCALBadChannelMap_Mod%d",i);
+ hBadChannels[i]=new TH2I(nameSM,nameSM,48,0,48,24,0,24);
+ }
+TFile *f=new TFile(fileName11,"RECREATE");
+cout<<endl<<"********** "<<name<<" ********** "<<endl;
+
+Int_t nSupMod=-1, nModule=-1, nIphi=-1, nIeta=-1, iphi=-1, ieta=-1;
+for(Int_t i=0; i<nTowers; i++){
+ fEMCALGeo->GetCellIndex(hotChannels[i],nSupMod,nModule,nIphi,nIeta);
+ fEMCALGeo->GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta,iphi,ieta);
+ fEMCALRecoUtils->SetEMCALChannelStatus(nSupMod, ieta, iphi);
+ cout<<endl<<"NSupMod: "<<nSupMod<<" ieta: "<<ieta<<" iphi:"<<iphi<<endl;
+ hBadChannels[nSupMod]->SetBinContent(ieta,iphi,1);
+ }
+for(int i=0;i<10;i++){
+ hBadChannels[i]->Write();
+ delete hBadChannels[i];
+}
+
+f->Close();
+
+}
\ No newline at end of file
--- /dev/null
+/*
+This a modification in a code sent by Marco Bregant, which, originally, created the OADB for misalignment matrices
+In this macro, the histograms with BadChannels Factors are loaded and some TObjarrays are filled with these histograms.
+At the end, a OADB container is created receiving these arrays.
+The histograms with badchannels can be made by a list of towers ID ( see the macro CreateEMCAL_OADB_BadChannelsHistos.C ) or
+directly from the OCDB ( see AliEMCALOCDBTenderConverter.cxx from Jiri Kral )
+*/
+// ******* Create OADB Container for EMCal Bad Channels
+void CreateEMCAL_OADB_BadChannels(const char *fileName10 = "BadChannels2010.root",
+ const char *fileName11a = "BadChannels2011_11a.root",
+ const char *fileName11b = "BadChannels2011_11b.root",
+ const char *fileName11c1 = "BadChannels2011_11c1.root",
+ const char *fileName11c2 = "BadChannels2011_11c2.root", //Subperiod with different histograms
+ const char *fileName11c3 = "BadChannels2011_11c3.root",
+ const char *fileName11d = "BadChannels2011_11d.root",
+ const char *fileName11e = "BadChannels2011_11e.root",
+ const char *fileName11f = "BadChannels2011_11f.root",
+ const char *fileName11h = "BadChannels2011_11h.root",
+ const char *fileName12a = "BadChannels2012_12a.root",
+ )
+
+{
+
+ gSystem->Load("libOADB");
+ //gSystem->Load("libOADB"); //comment if compiled
+
+ //LHC10
+ TObjArray array10(12); array10.SetName("BadChannels10");
+
+ //LHC11a
+ TObjArray array11a(12); array11a.SetName("BadChannels11a");
+
+ //LHC11b
+ TObjArray array11b(12); array11b.SetName("BadChannels11b");
+
+ //LHC11c
+ TObjArray array11c1(12); array11c1.SetName("BadChannels11c1");
+ TObjArray array11c2(12); array11c2.SetName("BadChannels11c2");
+ TObjArray array11c3(12); array11c3.SetName("BadChannels11c3");
+
+ //LHC11d
+ TObjArray array11d(12); array11d.SetName("BadChannels11d");
+
+ //LHC11e
+ TObjArray array11e(12); array11e.SetName("BadChannels11e");
+
+ //LHC11f
+ TObjArray array11f(12); array11f.SetName("BadChannels11f");
+
+ //LHC11h
+ TObjArray array11h(12); array11h.SetName("BadChannels11h");
+
+ //LHC12a
+ TObjArray array12a(12); array12a.SetName("BadChannels12a");
+
+
+ TFile *f10 = new TFile(fileName10,"read");
+ TFile *f11a = new TFile(fileName11a,"read");
+ TFile *f11b = new TFile(fileName11b,"read");
+ TFile *f11c1 = new TFile(fileName11c1,"read");
+ TFile *f11c2 = new TFile(fileName11c2,"read");
+ TFile *f11c3 = new TFile(fileName11c3,"read");
+ TFile *f11d = new TFile(fileName11d,"read");
+ TFile *f11e = new TFile(fileName11e,"read");
+ TFile *f11f = new TFile(fileName11f,"read");
+ TFile *f11h = new TFile(fileName11h,"read");
+ TFile *f12a = new TFile(fileName11h,"read");
+
+ //Create OADB container for BadChannels
+ AliOADBContainer* con = new AliOADBContainer("AliEMCALBadChannels");
+
+ char name[30];
+ for (Int_t mod=0;mod<12;mod++){
+ cout<<"SM "<< mod<<endl;
+
+ if (mod<4) {
+ sprintf(name,"EMCALBadChannelMap_Mod%d",mod);
+ cout<<"BadChannels2010:"<<name<<endl;
+ array10.Add(f10->Get(name));
+ }
+ sprintf(name,"EMCALBadChannelMap_Mod%d",mod);
+ cout<<"BadChannels2011:"<<name<<endl;
+ array11a.Add(f11a->Get(name));
+ array11b.Add(f11b->Get(name));
+ array11c1.Add(f11c1->Get(name));
+ array11c2.Add(f11c2->Get(name));
+ array11c3.Add(f11c3->Get(name));
+ array11d.Add(f11d->Get(name));
+ array11e.Add(f11e->Get(name));
+ array11f.Add(f11f->Get(name));
+ array11h.Add(f11h->Get(name));
+ array12a.Add(f12a->Get(name));
+
+ } //mod
+
+ con->AddDefaultObject(&array10);
+ con->AddDefaultObject(&array11a);
+ con->AddDefaultObject(&array11b);
+ con->AddDefaultObject(&array11c1);
+ con->AddDefaultObject(&array11c2);
+ con->AddDefaultObject(&array11c3);
+ con->AddDefaultObject(&array11d);
+ con->AddDefaultObject(&array11e);
+ con->AddDefaultObject(&array11f);
+ con->AddDefaultObject(&array11h);
+ con->AddDefaultObject(&array12a);
+
+
+ //Establishing run number with the correct objects
+ con->AppendObject(&array10,100000,140000);
+ con->AppendObject(&array11a,144871,146860);
+ con->AppendObject(&array11b,148531,150629);
+ con->AppendObject(&array11c1,151636,153569);
+ con->AppendObject(&array11c2,153570,154733);
+ con->AppendObject(&array11c3,154734,155384);
+ con->AppendObject(&array11d,156477,159635);
+ con->AppendObject(&array11e,160670,162740);
+ con->AppendObject(&array11f,162933,165746);
+ con->AppendObject(&array11h,166529,170673);
+ con->AppendObject(&array12a,177320,999999999);
+
+ con->WriteToFile("BetaBadChannels.root");
+}
+
--- /dev/null
+//This a modification in a code sent by Marco Bregant, which, originally, created the OADB for misalignment matrices
+
+//In this macro, the histograms with Recalibraton Factors are loaded and some TObjarrays are filled with these histograms.
+// At the end, a OADB container is created receiving these arrays.
+
+void CreateEMCAL_OADB_Recalib(const char *fileName10s_d="RecalDB/summer_december_2010/RecalibrationFactors.root",const char *fileName10d="RecalDB/december2010/RecalibrationFactors.root",
+ const char *fileName10s="RecalDB/summer2010/RecalibrationFactors.root", const char *fileName11v1="RecalDB/2011_v1/RecalibrationFactors.root")
+{
+
+gSystem->Load("libOADB");
+
+Bool_t Recalib2010=kTRUE;
+Bool_t Recalib2011=kTRUE;
+
+
+// **** Loading the root files with Recalibration Factors:
+TFile* f10s_d=new TFile(fileName10s_d);
+TFile* f10d=new TFile(fileName10d);
+TFile* f10s=new TFile(fileName10s);
+TFile* f11v1=new TFile(fileName11v1);
+
+// ********* Arrays with the objects *********************
+TObjArray array10s_d(4); //summer_december_2010/
+TObjArray array10dec(4); //december2010
+TObjArray array10s(4); //summer2010
+TObjArray array11v1(10); // 2011_v1
+
+array10s_d.SetName("Recalib");
+array10dec.SetName("Recalib");
+array10s.SetName("Recalib");
+array11v1.SetName("Recalib");
+
+char name[30];
+// Filling The objects above with the EMCALRecalFactors_SM Histos:
+for (Int_t mod=0;mod<10;mod++){
+
+ cout<<"SM "<< mod<<endl;
+
+ // Recalib Objects for 2010:
+ if (Recalib2010&&mod<4) { //if 2010 4 SMs
+ sprintf(name,"EMCALRecalFactors_SM%d",mod);
+ cout<<"Recalib2010:"<<name<<endl;
+
+ //Summer_December:
+ array10s_d.Add(f10s_d->Get(name));
+
+ //December:
+ array10dec.Add(f10d->Get(name));
+
+ //Summer:
+ array10s.Add(&array10s_d);
+ }
+
+ // Recalib Objects for 2011:
+ if (Recalib2011) { //if 2011 10 SMs
+ sprintf(name,"EMCALRecalFactors_SM%d",mod);
+ cout<<"Recalib2011:"<<name<<endl;
+ array11v1.Add(f11v1->Get(name));
+ }
+
+ } //mod
+//********************************************************************
+
+// ************** Establishing different configuration according to the pass ***********
+// ************ Latest Tender Information : (September 3rd 2011) AliRootTrunk revision 51405 ***********************
+
+// ******* 2010 ******************
+TObjArray array10b_pass2(4);//runRC >= 114737 && runRC <= 117223
+array10b_pass2.SetName("pass2");
+
+TObjArray array10c_pass2(4);//runRC >= 118503 && runRC <= 121040
+array10c_pass2.SetName("pass2");
+
+TObjArray array10c_pass3(4);//runRC >= 118503 && runRC <= 121040
+array10c_pass3.SetName("pass3");
+
+TObjArray array10d_pass1(4);//runRC >= 122195 && runRC <= 126437
+array10d_pass1.SetName("pass1");
+
+TObjArray array10e_pass1(4);//runRC >= 127712 && runRC <= 130850
+array10e_pass1.SetName("pass1");
+
+TObjArray array10f_pass1a(4);//runRC >= 133004 && runRC < 134657
+array10f_pass1a.SetName("pass1");
+
+//December:
+TObjArray array10d_pass2(4); //runRC >= 122195 && runRC <= 126437
+array10d_pass2.SetName("pass2");
+
+TObjArray array10f_pass1b(4);//runRC >= 134657 && runRC <= 135029
+array10f_pass1b.SetName("pass1");
+
+TObjArray array10g_pass1(4); //runRC >= 135654 && runRC <= 136377
+array10g_pass1.SetName("pass1");
+
+TObjArray array10h_pass1a(4); //Until Christmas: runRC >= 136851 && runRC < 137231
+array10h_pass1a.SetName("pass1");
+
+//Summer:
+TObjArray array10h_pass1b(4); //runRC >= 137231 && runRC <= 139517
+array10h_pass1b.SetName("pass1");
+
+//Summer_December:
+array10b_pass2.Add(&array10s_d);//runRC >= 114737 && runRC <= 117223
+array10c_pass2.Add(&array10s_d);//runRC >= 118503 && runRC <= 121040
+array10c_pass3.Add(&array10s_d);//runRC >= 118503 && runRC <= 121040
+array10d_pass1.Add(&array10s_d);//runRC >= 122195 && runRC <= 126437
+array10e_pass1.Add(&array10s_d);//runRC >= 127712 && runRC <= 130850
+array10f_pass1a.Add(&array10s_d);//runRC >= 133004 && runRC < 134657
+
+//December:
+array10d_pass2.Add(&array10dec); //runRC >= 122195 && runRC <= 126437
+array10f_pass1b.Add(&array10dec);//runRC >= 134657 && runRC <= 135029
+array10g_pass1.Add(&array10dec); //runRC >= 135654 && runRC <= 136377
+array10h_pass1a.Add(&array10dec); //Until Christmas: runRC >= 136851 && runRC < 137231
+
+//Summer:
+array10h_pass1b.Add(&array10s); //runRC >= 137231 && runRC <= 139517
+
+//*********** 2011 ***************************************
+TObjArray array11a_pass1(10); // LHC11a pass1
+array11a_pass1.SetName("pass1");
+
+TObjArray array11a_pass2(10); // LHC11a pass2
+array11a_pass2.SetName("pass2");
+
+TObjArray array11c_pass1(10); // LHC11c pass1
+array11c_pass1.SetName("pass1");
+
+array11a_pass1.Add(&array11v1);
+array11a_pass2.Add(&array11v1);
+array11c_pass1.Add(&array11v1);
+// *************************************************************************************
+
+// ******** Establishing the objects for the specific Periods ************************
+
+// 2010
+TObjArray array10b(4);
+array10b.SetName("LHC10b");
+
+TObjArray array10c(4);
+array10c.SetName("LHC10c");
+
+TObjArray array10d(4);
+array10d.SetName("LHC10d");
+
+TObjArray array10e(4);
+array10e.SetName("LHC10e");
+
+TObjArray array10fa(4);
+array10fa.SetName("LHC10fa");
+
+TObjArray array10fb(4);
+array10fb.SetName("LHC10fb");
+
+TObjArray array10g(4);
+array10g.SetName("LHC10g");
+
+TObjArray array10ha(4);
+array10ha.SetName("LHC10ha");
+
+TObjArray array10hb(4);
+array10hb.SetName("LHC10hb");
+
+
+array10b.Add(&array10b_pass2);
+
+array10c.Add(&array10c_pass2);
+array10c.Add(&array10c_pass3);
+
+array10d.Add(&array10d_pass1);
+array10d.Add(&array10d_pass2);
+
+array10e.Add(&array10e_pass1);
+
+array10fa.Add(&array10f_pass1a);
+array10fb.Add(&array10f_pass1b);
+
+array10g.Add(&array10g_pass1);
+
+array10ha.Add(&array10h_pass1a);
+array10hb.Add(&array10h_pass1b);
+
+// ************
+
+//2011
+TObjArray array11a(10);
+array11a.SetName("LHC11a");
+
+TObjArray array11c(10);
+array11c.SetName("LHC11c");
+
+array11a.Add(&array11a_pass1);
+array11a.Add(&array11a_pass2);
+array11c.Add(&array11c_pass1);
+// *****************
+
+
+// Creating Container
+AliOADBContainer* con = new AliOADBContainer("AliEMCALRecalib");
+
+con->AddDefaultObject((TObject*) &array10b);
+con->AddDefaultObject((TObject*) &array10c);
+con->AddDefaultObject((TObject*) &array10d);
+con->AddDefaultObject((TObject*) &array10e);
+con->AddDefaultObject((TObject*) &array10fa);
+con->AddDefaultObject((TObject*) &array10fb);
+con->AddDefaultObject((TObject*) &array10g);
+con->AddDefaultObject((TObject*) &array10ha);
+con->AddDefaultObject((TObject*) &array10hb);
+con->AddDefaultObject((TObject*) &array11a);
+con->AddDefaultObject((TObject*) &array11c);
+
+// Appending objects to their specific Run number
+con->AppendObject(&array10b,114737,117223);
+con->AppendObject(&array10c,118503,121040);
+con->AppendObject(&array10d,122195,126437);
+con->AppendObject(&array10e,127712,130850);
+con->AppendObject(&array10fa,133004,134656);
+con->AppendObject(&array10fb,134657,135029);
+con->AppendObject(&array10g,135654,136377);
+con->AppendObject(&array10ha,136851,137230);
+con->AppendObject(&array10hb,137231,139517);
+con->AppendObject(&array11a,144871,146860);
+con->AppendObject(&array11c,151636,155384);
+con->WriteToFile("BetaRecalib.root");
+
+test(); // If someone wants to test container
+}
+
+void test(){
+//
+// let's read back the file
+AliOADBContainer *cont=new AliOADBContainer("");
+cont->InitFromFile("BetaRecalib.root", "AliEMCALRecalib");
+//
+cout<<"_________--------------- dump ---------------------___________"<<endl;
+cont->Dump();
+cout<<"_________--------------- list ---------------------___________"<<endl;
+//cont0.List();
+cout<<"cont->GetDefaultList()->Print()"<<endl;
+cont->GetDefaultList()->Print();
+
+TObjArray *recal=cont->GetObject(118503); //GetObject(int runnumber)
+recal->ls();
+
+TObjArray *recalpass=recal->FindObject("pass2");
+
+if(!recalpass){
+ cout<<" norecalpass"<<endl;
+ return;
+}
+
+TObjArray *recalib=recalpass->FindObject("Recalib");
+
+if(!recalib){
+ cout<<" no recalib found"<<endl;
+ return;
+}
+
+TH2F *h2=(TH2F*)recalib->FindObject("EMCALRecalFactors_SM0");
+if(!h2){
+ return;
+cout<<" no histo found"<<endl;
+}
+h2->DrawCopy("colz");
+cout<<"That's all folks!"<<endl;
+
+
+}
--- /dev/null
+// ******* Example to Create or Read OADB Container
+// ******* for EMCal Run by Run calibration dependent
+// ******* on Temperature variations
+// Author : Gustavo Conesa Balbastre (LPSC-Grenoble)
+
+void CreateEMCAL_OADB_RunByRunTemperatureECalibCorrection(Int_t opt = 1, Int_t runNumber = 170387)
+{
+ if(opt == 0) Read(runNumber);
+ if(opt == 1) Create();
+}
+
+void Create()
+{
+ //Create OADB container for Temperature calibration parameters
+
+ gSystem->Load("libOADB");
+
+ AliOADBContainer* con = new AliOADBContainer("AliEMCALRunDepTempCalibCorrections");
+
+ // Get the list of run numbers to be added to the OADB, parameters provided usually in a
+ // root file per run
+ // Tar ball with all the files can be found here
+ // https://twiki.cern.ch/twiki/bin/viewauth/ALICE/EMCalTimeDependentCalibrations
+
+ ifstream fList;
+ fList.open("CorrectionFiles/runlist.txt");
+
+ Int_t runNumber = 0;
+ TString string;
+ Int_t nRuns=0;
+ Int_t nSM = 12;
+
+ AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1");
+
+ if (fList.good())
+ {
+ while(string.ReadLine(fList, kFALSE) && !fList.eof())
+ {
+ sscanf(string.Data(), "%d",&runNumber);
+
+ //printf("Run %d \n",runNumber);
+
+ if (runNumber < 140000) nSM = 4;
+ else if(runNumber < 173000) nSM = 10;
+ if(runNumber==170387){
+ // Access class that contains methods to read the content of
+ // the calibration file per run
+ AliEMCALCalibTimeDepCorrection *corr = new AliEMCALCalibTimeDepCorrection();
+ corr->ReadRootInfo(Form("CorrectionFiles/Run%d_Correction.root",runNumber));
+
+ // Init the histogram
+ TH1S *h = new TH1S(Form("h%d",runNumber),"",24*48*nSM,0,24*48*nSM);
+
+ 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 recalFactor = corr->GetCorrection(ism, icol,irow,0);
+
+ Int_t absID = geom->GetAbsCellIdFromCellIndexes(ism, irow, icol);
+
+ //if(recalFactor < 0.1)
+ printf("ism %d, icol %d, irow %d,absID %d, corrections : factor %d\n",ism, icol, irow, absID, recalFactor*10000);
+
+ h->SetBinContent(absID,(Short_t)(recalFactor*10000));
+ //h->SetBinContent(absID,recalFactor);
+
+ }
+ }
+ }
+
+ con->AddDefaultObject(h);
+
+ //Establishing run number with the correct objects
+ con->AppendObject(h,runNumber,runNumber);
+
+ delete corr;
+
+ nRuns++;
+ }
+ }
+ }
+
+ fList.close();
+
+ printf(" *** nRuns *** %d\n",nRuns);
+
+ con->WriteToFile("EMCALTemperatureCorrCalib.root");
+
+
+}
+
+void Read(Int_t runNumber = 170387)
+{
+
+ gSystem->Load("libOADB");
+
+ AliOADBContainer *cont=new AliOADBContainer("");
+ cont->InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALTemperatureCorrCalib.root", "AliEMCALRunDepTempCalibCorrections");
+
+ //cout<<"_________--------------- dump ---------------------___________"<<endl;
+ //cont->Dump();
+
+ //cout<<"cont->GetDefaultList()->Print()"<<endl;
+ //cont->GetDefaultList()->Print();
+
+ TH1S *h=cont->GetObject(runNumber); //GetObject(int runnumber)
+
+ printf("h entries %d\n");
+
+
+ AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1");
+
+ // Read parameter file line-by-line
+ // Get number of lines first
+
+ Int_t nSM = 10;
+
+ for(Int_t iabsID = 0; iabsID < 24*48*nSM; iabsID++)
+ {
+ printf("absID %d, content %d\n",iabsID,h->GetBinContent(iabsID));
+
+ }
+
+ h->Draw();
+
+}
+
+