Corrections implemented into AliAnalysisHadEtReconstructed, simulated hadronic and...
[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
28 using namespace std;
29
30 ClassImp(AliAnalysisHadEtReconstructed);
31
32
33 AliAnalysisHadEtReconstructed::AliAnalysisHadEtReconstructed() :
34         AliAnalysisHadEt()
35         ,corrections(0)
36         ,fConfigFile("ConfigHadEtAnalysis.C")
37     ,fCorrTotEtFullAcceptanceTPC(0)
38     ,fCorrTotEtFullAcceptanceITS(0)
39     ,fCorrHadEtFullAcceptanceTPC(0)
40     ,fCorrHadEtFullAcceptanceITS(0)
41     ,fCorrTotEtEMCALAcceptanceTPC(0)
42     ,fCorrTotEtEMCALAcceptanceITS(0)
43     ,fCorrHadEtEMCALAcceptanceTPC(0)
44     ,fCorrHadEtEMCALAcceptanceITS(0)
45     ,fCorrTotEtPHOSAcceptanceTPC(0)
46     ,fCorrTotEtPHOSAcceptanceITS(0)
47     ,fCorrHadEtPHOSAcceptanceTPC(0)
48     ,fCorrHadEtPHOSAcceptanceITS(0)
49     ,fCorrectedHadEtFullAcceptanceTPCNoPID(0)
50     ,fCorrectedHadEtFullAcceptanceITSNoPID(0)
51     ,fCorrectedHadEtEMCALAcceptanceTPCNoPID(0)
52     ,fCorrectedHadEtEMCALAcceptanceITSNoPID(0)
53     ,fCorrectedHadEtPHOSAcceptanceTPCNoPID(0)
54     ,fCorrectedHadEtPHOSAcceptanceITSNoPID(0)
55     ,fCorrectedHadEtFullAcceptanceTPC(0)
56     ,fCorrectedHadEtFullAcceptanceITS(0)
57     ,fCorrectedHadEtEMCALAcceptanceTPC(0)
58     ,fCorrectedHadEtEMCALAcceptanceITS(0)
59     ,fCorrectedHadEtPHOSAcceptanceTPC(0)
60     ,fCorrectedHadEtPHOSAcceptanceITS(0)
61     ,fRawEtFullAcceptanceTPC(0)
62     ,fRawEtFullAcceptanceITS(0)
63     ,fRawEtEMCALAcceptanceTPC(0)
64     ,fRawEtEMCALAcceptanceITS(0)
65     ,fRawEtPHOSAcceptanceTPC(0)
66     ,fRawEtPHOSAcceptanceITS(0)
67     ,fRawEtFullAcceptanceTPCNoPID(0)
68     ,fRawEtFullAcceptanceITSNoPID(0)
69     ,fRawEtEMCALAcceptanceTPCNoPID(0)
70     ,fRawEtEMCALAcceptanceITSNoPID(0)
71     ,fRawEtPHOSAcceptanceTPCNoPID(0)
72     ,fRawEtPHOSAcceptanceITSNoPID(0)
73 {
74
75 }
76
77 AliAnalysisHadEtReconstructed::~AliAnalysisHadEtReconstructed() 
78 {
79 }
80
81 Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
82 { // analyse ESD event
83     ResetEventValues();
84
85     AliESDEvent *realEvent = dynamic_cast<AliESDEvent*>(ev);
86     //for PID
87     AliESDpid *pID = new AliESDpid();
88     pID->MakePID(realEvent);
89
90     TString *strTPC = new TString("TPC");
91     TString *strITS = new TString("ITS");
92     TString *strTPCITS = new TString("TPCITS");
93     bool isTPC = false;
94     for(Int_t cutset=0;cutset<2;cutset++){
95       TString *cutName;
96       TObjArray* list;
97       switch(cutset){
98       case 0:
99         cutName = strTPC;
100         list = fEsdtrackCutsTPC->GetAcceptedTracks(realEvent);
101         isTPC = true;
102         break;
103       case 1:
104         cutName = strITS;
105         list = fEsdtrackCutsITS->GetAcceptedTracks(realEvent);
106         break;
107       case 2:
108         cutName = strTPCITS;
109         list = fEsdtrackCutsITSTPC->GetAcceptedTracks(realEvent);
110         break;
111       default:
112         cerr<<"Error:  cannot fill histograms!"<<endl;
113         return -1;
114       }
115       Int_t nGoodTracks = list->GetEntries();
116       //cout<<nGoodTracks<<" "<<cutName->Data()<<" tracks"<<endl;
117       for (Int_t iTrack = 0; iTrack < nGoodTracks; iTrack++)
118         {
119
120
121           AliESDtrack *track = dynamic_cast<AliESDtrack*> (list->At(iTrack));
122           if (!track)
123             {
124               Printf("ERROR: Could not get track %d", iTrack);
125               continue;
126             }
127           else{
128             if(TMath::Abs(track->Eta())>corrections->GetEtaCut()) continue;
129             Float_t nSigmaPion,nSigmaProton,nSigmaKaon,nSigmaElectron;
130             
131             if(cutset!=1){
132               nSigmaPion = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kPion));
133               nSigmaProton = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kProton));
134               nSigmaKaon = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kKaon));
135               nSigmaElectron = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kElectron));
136             }
137             else{
138               nSigmaPion = TMath::Abs(pID->NumberOfSigmasITS(track,AliPID::kPion));
139               nSigmaProton = TMath::Abs(pID->NumberOfSigmasITS(track,AliPID::kProton));
140               nSigmaKaon = TMath::Abs(pID->NumberOfSigmasITS(track,AliPID::kKaon));
141               nSigmaElectron = TMath::Abs(pID->NumberOfSigmasITS(track,AliPID::kElectron));
142             }
143             bool isPion = (nSigmaPion<3.0 && nSigmaProton>2.0 && nSigmaKaon>2.0);
144             bool isElectron = (nSigmaElectron<2.0 && nSigmaPion>4.0 && nSigmaProton>3.0 && nSigmaKaon>3.0);
145             bool isKaon = (nSigmaPion>3.0 && nSigmaProton>2.0 && nSigmaKaon<2.0);
146             bool isProton = (nSigmaPion>3.0 && nSigmaProton<2.0 && nSigmaKaon>2.0);
147
148             //bool IsElectron = false;
149             bool unidentified = (!isProton && !isKaon && !isElectron);
150             Float_t dEdx = track->GetTPCsignal();
151             if(cutset==1) dEdx = track->GetITSsignal();
152             FillHisto2D(Form("dEdxDataAll%s",cutName->Data()),track->P(),dEdx,1.0);
153
154             bool inPHOS = IsInPHOS(track);
155             bool inEMCAL = IsInEMCAL(track);
156             //if(!(corrections->GetEfficiencyPionTPC())) cerr<<"Uh-oh!  No histogram!"<<endl;
157
158             Float_t corrBkgd=0.0;
159             Float_t corrNotID=0.0;
160             Float_t corrNoID = corrections->GetNotIDCorrectionNoPID(track->Pt());
161             Float_t corrEff = 0.0;
162             Float_t corrEffNoID = 0.0;
163             if(cutset==0){//TPC
164               corrBkgd = corrections->GetBackgroundCorrectionTPC(track->Pt());
165               corrEffNoID = corrections->GetTPCEfficiencyCorrectionHadron(track->Pt());
166               corrNotID = corrections->GetNotIDCorrectionTPC(track->Pt());
167             }
168             if(cutset==1){//ITS
169               corrBkgd = corrections->GetBackgroundCorrectionITS(track->Pt());
170               //corrEffNoID = corrections->GetITSEfficiencyCorrectionHadron(track->Pt());
171               corrNotID = corrections->GetNotIDCorrectionITS(track->Pt());
172             }
173             Float_t et = 0.0;
174             Float_t etNoID = Et(track->P(),track->Theta(),fPiPlusCode,track->Charge());
175             Float_t etpartialcorrected = 0.0;
176             Float_t etpartialcorrectedNoID = corrNoID*corrBkgd*corrEffNoID*etNoID;
177             FillHisto2D(Form("EtDataRaw%sNoID",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrectedNoID);
178
179             if(isPion){
180               FillHisto2D(Form("dEdxDataPion%s",cutName->Data()),track->P(),dEdx,1.0);
181               et = Et(track->P(),track->Theta(),fPiPlusCode,track->Charge());
182               if(cutset==0){corrEff = corrections->GetTPCEfficiencyCorrectionPion(track->Pt());}
183               //else{corrEff = corrections->GetITSEfficiencyCorrectionPion(track->Pt());}
184               etpartialcorrected = et*corrBkgd*corrEff;
185               
186               if(track->Charge()>0.0){
187                 FillHisto2D(Form("EtDataRaw%sPiPlus",cutName->Data()),track->Pt(),track->Eta(),et);
188                 FillHisto2D(Form("EtDataCorrected%sPiPlus",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
189               }
190               else{
191                 FillHisto2D(Form("EtDataRaw%sPiMinus",cutName->Data()),track->Pt(),track->Eta(),et);
192                 FillHisto2D(Form("EtDataCorrected%sPiMinus",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
193               }
194             }
195             if(isKaon){
196               FillHisto2D(Form("dEdxDataKaon%s",cutName->Data()),track->P(),dEdx,1.0);
197               et = Et(track->P(),track->Theta(),fKPlusCode,track->Charge());
198               if(cutset==0){corrEff = corrections->GetTPCEfficiencyCorrectionKaon(track->Pt());}
199               //else{corrEff = corrections->GetITSEfficiencyCorrectionKaon(track->Pt());}
200               etpartialcorrected = et*corrBkgd*corrEff;
201               
202               if(track->Charge()>0.0){
203                 FillHisto2D(Form("EtDataRaw%sKPlus",cutName->Data()),track->Pt(),track->Eta(),et);
204                 FillHisto2D(Form("EtDataCorrected%sKPlus",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
205               }
206               else{
207                 FillHisto2D(Form("EtDataRaw%sKMinus",cutName->Data()),track->Pt(),track->Eta(),et);
208                 FillHisto2D(Form("EtDataCorrected%sKMinus",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
209               }
210             }
211             if(isProton){
212               FillHisto2D(Form("dEdxDataProton%s",cutName->Data()),track->P(),dEdx,1.0);
213               et = Et(track->P(),track->Theta(),fProtonCode,track->Charge());
214               if(cutset==0){corrEff = corrections->GetTPCEfficiencyCorrectionProton(track->Pt());}
215               //else{corrEff = corrections->GetITSEfficiencyCorrectionProton(track->Pt());}
216               etpartialcorrected = et*corrBkgd*corrEff;
217               
218               if(track->Charge()>0.0){
219                 FillHisto2D(Form("EtDataRaw%sProton",cutName->Data()),track->Pt(),track->Eta(),et);
220                 FillHisto2D(Form("EtDataCorrected%sProton",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
221               }
222               else{
223                 FillHisto2D(Form("EtDataRaw%sAntiProton",cutName->Data()),track->Pt(),track->Eta(),et);
224                 FillHisto2D(Form("EtDataCorrected%sAntiProton",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
225               }
226             }
227             if(isElectron){
228               FillHisto2D(Form("dEdxDataProton%s",cutName->Data()),track->P(),dEdx,1.0);
229               //et = Et(track->P(),track->Theta(),fPiPlusCode,track->Charge());
230             }
231             if(unidentified){
232               FillHisto2D(Form("dEdxDataUnidentified%s",cutName->Data()),track->P(),dEdx,1.0);
233               et = Et(track->P(),track->Theta(),fPiPlusCode,track->Charge());
234               etpartialcorrected = et*corrBkgd*corrEffNoID*corrNotID;
235               FillHisto2D(Form("EtDataCorrected%sUnidentified",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
236             }
237             if(!isTPC) etpartialcorrected = etpartialcorrectedNoID;//Not using PID for ITS
238             AddEt(et,etNoID,etpartialcorrected,etpartialcorrectedNoID,track->Pt(),isTPC,inPHOS,inEMCAL);
239             //if(inEMCAL) cout<<"I should add a track"<<endl;
240           }
241         }
242     }
243 //   cout<<"Finishing with Raw/Corrected Et in full, PHOS, EMCAL acceptance of "
244 //       << GetRawEtFullAcceptanceITS() <<"/"
245 //       << GetCorrectedHadEtFullAcceptanceITS() <<", "
246 //       << GetRawEtPHOSAcceptanceITS() <<"/"
247 //       << GetCorrectedHadEtPHOSAcceptanceITS() <<", "
248 //       << GetRawEtEMCALAcceptanceITS() <<"/"
249 //       << GetCorrectedHadEtEMCALAcceptanceITS() <<endl;
250 //   cout<<"Finishing with Raw/Corrected Et w/o PID in full, PHOS, EMCAL acceptance of "
251 //       << GetRawEtFullAcceptanceITSNoPID() <<"/"
252 //       << GetCorrectedHadEtFullAcceptanceITSNoPID() <<", "
253 //       << GetRawEtPHOSAcceptanceITSNoPID() <<"/"
254 //       << GetCorrectedHadEtPHOSAcceptanceITSNoPID() <<", "
255 //       << GetRawEtEMCALAcceptanceITSNoPID() <<"/"
256 //       << GetCorrectedHadEtEMCALAcceptanceITSNoPID() <<endl;
257 //   cout<<"Finishing with Raw/Corrected Et in full, PHOS, EMCAL acceptance of "
258 //       << GetRawEtFullAcceptanceTPC() <<"/"
259 //       << GetCorrectedHadEtFullAcceptanceTPC() <<", "
260 //       << GetRawEtPHOSAcceptanceTPC() <<"/"
261 //       << GetCorrectedHadEtPHOSAcceptanceTPC() <<", "
262 //       << GetRawEtEMCALAcceptanceTPC() <<"/"
263 //       << GetCorrectedHadEtEMCALAcceptanceTPC() <<endl;
264 //   cout<<"Finishing with Raw/Corrected Et w/o PID in full, PHOS, EMCAL acceptance of "
265 //       << GetRawEtFullAcceptanceTPCNoPID() <<"/"
266 //       << GetCorrectedHadEtFullAcceptanceTPCNoPID() <<", "
267 //       << GetRawEtPHOSAcceptanceTPCNoPID() <<"/"
268 //       << GetCorrectedHadEtPHOSAcceptanceTPCNoPID() <<", "
269 //       << GetRawEtEMCALAcceptanceTPCNoPID() <<"/"
270 //       << GetCorrectedHadEtEMCALAcceptanceTPCNoPID() <<endl;
271 //   cout<<"Correction factors "
272 //       <<fCorrTotEtFullAcceptanceTPC<<", "<<fCorrTotEtFullAcceptanceITS<<", "<<fCorrHadEtFullAcceptanceTPC<<", "<<fCorrHadEtFullAcceptanceITS<<","
273 //       <<fCorrTotEtEMCALAcceptanceTPC<<", "<<fCorrTotEtEMCALAcceptanceITS<<", "<<fCorrHadEtEMCALAcceptanceTPC<<", "<<fCorrHadEtEMCALAcceptanceITS<<","
274 //       <<fCorrTotEtPHOSAcceptanceTPC<<", "<<fCorrTotEtPHOSAcceptanceITS<<", "<<fCorrHadEtPHOSAcceptanceTPC<<", "<<fCorrHadEtPHOSAcceptanceITS<<endl;
275     return 1;
276 }
277 void AliAnalysisHadEtReconstructed::AddEt(Float_t rawEt, Float_t rawEtNoPID, Float_t corrEt, Float_t corrEtNoPID, Float_t pt, Bool_t IsTPC, Bool_t InPHOS, Bool_t InEMCAL) {
278   if(pt>=AliAnalysisHadEt::fgPtTPCCutOff && IsTPC){//TPC tracks
279     //adding to the raw Et
280     //if(InEMCAL) cout<<"Adding "<<rawEt<<" to the raw Et"<<endl;
281     fRawEtFullAcceptanceTPC += rawEt;
282     if(InPHOS)fRawEtPHOSAcceptanceTPC += rawEt;
283     if(InEMCAL)fRawEtEMCALAcceptanceTPC += rawEt;
284     fRawEtFullAcceptanceTPCNoPID += rawEtNoPID;
285     if(InPHOS)fRawEtPHOSAcceptanceTPCNoPID += rawEtNoPID;
286     if(InEMCAL)fRawEtEMCALAcceptanceTPCNoPID += rawEtNoPID;
287     //adding to the corrected Et
288     //if(InPHOS) cout<<"Adding "<<corrEt<<" to the corrected Et"<<endl;
289     fCorrectedHadEtFullAcceptanceTPC += corrEt;
290     if(InPHOS)fCorrectedHadEtPHOSAcceptanceTPC += corrEt;
291     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceTPC += corrEt;
292     fCorrectedHadEtFullAcceptanceTPCNoPID += corrEtNoPID;
293     if(InPHOS)fCorrectedHadEtPHOSAcceptanceTPCNoPID += corrEtNoPID;
294     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceTPCNoPID += corrEtNoPID;
295   }
296   if(pt<AliAnalysisHadEt::fgPtTPCCutOff &&pt>=AliAnalysisHadEt::fgPtITSCutOff && !IsTPC){//ITS tracks
297     //adding to the raw Et
298     fRawEtFullAcceptanceITS += rawEt;
299     if(InPHOS)fRawEtPHOSAcceptanceITS += rawEt;
300     if(InEMCAL)fRawEtEMCALAcceptanceITS += rawEt;
301     fRawEtFullAcceptanceITSNoPID += rawEtNoPID;
302     if(InPHOS)fRawEtPHOSAcceptanceITSNoPID += rawEtNoPID;
303     if(InEMCAL)fRawEtEMCALAcceptanceITSNoPID += rawEtNoPID;
304     //adding to the corrected Et
305     fCorrectedHadEtFullAcceptanceITS += corrEt;
306     if(InPHOS)fCorrectedHadEtPHOSAcceptanceITS += corrEt;
307     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceITS += corrEt;
308     fCorrectedHadEtFullAcceptanceITSNoPID += corrEtNoPID;
309     if(InPHOS)fCorrectedHadEtPHOSAcceptanceITSNoPID += corrEtNoPID;
310     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceITSNoPID += corrEtNoPID;
311   }
312 }
313
314 Bool_t AliAnalysisHadEtReconstructed::IsInPHOS(AliESDtrack *track){//This function will need to be elaborated on later to include PHOS dead channels
315   return   TMath::Abs(track->Eta()) < fCuts->GetGeometryPhosEtaAccCut()//in eta acceptance
316     && track->Phi()*180.0/TMath::Pi() > fCuts->GetGeometryPhosPhiAccMinCut()//greater than the minimum phi
317     && track->Phi()*180.0/TMath::Pi() < fCuts->GetGeometryPhosPhiAccMaxCut();//less than the maximum phi
318 }
319 Bool_t AliAnalysisHadEtReconstructed::IsInEMCAL(AliESDtrack *track){//This function will need to be elaborated on later to include EMCAL dead channels
320   //cout<<"Eta: |"<<track->Eta()<<"|<"<< fCuts->GetGeometryEmcalEtaAccCut() <<"; phi: "<<fCuts->GetGeometryEmcalPhiAccMinCut()<<"<"<<track->Phi()*180.0/TMath::Pi()<<"<"<<fCuts->GetGeometryEmcalPhiAccMaxCut()<<endl;
321   return   TMath::Abs(track->Eta()) < fCuts->GetGeometryEmcalEtaAccCut()//in eta acceptance
322     && track->Phi()*180.0/TMath::Pi() > fCuts->GetGeometryEmcalPhiAccMinCut()//greater than the minimum phi
323     && track->Phi()*180.0/TMath::Pi() < fCuts->GetGeometryEmcalPhiAccMaxCut();//less than the maximum phi
324 }
325 Bool_t AliAnalysisHadEtReconstructed::CheckGoodVertex(AliVParticle* track)
326 { // check vertex
327
328     Float_t bxy = 999.;
329     Float_t bz = 999.;
330     dynamic_cast<AliESDtrack*>(track)->GetImpactParametersTPC(bxy,bz);
331
332     bool status = (TMath::Abs(track->Xv()) < fCuts->GetReconstructedVertexXCut()) && 
333       (TMath::Abs(track->Yv()) < fCuts->GetReconstructedVertexYCut()) && 
334       (TMath::Abs(track->Zv()) < fCuts->GetReconstructedVertexZCut()) && 
335       (TMath::Abs(bxy) < fCuts->GetReconstructedIPxyCut()) && 
336       (TMath::Abs(bz) < fCuts->GetReconstructedIPzCut()); 
337
338     return status;
339 }
340
341 void AliAnalysisHadEtReconstructed::Init()
342 { // Init
343     AliAnalysisHadEt::Init();
344
345   if (fConfigFile.Length()) {
346     gROOT->LoadMacro(fConfigFile);
347     corrections = (AliAnalysisHadEtCorrections *) gInterpreter->ProcessLine("ConfigHadEtAnalysis()");
348     fCorrTotEtFullAcceptanceTPC = corrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"Full");
349     fCorrTotEtFullAcceptanceITS = corrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"Full");
350     fCorrHadEtFullAcceptanceTPC = corrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"Full");
351     fCorrHadEtFullAcceptanceITS = corrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"Full");
352     fCorrTotEtEMCALAcceptanceTPC = corrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"EMCAL");
353     fCorrTotEtEMCALAcceptanceITS = corrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"EMCAL");
354     fCorrHadEtEMCALAcceptanceTPC = corrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"EMCAL");
355     fCorrHadEtEMCALAcceptanceITS = corrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"EMCAL");
356     fCorrTotEtPHOSAcceptanceTPC = corrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"PHOS");
357     fCorrTotEtPHOSAcceptanceITS = corrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"PHOS");
358     fCorrHadEtPHOSAcceptanceTPC = corrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"PHOS");
359     fCorrHadEtPHOSAcceptanceITS = corrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"PHOS");
360
361   }
362 }
363
364 void AliAnalysisHadEtReconstructed::ResetEventValues(){
365   AliAnalysisHadEt::ResetEventValues();
366      fCorrectedHadEtFullAcceptanceTPCNoPID=0.0;
367      fCorrectedHadEtFullAcceptanceITSNoPID=0.0;
368      fCorrectedHadEtEMCALAcceptanceTPCNoPID=0.0;
369      fCorrectedHadEtEMCALAcceptanceITSNoPID=0.0;
370      fCorrectedHadEtPHOSAcceptanceTPCNoPID=0.0;
371      fCorrectedHadEtPHOSAcceptanceITSNoPID=0.0;
372      fCorrectedHadEtFullAcceptanceTPC=0.0;
373      fCorrectedHadEtFullAcceptanceITS=0.0;
374      fCorrectedHadEtEMCALAcceptanceTPC=0.0;
375      fCorrectedHadEtEMCALAcceptanceITS=0.0;
376      fCorrectedHadEtPHOSAcceptanceTPC=0.0;
377      fCorrectedHadEtPHOSAcceptanceITS=0.0;
378      fRawEtFullAcceptanceTPC=0.0;
379      fRawEtFullAcceptanceITS=0.0;
380      fRawEtEMCALAcceptanceTPC=0.0;
381      fRawEtEMCALAcceptanceITS=0.0;
382      fRawEtPHOSAcceptanceTPC=0.0;
383      fRawEtPHOSAcceptanceITS=0.0;
384      fRawEtFullAcceptanceTPCNoPID=0.0;
385      fRawEtFullAcceptanceITSNoPID=0.0;
386      fRawEtEMCALAcceptanceTPCNoPID=0.0;
387      fRawEtEMCALAcceptanceITSNoPID=0.0;
388      fRawEtPHOSAcceptanceTPCNoPID=0.0;
389      fRawEtPHOSAcceptanceITSNoPID=0.0;
390
391      if(TMath::Abs(fCorrTotEtFullAcceptanceTPC)<1e-3){
392        if (fConfigFile.Length()) {
393          cout<<"Rereading corrections file..."<<endl;
394          gROOT->LoadMacro(fConfigFile);
395          corrections = (AliAnalysisHadEtCorrections *) gInterpreter->ProcessLine("ConfigHadEtAnalysis()");
396          fCorrTotEtFullAcceptanceTPC = corrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"Full");
397          fCorrTotEtFullAcceptanceITS = corrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"Full");
398          fCorrHadEtFullAcceptanceTPC = corrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"Full");
399          fCorrHadEtFullAcceptanceITS = corrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"Full");
400          fCorrTotEtEMCALAcceptanceTPC = corrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"EMCAL");
401          fCorrTotEtEMCALAcceptanceITS = corrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"EMCAL");
402          fCorrHadEtEMCALAcceptanceTPC = corrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"EMCAL");
403          fCorrHadEtEMCALAcceptanceITS = corrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"EMCAL");
404          fCorrTotEtPHOSAcceptanceTPC = corrections->GetConstantCorrections(kTRUE,fgPtTPCCutOff,"PHOS");
405          fCorrTotEtPHOSAcceptanceITS = corrections->GetConstantCorrections(kTRUE,fgPtITSCutOff,"PHOS");
406          fCorrHadEtPHOSAcceptanceTPC = corrections->GetConstantCorrections(kFALSE,fgPtTPCCutOff,"PHOS");
407          fCorrHadEtPHOSAcceptanceITS = corrections->GetConstantCorrections(kFALSE,fgPtITSCutOff,"PHOS");
408        }
409        else{cerr<<"Uh-oh!  Unable to open configuration file!"<<endl;}
410      }
411
412 }
413 void AliAnalysisHadEtReconstructed::CreateHistograms(){
414
415   TString *strTPC = new TString("TPC");
416   TString *strITS = new TString("ITS");
417   TString *strTPCITS = new TString("TPCITS");
418   for(Int_t i=0;i<2;i++){
419     TString *cutName;
420     Float_t maxPtdEdx = 10;
421     Float_t mindEdx = 35;
422     Float_t maxdEdx = 150.0;
423     switch(i){
424     case 0:
425       cutName = strTPC;
426       break;
427     case 1:
428       cutName = strITS;
429       maxPtdEdx = 5;
430       maxdEdx = 500.0;
431       break;
432     case 2:
433       cutName = strTPCITS;
434       break;
435     default:
436       cerr<<"Error:  cannot make histograms!"<<endl;
437       return;
438     }
439
440     CreateEtaPtHisto2D(Form("EtDataRaw%sPiPlus",cutName->Data()),"Raw reconstructed E_{T} from identified #pi^{+}");
441     CreateEtaPtHisto2D(Form("EtDataRaw%sPiMinus",cutName->Data()),"Raw reconstructed E_{T} from identified #pi^{-}");
442     CreateEtaPtHisto2D(Form("EtDataRaw%sKPlus",cutName->Data()),"Raw reconstructed E_{T} from identified K^{+}");
443 //     CreateEtaPtHisto2D(Form("EtDataRaw%sEMinus",cutName->Data()),"Raw reconstructed E_{T} from identified e^{-}");
444 //     CreateEtaPtHisto2D(Form("EtDataRaw%sEPlus",cutName->Data()),"Raw reconstructed E_{T} from identified e^{+}");
445     CreateEtaPtHisto2D(Form("EtDataRaw%sKMinus",cutName->Data()),"Raw reconstructed E_{T} from identified K^{-}");
446     CreateEtaPtHisto2D(Form("EtDataRaw%sProton",cutName->Data()),"Raw reconstructed E_{T} from identified p");
447     CreateEtaPtHisto2D(Form("EtDataRaw%sAntiProton",cutName->Data()),"Raw reconstructed E_{T} from identified #bar{p}");
448     CreateEtaPtHisto2D(Form("EtDataRaw%sUnidentified",cutName->Data()),"Raw reconstructed E_{T} from unidentified particles using real mass");
449     CreateEtaPtHisto2D(Form("EtDataRaw%sNoID",cutName->Data()),"Raw reconstructed E_{T} from unidentified particles using real mass");
450
451     CreateEtaPtHisto2D(Form("EtDataCorrected%sPiPlus",cutName->Data()),"Corrected reconstructed E_{T} from identified #pi^{+}");
452     CreateEtaPtHisto2D(Form("EtDataCorrected%sPiMinus",cutName->Data()),"Corrected reconstructed E_{T} from identified #pi^{-}");
453     CreateEtaPtHisto2D(Form("EtDataCorrected%sKPlus",cutName->Data()),"Corrected reconstructed E_{T} from identified K^{+}");
454 //     CreateEtaPtHisto2D(Form("EtDataCorrected%sEMinus",cutName->Data()),"Corrected reconstructed E_{T} from identified e^{-}");
455 //     CreateEtaPtHisto2D(Form("EtDataCorrected%sEPlus",cutName->Data()),"Corrected reconstructed E_{T} from identified e^{+}");
456     CreateEtaPtHisto2D(Form("EtDataCorrected%sKMinus",cutName->Data()),"Corrected reconstructed E_{T} from identified K^{-}");
457     CreateEtaPtHisto2D(Form("EtDataCorrected%sProton",cutName->Data()),"Corrected reconstructed E_{T} from identified p");
458     CreateEtaPtHisto2D(Form("EtDataCorrected%sAntiProton",cutName->Data()),"Corrected reconstructed E_{T} from identified #bar{p}");
459     CreateEtaPtHisto2D(Form("EtDataCorrected%sUnidentified",cutName->Data()),"Corrected reconstructed E_{T} from unidentified particles using real mass");
460     CreateEtaPtHisto2D(Form("EtDataCorrected%sNoID",cutName->Data()),"Corrected reconstructed E_{T} from unidentified particles using real mass");
461
462
463     CreateEtaPtHisto2D(Form("EtNData%sPiPlus",cutName->Data()),"Number of reconstructed #pi^{+}");
464     CreateEtaPtHisto2D(Form("EtNData%sPiMinus",cutName->Data()),"Number of reconstructed #pi^{-}");
465     CreateEtaPtHisto2D(Form("EtNData%sKPlus",cutName->Data()),"Number of reconstructed K^{+}");
466     CreateEtaPtHisto2D(Form("EtNData%sKMinus",cutName->Data()),"Number of reconstructed K^{-}");
467     CreateEtaPtHisto2D(Form("EtNData%sProton",cutName->Data()),"Number of reconstructed p");
468     CreateEtaPtHisto2D(Form("EtNData%sAntiProton",cutName->Data()),"Number of reconstructed #bar{p}");
469     CreateEtaPtHisto2D(Form("EtNData%sUnidentified",cutName->Data()),"Number of Reconstructed unidentified particles");
470
471     CreateHisto2D(Form("dEdxDataAll%s",cutName->Data()),"dE/dx for all particles","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
472     CreateHisto2D(Form("dEdxDataPion%s",cutName->Data()),"dE/dx for #pi^{#pm}","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
473     CreateHisto2D(Form("dEdxDataKaon%s",cutName->Data()),"dE/dx for K^{#pm}","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
474     CreateHisto2D(Form("dEdxDataProton%s",cutName->Data()),"dE/dx for p(#bar{p})","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
475     CreateHisto2D(Form("dEdxDataElectron%s",cutName->Data()),"dE/dx for e^{#pm}","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
476     CreateHisto2D(Form("dEdxDataUnidentified%s",cutName->Data()),"dE/dx for unidentified particles","momentum (GeV/c)","dE/dx",400,0.0,maxPtdEdx,200,mindEdx,maxdEdx);
477   }
478 }