AliPhysics  aaf9c62 (aaf9c62)
UpdateEMCAL_OADB_Recalib.C
Go to the documentation of this file.
1 
2  const int kNbSMEMCAL=10;
3  const int kNbSMEMCALthird=2;
4  const int kNbSMDCAL=6;
5  const int kNbSMDCALthird=2;
7 
24 
33 (
34  const char *fileNameOADB="EMCALRecalib_input4test.root",
35  const char *fileNameRecalibFactors="/cebaf/cebaf/EMCAL/calibPi0_run2/createOCDB_4_with2015data_Nov2016finalCalib/multiplyPi0CalibrationFactors_TextToHisto_Final.root"
36  )
37 {
38 
39 gSystem->Load("libOADB");
40 
41 AliOADBContainer *con = new AliOADBContainer("");
42 con->InitFromFile(fileNameOADB, "AliEMCALRecalib"); //Updating the original OADB file, output will be written into BetaRecalib.root
43 
44 // **** Loading the root files with Recalibration Factors:
45 TFile* fRecalibFactors=new TFile(fileNameRecalibFactors);
46 
47 TObjArray *arrayRecalibFactors = new TObjArray(kNbSMtot);
48 arrayRecalibFactors->SetName("Recalib");
49 
50 char name[30];
51 
52 
53 // Filling The objects above with the EMCALRecalFactors_SM Histos:
54 for (Int_t iSM=0;iSM<kNbSMtot;iSM++){
55  cout<<"SM "<< iSM<<endl;
56  sprintf(name,"EMCALRecalFactors_SM%d",iSM);
57  cout<<"Recalib : "<<name<<endl;
58  arrayRecalibFactors->Add(fRecalibFactors->Get(name));
59  } //iSM
60 
61 
62 //********************************************************************
63 // Setting Periods
64 //**** Adding pass object to period Object ****/
65 //When updating object that has already been created. For instance, adding pass2,3 etc.
66 //Just get the object and add new array. Append of runnumber is already done in this case.
67 
68 /*TObjArray *array13b = (TObjArray*)con->GetObject(195345,"LHC13b");
69 TObjArray *array13c = (TObjArray*)con->GetObject(195529,"LHC13c");
70 TObjArray *array13d = (TObjArray*)con->GetObject(195681,"LHC13d");
71 TObjArray *array13e = (TObjArray*)con->GetObject(195935,"LHC13e");
72 TObjArray *array13f = (TObjArray*)con->GetObject(196433,"LHC13f");
73 
74 
75 TObjArray *array13b_pass3 = new TObjArray(kNbSMtot); array13b_pass3->SetName("pass3"); array13b_pass3->Add(*&arrayRecalibFactors);
76 TObjArray *array13c_pass2 = new TObjArray(kNbSMtot); array13c_pass2->SetName("pass2"); array13c_pass2->Add(*&arrayRecalibFactors);
77 TObjArray *array13d_pass2 = new TObjArray(kNbSMtot); array13d_pass2->SetName("pass2"); array13d_pass2->Add(*&arrayRecalibFactors);
78 TObjArray *array13e_pass2 = new TObjArray(kNbSMtot); array13e_pass2->SetName("pass2"); array13e_pass2->Add(*&arrayRecalibFactors);
79 TObjArray *array13f_pass2 = new TObjArray(kNbSMtot); array13f_pass2->SetName("pass2"); array13f_pass2->Add(*&arrayRecalibFactors);
80 
81 array13b->Add(*&array13b_pass3);
82 array13c->Add(*&array13c_pass2);
83 array13d->Add(*&array13d_pass2);
84 array13e->Add(*&array13e_pass2);
85 array13f->Add(*&array13f_pass2);*/
86 
87  TObjArray *array15_pass1 = new TObjArray(kNbSMtot);
88  TObjArray *array15_pass2 = new TObjArray(kNbSMtot);
89  TObjArray *array15_pass3 = new TObjArray(kNbSMtot);
90  array15_pass1->SetName("pass1");
91  array15_pass2->SetName("pass2");
92  array15_pass3->SetName("pass3");
93  array15_pass1->Add(*&arrayRecalibFactors);
94  array15_pass2->Add(*&arrayRecalibFactors);
95  array15_pass3->Add(*&arrayRecalibFactors);
96 
97 con->WriteToFile("BetaRecalib.root");
98 
99 //test(195935); // If someone wants to test container
100 
101 }
102 
103 
104 
105 
106 
112 void test(int runnumber=195345){
113 //
114 // let's read back the file
115 AliOADBContainer *cont=new AliOADBContainer("");
116 cont->InitFromFile("BetaRecalib.root", "AliEMCALRecalib");
117 //
118 cout<<"_________--------------- dump ---------------------___________"<<endl;
119 cont->Dump();
120 cout<<"_________--------------- list ---------------------___________"<<endl;
121 //cont0.List();
122 cout<<"cont->GetDefaultList()->Print()"<<endl;
123 cont->GetDefaultList()->Print();
124 
125 TObjArray *recal=cont->GetObject(runnumber); //GetObject(int runnumber)
126 recal->ls();
127 
128 TObjArray *recalpass=recal->FindObject("pass1");
129 
130 if(!recalpass){
131  cout<<" norecalpass"<<endl;
132  return;
133 }
134 
135 TObjArray *recalib=recalpass->FindObject("Recalib");
136 
137 if(!recalib){
138  cout<<" no recalib found"<<endl;
139  return;
140 }
141 
142 TH2F *h2=(TH2F*)recalib->FindObject("EMCALRecalFactors_SM0");
143 if(!h2){
144  return;
145 cout<<" no histo found"<<endl;
146 }
147 h2->DrawCopy("colz");
148 cout<<"That's all folks!"<<endl;
149 
150 
151 }
152 
153 
154 
155 
156 
157 
Definition: External.C:236
void UpdateEMCAL_OADB_Recalib(const char *fileNameOADB="EMCALRecalib_input4test.root", const char *fileNameRecalibFactors="/cebaf/cebaf/EMCAL/calibPi0_run2/createOCDB_4_with2015data_Nov2016finalCalib/multiplyPi0CalibrationFactors_TextToHisto_Final.root")
TSystem * gSystem
const int kNbSMDCALthird
int Int_t
Definition: External.C:63
const int kNbSMEMCALthird
const int kNbSMtot
void test(int runnumber=195345)
const int kNbSMDCAL
const int kNbSMEMCAL