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