]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/totEt/AliAnalysisHadEtCorrections.cxx
delayed unload from cache of alignment objects and one GRP object in case of creation...
[u/mrichter/AliRoot.git] / PWG4 / totEt / AliAnalysisHadEtCorrections.cxx
CommitLineData
cf6522d1 1//Created by Christine Nattrass, Rebecca Scott, Irakli Martashvili
020abff0 2//University of Tennessee at Knoxville
cf6522d1 3// This is a container class for the correction factors for the hadronic
4// component of transverse energy
5// It is filled by the output of AliAnalysisTaskHadEt from spinning over Monte
6// Carlo data (using AliAnalysisHadEtMonteCarlo)
7//It is used by AliAnalysisTaskHadEt while spinning over reconstructed data
8// (using AliAnalysisHadEtReconstructed)
020abff0 9//Please see https://twiki.cern.ch/twiki/bin/view/ALICE/ETCaloAnalysis
10#include "AliAnalysisHadEtCorrections.h"
11#include "TMath.h"
12#include <iostream>
13#include "Rtypes.h"
226c54bf 14#include "TObjArray.h"
15#include "AliLog.h"
45e5a6ec 16#include "TH1D.h"
020abff0 17
18using namespace std;
19
20ClassImp(AliAnalysisHadEtCorrections);
21
22
23AliAnalysisHadEtCorrections::AliAnalysisHadEtCorrections() : TNamed(),
0e866ddc 24 fEtaCut(0)
25 ,fAcceptanceCorrectionFull(0)
26 ,fAcceptanceCorrectionEMCAL(0)
27 ,fAcceptanceCorrectionPHOS(0)
28 ,fNeutralCorrection(0)
29 ,fNotHadronicCorrection(0)
30 ,fpTcutCorrectionTPC(0)
31 ,fpTcutCorrectionITS(0)
32 ,fNotIDConstTPC(0)
33 ,fNotIDConstITS(0)
34 ,fNotIDConstTPCNoID(0)
35 ,fNotIDConstITSNoID(0)
36 ,fNeutralCorrectionLow(0)
37 ,fNotHadronicCorrectionLow(0)
38 ,ffpTcutCorrectionTPCLow(0)
39 ,ffpTcutCorrectionITSLow(0)
40 ,fNeutralCorrectionHigh(0)
41 ,fNotHadronicCorrectionHigh(0)
42 ,ffpTcutCorrectionTPCHigh(0)
43 ,ffpTcutCorrectionITSHigh(0)
44 ,fNotIDConstTPCLow(0)
45 ,fNotIDConstITSLow(0)
46 ,fNotIDConstTPCNoIDLow(0)
47 ,fNotIDConstITSNoIDLow(0)
48 ,fNotIDConstTPCHigh(0)
49 ,fNotIDConstITSHigh(0)
50 ,fNotIDConstTPCNoIDHigh(0)
51 ,fNotIDConstITSNoIDHigh(0)
52 ,fnotIDTPC(0)
53 ,fnotIDITS(0)
54 ,fnotIDNoID(0)
55 ,fEfficiencyPionTPC(0)
56 ,fEfficiencyKaonTPC(0)
57 ,fEfficiencyProtonTPC(0)
58 ,fEfficiencyHadronTPC(0)
59 ,fEfficiencyPionITS(0)
60 ,fEfficiencyKaonITS(0)
61 ,fEfficiencyProtonITS(0)
62 ,fEfficiencyHadronITS(0)
61e9e643 63 ,fEfficiencyTPC(0)
64 ,fEfficiencyITS(0)
45f9be5c 65 ,fEfficiencyErrorLow(0)
66 ,fEfficiencyErrorHigh(0)
67 ,fBackgroundErrorLow(0)
68 ,fBackgroundErrorHigh(0)
0e866ddc 69 ,fBackgroundTPC(0)
70 ,fBackgroundITS(0)
226c54bf 71 ,fIsEMCal(kTRUE)
72 ,fIsData(kFALSE)
73 ,fDataSet(2009)
74 ,fProduction("ProductionName")
75 ,fProductionDescription("Long production description")
020abff0 76{//default constructor
c32af3dd 77 Init();
78}
c32af3dd 79void AliAnalysisHadEtCorrections::Init()
80{ //This seems to solve a compiler error
45e5a6ec 81 cout<<"Creating new AliAnalysisHadEtCorrections"<<endl;
82 fEfficiencyTPC = new TObjArray();
83 fEfficiencyITS = new TObjArray();
020abff0 84}
c32af3dd 85
020abff0 86AliAnalysisHadEtCorrections::~AliAnalysisHadEtCorrections()
87{//destructor
88 //Clear();
951efd81 89 fnotIDTPC->Clear();
90 fnotIDITS->Clear();
91 fnotIDNoID->Clear();
92 fEfficiencyPionTPC->Clear();
93 fEfficiencyKaonTPC->Clear();
94 fEfficiencyProtonTPC->Clear();
95 fEfficiencyHadronTPC->Clear();
96 fEfficiencyPionITS->Clear();
97 fEfficiencyKaonITS->Clear();
98 fEfficiencyProtonITS->Clear();
99 fEfficiencyHadronITS->Clear();
100 fBackgroundTPC->Clear();
101 fBackgroundITS->Clear();
020abff0 102 delete fnotIDTPC;
103 delete fnotIDITS;
104 delete fnotIDNoID;
105 delete fEfficiencyPionTPC;
106 delete fEfficiencyKaonTPC;
107 delete fEfficiencyProtonTPC;
108 delete fEfficiencyHadronTPC;
109 delete fEfficiencyPionITS;
110 delete fEfficiencyKaonITS;
111 delete fEfficiencyProtonITS;
112 delete fEfficiencyHadronITS;
226c54bf 113 delete fEfficiencyTPC;
114 delete fEfficiencyITS;
020abff0 115 delete fBackgroundTPC;
116 delete fBackgroundITS;
020abff0 117}
118AliAnalysisHadEtCorrections::AliAnalysisHadEtCorrections(const AliAnalysisHadEtCorrections *g): TNamed(),
0e866ddc 119 fEtaCut(g->fEtaCut)
120 ,fAcceptanceCorrectionFull(g->fAcceptanceCorrectionFull)
121 ,fAcceptanceCorrectionEMCAL(g->fAcceptanceCorrectionEMCAL)
122 ,fAcceptanceCorrectionPHOS(g->fAcceptanceCorrectionPHOS)
123 ,fNeutralCorrection(g->fNeutralCorrection)
124 ,fNotHadronicCorrection(g->fNotHadronicCorrection)
125 ,fpTcutCorrectionTPC(g->fpTcutCorrectionTPC)
126 ,fpTcutCorrectionITS(g->fpTcutCorrectionITS)
127 ,fNotIDConstTPC(g->fNotIDConstTPC)
128 ,fNotIDConstITS(g->fNotIDConstITS)
129 ,fNotIDConstTPCNoID(g->fNotIDConstTPCNoID)
130 ,fNotIDConstITSNoID(g->fNotIDConstITSNoID)
131 ,fNeutralCorrectionLow(g->fNeutralCorrectionLow)
132 ,fNotHadronicCorrectionLow(g->fNotHadronicCorrectionLow)
133 ,ffpTcutCorrectionTPCLow(g->ffpTcutCorrectionTPCLow)
134 ,ffpTcutCorrectionITSLow(g->ffpTcutCorrectionITSLow)
135 ,fNeutralCorrectionHigh(g->fNeutralCorrectionHigh)
136 ,fNotHadronicCorrectionHigh(g->fNotHadronicCorrectionHigh)
137 ,ffpTcutCorrectionTPCHigh(g->ffpTcutCorrectionTPCHigh)
138 ,ffpTcutCorrectionITSHigh(g->ffpTcutCorrectionITSHigh)
139 ,fNotIDConstTPCLow(g->fNotIDConstTPCLow)
140 ,fNotIDConstITSLow(g->fNotIDConstITSLow)
141 ,fNotIDConstTPCNoIDLow(g->fNotIDConstTPCNoIDLow)
142 ,fNotIDConstITSNoIDLow(g->fNotIDConstITSNoIDLow)
143 ,fNotIDConstTPCHigh(g->fNotIDConstTPCHigh)
144 ,fNotIDConstITSHigh(g->fNotIDConstITSHigh)
145 ,fNotIDConstTPCNoIDHigh(g->fNotIDConstTPCNoIDHigh)
146 ,fNotIDConstITSNoIDHigh(g->fNotIDConstITSNoIDHigh)
147 ,fnotIDTPC(0)
148 ,fnotIDITS(0)
149 ,fnotIDNoID(0)
150 ,fEfficiencyPionTPC(0)
151 ,fEfficiencyKaonTPC(0)
152 ,fEfficiencyProtonTPC(0)
153 ,fEfficiencyHadronTPC(0)
154 ,fEfficiencyPionITS(0)
155 ,fEfficiencyKaonITS(0)
156 ,fEfficiencyProtonITS(0)
157 ,fEfficiencyHadronITS(0)
226c54bf 158 ,fEfficiencyTPC(0)
159 ,fEfficiencyITS(0)
45f9be5c 160 ,fEfficiencyErrorLow(g->fEfficiencyErrorLow)
161 ,fEfficiencyErrorHigh(g->fEfficiencyErrorHigh)
162 ,fBackgroundErrorLow(g->fBackgroundErrorLow)
163 ,fBackgroundErrorHigh(g->fBackgroundErrorHigh)
0e866ddc 164 ,fBackgroundTPC(0)
165 ,fBackgroundITS(0)
226c54bf 166 ,fIsEMCal(g->fIsEMCal)
167 ,fIsData(g->fIsData)
168 ,fDataSet(g->fDataSet)
169 ,fProduction(g->fProduction)
170 ,fProductionDescription(g->fProductionDescription)
020abff0 171{//copy constructor
172 //SetName(g->GetName());
173 fnotIDTPC = new TH1D(*(g->fnotIDTPC));
174 fnotIDITS = new TH1D(*(g->fnotIDITS));
175 fnotIDNoID = new TH1D(*(g->fnotIDNoID));
176 fEfficiencyPionTPC = new TH1D(*(g->fEfficiencyPionTPC));
177 fEfficiencyKaonTPC = new TH1D(*(g->fEfficiencyKaonTPC));
178 fEfficiencyProtonTPC = new TH1D(*(g->fEfficiencyProtonTPC));
179 fEfficiencyHadronTPC = new TH1D(*(g->fEfficiencyHadronTPC));
180 fEfficiencyPionITS = new TH1D(*(g->fEfficiencyPionITS));
181 fEfficiencyKaonITS = new TH1D(*(g->fEfficiencyKaonITS));
182 fEfficiencyProtonITS = new TH1D(*(g->fEfficiencyProtonITS));
183 fEfficiencyHadronITS = new TH1D(*(g->fEfficiencyHadronITS));
226c54bf 184 fEfficiencyTPC = new TObjArray(*(g->fEfficiencyTPC));
185 fEfficiencyITS = new TObjArray(*(g->fEfficiencyITS));
020abff0 186 fBackgroundTPC = new TH1D(*(g->fBackgroundTPC));
187 fBackgroundITS = new TH1D(*(g->fBackgroundITS));
188}
189
3ce6b879 190
464aa50c 191Float_t AliAnalysisHadEtCorrections::GetConstantCorrections(Bool_t totEt, Float_t ptcut, TString type) const {//Get the correction values that are not pt dependent
3ce6b879 192 Float_t acceptance = 0.0;
193 Float_t neutral = 0.0;
194 Float_t ptcorr = 0.0;
195 float correction = 0.0;
196
197 //TString *type = new TString(mytype);
198
199 if(type.Contains("Full")) acceptance = fAcceptanceCorrectionFull;
200 if(type.Contains("EMCAL")) acceptance = fAcceptanceCorrectionEMCAL;
201 if(type.Contains("PHOS")) acceptance = fAcceptanceCorrectionPHOS;
202
203 if(type.Contains("High")){//high bound
204 if(totEt) neutral = fNotHadronicCorrectionHigh;
205 else{neutral = fNeutralCorrectionHigh;}
206 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCHigh;}
207 else{ptcorr = ffpTcutCorrectionITSHigh;}
208 cout<<"Setting correction factor to "<<correction<<endl;
209 return correction;
210 }
211 if(type.Contains("Low")){//high bound
212 if(totEt) neutral = fNotHadronicCorrectionLow;
213 else{neutral = fNeutralCorrectionLow;}
214 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCLow;}
215 else{ptcorr = ffpTcutCorrectionITSLow;}
216 cout<<"Setting correction factor to "<<correction<<endl;
217 return correction;
218 }
219
220 if(totEt) neutral = fNotHadronicCorrection;
221 else{neutral = fNeutralCorrection;}
222 if(ptcut>0.12){ptcorr = fpTcutCorrectionTPC;}
223 else{ptcorr = fpTcutCorrectionITS;}
224
225 correction = acceptance*neutral*ptcorr;
226 cout<<"Setting correction factor for ";
227 if(totEt) cout<<"total et";
228 else{cout<<"hadronic et";}
229 cout<<" with the pt cut off "<<ptcut<<" for "<<type<<" acceptance to "<<correction<<endl;
45f9be5c 230 //cout<<" Acceptance "<<acceptance<<" neutral "<<neutral<<" ptcorr "<<ptcorr<<endl;
3ce6b879 231 return correction;
232
233}
d263b18f 234Float_t AliAnalysisHadEtCorrections::GetSystematicErrorBound(Float_t et,Bool_t isLowBound, Bool_t isHadronic, Bool_t isTPC) const{
45f9be5c 235 //we calculate factors for each value and then multiply them to get the overall bounds
236 //neutral corrections, pt cut, pid, efficiency, background
237 float neutral = 1.0;
238 float ptcut = 1.0;
239 float pid = 1.0;
240 float efficiency = 1.0;
241 float background = 1.0;
242 if(isLowBound){//is lower bound
243 if(isHadronic) neutral= fNeutralCorrectionLow/fNeutralCorrection;
244 else{neutral = fNotHadronicCorrectionLow/fNotHadronicCorrection;}
245 if(isTPC) ptcut = ffpTcutCorrectionTPCLow/fpTcutCorrectionTPC;
246 else{ptcut = ffpTcutCorrectionITSLow/fpTcutCorrectionITS;}
247 pid = fNotIDConstTPCLow/fNotIDConstTPC;
248 efficiency = fEfficiencyErrorLow;
249 background = fBackgroundErrorLow;
250 }
251 else{//is higher bound
252 if(isHadronic) neutral= fNeutralCorrectionHigh/fNeutralCorrection;
253 else{neutral= fNotHadronicCorrectionHigh/fNotHadronicCorrection;}
254 if(isTPC) ptcut = ffpTcutCorrectionTPCHigh/fpTcutCorrectionTPC;
255 else{ptcut = ffpTcutCorrectionITSHigh/fpTcutCorrectionITS;}
256 pid = fNotIDConstTPCHigh/fNotIDConstTPC;
257 efficiency = fEfficiencyErrorHigh;
258 background = fBackgroundErrorHigh;
259 }
260 //cout<<"neutral "<<neutral<<" ptcut "<<ptcut<<" pid "<<pid<<" efficiency "<<efficiency<<" background "<<background<<" overall "<<neutral*ptcut*pid*efficiency*background<<endl;
261 return neutral*ptcut*pid*efficiency*background*et;
262}
020abff0 263// AliAnalysisHadEtCorrections & operator = (const AliAnalysisHadEtCorrections & g) {
264
265// fEtaCut=g->fEtaCut;
266// fAcceptanceCorrectionFull=g->fAcceptanceCorrectionFull;
267// fAcceptanceCorrectionEMCAL=g->fAcceptanceCorrectionEMCAL;
268// fAcceptanceCorrectionPHOS=g->fAcceptanceCorrectionPHOS;
269// fNeutralCorrection=g->fNeutralCorrection;
270// fNotHadronicCorrection=g->fNotHadronicCorrection;
271// fpTcutCorrectionTPC=g->fpTcutCorrectionTPC;
272// fpTcutCorrectionITS=g->fpTcutCorrectionITS;
273// fNeutralCorrectionLow=g->fNeutralCorrectionLow;
274// fNotHadronicCorrectionLow=g->fNotHadronicCorrectionLow;
275// ffpTcutCorrectionTPCLow=g->ffpTcutCorrectionTPCLow;
276// ffpTcutCorrectionITSLow=g->ffpTcutCorrectionITSLow;
277// fNeutralCorrectionHigh=g->fNeutralCorrectionHigh;
278// fNotHadronicCorrectionHigh=g->fNotHadronicCorrectionHigh;
279// ffpTcutCorrectionTPCHigh=g->ffpTcutCorrectionTPCHigh;
280// ffpTcutCorrectionITSHigh=g->ffpTcutCorrectionITSHigh;
281
282// fnotIDTPC = g->fnotIDTPC;
283// fnotIDITS = g->fnotIDITS;
284// fnotIDNoID = g->fnotIDNoID;
285// fEfficiencyPionTPC = g->fEfficiencyPionTPC;
286// fEfficiencyKaonTPC = g->fEfficiencyKaonTPC;
287// fEfficiencyProtonTPC = g->fEfficiencyProtonTPC;
288// fEfficiencyHadronTPC = g->fEfficiencyHadronTPC;
289// fEfficiencyPionITS = g->fEfficiencyPionITS;
290// fEfficiencyKaonITS = g->fEfficiencyKaonITS;
291// fEfficiencyProtonITS = g->fEfficiencyProtonITS;
292// fEfficiencyHadronITS = g->fEfficiencyHadronITS;
293// fBackgroundTPC = g->fBackgroundTPC;
294// fBackgroundITS = g->fBackgroundITS;
295// }
45f9be5c 296TH1D *AliAnalysisHadEtCorrections::GetEfficiencyPionTPC(const int cb){//Get centrality dependent efficiency
297 if(cb==-1){return fEfficiencyPionTPC;}
298 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",cb));}
299}
300TH1D *AliAnalysisHadEtCorrections::GetEfficiencyKaonTPC(const int cb){//Get centrality dependent efficiency
301 if(cb==-1){return fEfficiencyKaonTPC;}
302 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",cb));}
303}
304TH1D *AliAnalysisHadEtCorrections::GetEfficiencyProtonTPC(const int cb){//Get centrality dependent efficiency
305 if(cb==-1){return fEfficiencyProtonTPC;}
306 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",cb));}
307}
308TH1D *AliAnalysisHadEtCorrections::GetEfficiencyHadronTPC(const int cb){//Get centrality dependent efficiency
309 if(cb==-1){return fEfficiencyHadronTPC;}
310 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",cb));}
311}
312TH1D *AliAnalysisHadEtCorrections::GetEfficiencyPionITS(const int cb){//Get centrality dependent efficiency
313 if(cb==-1){return fEfficiencyPionITS;}
314 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",cb));}
315}
316TH1D *AliAnalysisHadEtCorrections::GetEfficiencyKaonITS(const int cb){//Get centrality dependent efficiency
317 if(cb==-1){return fEfficiencyKaonITS;}
318 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",cb));}
319}
320TH1D *AliAnalysisHadEtCorrections::GetEfficiencyProtonITS(const int cb){//Get centrality dependent efficiency
321 if(cb==-1){return fEfficiencyProtonITS;}
322 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",cb));}
323}//Proton
324TH1D *AliAnalysisHadEtCorrections::GetEfficiencyHadronITS(const int cb){//Get centrality dependent efficiency
325 if(cb==-1){return fEfficiencyHadronITS;}
326 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",cb));}
327}
226c54bf 328Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionPion(const float pT, const int cb){//Get the efficiency for reconstructing a pion in the TPC
329 float eff = -1.0;
330 if(cb ==-1){//pp
331 if(!fEfficiencyPionTPC){cerr<<"No histogram fEfficiencyPionTPC!"<<endl; return -1.0;}
332 eff = fEfficiencyPionTPC->GetBinContent(fEfficiencyPionTPC->FindBin(pT));
45e5a6ec 333 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 334 }
335 else{
336 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",cb));
337 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyPionTPC%i",cb)<<endl; return -1.0;}
338 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 339 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 340 }
a02dfa56 341 return 1.0/eff;
342}
226c54bf 343Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionKaon(const float pT, const int cb){//Get the efficiency for reconstructing a kaon in the TPC
344 float eff = -1.0;
345 if(cb ==-1){//pp
346 if(!fEfficiencyKaonTPC){cerr<<"No histogram fEfficiencyKaonTPC!"<<endl; return -1.0;}
347 eff = fEfficiencyKaonTPC->GetBinContent(fEfficiencyKaonTPC->FindBin(pT));
45e5a6ec 348 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 349 }
350 else{
351 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",cb));
352 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyKaonTPC%i",cb)<<endl; return -1.0;}
353 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 354 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 355 }
a02dfa56 356 return 1.0/eff;
357}
226c54bf 358Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionProton(const float pT, const int cb){//Get the efficiency for reconstructing a proton in the TPC
359 float eff = -1.0;
360 if(cb ==-1){//pp
361 if(!fEfficiencyProtonTPC){cerr<<"No histogram fEfficiencyProtonTPC!"<<endl; return -1.0;}
362 eff = fEfficiencyProtonTPC->GetBinContent(fEfficiencyProtonTPC->FindBin(pT));
45e5a6ec 363 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 364 }
365 else{
366 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",cb));
367 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyProtonTPC%i",cb)<<endl; return -1.0;}
368 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 369 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 370 }
a02dfa56 371 return 1.0/eff;
372}
226c54bf 373Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionHadron(const float pT, const int cb){//Get the efficiency for reconstructing a hadron in the TPC
374 float eff = -1.0;
375 if(cb ==-1){//pp
376 if(!fEfficiencyHadronTPC){cerr<<"No histogram fEfficiencyHadronTPC!"<<endl; return -1.0;}
377 eff = fEfficiencyHadronTPC->GetBinContent(fEfficiencyHadronTPC->FindBin(pT));
45e5a6ec 378 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 379 }
380 else{
381 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",cb));
382 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyHadronTPC%i",cb)<<endl; return -1.0;}
383 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 384 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 385 }
a02dfa56 386 return 1.0/eff;
387}
226c54bf 388Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionPion(const float pT, const int cb){//Get the efficiency for reconstructing a pion in the ITS
389 float eff = -1.0;
390 if(cb ==-1){//pp
391 if(!fEfficiencyPionITS){cerr<<"No histogram fEfficiencyPionITS!"<<endl; return -1.0;}
392 eff = fEfficiencyPionITS->GetBinContent(fEfficiencyPionITS->FindBin(pT));
45e5a6ec 393 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 394 }
395 else{
396 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",cb));
397 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyPionITS%i",cb)<<endl; return -1.0;}
398 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 399 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 400 }
a02dfa56 401 return 1.0/eff;
402}
226c54bf 403Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionKaon(const float pT, const int cb){//Get the efficiency for reconstructing a kaon in the ITS
404 float eff = -1.0;
405 if(cb ==-1){//pp
406 if(!fEfficiencyKaonITS){cerr<<"No histogram fEfficiencyKaonITS!"<<endl; return -1.0;}
407 eff = fEfficiencyKaonITS->GetBinContent(fEfficiencyKaonITS->FindBin(pT));
45e5a6ec 408 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 409 }
410 else{
411 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",cb));
412 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyKaonITS%i",cb)<<endl; return -1.0;}
413 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 414 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 415 }
a02dfa56 416 return 1.0/eff;
417}
226c54bf 418Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionProton(const float pT, const int cb){//Get the efficiency for reconstructing a proton in the ITS
419 float eff = -1.0;
420 if(cb ==-1){//pp
421 if(!fEfficiencyProtonITS){cerr<<"No histogram fEfficiencyProtonITS!"<<endl; return -1.0;}
422 eff = fEfficiencyProtonITS->GetBinContent(fEfficiencyProtonITS->FindBin(pT));
45e5a6ec 423 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 424 }
425 else{
426 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",cb));
427 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyProtonITS%i",cb)<<endl; return -1.0;}
428 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 429 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 430 }
a02dfa56 431 return 1.0/eff;
432}
226c54bf 433Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionHadron(const float pT, const int cb){//Get the efficiency for reconstructing a hadron in the ITS
434 float eff = -1.0;
435 if(cb ==-1){//pp
436 if(!fEfficiencyHadronITS){cerr<<"No histogram fEfficiencyHadronITS!"<<endl; return -1.0;}
437 eff = fEfficiencyHadronITS->GetBinContent(fEfficiencyHadronITS->FindBin(pT));
45e5a6ec 438 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 439 }
440 else{
441 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",cb));
442 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyHadronITS%i",cb)<<endl; return -1.0;}
443 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 444 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 445 }
a02dfa56 446 return 1.0/eff;
447}
226c54bf 448void AliAnalysisHadEtCorrections::SetEfficiencyPionTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
449 if(histo){
450 //first check to see if the histogram exists already
451 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",cb));
452 if(old){
453 fEfficiencyTPC->Remove(old);
454 delete old;
455 }
456 //then if the new histogram exists, add it to the array
457 histo->SetName(Form("fEfficiencyPionTPC%i",cb));
458 fEfficiencyTPC->Add(histo);
459 }
460 else{cerr<<"Histogram does not exist!"<<endl;}
461}
462void AliAnalysisHadEtCorrections::SetEfficiencyKaonTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
463 if(histo){
464 //first check to see if the histogram exists already
465 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",cb));
466 if(old){
467 fEfficiencyTPC->Remove(old);
468 delete old;
469 }
470 //then if the new histogram exists, add it to the array
471 histo->SetName(Form("fEfficiencyKaonTPC%i",cb));
472 fEfficiencyTPC->Add(histo);
473 }
474 else{cerr<<"Histogram does not exist!"<<endl;}
475}//Kaon
476void AliAnalysisHadEtCorrections::SetEfficiencyProtonTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
477 if(histo){
478 //first check to see if the histogram exists already
479 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",cb));
480 if(old){
481 fEfficiencyTPC->Remove(old);
482 delete old;
483 }
484 //then if the new histogram exists, add it to the array
485 histo->SetName(Form("fEfficiencyProtonTPC%i",cb));
486 fEfficiencyTPC->Add(histo);
487 }
488 else{cerr<<"Histogram does not exist!"<<endl;}
489}//Proton
490void AliAnalysisHadEtCorrections::SetEfficiencyHadronTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
491 if(histo){
492 //first check to see if the histogram exists already
493 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",cb));
494 if(old){
495 fEfficiencyTPC->Remove(old);
496 delete old;
497 }
498 //then if the new histogram exists, add it to the array
499 histo->SetName(Form("fEfficiencyHadronTPC%i",cb));
500 fEfficiencyTPC->Add(histo);
501 }
502 else{cerr<<"Histogram does not exist!"<<endl;}
503}
504void AliAnalysisHadEtCorrections::SetEfficiencyPionITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
505 if(histo){
506 //first check to see if the histogram exists already
507 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",cb));
508 if(old){
509 fEfficiencyITS->Remove(old);
510 delete old;
511 }
512 //then if the new histogram exists, add it to the array
513 histo->SetName(Form("fEfficiencyPionITS%i",cb));
514 fEfficiencyITS->Add(histo);
515 }
516 else{cerr<<"Histogram does not exist!"<<endl;}
517}
518void AliAnalysisHadEtCorrections::SetEfficiencyKaonITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
519 if(histo){
520 //first check to see if the histogram exists already
521 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",cb));
522 if(old){
523 fEfficiencyITS->Remove(old);
524 delete old;
525 }
526 //then if the new histogram exists, add it to the array
527 histo->SetName(Form("fEfficiencyKaonITS%i",cb));
528 fEfficiencyITS->Add(histo);
529 }
530 else{cerr<<"Histogram does not exist!"<<endl;}
531}//Kaon
532void AliAnalysisHadEtCorrections::SetEfficiencyProtonITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
533 if(histo){
534 //first check to see if the histogram exists already
535 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",cb));
536 if(old){
537 fEfficiencyITS->Remove(old);
538 delete old;
539 }
540 //then if the new histogram exists, add it to the array
541 histo->SetName(Form("fEfficiencyProtonITS%i",cb));
542 fEfficiencyITS->Add(histo);
543 }
544 else{cerr<<"Histogram does not exist!"<<endl;}
545}//Proton
546void AliAnalysisHadEtCorrections::SetEfficiencyHadronITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
547 if(histo){
548 //first check to see if the histogram exists already
549 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",cb));
550 if(old){
551 fEfficiencyITS->Remove(old);
552 delete old;
553 }
554 //then if the new histogram exists, add it to the array
555 histo->SetName(Form("fEfficiencyHadronITS%i",cb));
556 fEfficiencyITS->Add(histo);
557 }
558 else{cerr<<"Histogram does not exist!"<<endl;}
559}
560
561
0e866ddc 562Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionTPC(const float pT){//get correction for unidentified particles in the TPC
563 Float_t val = fnotIDTPC->GetBinContent(fnotIDTPC->FindBin(pT));
564 if(val>0.0) return 1.0/(val);
565 else{return 0.0;}
566}
567Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionITS(const float pT){//Get correction for unidentified particles in the ITS
568 Float_t val = fnotIDITS->GetBinContent(fnotIDITS->FindBin(pT));
569 if(val>0.0) return 1.0/(val);
570 else{return 0.0;}
571}
572Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionNoPID(const float pT){//Get correction for particles in the case that there is no particle identification
573 Float_t val = fnotIDNoID->GetBinContent(fnotIDNoID->FindBin(pT));
574 if(val>0.0) return 1.0/(val);
575 else{return 0.0;}
576}
45e5a6ec 577Float_t AliAnalysisHadEtCorrections::GetBackgroundCorrectionTPC(const float pT){//Get background correction for TPC tracks
578 return (1.0-fBackgroundTPC->GetBinContent(fBackgroundTPC->FindBin(pT)));
579}
580Float_t AliAnalysisHadEtCorrections::GetBackgroundCorrectionITS(const float pT){//Get background correction for ITS tracks
581 return (1.0-fBackgroundITS->GetBinContent(fBackgroundITS->FindBin(pT)));
582}
226c54bf 583void AliAnalysisHadEtCorrections::Report(){//Gives a report on the status of all corrections
4cb06159 584 //This is primarily for cross checking that the results we get from the macro that fills this class, GetCorrections.C, are sane
226c54bf 585 cout<<"======================================================================="<<endl;
586 cout<<" Report from "<<GetName()<<endl;
587 cout<<"======================================================================="<<endl;
588 cout<<fProductionDescription<<" created from "<<fProduction<<endl;
589 cout<<"This for determination of EThad from ";
590 if(fIsData) cout<<"data of ";
591 else{cout<<"simulation of ";}
592 switch(fDataSet){
593 case 2009:
594 cout<<"p+p collisions at 900 GeV"<<endl;
595 break;
596 case 2010:
597 cout<<"p+p collisions at 7 TeV"<<endl;
598 break;
599 case 20100:
600 cout<<"Pb+Pb collisions at 2.76 TeV"<<endl;
601 break;
602 default:
603 cout<<"an undetermined collision system and energy"<<endl;
604 }
605 cout<<"This is initialized for the ";
606 if(fIsEMCal) cout<<"EMCal";
607 else{cout<<"PHOS";}
608 cout<<" acceptance"<<endl<<endl;
609
610 cout<<"The acceptance correction for the full "<<fAcceptanceCorrectionFull<<endl;
611 cout<<" EMCal "<<fAcceptanceCorrectionEMCAL<<endl;
612 cout<<" PHOS "<<fAcceptanceCorrectionPHOS<<endl<<endl;
613
614 cout<<Form("The neutral energy correction is %2.4f [%2.4f,%2.4f]",fNeutralCorrection,fNeutralCorrectionLow,fNeutralCorrectionHigh)<<endl;
615 cout<<Form(" total %2.4f [%2.4f,%2.4f]",fNotHadronicCorrection,fNotHadronicCorrectionLow,fNotHadronicCorrectionHigh)<<endl<<endl;
616
617 cout<<Form("The pT cut correction for 100 MeV is %2.4f [%2.4f,%2.4f]",fpTcutCorrectionITS,ffpTcutCorrectionITSLow,ffpTcutCorrectionITSHigh)<<endl;
618 cout<<Form(" 150 MeV %2.4f [%2.4f,%2.4f]",fpTcutCorrectionTPC,ffpTcutCorrectionTPCLow,ffpTcutCorrectionTPCHigh)<<endl<<endl;
619
0add53f6 620 cout<<Form("The correction for unidentified ITS tracks is %2.4f [%2.4f,%2.4f]",fNotIDConstITS,fNotIDConstITSLow,fNotIDConstITSHigh)<<endl;
621 cout<<Form(" TPC tracks %2.4f [%2.4f,%2.4f]",fNotIDConstTPC,fNotIDConstTPCLow,fNotIDConstTPCHigh)<<endl<<endl;
226c54bf 622
623 cout<<"Background correction histogram for ITS tracks is";
624 if(!fBackgroundITS)cout<<" not set"<<endl;
625 else{cout<<" set and has "<<fBackgroundITS->GetEntries()<<" entries"<<endl;}
626 cout<<" TPC ";
627 if(!fBackgroundTPC)cout<<" not set"<<endl;
628 else{cout<<" set and has "<<fBackgroundTPC->GetEntries()<<" entries"<<endl;}
629 cout<<endl;
630
631
632 cout<<"Efficiency histogram for ITS tracks for hadrons is";
633 if(!fEfficiencyHadronITS)cout<<" not set"<<endl;
634 else{cout<<" set and has "<<fEfficiencyHadronITS->GetEntries()<<" entries"<<endl;}
635 cout<<" TPC hadrons ";
636 if(!fEfficiencyHadronTPC)cout<<" not set"<<endl;
637 else{cout<<" set and has "<<fEfficiencyHadronTPC->GetEntries()<<" entries"<<endl;}
638 cout<<" ITS pions ";
639 if(!fEfficiencyPionITS)cout<<" not set"<<endl;
640 else{cout<<" set and has "<<fEfficiencyPionITS->GetEntries()<<" entries"<<endl;}
641 cout<<" TPC pions ";
642 if(!fEfficiencyPionTPC)cout<<" not set"<<endl;
643 else{cout<<" set and has "<<fEfficiencyPionTPC->GetEntries()<<" entries"<<endl;}
644 cout<<" ITS kaons ";
645 if(!fEfficiencyKaonITS)cout<<" not set"<<endl;
646 else{cout<<" set and has "<<fEfficiencyKaonITS->GetEntries()<<" entries"<<endl;}
647 cout<<" TPC kaons ";
648 if(!fEfficiencyKaonTPC)cout<<" not set"<<endl;
649 else{cout<<" set and has "<<fEfficiencyKaonTPC->GetEntries()<<" entries"<<endl;}
650 cout<<" ITS protons ";
651 if(!fEfficiencyProtonITS)cout<<" not set"<<endl;
652 else{cout<<" set and has "<<fEfficiencyProtonITS->GetEntries()<<" entries"<<endl;}
653 cout<<" TPC protons ";
654 if(!fEfficiencyProtonTPC)cout<<" not set"<<endl;
655 else{cout<<" set and has "<<fEfficiencyProtonTPC->GetEntries()<<" entries"<<endl;}
656 cout<<endl;
657
658 if(fDataSet==20100){//if Pb+Pb
659 cout<<"Efficiency histogram for TPC tracks for hadrons is set for centrality bins ";
45f9be5c 660 for(int i = 0;i<=21;i++){
226c54bf 661 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",i));
662 if(histo) cout<<i<<" ";
663 }
664 cout<<endl;
665 cout<<" pions ";
45f9be5c 666 for(int i = 0;i<=21;i++){
226c54bf 667 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",i));
668 if(histo) cout<<i<<" ";
669 }
670 cout<<endl;
671 cout<<" kaons ";
45f9be5c 672 for(int i = 0;i<=21;i++){
226c54bf 673 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",i));
674 if(histo) cout<<i<<" ";
675 }
676 cout<<endl;
677 cout<<" protons ";
45f9be5c 678 for(int i = 0;i<=21;i++){
226c54bf 679 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",i));
680 if(histo) cout<<i<<" ";
681 }
682 cout<<endl;
683 cout<<" ITS hadrons ";
45f9be5c 684 for(int i = 0;i<=21;i++){
226c54bf 685 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",i));
686 if(histo) cout<<i<<" ";
687 }
688 cout<<endl;
689 cout<<" pions ";
45f9be5c 690 for(int i = 0;i<=21;i++){
226c54bf 691 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",i));
692 if(histo) cout<<i<<" ";
693 }
694 cout<<endl;
695 cout<<" kaons ";
45f9be5c 696 for(int i = 0;i<=21;i++){
226c54bf 697 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",i));
698 if(histo) cout<<i<<" ";
699 }
700 cout<<endl;
701 cout<<" protons ";
45f9be5c 702 for(int i = 0;i<=21;i++){
226c54bf 703 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",i));
704 if(histo) cout<<i<<" ";
705 }
706 cout<<endl;
707
708
709 int nEntries = fEfficiencyTPC->GetEntries();
710 int nbadhistograms = 0;
711 for(int i=0;i<nEntries;i++){
712 TH1D *histo = (TH1D*) fEfficiencyTPC->At(i);
713 if(!histo){
714 cout<<"Warning: Histogram in fEfficiencyTPC at "<<i<<" is NULL!"<<endl;
715 nbadhistograms++;
716 }
717 else{
718 if(histo->GetEntries()<=1e-2){
719 cout<<"Warning: Histogram "<<histo->GetName()<<" in fEfficiencyTPC is empty!"<<endl;
720 nbadhistograms++;
721 }
722 }
723 }
724 cout<<nbadhistograms<<" bad histograms in fEfficiencyTPC"<<endl;
725
726 nEntries = fEfficiencyITS->GetEntries();
727 nbadhistograms = 0;
728 for(int i=0;i<nEntries;i++){
729 TH1D *histo = (TH1D*) fEfficiencyITS->At(i);
730 if(!histo){
731 cout<<"Warning: Histogram in fEfficiencyITS at "<<i<<" is NULL!"<<endl;
732 nbadhistograms++;
733 }
734 else{
735 if(histo->GetEntries()<=1e-2){
736 cout<<"Warning: Histogram "<<histo->GetName()<<" in fEfficiencyITS is empty!"<<endl;
737 nbadhistograms++;
738 }
739 }
740 }
741 cout<<nbadhistograms<<" bad histograms in fEfficiencyITS"<<endl;
742
743
744 }
745
746
747 cout<<endl;
748 cout<<"======================================================================="<<endl;
749 cout<<"======================================================================="<<endl;
750}
751