]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/totEt/AliAnalysisHadEtCorrections.cxx
Not sure why this isn't letting me just make my commit
[u/mrichter/AliRoot.git] / PWGLF / 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
3dd386ab 199 if(type.Contains("Full") || type.Contains("PiKP")) acceptance = fAcceptanceCorrectionFull;
3ce6b879 200 if(type.Contains("EMCAL")) acceptance = fAcceptanceCorrectionEMCAL;
201 if(type.Contains("PHOS")) acceptance = fAcceptanceCorrectionPHOS;
202
025a0bb1 203 if(totEt) neutral = fNotHadronicCorrection;
204 else{neutral = fNeutralCorrection;}
205 if(ptcut>0.12){ptcorr = fpTcutCorrectionTPC;}
206 else{ptcorr = fpTcutCorrectionITS;}
207
3dd386ab 208 if(type.Contains("PiKP")){
209 if(ptcut>0.12){ptcorr = fpTcutCorrectionTPC;}
210 else{ptcorr = fpTcutCorrectionITS;}
211 if(type.Contains("High")){
212 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCHigh;}
213 else{ptcorr = ffpTcutCorrectionITSHigh;}
214 }
215 if(type.Contains("Low")){
216 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCLow;}
217 else{ptcorr = ffpTcutCorrectionITSLow;}
218 }
025a0bb1 219 neutral = 1.0;
3dd386ab 220 }
221
3ce6b879 222 if(type.Contains("High")){//high bound
223 if(totEt) neutral = fNotHadronicCorrectionHigh;
224 else{neutral = fNeutralCorrectionHigh;}
225 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCHigh;}
226 else{ptcorr = ffpTcutCorrectionITSHigh;}
227 cout<<"Setting correction factor to "<<correction<<endl;
228 return correction;
229 }
230 if(type.Contains("Low")){//high bound
231 if(totEt) neutral = fNotHadronicCorrectionLow;
232 else{neutral = fNeutralCorrectionLow;}
233 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCLow;}
234 else{ptcorr = ffpTcutCorrectionITSLow;}
235 cout<<"Setting correction factor to "<<correction<<endl;
236 return correction;
237 }
025a0bb1 238
239
3ce6b879 240 correction = acceptance*neutral*ptcorr;
025a0bb1 241 cout<<"correction "<<correction<<" = "<<acceptance<<"*"<<neutral<<"*"<<ptcorr<<endl;
3ce6b879 242 cout<<"Setting correction factor for ";
243 if(totEt) cout<<"total et";
244 else{cout<<"hadronic et";}
245 cout<<" with the pt cut off "<<ptcut<<" for "<<type<<" acceptance to "<<correction<<endl;
45f9be5c 246 //cout<<" Acceptance "<<acceptance<<" neutral "<<neutral<<" ptcorr "<<ptcorr<<endl;
3ce6b879 247 return correction;
248
249}
d263b18f 250Float_t AliAnalysisHadEtCorrections::GetSystematicErrorBound(Float_t et,Bool_t isLowBound, Bool_t isHadronic, Bool_t isTPC) const{
45f9be5c 251 //we calculate factors for each value and then multiply them to get the overall bounds
252 //neutral corrections, pt cut, pid, efficiency, background
253 float neutral = 1.0;
254 float ptcut = 1.0;
255 float pid = 1.0;
256 float efficiency = 1.0;
257 float background = 1.0;
258 if(isLowBound){//is lower bound
259 if(isHadronic) neutral= fNeutralCorrectionLow/fNeutralCorrection;
260 else{neutral = fNotHadronicCorrectionLow/fNotHadronicCorrection;}
261 if(isTPC) ptcut = ffpTcutCorrectionTPCLow/fpTcutCorrectionTPC;
262 else{ptcut = ffpTcutCorrectionITSLow/fpTcutCorrectionITS;}
263 pid = fNotIDConstTPCLow/fNotIDConstTPC;
264 efficiency = fEfficiencyErrorLow;
265 background = fBackgroundErrorLow;
266 }
267 else{//is higher bound
268 if(isHadronic) neutral= fNeutralCorrectionHigh/fNeutralCorrection;
269 else{neutral= fNotHadronicCorrectionHigh/fNotHadronicCorrection;}
270 if(isTPC) ptcut = ffpTcutCorrectionTPCHigh/fpTcutCorrectionTPC;
271 else{ptcut = ffpTcutCorrectionITSHigh/fpTcutCorrectionITS;}
272 pid = fNotIDConstTPCHigh/fNotIDConstTPC;
273 efficiency = fEfficiencyErrorHigh;
274 background = fBackgroundErrorHigh;
275 }
276 //cout<<"neutral "<<neutral<<" ptcut "<<ptcut<<" pid "<<pid<<" efficiency "<<efficiency<<" background "<<background<<" overall "<<neutral*ptcut*pid*efficiency*background<<endl;
277 return neutral*ptcut*pid*efficiency*background*et;
278}
020abff0 279// AliAnalysisHadEtCorrections & operator = (const AliAnalysisHadEtCorrections & g) {
280
281// fEtaCut=g->fEtaCut;
282// fAcceptanceCorrectionFull=g->fAcceptanceCorrectionFull;
283// fAcceptanceCorrectionEMCAL=g->fAcceptanceCorrectionEMCAL;
284// fAcceptanceCorrectionPHOS=g->fAcceptanceCorrectionPHOS;
285// fNeutralCorrection=g->fNeutralCorrection;
286// fNotHadronicCorrection=g->fNotHadronicCorrection;
287// fpTcutCorrectionTPC=g->fpTcutCorrectionTPC;
288// fpTcutCorrectionITS=g->fpTcutCorrectionITS;
289// fNeutralCorrectionLow=g->fNeutralCorrectionLow;
290// fNotHadronicCorrectionLow=g->fNotHadronicCorrectionLow;
291// ffpTcutCorrectionTPCLow=g->ffpTcutCorrectionTPCLow;
292// ffpTcutCorrectionITSLow=g->ffpTcutCorrectionITSLow;
293// fNeutralCorrectionHigh=g->fNeutralCorrectionHigh;
294// fNotHadronicCorrectionHigh=g->fNotHadronicCorrectionHigh;
295// ffpTcutCorrectionTPCHigh=g->ffpTcutCorrectionTPCHigh;
296// ffpTcutCorrectionITSHigh=g->ffpTcutCorrectionITSHigh;
297
298// fnotIDTPC = g->fnotIDTPC;
299// fnotIDITS = g->fnotIDITS;
300// fnotIDNoID = g->fnotIDNoID;
301// fEfficiencyPionTPC = g->fEfficiencyPionTPC;
302// fEfficiencyKaonTPC = g->fEfficiencyKaonTPC;
303// fEfficiencyProtonTPC = g->fEfficiencyProtonTPC;
304// fEfficiencyHadronTPC = g->fEfficiencyHadronTPC;
305// fEfficiencyPionITS = g->fEfficiencyPionITS;
306// fEfficiencyKaonITS = g->fEfficiencyKaonITS;
307// fEfficiencyProtonITS = g->fEfficiencyProtonITS;
308// fEfficiencyHadronITS = g->fEfficiencyHadronITS;
309// fBackgroundTPC = g->fBackgroundTPC;
310// fBackgroundITS = g->fBackgroundITS;
311// }
45f9be5c 312TH1D *AliAnalysisHadEtCorrections::GetEfficiencyPionTPC(const int cb){//Get centrality dependent efficiency
313 if(cb==-1){return fEfficiencyPionTPC;}
314 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",cb));}
315}
316TH1D *AliAnalysisHadEtCorrections::GetEfficiencyKaonTPC(const int cb){//Get centrality dependent efficiency
317 if(cb==-1){return fEfficiencyKaonTPC;}
318 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",cb));}
319}
320TH1D *AliAnalysisHadEtCorrections::GetEfficiencyProtonTPC(const int cb){//Get centrality dependent efficiency
321 if(cb==-1){return fEfficiencyProtonTPC;}
322 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",cb));}
323}
324TH1D *AliAnalysisHadEtCorrections::GetEfficiencyHadronTPC(const int cb){//Get centrality dependent efficiency
325 if(cb==-1){return fEfficiencyHadronTPC;}
326 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",cb));}
327}
328TH1D *AliAnalysisHadEtCorrections::GetEfficiencyPionITS(const int cb){//Get centrality dependent efficiency
329 if(cb==-1){return fEfficiencyPionITS;}
330 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",cb));}
331}
332TH1D *AliAnalysisHadEtCorrections::GetEfficiencyKaonITS(const int cb){//Get centrality dependent efficiency
333 if(cb==-1){return fEfficiencyKaonITS;}
334 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",cb));}
335}
336TH1D *AliAnalysisHadEtCorrections::GetEfficiencyProtonITS(const int cb){//Get centrality dependent efficiency
337 if(cb==-1){return fEfficiencyProtonITS;}
338 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",cb));}
339}//Proton
340TH1D *AliAnalysisHadEtCorrections::GetEfficiencyHadronITS(const int cb){//Get centrality dependent efficiency
341 if(cb==-1){return fEfficiencyHadronITS;}
342 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",cb));}
343}
226c54bf 344Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionPion(const float pT, const int cb){//Get the efficiency for reconstructing a pion in the TPC
345 float eff = -1.0;
346 if(cb ==-1){//pp
347 if(!fEfficiencyPionTPC){cerr<<"No histogram fEfficiencyPionTPC!"<<endl; return -1.0;}
348 eff = fEfficiencyPionTPC->GetBinContent(fEfficiencyPionTPC->FindBin(pT));
45e5a6ec 349 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 350 }
351 else{
352 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",cb));
353 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyPionTPC%i",cb)<<endl; return -1.0;}
354 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 355 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 356 }
a02dfa56 357 return 1.0/eff;
358}
226c54bf 359Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionKaon(const float pT, const int cb){//Get the efficiency for reconstructing a kaon in the TPC
360 float eff = -1.0;
361 if(cb ==-1){//pp
362 if(!fEfficiencyKaonTPC){cerr<<"No histogram fEfficiencyKaonTPC!"<<endl; return -1.0;}
363 eff = fEfficiencyKaonTPC->GetBinContent(fEfficiencyKaonTPC->FindBin(pT));
45e5a6ec 364 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 365 }
366 else{
367 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",cb));
368 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyKaonTPC%i",cb)<<endl; return -1.0;}
369 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 370 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 371 }
a02dfa56 372 return 1.0/eff;
373}
226c54bf 374Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionProton(const float pT, const int cb){//Get the efficiency for reconstructing a proton in the TPC
375 float eff = -1.0;
376 if(cb ==-1){//pp
377 if(!fEfficiencyProtonTPC){cerr<<"No histogram fEfficiencyProtonTPC!"<<endl; return -1.0;}
378 eff = fEfficiencyProtonTPC->GetBinContent(fEfficiencyProtonTPC->FindBin(pT));
45e5a6ec 379 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 380 }
381 else{
382 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",cb));
383 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyProtonTPC%i",cb)<<endl; return -1.0;}
384 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 385 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 386 }
a02dfa56 387 return 1.0/eff;
388}
226c54bf 389Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionHadron(const float pT, const int cb){//Get the efficiency for reconstructing a hadron in the TPC
390 float eff = -1.0;
391 if(cb ==-1){//pp
392 if(!fEfficiencyHadronTPC){cerr<<"No histogram fEfficiencyHadronTPC!"<<endl; return -1.0;}
393 eff = fEfficiencyHadronTPC->GetBinContent(fEfficiencyHadronTPC->FindBin(pT));
45e5a6ec 394 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 395 }
396 else{
397 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",cb));
398 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyHadronTPC%i",cb)<<endl; return -1.0;}
399 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 400 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 401 }
a02dfa56 402 return 1.0/eff;
403}
226c54bf 404Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionPion(const float pT, const int cb){//Get the efficiency for reconstructing a pion in the ITS
405 float eff = -1.0;
406 if(cb ==-1){//pp
407 if(!fEfficiencyPionITS){cerr<<"No histogram fEfficiencyPionITS!"<<endl; return -1.0;}
408 eff = fEfficiencyPionITS->GetBinContent(fEfficiencyPionITS->FindBin(pT));
45e5a6ec 409 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 410 }
411 else{
412 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",cb));
413 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyPionITS%i",cb)<<endl; return -1.0;}
414 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 415 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 416 }
a02dfa56 417 return 1.0/eff;
418}
226c54bf 419Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionKaon(const float pT, const int cb){//Get the efficiency for reconstructing a kaon in the ITS
420 float eff = -1.0;
421 if(cb ==-1){//pp
422 if(!fEfficiencyKaonITS){cerr<<"No histogram fEfficiencyKaonITS!"<<endl; return -1.0;}
423 eff = fEfficiencyKaonITS->GetBinContent(fEfficiencyKaonITS->FindBin(pT));
45e5a6ec 424 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 425 }
426 else{
427 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",cb));
428 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyKaonITS%i",cb)<<endl; return -1.0;}
429 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 430 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 431 }
a02dfa56 432 return 1.0/eff;
433}
226c54bf 434Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionProton(const float pT, const int cb){//Get the efficiency for reconstructing a proton in the ITS
435 float eff = -1.0;
436 if(cb ==-1){//pp
437 if(!fEfficiencyProtonITS){cerr<<"No histogram fEfficiencyProtonITS!"<<endl; return -1.0;}
438 eff = fEfficiencyProtonITS->GetBinContent(fEfficiencyProtonITS->FindBin(pT));
45e5a6ec 439 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 440 }
441 else{
442 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",cb));
443 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyProtonITS%i",cb)<<endl; return -1.0;}
444 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 445 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 446 }
a02dfa56 447 return 1.0/eff;
448}
226c54bf 449Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionHadron(const float pT, const int cb){//Get the efficiency for reconstructing a hadron in the ITS
450 float eff = -1.0;
451 if(cb ==-1){//pp
452 if(!fEfficiencyHadronITS){cerr<<"No histogram fEfficiencyHadronITS!"<<endl; return -1.0;}
453 eff = fEfficiencyHadronITS->GetBinContent(fEfficiencyHadronITS->FindBin(pT));
45e5a6ec 454 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
226c54bf 455 }
456 else{
457 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",cb));
458 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyHadronITS%i",cb)<<endl; return -1.0;}
459 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
45e5a6ec 460 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
226c54bf 461 }
a02dfa56 462 return 1.0/eff;
463}
226c54bf 464void AliAnalysisHadEtCorrections::SetEfficiencyPionTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
465 if(histo){
466 //first check to see if the histogram exists already
467 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",cb));
468 if(old){
469 fEfficiencyTPC->Remove(old);
470 delete old;
471 }
472 //then if the new histogram exists, add it to the array
473 histo->SetName(Form("fEfficiencyPionTPC%i",cb));
474 fEfficiencyTPC->Add(histo);
475 }
476 else{cerr<<"Histogram does not exist!"<<endl;}
477}
478void AliAnalysisHadEtCorrections::SetEfficiencyKaonTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
479 if(histo){
480 //first check to see if the histogram exists already
481 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",cb));
482 if(old){
483 fEfficiencyTPC->Remove(old);
484 delete old;
485 }
486 //then if the new histogram exists, add it to the array
487 histo->SetName(Form("fEfficiencyKaonTPC%i",cb));
488 fEfficiencyTPC->Add(histo);
489 }
490 else{cerr<<"Histogram does not exist!"<<endl;}
491}//Kaon
492void AliAnalysisHadEtCorrections::SetEfficiencyProtonTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
493 if(histo){
494 //first check to see if the histogram exists already
495 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",cb));
496 if(old){
497 fEfficiencyTPC->Remove(old);
498 delete old;
499 }
500 //then if the new histogram exists, add it to the array
501 histo->SetName(Form("fEfficiencyProtonTPC%i",cb));
502 fEfficiencyTPC->Add(histo);
503 }
504 else{cerr<<"Histogram does not exist!"<<endl;}
505}//Proton
506void AliAnalysisHadEtCorrections::SetEfficiencyHadronTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
507 if(histo){
508 //first check to see if the histogram exists already
509 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",cb));
510 if(old){
511 fEfficiencyTPC->Remove(old);
512 delete old;
513 }
514 //then if the new histogram exists, add it to the array
515 histo->SetName(Form("fEfficiencyHadronTPC%i",cb));
516 fEfficiencyTPC->Add(histo);
517 }
518 else{cerr<<"Histogram does not exist!"<<endl;}
519}
520void AliAnalysisHadEtCorrections::SetEfficiencyPionITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
521 if(histo){
522 //first check to see if the histogram exists already
523 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",cb));
524 if(old){
525 fEfficiencyITS->Remove(old);
526 delete old;
527 }
528 //then if the new histogram exists, add it to the array
529 histo->SetName(Form("fEfficiencyPionITS%i",cb));
530 fEfficiencyITS->Add(histo);
531 }
532 else{cerr<<"Histogram does not exist!"<<endl;}
533}
534void AliAnalysisHadEtCorrections::SetEfficiencyKaonITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
535 if(histo){
536 //first check to see if the histogram exists already
537 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",cb));
538 if(old){
539 fEfficiencyITS->Remove(old);
540 delete old;
541 }
542 //then if the new histogram exists, add it to the array
543 histo->SetName(Form("fEfficiencyKaonITS%i",cb));
544 fEfficiencyITS->Add(histo);
545 }
546 else{cerr<<"Histogram does not exist!"<<endl;}
547}//Kaon
548void AliAnalysisHadEtCorrections::SetEfficiencyProtonITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
549 if(histo){
550 //first check to see if the histogram exists already
551 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",cb));
552 if(old){
553 fEfficiencyITS->Remove(old);
554 delete old;
555 }
556 //then if the new histogram exists, add it to the array
557 histo->SetName(Form("fEfficiencyProtonITS%i",cb));
558 fEfficiencyITS->Add(histo);
559 }
560 else{cerr<<"Histogram does not exist!"<<endl;}
561}//Proton
562void AliAnalysisHadEtCorrections::SetEfficiencyHadronITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
563 if(histo){
564 //first check to see if the histogram exists already
565 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",cb));
566 if(old){
567 fEfficiencyITS->Remove(old);
568 delete old;
569 }
570 //then if the new histogram exists, add it to the array
571 histo->SetName(Form("fEfficiencyHadronITS%i",cb));
572 fEfficiencyITS->Add(histo);
573 }
574 else{cerr<<"Histogram does not exist!"<<endl;}
575}
576
577
0e866ddc 578Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionTPC(const float pT){//get correction for unidentified particles in the TPC
579 Float_t val = fnotIDTPC->GetBinContent(fnotIDTPC->FindBin(pT));
580 if(val>0.0) return 1.0/(val);
581 else{return 0.0;}
582}
583Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionITS(const float pT){//Get correction for unidentified particles in the ITS
584 Float_t val = fnotIDITS->GetBinContent(fnotIDITS->FindBin(pT));
585 if(val>0.0) return 1.0/(val);
586 else{return 0.0;}
587}
588Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionNoPID(const float pT){//Get correction for particles in the case that there is no particle identification
589 Float_t val = fnotIDNoID->GetBinContent(fnotIDNoID->FindBin(pT));
590 if(val>0.0) return 1.0/(val);
591 else{return 0.0;}
592}
45e5a6ec 593Float_t AliAnalysisHadEtCorrections::GetBackgroundCorrectionTPC(const float pT){//Get background correction for TPC tracks
594 return (1.0-fBackgroundTPC->GetBinContent(fBackgroundTPC->FindBin(pT)));
595}
596Float_t AliAnalysisHadEtCorrections::GetBackgroundCorrectionITS(const float pT){//Get background correction for ITS tracks
597 return (1.0-fBackgroundITS->GetBinContent(fBackgroundITS->FindBin(pT)));
598}
226c54bf 599void AliAnalysisHadEtCorrections::Report(){//Gives a report on the status of all corrections
4cb06159 600 //This is primarily for cross checking that the results we get from the macro that fills this class, GetCorrections.C, are sane
226c54bf 601 cout<<"======================================================================="<<endl;
602 cout<<" Report from "<<GetName()<<endl;
603 cout<<"======================================================================="<<endl;
604 cout<<fProductionDescription<<" created from "<<fProduction<<endl;
605 cout<<"This for determination of EThad from ";
606 if(fIsData) cout<<"data of ";
607 else{cout<<"simulation of ";}
608 switch(fDataSet){
609 case 2009:
610 cout<<"p+p collisions at 900 GeV"<<endl;
611 break;
612 case 2010:
613 cout<<"p+p collisions at 7 TeV"<<endl;
614 break;
ae2636ae 615 case 2012:
616 cout<<"p+p collisions at 8 TeV"<<endl;
af0de7a4 617 break;
ae2636ae 618 case 2013:
619 cout<<"p+Pb collisions at 5 TeV"<<endl;
620 break;
4c202dd2 621 case 20111:
622 cout<<"p+p collisions at 2.76 TeV"<<endl;
623 break;
226c54bf 624 case 20100:
625 cout<<"Pb+Pb collisions at 2.76 TeV"<<endl;
626 break;
627 default:
628 cout<<"an undetermined collision system and energy"<<endl;
629 }
630 cout<<"This is initialized for the ";
631 if(fIsEMCal) cout<<"EMCal";
632 else{cout<<"PHOS";}
633 cout<<" acceptance"<<endl<<endl;
634
635 cout<<"The acceptance correction for the full "<<fAcceptanceCorrectionFull<<endl;
636 cout<<" EMCal "<<fAcceptanceCorrectionEMCAL<<endl;
637 cout<<" PHOS "<<fAcceptanceCorrectionPHOS<<endl<<endl;
638
639 cout<<Form("The neutral energy correction is %2.4f [%2.4f,%2.4f]",fNeutralCorrection,fNeutralCorrectionLow,fNeutralCorrectionHigh)<<endl;
640 cout<<Form(" total %2.4f [%2.4f,%2.4f]",fNotHadronicCorrection,fNotHadronicCorrectionLow,fNotHadronicCorrectionHigh)<<endl<<endl;
641
642 cout<<Form("The pT cut correction for 100 MeV is %2.4f [%2.4f,%2.4f]",fpTcutCorrectionITS,ffpTcutCorrectionITSLow,ffpTcutCorrectionITSHigh)<<endl;
643 cout<<Form(" 150 MeV %2.4f [%2.4f,%2.4f]",fpTcutCorrectionTPC,ffpTcutCorrectionTPCLow,ffpTcutCorrectionTPCHigh)<<endl<<endl;
644
0add53f6 645 cout<<Form("The correction for unidentified ITS tracks is %2.4f [%2.4f,%2.4f]",fNotIDConstITS,fNotIDConstITSLow,fNotIDConstITSHigh)<<endl;
646 cout<<Form(" TPC tracks %2.4f [%2.4f,%2.4f]",fNotIDConstTPC,fNotIDConstTPCLow,fNotIDConstTPCHigh)<<endl<<endl;
226c54bf 647
648 cout<<"Background correction histogram for ITS tracks is";
649 if(!fBackgroundITS)cout<<" not set"<<endl;
650 else{cout<<" set and has "<<fBackgroundITS->GetEntries()<<" entries"<<endl;}
651 cout<<" TPC ";
652 if(!fBackgroundTPC)cout<<" not set"<<endl;
653 else{cout<<" set and has "<<fBackgroundTPC->GetEntries()<<" entries"<<endl;}
654 cout<<endl;
655
656
657 cout<<"Efficiency histogram for ITS tracks for hadrons is";
658 if(!fEfficiencyHadronITS)cout<<" not set"<<endl;
659 else{cout<<" set and has "<<fEfficiencyHadronITS->GetEntries()<<" entries"<<endl;}
660 cout<<" TPC hadrons ";
661 if(!fEfficiencyHadronTPC)cout<<" not set"<<endl;
662 else{cout<<" set and has "<<fEfficiencyHadronTPC->GetEntries()<<" entries"<<endl;}
663 cout<<" ITS pions ";
664 if(!fEfficiencyPionITS)cout<<" not set"<<endl;
665 else{cout<<" set and has "<<fEfficiencyPionITS->GetEntries()<<" entries"<<endl;}
666 cout<<" TPC pions ";
667 if(!fEfficiencyPionTPC)cout<<" not set"<<endl;
668 else{cout<<" set and has "<<fEfficiencyPionTPC->GetEntries()<<" entries"<<endl;}
669 cout<<" ITS kaons ";
670 if(!fEfficiencyKaonITS)cout<<" not set"<<endl;
671 else{cout<<" set and has "<<fEfficiencyKaonITS->GetEntries()<<" entries"<<endl;}
672 cout<<" TPC kaons ";
673 if(!fEfficiencyKaonTPC)cout<<" not set"<<endl;
674 else{cout<<" set and has "<<fEfficiencyKaonTPC->GetEntries()<<" entries"<<endl;}
675 cout<<" ITS protons ";
676 if(!fEfficiencyProtonITS)cout<<" not set"<<endl;
677 else{cout<<" set and has "<<fEfficiencyProtonITS->GetEntries()<<" entries"<<endl;}
678 cout<<" TPC protons ";
679 if(!fEfficiencyProtonTPC)cout<<" not set"<<endl;
680 else{cout<<" set and has "<<fEfficiencyProtonTPC->GetEntries()<<" entries"<<endl;}
681 cout<<endl;
682
683 if(fDataSet==20100){//if Pb+Pb
684 cout<<"Efficiency histogram for TPC tracks for hadrons is set for centrality bins ";
45f9be5c 685 for(int i = 0;i<=21;i++){
226c54bf 686 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",i));
687 if(histo) cout<<i<<" ";
688 }
689 cout<<endl;
690 cout<<" pions ";
45f9be5c 691 for(int i = 0;i<=21;i++){
226c54bf 692 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",i));
693 if(histo) cout<<i<<" ";
694 }
695 cout<<endl;
696 cout<<" kaons ";
45f9be5c 697 for(int i = 0;i<=21;i++){
226c54bf 698 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",i));
699 if(histo) cout<<i<<" ";
700 }
701 cout<<endl;
702 cout<<" protons ";
45f9be5c 703 for(int i = 0;i<=21;i++){
226c54bf 704 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",i));
705 if(histo) cout<<i<<" ";
706 }
707 cout<<endl;
708 cout<<" ITS hadrons ";
45f9be5c 709 for(int i = 0;i<=21;i++){
226c54bf 710 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",i));
711 if(histo) cout<<i<<" ";
712 }
713 cout<<endl;
714 cout<<" pions ";
45f9be5c 715 for(int i = 0;i<=21;i++){
226c54bf 716 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",i));
717 if(histo) cout<<i<<" ";
718 }
719 cout<<endl;
720 cout<<" kaons ";
45f9be5c 721 for(int i = 0;i<=21;i++){
226c54bf 722 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",i));
723 if(histo) cout<<i<<" ";
724 }
725 cout<<endl;
726 cout<<" protons ";
45f9be5c 727 for(int i = 0;i<=21;i++){
226c54bf 728 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",i));
729 if(histo) cout<<i<<" ";
730 }
731 cout<<endl;
732
733
734 int nEntries = fEfficiencyTPC->GetEntries();
735 int nbadhistograms = 0;
736 for(int i=0;i<nEntries;i++){
737 TH1D *histo = (TH1D*) fEfficiencyTPC->At(i);
738 if(!histo){
739 cout<<"Warning: Histogram in fEfficiencyTPC at "<<i<<" is NULL!"<<endl;
740 nbadhistograms++;
741 }
742 else{
743 if(histo->GetEntries()<=1e-2){
744 cout<<"Warning: Histogram "<<histo->GetName()<<" in fEfficiencyTPC is empty!"<<endl;
745 nbadhistograms++;
746 }
747 }
748 }
749 cout<<nbadhistograms<<" bad histograms in fEfficiencyTPC"<<endl;
750
751 nEntries = fEfficiencyITS->GetEntries();
752 nbadhistograms = 0;
753 for(int i=0;i<nEntries;i++){
754 TH1D *histo = (TH1D*) fEfficiencyITS->At(i);
755 if(!histo){
756 cout<<"Warning: Histogram in fEfficiencyITS at "<<i<<" is NULL!"<<endl;
757 nbadhistograms++;
758 }
759 else{
760 if(histo->GetEntries()<=1e-2){
761 cout<<"Warning: Histogram "<<histo->GetName()<<" in fEfficiencyITS is empty!"<<endl;
762 nbadhistograms++;
763 }
764 }
765 }
766 cout<<nbadhistograms<<" bad histograms in fEfficiencyITS"<<endl;
767
768
769 }
770
771
772 cout<<endl;
773 cout<<"======================================================================="<<endl;
774 cout<<"======================================================================="<<endl;
775}
776