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