Changing range on PbPb histograms
[u/mrichter/AliRoot.git] / PWG4 / totEt / AliAnalysisHadEtReconstructed.cxx
1 //_________________________________________________________________________
2 //  Utility Class for transverse energy studies, charged hadrons
3 //  Base class for ESD analysis
4 //  - reconstruction output
5 // implementation file
6 //
7 //Created by Christine Nattrass, Rebecca Scott, Irakli Martashvili
8 //University of Tennessee at Knoxville
9 //_________________________________________________________________________
10
11 #include <TROOT.h>
12 #include <TSystem.h>
13 #include <TInterpreter.h>
14 #include "AliAnalysisHadEtReconstructed.h"
15 #include "AliAnalysisEtCuts.h"
16 #include "AliESDtrack.h"
17 #include "AliESDCaloCluster.h"
18 #include "AliVEvent.h"
19 #include "AliESDEvent.h"
20 #include "AliESDtrackCuts.h"
21 #include "AliESDpid.h"
22 #include "AliVParticle.h"
23 #include <iostream>
24 #include "AliAnalysisHadEtCorrections.h"
25 #include "TFile.h"
26 #include "TString.h"
27 #include "AliAnalysisEtCommon.h"
28 #include "AliAnalysisHadEt.h"
29 #include "AliCentrality.h"
30 #include "AliLog.h"
31
32 using namespace std;
33
34 ClassImp(AliAnalysisHadEtReconstructed);
35
36
37 AliAnalysisHadEtReconstructed::AliAnalysisHadEtReconstructed() :
38   AliAnalysisHadEt()
39   ,fCorrections(0)
40   ,fConfigFile("ConfigHadEtAnalysis.C")
41   ,fCorrTotEtFullAcceptanceTPC(0)
42   ,fCorrTotEtFullAcceptanceITS(0)
43   ,fCorrHadEtFullAcceptanceTPC(0)
44   ,fCorrHadEtFullAcceptanceITS(0)
45   ,fCorrTotEtEMCALAcceptanceTPC(0)
46   ,fCorrTotEtEMCALAcceptanceITS(0)
47   ,fCorrHadEtEMCALAcceptanceTPC(0)
48   ,fCorrHadEtEMCALAcceptanceITS(0)
49   ,fCorrTotEtPHOSAcceptanceTPC(0)
50   ,fCorrTotEtPHOSAcceptanceITS(0)
51   ,fCorrHadEtPHOSAcceptanceTPC(0)
52   ,fCorrHadEtPHOSAcceptanceITS(0)
53   ,fCorrectedHadEtFullAcceptanceTPCNoPID(0)
54   ,fCorrectedHadEtFullAcceptanceITSNoPID(0)
55   ,fCorrectedHadEtEMCALAcceptanceTPCNoPID(0)
56   ,fCorrectedHadEtEMCALAcceptanceITSNoPID(0)
57   ,fCorrectedHadEtPHOSAcceptanceTPCNoPID(0)
58   ,fCorrectedHadEtPHOSAcceptanceITSNoPID(0)
59   ,fCorrectedHadEtFullAcceptanceTPC(0)
60   ,fCorrectedHadEtFullAcceptanceITS(0)
61   ,fCorrectedHadEtFullAcceptanceTPCAssumingPion(0)
62   ,fCorrectedHadEtFullAcceptanceITSAssumingPion(0)
63   ,fCorrectedHadEtFullAcceptanceTPCAssumingProton(0)
64   ,fCorrectedHadEtFullAcceptanceITSAssumingProton(0)
65   ,fCorrectedHadEtFullAcceptanceTPCAssumingKaon(0)
66   ,fCorrectedHadEtFullAcceptanceITSAssumingKaon(0)
67   ,fCorrectedHadEtEMCALAcceptanceTPC(0)
68   ,fCorrectedHadEtEMCALAcceptanceITS(0)
69   ,fCorrectedHadEtPHOSAcceptanceTPC(0)
70   ,fCorrectedHadEtPHOSAcceptanceITS(0)
71   ,fRawEtFullAcceptanceTPC(0)
72   ,fRawEtFullAcceptanceITS(0)
73   ,fRawEtEMCALAcceptanceTPC(0)
74   ,fRawEtEMCALAcceptanceITS(0)
75   ,fRawEtPHOSAcceptanceTPC(0)
76   ,fRawEtPHOSAcceptanceITS(0)
77   ,fRawEtFullAcceptanceTPCNoPID(0)
78   ,fRawEtFullAcceptanceITSNoPID(0)
79   ,fRawEtEMCALAcceptanceTPCNoPID(0)
80   ,fRawEtEMCALAcceptanceITSNoPID(0)
81   ,fRawEtPHOSAcceptanceTPCNoPID(0)
82   ,fRawEtPHOSAcceptanceITSNoPID(0)
83 {
84 }
85
86 AliAnalysisHadEtReconstructed::~AliAnalysisHadEtReconstructed() 
87 {
88   delete fCorrections;
89 }
90
91 Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
92 { // analyse ESD event
93   ResetEventValues();
94   if(!ev){
95     AliFatal("ERROR: Event does not exist");   
96     return 0;
97   }
98
99   AliESDEvent *realEvent = dynamic_cast<AliESDEvent*>(ev);
100   if(!realEvent){  
101     AliFatal("ERROR: ESD Event does not exist");
102     return 0;
103   }
104   fCentBin= -1;
105   fGoodEvent = kTRUE;//for p+p collisions if we made it this far we have a good event
106   if(fDataSet==20100){//If this is Pb+Pb
107     AliCentrality *centrality = realEvent->GetCentrality();
108     if(fNCentBins<21) fCentBin= centrality->GetCentralityClass10(fCentralityMethod);
109     else{ fCentBin= centrality->GetCentralityClass5(fCentralityMethod);}
110     if(fCentBin ==-1) fGoodEvent = kFALSE;//but for Pb+Pb events we don't want to count events where we did not find a centrality
111   }
112   //for PID
113   AliESDpid *pID = new AliESDpid();
114   pID->MakePID(realEvent);
115   TString *strTPC = new TString("TPC");
116   TString *strITS = new TString("ITS");
117   TString *strTPCITS = new TString("TPCITS");
118   for(Int_t cutset=0;cutset<2;cutset++){
119     bool isTPC = false;
120     TString *cutName = NULL;
121     TObjArray* list = NULL;
122     switch(cutset){
123     case 0:
124       cutName = strTPCITS;
125       list = fEsdtrackCutsITSTPC->GetAcceptedTracks(realEvent);
126       isTPC = true;
127       break;
128     case 1:
129       cutName = strITS;
130       list = fEsdtrackCutsITS->GetAcceptedTracks(realEvent);
131       break;
132     case 2:
133       cutName = strTPC;
134       list = fEsdtrackCutsTPC->GetAcceptedTracks(realEvent);
135       break;
136     default:
137       cerr<<"Error:  cannot fill histograms!"<<endl;
138       return -1;
139     }
140     Int_t nGoodTracks = list->GetEntries();
141     for (Int_t iTrack = 0; iTrack < nGoodTracks; iTrack++)
142       {
143
144
145         AliESDtrack *track = dynamic_cast<AliESDtrack*> (list->At(iTrack));
146         if (!track)
147           {
148             Printf("ERROR: Could not get track %d", iTrack);
149             continue;
150           }
151         else{
152           if(TMath::Abs(track->Eta())>fCorrections->GetEtaCut()) continue;
153           Float_t nSigmaPion,nSigmaProton,nSigmaKaon,nSigmaElectron;
154           pID->MakeTPCPID(track);
155           pID->MakeITSPID(track);
156           if(cutset!=1){
157             nSigmaPion = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kPion));
158             nSigmaProton = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kProton));
159             nSigmaKaon = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kKaon));
160             nSigmaElectron = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kElectron));
161           }
162           else{
163             nSigmaPion = TMath::Abs(pID->NumberOfSigmasITS(track,AliPID::kPion));
164             nSigmaProton = TMath::Abs(pID->NumberOfSigmasITS(track,AliPID::kProton));
165             nSigmaKaon = TMath::Abs(pID->NumberOfSigmasITS(track,AliPID::kKaon));
166             nSigmaElectron = TMath::Abs(pID->NumberOfSigmasITS(track,AliPID::kElectron));
167           }
168           //        bool isPion = (nSigmaPion<3.0 && nSigmaProton>2.0 && nSigmaKaon>2.0);
169           //        bool isElectron = (nSigmaElectron<2.0 && nSigmaPion>4.0 && nSigmaProton>3.0 && nSigmaKaon>3.0);
170           //        bool isKaon = (nSigmaPion>3.0 && nSigmaProton>2.0 && nSigmaKaon<2.0);
171           //        bool isProton = (nSigmaPion>3.0 && nSigmaProton<2.0 && nSigmaKaon>2.0);
172           bool isPion = (nSigmaPion<3.0 && nSigmaProton>2.0 && nSigmaKaon>2.0);
173           bool isElectron = (nSigmaElectron<2.0 && nSigmaPion>4.0 && nSigmaProton>3.0 && nSigmaKaon>3.0);
174           bool isKaon = (nSigmaPion>3.0 && nSigmaProton>3.0 && nSigmaKaon<3.0 && track->Pt()<0.45);
175           bool isProton = (nSigmaPion>3.0 && nSigmaProton<3.0 && nSigmaKaon>3.0 && track->Pt()<0.9);
176
177           bool unidentified = (!isProton && !isKaon && !isElectron && !isPion);
178           if(cutset==1){//ITS dE/dx identification requires tighter cuts on the tracks and we don't gain much from that so we won't do it
179             unidentified = true;
180             isPion=false;
181             isElectron=false;
182             isKaon=false;
183             isProton=false;
184           }
185           Float_t dEdx = track->GetTPCsignal();
186           if(cutset==1) dEdx = track->GetITSsignal();
187           FillHisto2D(Form("dEdxDataAll%s",cutName->Data()),track->P(),dEdx,1.0);
188
189           bool inPHOS = IsInPHOS(track);
190           bool inEMCAL = IsInEMCAL(track);
191
192           Float_t corrBkgd=0.0;
193           Float_t corrNotID=0.0;
194           Float_t corrNoID = fCorrections->GetNotIDCorrectionNoPID(track->Pt());
195           Float_t corrEff = 0.0;
196           Float_t corrEffNoID = 0.0;
197           if(cutset!=1){//TPC
198             corrBkgd = fCorrections->GetBackgroundCorrectionTPC(track->Pt());
199             corrEffNoID = fCorrections->GetTPCEfficiencyCorrectionHadron(track->Pt(),fCentBin);
200             corrNotID = fCorrections->GetNotIDConstCorrectionTPC();
201             corrNoID = fCorrections->GetNotIDConstCorrectionTPCNoID();
202           }
203           if(cutset==1){//ITS
204             corrBkgd = fCorrections->GetBackgroundCorrectionITS(track->Pt());
205             corrEffNoID = fCorrections->GetITSEfficiencyCorrectionHadron(track->Pt(),fCentBin);
206             corrNotID = fCorrections->GetNotIDConstCorrectionITS();
207             corrNoID = fCorrections->GetNotIDConstCorrectionITSNoID();
208           }
209           if(fDataSet==20100){
210             FillHisto2D("fbkgdVsCentralityBin",fCentBin,corrBkgd,1.0);
211             FillHisto2D("fnotIDVsCentralityBin",fCentBin,corrNotID,1.0);
212             FillHisto2D("fpTcutVsCentralityBin",fCentBin,fCorrections->GetpTCutCorrectionTPC(),1.0);
213             if(fCorrHadEtFullAcceptanceTPC>0.0) FillHisto2D("fneutralVsCentralityBin",fCentBin,1.0/fCorrHadEtFullAcceptanceTPC,1.0);
214             if(fCorrections->GetNeutralCorrection()>0.0) FillHisto2D("ConstantCorrectionsVsCentralityBin",fCentBin,1.0/fCorrections->GetNeutralCorrection(),1.0);
215           }
216           Float_t et = 0.0;
217           Float_t etNoID = Et(track->P(),track->Theta(),fgPiPlusCode,track->Charge());
218           Float_t etpartialcorrected = 0.0;
219           Float_t etpartialcorrectedPion = 0.0;
220           Float_t etpartialcorrectedKaon = 0.0;
221           Float_t etpartialcorrectedProton = 0.0;
222           Float_t etpartialcorrectedNoID = corrNoID*corrBkgd*corrEffNoID*etNoID;
223           FillHisto2D(Form("EtDataRaw%sNoID",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrectedNoID);
224
225           if(isPion){
226             FillHisto2D(Form("dEdxDataPion%s",cutName->Data()),track->P(),dEdx,1.0);
227             et = Et(track->P(),track->Theta(),fgPiPlusCode,track->Charge());
228             if(cutset==0){corrEff = fCorrections->GetTPCEfficiencyCorrectionPion(track->Pt(),fCentBin);}
229             etpartialcorrected = et*corrBkgd*corrEff*corrNotID;
230             if(corrEff>0.0&&fDataSet==20100)FillHisto2D("feffPionVsCentralityBin",fCentBin,1.0/corrEff,1.0);
231             if(track->Charge()>0.0){
232               FillHisto2D(Form("EtDataRaw%sPiPlus",cutName->Data()),track->Pt(),track->Eta(),et);
233               FillHisto2D(Form("EtDataCorrected%sPiPlus",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
234             }
235             else{
236               FillHisto2D(Form("EtDataRaw%sPiMinus",cutName->Data()),track->Pt(),track->Eta(),et);
237               FillHisto2D(Form("EtDataCorrected%sPiMinus",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
238             }
239           }
240           if(isKaon){
241             FillHisto2D(Form("dEdxDataKaon%s",cutName->Data()),track->P(),dEdx,1.0);
242             et = Et(track->P(),track->Theta(),fgKPlusCode,track->Charge());
243             if(cutset==0){corrEff = fCorrections->GetTPCEfficiencyCorrectionKaon(track->Pt(),fCentBin);}
244             etpartialcorrected = et*corrBkgd*corrEff*corrNotID;
245             if(corrEff>0.0&&fDataSet==20100)FillHisto2D("feffKaonVsCentralityBin",fCentBin,1.0/corrEff,1.0);
246               
247             if(track->Charge()>0.0){
248               FillHisto2D(Form("EtDataRaw%sKPlus",cutName->Data()),track->Pt(),track->Eta(),et);
249               FillHisto2D(Form("EtDataCorrected%sKPlus",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
250             }
251             else{
252               FillHisto2D(Form("EtDataRaw%sKMinus",cutName->Data()),track->Pt(),track->Eta(),et);
253               FillHisto2D(Form("EtDataCorrected%sKMinus",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
254             }
255           }
256           if(isProton){
257             FillHisto2D(Form("dEdxDataProton%s",cutName->Data()),track->P(),dEdx,1.0);
258             et = Et(track->P(),track->Theta(),fgProtonCode,track->Charge());
259             if(cutset==0){corrEff = fCorrections->GetTPCEfficiencyCorrectionProton(track->Pt(),fCentBin);}
260             etpartialcorrected = et*corrBkgd*corrEff*corrNotID;
261             if(corrEff>0.0&&fDataSet==20100)FillHisto2D("feffProtonVsCentralityBin",fCentBin,1.0/corrEff,1.0);
262               
263             if(track->Charge()>0.0){
264               FillHisto2D(Form("EtDataRaw%sProton",cutName->Data()),track->Pt(),track->Eta(),et);
265               FillHisto2D(Form("EtDataCorrected%sProton",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
266             }
267             else{
268               FillHisto2D(Form("EtDataRaw%sAntiProton",cutName->Data()),track->Pt(),track->Eta(),et);
269               FillHisto2D(Form("EtDataCorrected%sAntiProton",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
270             }
271           }
272           if(isElectron){
273             FillHisto2D(Form("dEdxDataProton%s",cutName->Data()),track->P(),dEdx,1.0);
274           }
275           if(unidentified){
276             if(isPion) cerr<<"I should not be here!!  AliAnalysisHadEtReconstructed 273"<<endl; 
277             FillHisto2D(Form("dEdxDataUnidentified%s",cutName->Data()),track->P(),dEdx,1.0);
278             et = Et(track->P(),track->Theta(),fgPiPlusCode,track->Charge());
279             Float_t etProton = Et(track->P(),track->Theta(),fgProtonCode,track->Charge());
280             Float_t etKaon = Et(track->P(),track->Theta(),fgKPlusCode,track->Charge());
281             if(corrEff>0.0&&fDataSet==20100)FillHisto2D("feffHadronVsCentralityBin",fCentBin,1.0/corrEff,1.0);
282             etpartialcorrected = et*corrBkgd*corrEffNoID*corrNotID;
283             etpartialcorrectedPion = et*corrBkgd*corrEffNoID;
284             etpartialcorrectedProton = etProton*corrBkgd*corrEffNoID;
285             etpartialcorrectedKaon = etKaon*corrBkgd*corrEffNoID;
286             FillHisto2D(Form("EtDataCorrected%sUnidentified",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
287           }
288           else{
289             etpartialcorrectedPion = etpartialcorrected;
290             etpartialcorrectedKaon = etpartialcorrected;
291             etpartialcorrectedProton = etpartialcorrected;
292           }
293           if(!isTPC){
294             etpartialcorrected = etpartialcorrectedNoID;//Not using PID for ITS
295           }
296           AddEt(et,etNoID,etpartialcorrected,etpartialcorrectedPion,etpartialcorrectedProton,etpartialcorrectedKaon,etpartialcorrectedNoID,track->Pt(),isTPC,inPHOS,inEMCAL);
297         }
298       }
299     delete list;
300   }
301   if(GetCorrectedHadEtFullAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceTPC",GetCorrectedHadEtFullAcceptanceTPC(),1.0);
302   if(GetCorrectedTotEtFullAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtFullAcceptanceTPC",GetCorrectedTotEtFullAcceptanceTPC(),1.0);
303   if(GetCorrectedHadEtFullAcceptanceTPCAssumingPion()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceTPCAssumingPion",GetCorrectedHadEtFullAcceptanceTPCAssumingPion(),1.0);
304   if(GetCorrectedHadEtFullAcceptanceTPCAssumingProton()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceTPCAssumingProton",GetCorrectedHadEtFullAcceptanceTPCAssumingProton(),1.0);
305   if(GetCorrectedHadEtFullAcceptanceTPCAssumingKaon()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceTPCAssumingKaon",GetCorrectedHadEtFullAcceptanceTPCAssumingKaon(),1.0);
306   if(GetCorrectedHadEtEMCALAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtEMCALAcceptanceTPC",GetCorrectedHadEtEMCALAcceptanceTPC(),1.0);
307   if(GetCorrectedTotEtEMCALAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtEMCALAcceptanceTPC",GetCorrectedTotEtEMCALAcceptanceTPC(),1.0);
308   if(GetCorrectedHadEtPHOSAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtPHOSAcceptanceTPC",GetCorrectedHadEtPHOSAcceptanceTPC(),1.0);
309   if(GetCorrectedTotEtPHOSAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtPHOSAcceptanceTPC",GetCorrectedTotEtPHOSAcceptanceTPC(),1.0);
310   if(GetCorrectedHadEtFullAcceptanceTPCNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceTPCNoPID",GetCorrectedHadEtFullAcceptanceTPCNoPID(),1.0);
311   if(GetCorrectedTotEtFullAcceptanceTPCNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtFullAcceptanceTPCNoPID",GetCorrectedTotEtFullAcceptanceTPCNoPID(),1.0);
312   if(GetCorrectedHadEtEMCALAcceptanceTPCNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtEMCALAcceptanceTPCNoPID",GetCorrectedHadEtEMCALAcceptanceTPCNoPID(),1.0);
313   if(GetCorrectedTotEtEMCALAcceptanceTPCNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtEMCALAcceptanceTPCNoPID",GetCorrectedTotEtEMCALAcceptanceTPCNoPID(),1.0);
314   if(GetCorrectedHadEtPHOSAcceptanceTPCNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtPHOSAcceptanceTPCNoPID",GetCorrectedHadEtPHOSAcceptanceTPCNoPID(),1.0);
315   if(GetCorrectedTotEtPHOSAcceptanceTPCNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtPHOSAcceptanceTPCNoPID",GetCorrectedTotEtPHOSAcceptanceTPCNoPID(),1.0);
316   if(GetCorrectedHadEtFullAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceITS",GetCorrectedHadEtFullAcceptanceITS(),1.0);
317   if(GetCorrectedHadEtFullAcceptanceITSAssumingPion()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceITSAssumingPion",GetCorrectedHadEtFullAcceptanceITSAssumingPion(),1.0);
318   if(GetCorrectedHadEtFullAcceptanceITSAssumingProton()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceITSAssumingProton",GetCorrectedHadEtFullAcceptanceITSAssumingProton(),1.0);
319   if(GetCorrectedHadEtFullAcceptanceITSAssumingKaon()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceITSAssumingKaon",GetCorrectedHadEtFullAcceptanceITSAssumingKaon(),1.0);
320   if(GetCorrectedTotEtFullAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtFullAcceptanceITS",GetCorrectedTotEtFullAcceptanceITS(),1.0);
321   if(GetCorrectedHadEtEMCALAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtEMCALAcceptanceITS",GetCorrectedHadEtEMCALAcceptanceITS(),1.0);
322   if(GetCorrectedTotEtEMCALAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtEMCALAcceptanceITS",GetCorrectedTotEtEMCALAcceptanceITS(),1.0);
323   if(GetCorrectedHadEtPHOSAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtPHOSAcceptanceITS",GetCorrectedHadEtPHOSAcceptanceITS(),1.0);
324   if(GetCorrectedTotEtPHOSAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtPHOSAcceptanceITS",GetCorrectedTotEtPHOSAcceptanceITS(),1.0);
325   if(GetCorrectedHadEtFullAcceptanceITSNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtFullAcceptanceITSNoPID",GetCorrectedHadEtFullAcceptanceITSNoPID(),1.0);
326   if(GetCorrectedTotEtFullAcceptanceITSNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtFullAcceptanceITSNoPID",GetCorrectedTotEtFullAcceptanceITSNoPID(),1.0);
327   if(GetCorrectedHadEtEMCALAcceptanceITSNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtEMCALAcceptanceITSNoPID",GetCorrectedHadEtEMCALAcceptanceITSNoPID(),1.0);
328   if(GetCorrectedTotEtEMCALAcceptanceITSNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtEMCALAcceptanceITSNoPID",GetCorrectedTotEtEMCALAcceptanceITSNoPID(),1.0);
329   if(GetCorrectedHadEtPHOSAcceptanceITSNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoHadEtPHOSAcceptanceITSNoPID",GetCorrectedHadEtPHOSAcceptanceITSNoPID(),1.0);
330   if(GetCorrectedTotEtPHOSAcceptanceITSNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoTotEtPHOSAcceptanceITSNoPID",GetCorrectedTotEtPHOSAcceptanceITSNoPID(),1.0);
331
332   if(GetRawEtFullAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtFullAcceptanceTPC",GetRawEtFullAcceptanceTPC(),1.0);
333   if(GetRawEtEMCALAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtEMCALAcceptanceTPC",GetRawEtEMCALAcceptanceTPC(),1.0);
334   if(GetRawEtPHOSAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtPHOSAcceptanceTPC",GetRawEtPHOSAcceptanceTPC(),1.0);
335   if(GetRawEtFullAcceptanceTPCNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtFullAcceptanceTPCNoPID",GetRawEtFullAcceptanceTPCNoPID(),1.0);
336   if(GetRawEtEMCALAcceptanceTPCNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtEMCALAcceptanceTPCNoPID",GetRawEtEMCALAcceptanceTPCNoPID(),1.0);
337   if(GetRawEtPHOSAcceptanceTPCNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtPHOSAcceptanceTPCNoPID",GetRawEtPHOSAcceptanceTPCNoPID(),1.0);
338   if(GetRawEtFullAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtFullAcceptanceITS",GetRawEtFullAcceptanceITS(),1.0);
339   if(GetRawEtEMCALAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtEMCALAcceptanceITS",GetRawEtEMCALAcceptanceITS(),1.0);
340   if(GetRawEtPHOSAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtPHOSAcceptanceITS",GetRawEtPHOSAcceptanceITS(),1.0);
341   if(GetRawEtFullAcceptanceITSNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtFullAcceptanceITSNoPID",GetRawEtFullAcceptanceITSNoPID(),1.0);
342   if(GetRawEtEMCALAcceptanceITSNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtEMCALAcceptanceITSNoPID",GetRawEtEMCALAcceptanceITSNoPID(),1.0);
343   if(GetRawEtPHOSAcceptanceITSNoPID()>0.0 && fGoodEvent)FillHisto1D("RecoRawEtPHOSAcceptanceITSNoPID",GetRawEtPHOSAcceptanceITSNoPID(),1.0);
344   if(fCentBin>-1){//if we have Pb+Pb and found a centrality bin
345     if(GetCorrectedHadEtFullAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D(Form("RecoHadEtFullAcceptanceTPCCB%i",fCentBin),GetCorrectedHadEtFullAcceptanceTPC(),1.0);
346     if(GetCorrectedTotEtFullAcceptanceTPC()>0.0 && fGoodEvent)FillHisto1D(Form("RecoTotEtFullAcceptanceTPCCB%i",fCentBin),GetCorrectedTotEtFullAcceptanceTPC(),1.0);
347     if(GetCorrectedHadEtFullAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D(Form("RecoHadEtFullAcceptanceITSCB%i",fCentBin),GetCorrectedHadEtFullAcceptanceITS(),1.0);
348     if(GetCorrectedTotEtFullAcceptanceITS()>0.0 && fGoodEvent)FillHisto1D(Form("RecoTotEtFullAcceptanceITSCB%i",fCentBin),GetCorrectedTotEtFullAcceptanceITS(),1.0);
349     if(GetRawEtFullAcceptanceTPC()>0.0 && fGoodEvent)         FillHisto1D(Form("RecoRawEtFullAcceptanceTPCCB%i",fCentBin),GetRawEtFullAcceptanceTPC(),1.0);
350     if(GetRawEtFullAcceptanceITS()>0.0 && fGoodEvent)         FillHisto1D(Form("RecoRawEtFullAcceptanceITSCB%i",fCentBin),GetRawEtFullAcceptanceITS(),1.0);
351   }
352   delete pID;
353   delete strTPC;
354   delete strITS;
355   delete strTPCITS;
356   // cout<<"Reconstructed pi/k/p et "<<GetCorrectedPiKPEtFullAcceptanceTPC()<<endl;
357   return 1;
358 }
359 void AliAnalysisHadEtReconstructed::AddEt(Float_t rawEt, Float_t rawEtNoPID, Float_t corrEt, Float_t corrEtPion, Float_t corrEtProton, Float_t corrEtKaon, Float_t corrEtNoPID, Float_t pt, Bool_t IsTPC, Bool_t InPHOS, Bool_t InEMCAL) {//Adding Et to each of the variables that tracks et event by event
360   if(pt>=AliAnalysisHadEt::fgPtTPCCutOff && IsTPC){//TPC tracks
361     //adding to the raw Et
362     fRawEtFullAcceptanceTPC += rawEt;
363     if(InPHOS)fRawEtPHOSAcceptanceTPC += rawEt;
364     if(InEMCAL)fRawEtEMCALAcceptanceTPC += rawEt;
365     fRawEtFullAcceptanceTPCNoPID += rawEtNoPID;
366     if(InPHOS)fRawEtPHOSAcceptanceTPCNoPID += rawEtNoPID;
367     if(InEMCAL)fRawEtEMCALAcceptanceTPCNoPID += rawEtNoPID;
368     //adding to the corrected Et
369     fCorrectedHadEtFullAcceptanceTPC += corrEt;//the pi/k/p et
370     fCorrectedHadEtFullAcceptanceTPCAssumingPion += corrEtPion;
371     fCorrectedHadEtFullAcceptanceTPCAssumingProton += corrEtProton;
372     fCorrectedHadEtFullAcceptanceTPCAssumingKaon += corrEtKaon;
373     if(InPHOS)fCorrectedHadEtPHOSAcceptanceTPC += corrEt;
374     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceTPC += corrEt;
375     fCorrectedHadEtFullAcceptanceTPCNoPID += corrEtNoPID;
376     if(InPHOS)fCorrectedHadEtPHOSAcceptanceTPCNoPID += corrEtNoPID;
377     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceTPCNoPID += corrEtNoPID;
378   }
379   if(pt<AliAnalysisHadEt::fgPtTPCCutOff &&pt>=AliAnalysisHadEt::fgPtITSCutOff && !IsTPC){//ITS tracks
380     //adding to the raw Et
381     fRawEtFullAcceptanceITS += rawEt;
382     if(InPHOS)fRawEtPHOSAcceptanceITS += rawEt;
383     if(InEMCAL)fRawEtEMCALAcceptanceITS += rawEt;
384     fRawEtFullAcceptanceITSNoPID += rawEtNoPID;
385     if(InPHOS)fRawEtPHOSAcceptanceITSNoPID += rawEtNoPID;
386     if(InEMCAL)fRawEtEMCALAcceptanceITSNoPID += rawEtNoPID;
387     //adding to the corrected Et
388     fCorrectedHadEtFullAcceptanceITS += corrEt;
389     fCorrectedHadEtFullAcceptanceITSAssumingPion += corrEtPion;
390     fCorrectedHadEtFullAcceptanceITSAssumingProton += corrEtProton;
391     fCorrectedHadEtFullAcceptanceITSAssumingKaon += corrEtKaon;
392     if(InPHOS)fCorrectedHadEtPHOSAcceptanceITS += corrEt;
393     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceITS += corrEt;
394     fCorrectedHadEtFullAcceptanceITSNoPID += corrEtNoPID;
395     if(InPHOS)fCorrectedHadEtPHOSAcceptanceITSNoPID += corrEtNoPID;
396     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceITSNoPID += corrEtNoPID;
397   }
398 }
399
400 Bool_t AliAnalysisHadEtReconstructed::IsInPHOS(AliESDtrack *track){//This function will need to be elaborated on later to include PHOS dead channels
401   if(!track){
402     cout<<"Error: Track does not exist!!"<<endl;
403     return kFALSE;
404   }
405   return   TMath::Abs(track->Eta()) < fCuts->GetGeometryPhosEtaAccCut()//in eta acceptance
406     && track->Phi()*180.0/TMath::Pi() > fCuts->GetGeometryPhosPhiAccMinCut()//greater than the minimum phi
407     && track->Phi()*180.0/TMath::Pi() < fCuts->GetGeometryPhosPhiAccMaxCut();//less than the maximum phi
408 }
409 Bool_t AliAnalysisHadEtReconstructed::IsInEMCAL(AliESDtrack *track){//This function will need to be elaborated on later to include EMCAL dead channels
410   if(!track){
411     cout<<"Error: Track does not exist!!"<<endl;
412     return kFALSE;
413   }
414   return   TMath::Abs(track->Eta()) < fCuts->GetGeometryEmcalEtaAccCut()//in eta acceptance
415     && track->Phi()*180.0/TMath::Pi() > fCuts->GetGeometryEmcalPhiAccMinCut()//greater than the minimum phi
416     && track->Phi()*180.0/TMath::Pi() < fCuts->GetGeometryEmcalPhiAccMaxCut();//less than the maximum phi
417 }
418 Bool_t AliAnalysisHadEtReconstructed::CheckGoodVertex(AliVParticle* track)
419 { // check vertex
420
421   Float_t bxy = 999.;
422   Float_t bz = 999.;
423   if(!track){
424     AliError("ERROR: no track");
425     return kFALSE;
426   }
427   AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track);
428   if(!esdTrack){
429     AliError("ERROR: no track");
430     return kFALSE;
431   }
432   esdTrack->GetImpactParametersTPC(bxy,bz);
433
434   bool status = (TMath::Abs(track->Xv()) < fCuts->GetReconstructedVertexXCut()) && 
435     (TMath::Abs(track->Yv()) < fCuts->GetReconstructedVertexYCut()) && 
436     (TMath::Abs(track->Zv()) < fCuts->GetReconstructedVertexZCut()) && 
437     (TMath::Abs(bxy) < fCuts->GetReconstructedIPxyCut()) && 
438     (TMath::Abs(bz) < fCuts->GetReconstructedIPzCut()); 
439
440   return status;
441 }
442
443 void AliAnalysisHadEtReconstructed::Init()
444 { // Init
445   AliAnalysisHadEt::Init();
446   if(fCorrections){
447     fCorrTotEtFullAcceptanceTPC = fCorrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"Full");
448     fCorrTotEtFullAcceptanceITS = fCorrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"Full");
449     fCorrHadEtFullAcceptanceTPC = fCorrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"Full");
450     fCorrHadEtFullAcceptanceITS = fCorrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"Full");
451     fCorrTotEtEMCALAcceptanceTPC = fCorrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"EMCAL");
452     fCorrTotEtEMCALAcceptanceITS = fCorrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"EMCAL");
453     fCorrHadEtEMCALAcceptanceTPC = fCorrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"EMCAL");
454     fCorrHadEtEMCALAcceptanceITS = fCorrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"EMCAL");
455     fCorrTotEtPHOSAcceptanceTPC = fCorrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"PHOS");
456     fCorrTotEtPHOSAcceptanceITS = fCorrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"PHOS");
457     fCorrHadEtPHOSAcceptanceTPC = fCorrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"PHOS");
458     fCorrHadEtPHOSAcceptanceITS = fCorrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"PHOS");
459   }
460   else{
461     cout<<"Warning!  You have not set corrections.  Your code will crash.  You have to set the corrections."<<endl;
462   }
463 }
464
465 void AliAnalysisHadEtReconstructed::ResetEventValues(){//resetting event by event et's
466   AliAnalysisHadEt::ResetEventValues();
467   fCorrectedHadEtFullAcceptanceTPCNoPID=0.0;
468   fCorrectedHadEtFullAcceptanceITSNoPID=0.0;
469   fCorrectedHadEtEMCALAcceptanceTPCNoPID=0.0;
470   fCorrectedHadEtEMCALAcceptanceITSNoPID=0.0;
471   fCorrectedHadEtPHOSAcceptanceTPCNoPID=0.0;
472   fCorrectedHadEtPHOSAcceptanceITSNoPID=0.0;
473   fCorrectedHadEtFullAcceptanceTPC=0.0;
474   fCorrectedHadEtFullAcceptanceITS=0.0;
475   fCorrectedHadEtFullAcceptanceTPCAssumingPion=0.0;
476   fCorrectedHadEtFullAcceptanceITSAssumingPion=0.0;
477   fCorrectedHadEtFullAcceptanceTPCAssumingProton=0.0;
478   fCorrectedHadEtFullAcceptanceITSAssumingProton=0.0;
479   fCorrectedHadEtFullAcceptanceTPCAssumingKaon=0.0;
480   fCorrectedHadEtFullAcceptanceITSAssumingKaon=0.0;
481   fCorrectedHadEtEMCALAcceptanceTPC=0.0;
482   fCorrectedHadEtEMCALAcceptanceITS=0.0;
483   fCorrectedHadEtPHOSAcceptanceTPC=0.0;
484   fCorrectedHadEtPHOSAcceptanceITS=0.0;
485   fRawEtFullAcceptanceTPC=0.0;
486   fRawEtFullAcceptanceITS=0.0;
487   fRawEtEMCALAcceptanceTPC=0.0;
488   fRawEtEMCALAcceptanceITS=0.0;
489   fRawEtPHOSAcceptanceTPC=0.0;
490   fRawEtPHOSAcceptanceITS=0.0;
491   fRawEtFullAcceptanceTPCNoPID=0.0;
492   fRawEtFullAcceptanceITSNoPID=0.0;
493   fRawEtEMCALAcceptanceTPCNoPID=0.0;
494   fRawEtEMCALAcceptanceITSNoPID=0.0;
495   fRawEtPHOSAcceptanceTPCNoPID=0.0;
496   fRawEtPHOSAcceptanceITSNoPID=0.0;
497
498   if(TMath::Abs(fCorrTotEtFullAcceptanceTPC)<1e-3){
499     if (fConfigFile.Length()) {
500       cout<<"Warning: Rereading fCorrections file..."<<endl;
501       gROOT->LoadMacro(fConfigFile);
502       fCorrections = (AliAnalysisHadEtCorrections *) gInterpreter->ProcessLine("ConfigHadEtAnalysis()");
503       fCorrTotEtFullAcceptanceTPC = fCorrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"Full");
504       fCorrTotEtFullAcceptanceITS = fCorrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"Full");
505       fCorrHadEtFullAcceptanceTPC = fCorrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"Full");
506       fCorrHadEtFullAcceptanceITS = fCorrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"Full");
507       fCorrTotEtEMCALAcceptanceTPC = fCorrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"EMCAL");
508       fCorrTotEtEMCALAcceptanceITS = fCorrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"EMCAL");
509       fCorrHadEtEMCALAcceptanceTPC = fCorrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"EMCAL");
510       fCorrHadEtEMCALAcceptanceITS = fCorrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"EMCAL");
511       fCorrTotEtPHOSAcceptanceTPC = fCorrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"PHOS");
512       fCorrTotEtPHOSAcceptanceITS = fCorrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"PHOS");
513       fCorrHadEtPHOSAcceptanceTPC = fCorrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"PHOS");
514       fCorrHadEtPHOSAcceptanceITS = fCorrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"PHOS");
515     }
516     else{cerr<<"Uh-oh!  Unable to open configuration file!"<<endl;}
517   }
518 }
519 void AliAnalysisHadEtReconstructed::CreateHistograms(){//Creating histograms and adding them to the output TList
520
521   //TString *strTPC = new TString("TPC");
522   TString *strITS = new TString("ITS");
523   TString *strTPCITS = new TString("TPCITS");
524   for(Int_t i=0;i<2;i++){
525     TString *cutName = NULL;
526     Float_t maxPtdEdx = 10;
527     Float_t mindEdx = 35;
528     Float_t maxdEdx = 150.0;
529     switch(i){
530     case 0:
531       cutName = strTPCITS;
532       break;
533     case 1:
534       cutName = strITS;
535       maxPtdEdx = 5;
536       maxdEdx = 500.0;
537       break;
538       //not deleting this completely since we might want to add it back in later
539       //     case 2:
540       //       cutName = strTPC;
541       //       maxPtdEdx = 5;
542       //       maxdEdx = 500.0;
543       //       break;
544     default:
545       cerr<<"Error:  cannot make histograms!"<<endl;
546       return;
547     }
548
549     CreateEtaPtHisto2D(Form("EtDataRaw%sPiPlus",cutName->Data()),"Raw reconstructed E_{T} from identified #pi^{+}");
550     CreateEtaPtHisto2D(Form("EtDataRaw%sPiMinus",cutName->Data()),"Raw reconstructed E_{T} from identified #pi^{-}");
551     CreateEtaPtHisto2D(Form("EtDataRaw%sKPlus",cutName->Data()),"Raw reconstructed E_{T} from identified K^{+}");
552     //     CreateEtaPtHisto2D(Form("EtDataRaw%sEMinus",cutName->Data()),"Raw reconstructed E_{T} from identified e^{-}");
553     //     CreateEtaPtHisto2D(Form("EtDataRaw%sEPlus",cutName->Data()),"Raw reconstructed E_{T} from identified e^{+}");
554     CreateEtaPtHisto2D(Form("EtDataRaw%sKMinus",cutName->Data()),"Raw reconstructed E_{T} from identified K^{-}");
555     CreateEtaPtHisto2D(Form("EtDataRaw%sProton",cutName->Data()),"Raw reconstructed E_{T} from identified p");
556     CreateEtaPtHisto2D(Form("EtDataRaw%sAntiProton",cutName->Data()),"Raw reconstructed E_{T} from identified #bar{p}");
557     CreateEtaPtHisto2D(Form("EtDataRaw%sUnidentified",cutName->Data()),"Raw reconstructed E_{T} from unidentified particles using real mass");
558     CreateEtaPtHisto2D(Form("EtDataRaw%sNoID",cutName->Data()),"Raw reconstructed E_{T} from unidentified particles using real mass");
559
560     CreateEtaPtHisto2D(Form("EtDataCorrected%sPiPlus",cutName->Data()),"Corrected reconstructed E_{T} from identified #pi^{+}");
561     CreateEtaPtHisto2D(Form("EtDataCorrected%sPiMinus",cutName->Data()),"Corrected reconstructed E_{T} from identified #pi^{-}");
562     CreateEtaPtHisto2D(Form("EtDataCorrected%sKPlus",cutName->Data()),"Corrected reconstructed E_{T} from identified K^{+}");
563     //     CreateEtaPtHisto2D(Form("EtDataCorrected%sEMinus",cutName->Data()),"Corrected reconstructed E_{T} from identified e^{-}");
564     //     CreateEtaPtHisto2D(Form("EtDataCorrected%sEPlus",cutName->Data()),"Corrected reconstructed E_{T} from identified e^{+}");
565     CreateEtaPtHisto2D(Form("EtDataCorrected%sKMinus",cutName->Data()),"Corrected reconstructed E_{T} from identified K^{-}");
566     CreateEtaPtHisto2D(Form("EtDataCorrected%sProton",cutName->Data()),"Corrected reconstructed E_{T} from identified p");
567     CreateEtaPtHisto2D(Form("EtDataCorrected%sAntiProton",cutName->Data()),"Corrected reconstructed E_{T} from identified #bar{p}");
568     CreateEtaPtHisto2D(Form("EtDataCorrected%sUnidentified",cutName->Data()),"Corrected reconstructed E_{T} from unidentified particles using real mass");
569     CreateEtaPtHisto2D(Form("EtDataCorrected%sNoID",cutName->Data()),"Corrected reconstructed E_{T} from unidentified particles using real mass");
570
571
572     CreateEtaPtHisto2D(Form("EtNData%sPiPlus",cutName->Data()),"Number of reconstructed #pi^{+}");
573     CreateEtaPtHisto2D(Form("EtNData%sPiMinus",cutName->Data()),"Number of reconstructed #pi^{-}");
574     CreateEtaPtHisto2D(Form("EtNData%sKPlus",cutName->Data()),"Number of reconstructed K^{+}");
575     CreateEtaPtHisto2D(Form("EtNData%sKMinus",cutName->Data()),"Number of reconstructed K^{-}");
576     CreateEtaPtHisto2D(Form("EtNData%sProton",cutName->Data()),"Number of reconstructed p");
577     CreateEtaPtHisto2D(Form("EtNData%sAntiProton",cutName->Data()),"Number of reconstructed #bar{p}");
578     CreateEtaPtHisto2D(Form("EtNData%sUnidentified",cutName->Data()),"Number of Reconstructed unidentified particles");
579
580     CreateHisto2D(Form("dEdxDataAll%s",cutName->Data()),"dE/dx for all particles","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
581     CreateHisto2D(Form("dEdxDataPion%s",cutName->Data()),"dE/dx for #pi^{#pm}","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
582     CreateHisto2D(Form("dEdxDataKaon%s",cutName->Data()),"dE/dx for K^{#pm}","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
583     CreateHisto2D(Form("dEdxDataProton%s",cutName->Data()),"dE/dx for p(#bar{p})","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
584     CreateHisto2D(Form("dEdxDataElectron%s",cutName->Data()),"dE/dx for e^{#pm}","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
585     CreateHisto2D(Form("dEdxDataUnidentified%s",cutName->Data()),"dE/dx for unidentified particles","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
586   }
587
588   Float_t minEt = 0.0;
589   Float_t maxEt = 100.0;
590   if(fDataSet==20100) maxEt=3500.0;
591   Int_t nbinsEt = 200;
592   char histoname[200];
593   char histotitle[200];
594   char xtitle[50];
595   TString *ytitle = new TString("Number of events");
596   TString *sTPC = new TString("TPC");
597   TString *sITS = new TString("ITS");
598   TString *sTPCpt = new TString("0.15");
599   TString *sITSpt = new TString("0.10");
600   TString *sPID = new TString("");
601   TString *sNoPID = new TString("NoPID");
602   TString *sNoPIDString = new TString(", No PID");
603   TString *sHadEt = new TString("HadEt");
604   TString *sRawEt = new TString("RawEt");
605   TString *sTotEt = new TString("TotEt");
606   TString *sTotEtString = new TString("total E_{T}");
607   TString *sHadEtString = new TString("hadronic E_{T}");
608   TString *sRawEtString = new TString("raw E_{T}");
609   TString *sFull = new TString("Full");
610   TString *sEMCAL = new TString("EMCAL");
611   TString *sPHOS = new TString("PHOS");
612   
613   for(int tpc = 0;tpc<2;tpc++){
614     for(int hadet = 0;hadet<3;hadet++){
615       for(int type = 0;type<3;type++){
616         for(int pid = 0;pid<2;pid++){
617           TString *detector = NULL;
618           TString *partid = NULL;
619           TString *et = sHadEt;
620           TString *acceptance = NULL;
621           TString *ptstring = NULL;
622           TString *partidstring = NULL;
623           TString *etstring = sHadEtString;
624           if(tpc==1) {detector = sTPC; ptstring = sTPCpt;}
625           else{detector = sITS; ptstring = sITSpt;}
626           if(pid==1){partid = sPID; partidstring = sPID;}
627           else{partid = sNoPID; partidstring = sNoPIDString;}
628           if(hadet==1) {et = sHadEt; etstring = sHadEtString;}
629           if(hadet==0){et = sTotEt; etstring = sTotEtString;}
630           if(hadet==2){et = sRawEt; etstring = sRawEtString;}
631           switch(type){
632           case 0:
633             acceptance = sFull;
634             break;
635           case 1:
636             acceptance = sEMCAL;
637             break;
638           case 2:
639             acceptance = sPHOS;
640             break;
641           default:
642             acceptance = sFull;
643           }
644           snprintf(histoname,200,"Reco%s%sAcceptance%s%s",et->Data(),acceptance->Data(),detector->Data(),partid->Data());
645           snprintf(histotitle,200,"Reconstructed %s with %s acceptance for p_{T}>%s GeV/c%s",etstring->Data(),acceptance->Data(),ptstring->Data(),partidstring->Data());
646           snprintf(xtitle,50,"Reconstructed %s",etstring->Data());
647           CreateHisto1D(histoname,histotitle,xtitle,ytitle->Data(),nbinsEt*2,minEt,maxEt);
648           if(fDataSet==20100 && type ==0 &&pid==1){//If this is Pb+Pb and full acceptance with pid
649             Int_t width = 5;
650             if(fNCentBins<21) width = 10;
651             for(Int_t i=0;i<fNCentBins;i++){
652               snprintf(histoname,200,"Reco%s%sAcceptance%s%sCB%i",et->Data(),acceptance->Data(),detector->Data(),partid->Data(),i);
653               snprintf(histotitle,200,"Reconstructed %s with %s acceptance for p_{T}>%s GeV/c%s for centrality %i-%i",etstring->Data(),acceptance->Data(),ptstring->Data(),partidstring->Data(),i*width,(i+1)*width);
654               snprintf(xtitle,50,"Reconstructed %s",etstring->Data());
655               CreateHisto1D(histoname,histotitle,xtitle,ytitle->Data(),nbinsEt*2,minEt,maxEt);
656             }
657           }
658         }
659       }
660     }
661   }
662   CreateHisto1D("RecoHadEtFullAcceptanceTPCAssumingPion","Reconstructing E_{T}^{had} with full acceptance for p_{T}>0.15 GeV/c assuming pions","Reconstructed E_{T}^{had}","dN_{eve}/dE_{T}^{had}",nbinsEt*2,minEt,maxEt);
663   CreateHisto1D("RecoHadEtFullAcceptanceTPCAssumingProton","Reconstructing E_{T}^{had} with full acceptance for p_{T}>0.15 GeV/c assuming protons","Reconstructed E_{T}^{had}","dN_{eve}/dE_{T}^{had}",nbinsEt*2,minEt,maxEt);
664   CreateHisto1D("RecoHadEtFullAcceptanceTPCAssumingKaon","Reconstructing E_{T}^{had} with full acceptance for p_{T}>0.15 GeV/c assuming kaons","Reconstructed E_{T}^{had}","dN_{eve}/dE_{T}^{had}",nbinsEt*2,minEt,maxEt);
665   CreateHisto1D("RecoHadEtFullAcceptanceITSAssumingPion","Reconstructing E_{T}^{had} with full acceptance for p_{T}>0.10 GeV/c assuming pions","Reconstructed E_{T}^{had}","dN_{eve}/dE_{T}^{had}",nbinsEt*2,minEt,maxEt);
666   CreateHisto1D("RecoHadEtFullAcceptanceITSAssumingProton","Reconstructing E_{T}^{had} with full acceptance for p_{T}>0.10 GeV/c assuming protons","Reconstructed E_{T}^{had}","dN_{eve}/dE_{T}^{had}",nbinsEt*2,minEt,maxEt);
667   CreateHisto1D("RecoHadEtFullAcceptanceITSAssumingKaon","Reconstructing E_{T}^{had} with full acceptance for p_{T}>0.10 GeV/c assuming kaons","Reconstructed E_{T}^{had}","dN_{eve}/dE_{T}^{had}",nbinsEt*2,minEt,maxEt);
668
669   //Cross checks that corrections are applied correctly
670   if(fDataSet==20100){
671     CreateHisto2D("fbkgdVsCentralityBin","f_{bkgd} vs centrality bin","centrality bin","f_{bkgd}",21,-1.5,19.5,200,0.7,1.05);//
672     CreateHisto2D("feffPionVsCentralityBin","Pion efficiency vs centrality bin","centrality bin","pion efficiency",21,-1.5,19.5,200,0,1.2);//
673     CreateHisto2D("feffHadronVsCentralityBin","Hadron efficiency vs centrality bin","centrality bin","hadron efficiency",21,-1.5,19.5,200,0,1.2);//
674     CreateHisto2D("feffKaonVsCentralityBin","Kaon efficiency vs centrality bin","centrality bin","kaon efficiency",21,-1.5,19.5,200,0,1.2);//
675     CreateHisto2D("feffProtonVsCentralityBin","Proton efficiency vs centrality bin","centrality bin","proton efficiency",21,-1.5,19.5,200,0,1.2);//
676     CreateHisto2D("fnotIDVsCentralityBin","f_{notID} vs centrality bin","centrality bin","f_{notID}",21,-1.5,19.5,50,0.95,1.05);//
677     CreateHisto2D("fpTcutVsCentralityBin","f_{pTcut} vs centrality bin","centrality bin","f_{pTcut}",21,-1.5,19.5,50,0.95,1.05);
678     CreateHisto2D("fneutralVsCentralityBin","f_{neutral} vs centrality bin","centrality bin","f_{neutral}",21,-1.5,19.5,50,0.5,1.00);
679     CreateHisto2D("ConstantCorrectionsVsCentralityBin","constant corrections vs centrality bin","centrality bin","constant corrections",21,-1.5,19.5,50,0.5,1.00);
680   }
681
682   delete sTPC;
683   delete sITS;
684   delete sTPCpt;
685   delete sITSpt;
686   delete sPID;
687   delete sNoPID;
688   delete sNoPIDString;
689   delete sHadEt;
690   delete sTotEt;
691   delete sTotEtString;
692   delete sHadEtString;
693   delete sFull;
694   delete sEMCAL;
695   delete sPHOS;
696
697 }