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