1 //Created by Christine Nattrass, Rebecca Scott, Irakli Martashvili
2 //University of Tennessee at Knoxville
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)
9 //Please see https://twiki.cern.ch/twiki/bin/view/ALICE/ETCaloAnalysis
10 #include "AliAnalysisHadEtCorrections.h"
14 #include "TObjArray.h"
20 ClassImp(AliAnalysisHadEtCorrections);
23 AliAnalysisHadEtCorrections::AliAnalysisHadEtCorrections() : TNamed(),
25 ,fAcceptanceCorrectionFull(0)
26 ,fAcceptanceCorrectionEMCAL(0)
27 ,fAcceptanceCorrectionPHOS(0)
28 ,fNeutralCorrection(0)
29 ,fNotHadronicCorrection(0)
30 ,fpTcutCorrectionTPC(0)
31 ,fpTcutCorrectionITS(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)
46 ,fNotIDConstTPCNoIDLow(0)
47 ,fNotIDConstITSNoIDLow(0)
48 ,fNotIDConstTPCHigh(0)
49 ,fNotIDConstITSHigh(0)
50 ,fNotIDConstTPCNoIDHigh(0)
51 ,fNotIDConstITSNoIDHigh(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)
65 ,fEfficiencyErrorLow(0)
66 ,fEfficiencyErrorHigh(0)
67 ,fBackgroundErrorLow(0)
68 ,fBackgroundErrorHigh(0)
74 ,fProduction("ProductionName")
75 ,fProductionDescription("Long production description")
76 ,fSpectraCalcErrorCorrelation(1)
77 {//default constructor
80 void AliAnalysisHadEtCorrections::Init()
81 { //This seems to solve a compiler error
82 cout<<"Creating new AliAnalysisHadEtCorrections"<<endl;
83 fEfficiencyTPC = new TObjArray();
84 fEfficiencyITS = new TObjArray();
87 AliAnalysisHadEtCorrections::~AliAnalysisHadEtCorrections()
93 fEfficiencyPionTPC->Clear();
94 fEfficiencyKaonTPC->Clear();
95 fEfficiencyProtonTPC->Clear();
96 fEfficiencyHadronTPC->Clear();
97 fEfficiencyPionITS->Clear();
98 fEfficiencyKaonITS->Clear();
99 fEfficiencyProtonITS->Clear();
100 fEfficiencyHadronITS->Clear();
101 fBackgroundTPC->Clear();
102 fBackgroundITS->Clear();
106 delete fEfficiencyPionTPC;
107 delete fEfficiencyKaonTPC;
108 delete fEfficiencyProtonTPC;
109 delete fEfficiencyHadronTPC;
110 delete fEfficiencyPionITS;
111 delete fEfficiencyKaonITS;
112 delete fEfficiencyProtonITS;
113 delete fEfficiencyHadronITS;
114 delete fEfficiencyTPC;
115 delete fEfficiencyITS;
116 delete fBackgroundTPC;
117 delete fBackgroundITS;
119 AliAnalysisHadEtCorrections::AliAnalysisHadEtCorrections(const AliAnalysisHadEtCorrections *g): TNamed(),
121 ,fAcceptanceCorrectionFull(g->fAcceptanceCorrectionFull)
122 ,fAcceptanceCorrectionEMCAL(g->fAcceptanceCorrectionEMCAL)
123 ,fAcceptanceCorrectionPHOS(g->fAcceptanceCorrectionPHOS)
124 ,fNeutralCorrection(g->fNeutralCorrection)
125 ,fNotHadronicCorrection(g->fNotHadronicCorrection)
126 ,fpTcutCorrectionTPC(g->fpTcutCorrectionTPC)
127 ,fpTcutCorrectionITS(g->fpTcutCorrectionITS)
128 ,fNotIDConstTPC(g->fNotIDConstTPC)
129 ,fNotIDConstITS(g->fNotIDConstITS)
130 ,fNotIDConstTPCNoID(g->fNotIDConstTPCNoID)
131 ,fNotIDConstITSNoID(g->fNotIDConstITSNoID)
132 ,fNeutralCorrectionLow(g->fNeutralCorrectionLow)
133 ,fNotHadronicCorrectionLow(g->fNotHadronicCorrectionLow)
134 ,ffpTcutCorrectionTPCLow(g->ffpTcutCorrectionTPCLow)
135 ,ffpTcutCorrectionITSLow(g->ffpTcutCorrectionITSLow)
136 ,fNeutralCorrectionHigh(g->fNeutralCorrectionHigh)
137 ,fNotHadronicCorrectionHigh(g->fNotHadronicCorrectionHigh)
138 ,ffpTcutCorrectionTPCHigh(g->ffpTcutCorrectionTPCHigh)
139 ,ffpTcutCorrectionITSHigh(g->ffpTcutCorrectionITSHigh)
140 ,fNotIDConstTPCLow(g->fNotIDConstTPCLow)
141 ,fNotIDConstITSLow(g->fNotIDConstITSLow)
142 ,fNotIDConstTPCNoIDLow(g->fNotIDConstTPCNoIDLow)
143 ,fNotIDConstITSNoIDLow(g->fNotIDConstITSNoIDLow)
144 ,fNotIDConstTPCHigh(g->fNotIDConstTPCHigh)
145 ,fNotIDConstITSHigh(g->fNotIDConstITSHigh)
146 ,fNotIDConstTPCNoIDHigh(g->fNotIDConstTPCNoIDHigh)
147 ,fNotIDConstITSNoIDHigh(g->fNotIDConstITSNoIDHigh)
151 ,fEfficiencyPionTPC(0)
152 ,fEfficiencyKaonTPC(0)
153 ,fEfficiencyProtonTPC(0)
154 ,fEfficiencyHadronTPC(0)
155 ,fEfficiencyPionITS(0)
156 ,fEfficiencyKaonITS(0)
157 ,fEfficiencyProtonITS(0)
158 ,fEfficiencyHadronITS(0)
161 ,fEfficiencyErrorLow(g->fEfficiencyErrorLow)
162 ,fEfficiencyErrorHigh(g->fEfficiencyErrorHigh)
163 ,fBackgroundErrorLow(g->fBackgroundErrorLow)
164 ,fBackgroundErrorHigh(g->fBackgroundErrorHigh)
167 ,fIsEMCal(g->fIsEMCal)
169 ,fDataSet(g->fDataSet)
170 ,fProduction(g->fProduction)
171 ,fProductionDescription(g->fProductionDescription)
172 ,fSpectraCalcErrorCorrelation(g->fSpectraCalcErrorCorrelation)
174 //SetName(g->GetName());
175 fnotIDTPC = new TH1D(*(g->fnotIDTPC));
176 fnotIDITS = new TH1D(*(g->fnotIDITS));
177 fnotIDNoID = new TH1D(*(g->fnotIDNoID));
178 fEfficiencyPionTPC = new TH1D(*(g->fEfficiencyPionTPC));
179 fEfficiencyKaonTPC = new TH1D(*(g->fEfficiencyKaonTPC));
180 fEfficiencyProtonTPC = new TH1D(*(g->fEfficiencyProtonTPC));
181 fEfficiencyHadronTPC = new TH1D(*(g->fEfficiencyHadronTPC));
182 fEfficiencyPionITS = new TH1D(*(g->fEfficiencyPionITS));
183 fEfficiencyKaonITS = new TH1D(*(g->fEfficiencyKaonITS));
184 fEfficiencyProtonITS = new TH1D(*(g->fEfficiencyProtonITS));
185 fEfficiencyHadronITS = new TH1D(*(g->fEfficiencyHadronITS));
186 fEfficiencyTPC = new TObjArray(*(g->fEfficiencyTPC));
187 fEfficiencyITS = new TObjArray(*(g->fEfficiencyITS));
188 fBackgroundTPC = new TH1D(*(g->fBackgroundTPC));
189 fBackgroundITS = new TH1D(*(g->fBackgroundITS));
193 Float_t AliAnalysisHadEtCorrections::GetConstantCorrections(Bool_t totEt, Float_t ptcut, TString type) const {//Get the correction values that are not pt dependent
194 Float_t acceptance = 0.0;
195 Float_t neutral = 0.0;
196 Float_t ptcorr = 0.0;
197 float correction = 0.0;
199 //TString *type = new TString(mytype);
201 if(type.Contains("Full") || type.Contains("PiKP")) acceptance = fAcceptanceCorrectionFull;
202 if(type.Contains("EMCAL")) acceptance = fAcceptanceCorrectionEMCAL;
203 if(type.Contains("PHOS")) acceptance = fAcceptanceCorrectionPHOS;
205 if(totEt) neutral = fNotHadronicCorrection;
206 else{neutral = fNeutralCorrection;}
207 if(ptcut>0.12){ptcorr = fpTcutCorrectionTPC;}
208 else{ptcorr = fpTcutCorrectionITS;}
210 if(type.Contains("PiKP")){
211 if(ptcut>0.12){ptcorr = fpTcutCorrectionTPC;}
212 else{ptcorr = fpTcutCorrectionITS;}
213 if(type.Contains("High")){
214 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCHigh;}
215 else{ptcorr = ffpTcutCorrectionITSHigh;}
217 if(type.Contains("Low")){
218 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCLow;}
219 else{ptcorr = ffpTcutCorrectionITSLow;}
224 if(type.Contains("High")){//high bound
225 if(totEt) neutral = fNotHadronicCorrectionHigh;
226 else{neutral = fNeutralCorrectionHigh;}
227 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCHigh;}
228 else{ptcorr = ffpTcutCorrectionITSHigh;}
229 cout<<"Setting correction factor to "<<correction<<endl;
232 if(type.Contains("Low")){//high bound
233 if(totEt) neutral = fNotHadronicCorrectionLow;
234 else{neutral = fNeutralCorrectionLow;}
235 if(ptcut>0.12){ptcorr = ffpTcutCorrectionTPCLow;}
236 else{ptcorr = ffpTcutCorrectionITSLow;}
237 cout<<"Setting correction factor to "<<correction<<endl;
242 correction = acceptance*neutral*ptcorr;
243 cout<<"correction "<<correction<<" = "<<acceptance<<"*"<<neutral<<"*"<<ptcorr<<endl;
244 cout<<"Setting correction factor for ";
245 if(totEt) cout<<"total et";
246 else{cout<<"hadronic et";}
247 cout<<" with the pt cut off "<<ptcut<<" for "<<type<<" acceptance to "<<correction<<endl;
248 //cout<<" Acceptance "<<acceptance<<" neutral "<<neutral<<" ptcorr "<<ptcorr<<endl;
252 void AliAnalysisHadEtCorrections::GetTotalEt(Float_t hadEt,Float_t hadEtErr, Bool_t isTPC, Float_t rawEmEt, Float_t rawEmEtError, Float_t scale, Float_t energyScaleError, Float_t minEt, Float_t minEtError, Float_t nonLinError, Float_t neutronCorr, Float_t neutronError, Float_t hadronCorr, Float_t hadronError, Float_t kaonCorr, Float_t kaonError, Float_t secondaryCorr, Float_t secondaryError,Float_t &totEt, Float_t &totEtError, Float_t &totEtStatError){
253 Float_t neutralFracErr = (fNeutralCorrection - fNeutralCorrectionLow)/fNeutralCorrection;
254 Float_t ptcutFracErr = (ffpTcutCorrectionTPCHigh-fpTcutCorrectionTPC)/fpTcutCorrectionTPC;
255 if(!isTPC) ptcutFracErr = (ffpTcutCorrectionITSHigh-fpTcutCorrectionITS)/fpTcutCorrectionITS;
256 Float_t pidFracErr = (fNotIDConstTPCHigh-fNotIDConstTPC)/fNotIDConstTPC;
257 if(!isTPC) pidFracErr = (fNotIDConstITSHigh-fNotIDConstITS)/fNotIDConstITS;
258 Float_t efficiencyFracErr = (fEfficiencyErrorHigh-fEfficiencyErrorLow)/2.0;
259 Float_t backgroundFracErr = (fBackgroundErrorHigh-fBackgroundErrorLow)/2.0;
260 //Float_t fracerr = TMath::Sqrt(neutralFracErr*neutralFracErr+ptcutFracErr*ptcutFracErr+pidFracErr*pidFracErr+efficiencyFracErr*efficiencyFracErr+backgroundFracErr*backgroundFracErr);
263 emEt = scale*(rawEmEt-hadronCorr-kaonCorr-neutronCorr-secondaryCorr)/minEt;
264 totEtStatError = TMath::Sqrt(hadEtErr*hadEtErr+TMath::Power(scale*rawEmEtError/minEt,2));
267 //first add variance due to had et
268 Float_t variance = (neutralFracErr*neutralFracErr+ptcutFracErr*ptcutFracErr+pidFracErr*pidFracErr+backgroundFracErr*backgroundFracErr)*hadEt*hadEt;
269 //then add variance due to em et
270 variance += (energyScaleError*energyScaleError+minEtError/minEt*minEtError/minEt+nonLinError*nonLinError)*emEt*emEt+scale/minEt*(neutronError*neutronError+hadronError*hadronError+kaonError*kaonError+secondaryError*secondaryError);
271 //add efficiency errors separately - these are basically 100% correlated between Em ET and had Et
272 variance +=efficiencyFracErr*efficiencyFracErr*totEt*totEt;
274 // variance +=fSpectraCalcErrorCorrelation*neutralFracErr*hadEt*(pidFracErr*hadEt+backgroundFracErr*hadEt+scale*kaonError/minEt);
275 // variance +=fSpectraCalcErrorCorrelation*pidFracErr*hadEt*(backgroundFracErr*hadEt+scale*kaonError/minEt+neutralFracErr*hadEt) ;
276 // variance +=fSpectraCalcErrorCorrelation*backgroundFracErr*hadEt*(pidFracErr*hadEt+scale*kaonError/minEt+neutralFracErr*hadEt);
277 // variance +=fSpectraCalcErrorCorrelation*scale*kaonError/minEt*(pidFracErr*hadEt+backgroundFracErr*hadEt+neutralFracErr*hadEt);
278 variance +=fSpectraCalcErrorCorrelation*neutralFracErr*hadEt*(backgroundFracErr*hadEt+scale*kaonError/minEt);
279 variance +=fSpectraCalcErrorCorrelation*backgroundFracErr*hadEt*(scale*kaonError/minEt+neutralFracErr*hadEt);
280 variance +=fSpectraCalcErrorCorrelation*scale*kaonError/minEt*(backgroundFracErr*hadEt+neutralFracErr*hadEt);
281 // cout<<"Correlated error neutral "<<neutralFracErr*hadEt<<" pid "<<pidFracErr*hadEt<<" bkgd "<<backgroundFracErr*hadEt<<" kaon "<<scale*kaonError/minEt<<endl;
282 totEtError = TMath::Sqrt(variance);
283 //cout<<"totEt "<<totEt<<endl;
287 Float_t AliAnalysisHadEtCorrections::GetSystematicErrorBound(Float_t et,Bool_t isLowBound, Bool_t isHadronic, Bool_t isTPC) const{
288 //we calculate factors for each value and then multiply them to get the overall bounds
289 //neutral corrections, pt cut, pid, efficiency, background
291 // Float_t neutral = fNeutralCorrection;
292 // if(!isHadronic) neutral = fNotHadronicCorrection;
293 // Float_t ptcut = fpTcutCorrectionTPC;
294 // if(!isTPC) ptcut = fpTcutCorrectionITS;
295 // Float_t pid = fNotIDConstTPC;
296 // Float_t efficiency = (fEfficiencyErrorHigh+fEfficiencyErrorLow)/2.0;
297 // Float_t background = fBackground;
299 Float_t neutralFracErr = (fNeutralCorrection - fNeutralCorrectionLow)/fNeutralCorrection;
301 neutralFracErr = (fNotHadronicCorrection - fNotHadronicCorrectionLow)/fNotHadronicCorrection;
303 Float_t ptcutFracErr = (ffpTcutCorrectionTPCHigh-fpTcutCorrectionTPC)/fpTcutCorrectionTPC;
305 ptcutFracErr = (ffpTcutCorrectionTPCHigh-fpTcutCorrectionTPC)/fpTcutCorrectionTPC;
307 Float_t pidFracErr = (fNotIDConstTPCHigh-fNotIDConstTPC)/fNotIDConstTPC;
308 Float_t efficiencyFracErr = (fEfficiencyErrorHigh-fEfficiencyErrorLow)/2.0;
309 Float_t backgroundFracErr = (fBackgroundErrorHigh-fBackgroundErrorLow)/2.0;
310 //Float_t fracerr = TMath::Sqrt(neutralFracErr*neutralFracErr+ptcutFracErr*ptcutFracErr+pidFracErr*pidFracErr+efficiencyFracErr*efficiencyFracErr+backgroundFracErr*backgroundFracErr+fSpectraCalcErrorCorrelation*(neutralFracErr*pidFracErr+neutralFracErr*backgroundFracErr+backgroundFracErr*pidFracErr));
311 Float_t fracerr = TMath::Sqrt(neutralFracErr*neutralFracErr+ptcutFracErr*ptcutFracErr+pidFracErr*pidFracErr+efficiencyFracErr*efficiencyFracErr+backgroundFracErr*backgroundFracErr+fSpectraCalcErrorCorrelation*(neutralFracErr*backgroundFracErr));
312 //cout<<"fracerrs neutral "<<neutralFracErr<<" ptcut "<<ptcutFracErr<<" pid "<<pidFracErr<<" efficiency "<<efficiencyFracErr<<" bkgd "<<backgroundFracErr<<" total fracerr "<<fracerr<<endl;
314 return et*(1.0-fracerr);
317 return et*(1.0+fracerr);
320 // Float_t neutral = 1.0;
321 // Float_t ptcut = 1.0;
322 // Float_t pid = 1.0;
323 // Float_t efficiency = 1.0;
324 // Float_t background = 1.0;
325 // if(isLowBound){//is lower bound
326 // if(isHadronic) neutral= fNeutralCorrectionLow/fNeutralCorrection;
327 // else{neutral = fNotHadronicCorrectionLow/fNotHadronicCorrection;}
328 // if(isTPC) ptcut = ffpTcutCorrectionTPCLow/fpTcutCorrectionTPC;
329 // else{ptcut = ffpTcutCorrectionITSLow/fpTcutCorrectionITS;}
330 // pid = fNotIDConstTPCLow/fNotIDConstTPC;
331 // efficiency = fEfficiencyErrorLow;
332 // background = fBackgroundErrorLow;
334 // else{//is higher bound
335 // if(isHadronic) neutral= fNeutralCorrectionHigh/fNeutralCorrection;
336 // else{neutral= fNotHadronicCorrectionHigh/fNotHadronicCorrection;}
337 // if(isTPC) ptcut = ffpTcutCorrectionTPCHigh/fpTcutCorrectionTPC;
338 // else{ptcut = ffpTcutCorrectionITSHigh/fpTcutCorrectionITS;}
339 // pid = fNotIDConstTPCHigh/fNotIDConstTPC;
340 // efficiency = fEfficiencyErrorHigh;
341 // background = fBackgroundErrorHigh;
343 // //cout<<"neutral "<<neutral<<" ptcut "<<ptcut<<" pid "<<pid<<" efficiency "<<efficiency<<" background "<<background<<" overall "<<neutral*ptcut*pid*efficiency*background<<endl;
344 // return neutral*ptcut*pid*efficiency*background*et;
346 // AliAnalysisHadEtCorrections & operator = (const AliAnalysisHadEtCorrections & g) {
348 // fEtaCut=g->fEtaCut;
349 // fAcceptanceCorrectionFull=g->fAcceptanceCorrectionFull;
350 // fAcceptanceCorrectionEMCAL=g->fAcceptanceCorrectionEMCAL;
351 // fAcceptanceCorrectionPHOS=g->fAcceptanceCorrectionPHOS;
352 // fNeutralCorrection=g->fNeutralCorrection;
353 // fNotHadronicCorrection=g->fNotHadronicCorrection;
354 // fpTcutCorrectionTPC=g->fpTcutCorrectionTPC;
355 // fpTcutCorrectionITS=g->fpTcutCorrectionITS;
356 // fNeutralCorrectionLow=g->fNeutralCorrectionLow;
357 // fNotHadronicCorrectionLow=g->fNotHadronicCorrectionLow;
358 // ffpTcutCorrectionTPCLow=g->ffpTcutCorrectionTPCLow;
359 // ffpTcutCorrectionITSLow=g->ffpTcutCorrectionITSLow;
360 // fNeutralCorrectionHigh=g->fNeutralCorrectionHigh;
361 // fNotHadronicCorrectionHigh=g->fNotHadronicCorrectionHigh;
362 // ffpTcutCorrectionTPCHigh=g->ffpTcutCorrectionTPCHigh;
363 // ffpTcutCorrectionITSHigh=g->ffpTcutCorrectionITSHigh;
365 // fnotIDTPC = g->fnotIDTPC;
366 // fnotIDITS = g->fnotIDITS;
367 // fnotIDNoID = g->fnotIDNoID;
368 // fEfficiencyPionTPC = g->fEfficiencyPionTPC;
369 // fEfficiencyKaonTPC = g->fEfficiencyKaonTPC;
370 // fEfficiencyProtonTPC = g->fEfficiencyProtonTPC;
371 // fEfficiencyHadronTPC = g->fEfficiencyHadronTPC;
372 // fEfficiencyPionITS = g->fEfficiencyPionITS;
373 // fEfficiencyKaonITS = g->fEfficiencyKaonITS;
374 // fEfficiencyProtonITS = g->fEfficiencyProtonITS;
375 // fEfficiencyHadronITS = g->fEfficiencyHadronITS;
376 // fBackgroundTPC = g->fBackgroundTPC;
377 // fBackgroundITS = g->fBackgroundITS;
379 TH1D *AliAnalysisHadEtCorrections::GetEfficiencyPionTPC(const int cb){//Get centrality dependent efficiency
380 if(cb==-1){return fEfficiencyPionTPC;}
381 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",cb));}
383 TH1D *AliAnalysisHadEtCorrections::GetEfficiencyKaonTPC(const int cb){//Get centrality dependent efficiency
384 if(cb==-1){return fEfficiencyKaonTPC;}
385 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",cb));}
387 TH1D *AliAnalysisHadEtCorrections::GetEfficiencyProtonTPC(const int cb){//Get centrality dependent efficiency
388 if(cb==-1){return fEfficiencyProtonTPC;}
389 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",cb));}
391 TH1D *AliAnalysisHadEtCorrections::GetEfficiencyHadronTPC(const int cb){//Get centrality dependent efficiency
392 if(cb==-1){return fEfficiencyHadronTPC;}
393 else{return (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",cb));}
395 TH1D *AliAnalysisHadEtCorrections::GetEfficiencyPionITS(const int cb){//Get centrality dependent efficiency
396 if(cb==-1){return fEfficiencyPionITS;}
397 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",cb));}
399 TH1D *AliAnalysisHadEtCorrections::GetEfficiencyKaonITS(const int cb){//Get centrality dependent efficiency
400 if(cb==-1){return fEfficiencyKaonITS;}
401 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",cb));}
403 TH1D *AliAnalysisHadEtCorrections::GetEfficiencyProtonITS(const int cb){//Get centrality dependent efficiency
404 if(cb==-1){return fEfficiencyProtonITS;}
405 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",cb));}
407 TH1D *AliAnalysisHadEtCorrections::GetEfficiencyHadronITS(const int cb){//Get centrality dependent efficiency
408 if(cb==-1){return fEfficiencyHadronITS;}
409 else{return (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",cb));}
411 Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionPion(const float pT, const int cb){//Get the efficiency for reconstructing a pion in the TPC
414 if(!fEfficiencyPionTPC){cerr<<"No histogram fEfficiencyPionTPC!"<<endl; return -1.0;}
415 eff = fEfficiencyPionTPC->GetBinContent(fEfficiencyPionTPC->FindBin(pT));
416 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
419 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",cb));
420 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyPionTPC%i",cb)<<endl; return -1.0;}
421 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
422 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
426 Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionKaon(const float pT, const int cb){//Get the efficiency for reconstructing a kaon in the TPC
429 if(!fEfficiencyKaonTPC){cerr<<"No histogram fEfficiencyKaonTPC!"<<endl; return -1.0;}
430 eff = fEfficiencyKaonTPC->GetBinContent(fEfficiencyKaonTPC->FindBin(pT));
431 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
434 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",cb));
435 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyKaonTPC%i",cb)<<endl; return -1.0;}
436 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
437 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
441 Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionProton(const float pT, const int cb){//Get the efficiency for reconstructing a proton in the TPC
444 if(!fEfficiencyProtonTPC){cerr<<"No histogram fEfficiencyProtonTPC!"<<endl; return -1.0;}
445 eff = fEfficiencyProtonTPC->GetBinContent(fEfficiencyProtonTPC->FindBin(pT));
446 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
449 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",cb));
450 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyProtonTPC%i",cb)<<endl; return -1.0;}
451 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
452 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
456 Float_t AliAnalysisHadEtCorrections::GetTPCEfficiencyCorrectionHadron(const float pT, const int cb){//Get the efficiency for reconstructing a hadron in the TPC
459 if(!fEfficiencyHadronTPC){cerr<<"No histogram fEfficiencyHadronTPC!"<<endl; return -1.0;}
460 eff = fEfficiencyHadronTPC->GetBinContent(fEfficiencyHadronTPC->FindBin(pT));
461 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
464 TH1D *fEfficiency = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",cb));
465 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyHadronTPC%i",cb)<<endl; return -1.0;}
466 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
467 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
471 Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionPion(const float pT, const int cb){//Get the efficiency for reconstructing a pion in the ITS
474 if(!fEfficiencyPionITS){cerr<<"No histogram fEfficiencyPionITS!"<<endl; return -1.0;}
475 eff = fEfficiencyPionITS->GetBinContent(fEfficiencyPionITS->FindBin(pT));
476 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
479 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",cb));
480 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyPionITS%i",cb)<<endl; return -1.0;}
481 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
482 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
486 Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionKaon(const float pT, const int cb){//Get the efficiency for reconstructing a kaon in the ITS
489 if(!fEfficiencyKaonITS){cerr<<"No histogram fEfficiencyKaonITS!"<<endl; return -1.0;}
490 eff = fEfficiencyKaonITS->GetBinContent(fEfficiencyKaonITS->FindBin(pT));
491 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
494 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",cb));
495 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyKaonITS%i",cb)<<endl; return -1.0;}
496 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
497 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
501 Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionProton(const float pT, const int cb){//Get the efficiency for reconstructing a proton in the ITS
504 if(!fEfficiencyProtonITS){cerr<<"No histogram fEfficiencyProtonITS!"<<endl; return -1.0;}
505 eff = fEfficiencyProtonITS->GetBinContent(fEfficiencyProtonITS->FindBin(pT));
506 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
509 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",cb));
510 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyProtonITS%i",cb)<<endl; return -1.0;}
511 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
512 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
516 Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionHadron(const float pT, const int cb){//Get the efficiency for reconstructing a hadron in the ITS
519 if(!fEfficiencyHadronITS){cerr<<"No histogram fEfficiencyHadronITS!"<<endl; return -1.0;}
520 eff = fEfficiencyHadronITS->GetBinContent(fEfficiencyHadronITS->FindBin(pT));
521 if(eff<=0.0){AliInfo("Efficiency is zero!"); return 0.0;}
524 TH1D *fEfficiency = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",cb));
525 if(!fEfficiency){cerr<<"No histogram "<<Form("fEfficiencyHadronITS%i",cb)<<endl; return -1.0;}
526 eff = fEfficiency->GetBinContent(fEfficiency->FindBin(pT));
527 if(eff<=0.0){AliInfo(Form("Pion efficiency is zero for centrality bin %i!",cb)); return 0.0;}
531 void AliAnalysisHadEtCorrections::SetEfficiencyPionTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
533 //first check to see if the histogram exists already
534 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",cb));
536 fEfficiencyTPC->Remove(old);
539 //then if the new histogram exists, add it to the array
540 histo->SetName(Form("fEfficiencyPionTPC%i",cb));
541 fEfficiencyTPC->Add(histo);
543 else{cerr<<"Histogram does not exist!"<<endl;}
545 void AliAnalysisHadEtCorrections::SetEfficiencyKaonTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
547 //first check to see if the histogram exists already
548 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",cb));
550 fEfficiencyTPC->Remove(old);
553 //then if the new histogram exists, add it to the array
554 histo->SetName(Form("fEfficiencyKaonTPC%i",cb));
555 fEfficiencyTPC->Add(histo);
557 else{cerr<<"Histogram does not exist!"<<endl;}
559 void AliAnalysisHadEtCorrections::SetEfficiencyProtonTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
561 //first check to see if the histogram exists already
562 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",cb));
564 fEfficiencyTPC->Remove(old);
567 //then if the new histogram exists, add it to the array
568 histo->SetName(Form("fEfficiencyProtonTPC%i",cb));
569 fEfficiencyTPC->Add(histo);
571 else{cerr<<"Histogram does not exist!"<<endl;}
573 void AliAnalysisHadEtCorrections::SetEfficiencyHadronTPC(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
575 //first check to see if the histogram exists already
576 TH1D *old = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",cb));
578 fEfficiencyTPC->Remove(old);
581 //then if the new histogram exists, add it to the array
582 histo->SetName(Form("fEfficiencyHadronTPC%i",cb));
583 fEfficiencyTPC->Add(histo);
585 else{cerr<<"Histogram does not exist!"<<endl;}
587 void AliAnalysisHadEtCorrections::SetEfficiencyPionITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
589 //first check to see if the histogram exists already
590 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",cb));
592 fEfficiencyITS->Remove(old);
595 //then if the new histogram exists, add it to the array
596 histo->SetName(Form("fEfficiencyPionITS%i",cb));
597 fEfficiencyITS->Add(histo);
599 else{cerr<<"Histogram does not exist!"<<endl;}
601 void AliAnalysisHadEtCorrections::SetEfficiencyKaonITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
603 //first check to see if the histogram exists already
604 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",cb));
606 fEfficiencyITS->Remove(old);
609 //then if the new histogram exists, add it to the array
610 histo->SetName(Form("fEfficiencyKaonITS%i",cb));
611 fEfficiencyITS->Add(histo);
613 else{cerr<<"Histogram does not exist!"<<endl;}
615 void AliAnalysisHadEtCorrections::SetEfficiencyProtonITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
617 //first check to see if the histogram exists already
618 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",cb));
620 fEfficiencyITS->Remove(old);
623 //then if the new histogram exists, add it to the array
624 histo->SetName(Form("fEfficiencyProtonITS%i",cb));
625 fEfficiencyITS->Add(histo);
627 else{cerr<<"Histogram does not exist!"<<endl;}
629 void AliAnalysisHadEtCorrections::SetEfficiencyHadronITS(TH1D *histo, const int cb){//Set centrality dependent efficiency for centrality bin cb
631 //first check to see if the histogram exists already
632 TH1D *old = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",cb));
634 fEfficiencyITS->Remove(old);
637 //then if the new histogram exists, add it to the array
638 histo->SetName(Form("fEfficiencyHadronITS%i",cb));
639 fEfficiencyITS->Add(histo);
641 else{cerr<<"Histogram does not exist!"<<endl;}
645 Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionTPC(const float pT){//get correction for unidentified particles in the TPC
646 Float_t val = fnotIDTPC->GetBinContent(fnotIDTPC->FindBin(pT));
647 if(val>0.0) return 1.0/(val);
650 Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionITS(const float pT){//Get correction for unidentified particles in the ITS
651 Float_t val = fnotIDITS->GetBinContent(fnotIDITS->FindBin(pT));
652 if(val>0.0) return 1.0/(val);
655 Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionNoPID(const float pT){//Get correction for particles in the case that there is no particle identification
656 Float_t val = fnotIDNoID->GetBinContent(fnotIDNoID->FindBin(pT));
657 if(val>0.0) return 1.0/(val);
660 Float_t AliAnalysisHadEtCorrections::GetBackgroundCorrectionTPC(const float pT){//Get background correction for TPC tracks
661 return (1.0-fBackgroundTPC->GetBinContent(fBackgroundTPC->FindBin(pT)));
663 Float_t AliAnalysisHadEtCorrections::GetBackgroundCorrectionITS(const float pT){//Get background correction for ITS tracks
664 return (1.0-fBackgroundITS->GetBinContent(fBackgroundITS->FindBin(pT)));
666 void AliAnalysisHadEtCorrections::Report(){//Gives a report on the status of all corrections
667 //This is primarily for cross checking that the results we get from the macro that fills this class, GetCorrections.C, are sane
668 cout<<"======================================================================="<<endl;
669 cout<<" Report from "<<GetName()<<endl;
670 cout<<"======================================================================="<<endl;
671 cout<<fProductionDescription<<" created from "<<fProduction<<endl;
672 cout<<"This for determination of EThad from ";
673 if(fIsData) cout<<"data of ";
674 else{cout<<"simulation of ";}
677 cout<<"p+p collisions at 900 GeV"<<endl;
680 cout<<"p+p collisions at 7 TeV"<<endl;
683 cout<<"p+p collisions at 8 TeV"<<endl;
686 cout<<"p+Pb collisions at 5 TeV"<<endl;
689 cout<<"p+p collisions at 2.76 TeV"<<endl;
692 cout<<"Pb+Pb collisions at 2.76 TeV"<<endl;
695 cout<<"an undetermined collision system and energy"<<endl;
697 cout<<"This is initialized for the ";
698 if(fIsEMCal) cout<<"EMCal";
700 cout<<" acceptance"<<endl<<endl;
702 cout<<"The acceptance correction for the full "<<fAcceptanceCorrectionFull<<endl;
703 cout<<" EMCal "<<fAcceptanceCorrectionEMCAL<<endl;
704 cout<<" PHOS "<<fAcceptanceCorrectionPHOS<<endl<<endl;
706 cout<<Form("The neutral energy correction is %2.4f [%2.4f,%2.4f]",fNeutralCorrection,fNeutralCorrectionLow,fNeutralCorrectionHigh)<<endl;
707 cout<<Form(" total %2.4f [%2.4f,%2.4f]",fNotHadronicCorrection,fNotHadronicCorrectionLow,fNotHadronicCorrectionHigh)<<endl<<endl;
709 cout<<Form("The pT cut correction for 100 MeV is %2.4f [%2.4f,%2.4f]",fpTcutCorrectionITS,ffpTcutCorrectionITSLow,ffpTcutCorrectionITSHigh)<<endl;
710 cout<<Form(" 150 MeV %2.4f [%2.4f,%2.4f]",fpTcutCorrectionTPC,ffpTcutCorrectionTPCLow,ffpTcutCorrectionTPCHigh)<<endl<<endl;
712 cout<<Form("The correction for unidentified ITS tracks is %2.4f [%2.4f,%2.4f]",fNotIDConstITS,fNotIDConstITSLow,fNotIDConstITSHigh)<<endl;
713 cout<<Form(" TPC tracks %2.4f [%2.4f,%2.4f]",fNotIDConstTPC,fNotIDConstTPCLow,fNotIDConstTPCHigh)<<endl<<endl;
715 cout<<"Background correction histogram for ITS tracks is";
716 if(!fBackgroundITS)cout<<" not set"<<endl;
717 else{cout<<" set and has "<<fBackgroundITS->GetEntries()<<" entries"<<endl;}
719 if(!fBackgroundTPC)cout<<" not set"<<endl;
720 else{cout<<" set and has "<<fBackgroundTPC->GetEntries()<<" entries"<<endl;}
724 cout<<"Efficiency histogram for ITS tracks for hadrons is";
725 if(!fEfficiencyHadronITS)cout<<" not set"<<endl;
726 else{cout<<" set and has "<<fEfficiencyHadronITS->GetEntries()<<" entries"<<endl;}
727 cout<<" TPC hadrons ";
728 if(!fEfficiencyHadronTPC)cout<<" not set"<<endl;
729 else{cout<<" set and has "<<fEfficiencyHadronTPC->GetEntries()<<" entries"<<endl;}
731 if(!fEfficiencyPionITS)cout<<" not set"<<endl;
732 else{cout<<" set and has "<<fEfficiencyPionITS->GetEntries()<<" entries"<<endl;}
734 if(!fEfficiencyPionTPC)cout<<" not set"<<endl;
735 else{cout<<" set and has "<<fEfficiencyPionTPC->GetEntries()<<" entries"<<endl;}
737 if(!fEfficiencyKaonITS)cout<<" not set"<<endl;
738 else{cout<<" set and has "<<fEfficiencyKaonITS->GetEntries()<<" entries"<<endl;}
740 if(!fEfficiencyKaonTPC)cout<<" not set"<<endl;
741 else{cout<<" set and has "<<fEfficiencyKaonTPC->GetEntries()<<" entries"<<endl;}
742 cout<<" ITS protons ";
743 if(!fEfficiencyProtonITS)cout<<" not set"<<endl;
744 else{cout<<" set and has "<<fEfficiencyProtonITS->GetEntries()<<" entries"<<endl;}
745 cout<<" TPC protons ";
746 if(!fEfficiencyProtonTPC)cout<<" not set"<<endl;
747 else{cout<<" set and has "<<fEfficiencyProtonTPC->GetEntries()<<" entries"<<endl;}
750 if(fDataSet==20100){//if Pb+Pb
751 cout<<"Efficiency histogram for TPC tracks for hadrons is set for centrality bins ";
752 for(int i = 0;i<=21;i++){
753 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyHadronTPC%i",i));
754 if(histo) cout<<i<<" ";
758 for(int i = 0;i<=21;i++){
759 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyPionTPC%i",i));
760 if(histo) cout<<i<<" ";
764 for(int i = 0;i<=21;i++){
765 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyKaonTPC%i",i));
766 if(histo) cout<<i<<" ";
770 for(int i = 0;i<=21;i++){
771 TH1D *histo = (TH1D*) fEfficiencyTPC->FindObject(Form("fEfficiencyProtonTPC%i",i));
772 if(histo) cout<<i<<" ";
775 cout<<" ITS hadrons ";
776 for(int i = 0;i<=21;i++){
777 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyHadronITS%i",i));
778 if(histo) cout<<i<<" ";
782 for(int i = 0;i<=21;i++){
783 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyPionITS%i",i));
784 if(histo) cout<<i<<" ";
788 for(int i = 0;i<=21;i++){
789 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyKaonITS%i",i));
790 if(histo) cout<<i<<" ";
794 for(int i = 0;i<=21;i++){
795 TH1D *histo = (TH1D*) fEfficiencyITS->FindObject(Form("fEfficiencyProtonITS%i",i));
796 if(histo) cout<<i<<" ";
801 int nEntries = fEfficiencyTPC->GetEntries();
802 int nbadhistograms = 0;
803 for(int i=0;i<nEntries;i++){
804 TH1D *histo = (TH1D*) fEfficiencyTPC->At(i);
806 cout<<"Warning: Histogram in fEfficiencyTPC at "<<i<<" is NULL!"<<endl;
810 if(histo->GetEntries()<=1e-2){
811 cout<<"Warning: Histogram "<<histo->GetName()<<" in fEfficiencyTPC is empty!"<<endl;
816 cout<<nbadhistograms<<" bad histograms in fEfficiencyTPC"<<endl;
818 nEntries = fEfficiencyITS->GetEntries();
820 for(int i=0;i<nEntries;i++){
821 TH1D *histo = (TH1D*) fEfficiencyITS->At(i);
823 cout<<"Warning: Histogram in fEfficiencyITS at "<<i<<" is NULL!"<<endl;
827 if(histo->GetEntries()<=1e-2){
828 cout<<"Warning: Histogram "<<histo->GetName()<<" in fEfficiencyITS is empty!"<<endl;
833 cout<<nbadhistograms<<" bad histograms in fEfficiencyITS"<<endl;
840 cout<<"======================================================================="<<endl;
841 cout<<"======================================================================="<<endl;