]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtAnalysisPbPbAOD.h
eventplane determination changed, subtract the current track from the eventplane...
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / ChargedHadrons / dNdPt / AlidNdPtAnalysisPbPbAOD.h
CommitLineData
d25bcbe6 1#ifndef AlidNdPtAnalysisPbPbAOD_H
2#define AlidNdPtAnalysisPbPbAOD_H
3
4
5//------------------------------------------------------------------------------
6// AlidNdPtAnalysisPbPbAOD class used for dNdPt analysis in PbPb collision
7// via AODs
8//
9// Author: P. Luettig, 15.05.2013
ab1375ce 10// last modified: 10.06.2014
d25bcbe6 11//------------------------------------------------------------------------------
12
d25bcbe6 13
d25bcbe6 14
8a4ab847 15class iostream;
d25bcbe6 16
8a4ab847 17#include "AliAnalysisTaskSE.h"
18#include "TObject.h"
d25bcbe6 19#include "TList.h"
20#include "TFile.h"
21#include "TH1.h"
22#include "TH2.h"
23#include "TH3.h"
24#include "THnSparse.h"
72bb4ceb 25#include "THn.h"
d25bcbe6 26#include "TClonesArray.h"
0d3e3f7e 27#include "TString.h"
ab1375ce 28#include "TProfile.h"
3b07fd51 29#include "TVector2.h"
d25bcbe6 30
31#include "TParticlePDG.h"
32#include "TDatabasePDG.h"
33
34#include "AliLog.h"
35#include "AliCentrality.h"
36#include "AliAODEvent.h"
37#include "AliVEvent.h"
38
39#include "AliInputEventHandler.h"
40#include "AliAODInputHandler.h"
41#include "AliAnalysisManager.h"
42#include "AliMCEventHandler.h"
43#include "AliAODMCHeader.h"
44#include "AliAODMCParticle.h"
45#include "AliGenHijingEventHeader.h"
46#include "AliGenPythiaEventHeader.h"
d0483ba3 47#include "AliExternalTrackParam.h"
ea3cfeda 48#include "AliESDtrack.h"
bc80e684 49#include "AliEventplane.h"
d25bcbe6 50
51#include "TSystem.h"
52#include "TROOT.h"
53
54class AlidNdPtAnalysisPbPbAOD : public AliAnalysisTaskSE {
55 public :
bc80e684 56 enum CheckQuantity { cqCrossedRows = 0, cqNcluster = 1, cqChi = 2, cqLength = 3, cqRowsOverFindable = 4 };
72bb4ceb 57 enum KinematicQuantity { kqPt = 0, kqEta = 1, kqPhi = 2 };
bc80e684 58 enum MaxCheckQuantity { cqMax = 5 };
72bb4ceb 59 enum MaxKinematicQuantity { kqMax = 3 };
60
ea3cfeda 61 AlidNdPtAnalysisPbPbAOD(const char *name = "dNdPtPbPbAOD");
d25bcbe6 62 ~AlidNdPtAnalysisPbPbAOD();
63
64 virtual void UserCreateOutputObjects();
65 virtual void UserExec(Option_t *option);
66 virtual void Terminate(Option_t *);
67
68 // Set binning for Histograms (if not set default binning is used)
a0036e80 69 void SetBinsMult(Int_t nbins, Double_t* edges) { Printf("[I] Setting Mult Bins"); fMultNbins = nbins; fBinsMult = GetArrayClone(nbins,edges); }
70 void SetBinsPt(Int_t nbins, Double_t* edges) { Printf("[I] Setting pT Bins"); fPtNbins = nbins; fBinsPt = GetArrayClone(nbins,edges); }
3dd0b8f4 71 void SetBinsPtCorr(Int_t nbins, Double_t* edges) { Printf("[I] Setting pTcorr Bins"); fPtCorrNbins = nbins; fBinsPtCorr = GetArrayClone(nbins,edges); }
72 void SetBinsPtCheck(Int_t nbins, Double_t* edges) { Printf("[I] Setting pTcheck Bins"); fPtCheckNbins = nbins; fBinsPtCheck = GetArrayClone(nbins,edges); }
a0036e80 73 void SetBinsEta(Int_t nbins, Double_t* edges) { Printf("[I] Setting Eta Bins"); fEtaNbins = nbins; fBinsEta = GetArrayClone(nbins,edges); }
3dd0b8f4 74 void SetBinsEtaCheck(Int_t nbins, Double_t* edges) { Printf("[I] Setting EtaCheck Bins"); fEtaCheckNbins = nbins; fBinsEtaCheck = GetArrayClone(nbins,edges); }
a0036e80 75 void SetBinsZv(Int_t nbins, Double_t* edges) { Printf("[I] Setting Zv Bins"); fZvNbins = nbins; fBinsZv= GetArrayClone(nbins,edges); }
3dd0b8f4 76 void SetBinsCentrality(Int_t nbins, Double_t* edges) { Printf("[I] Setting Cent Bins"); fCentralityNbins = nbins; fBinsCentrality = GetArrayClone(nbins,edges); }
a0036e80 77 void SetBinsPhi(Int_t nbins, Double_t* edges) { Printf("[I] Setting Phi Bins"); fPhiNbins = nbins; fBinsPhi = GetArrayClone(nbins,edges); }
d25bcbe6 78
79 // set event cut variables
3dd0b8f4 80 void SetCutMaxZVertex( Double_t d) { fCutMaxZVertex = d; }
81 Double_t GetCutMaxZVertex() { return fCutMaxZVertex; }
d25bcbe6 82
83 // set track kinematic cut parameters
3dd0b8f4 84 void SetCutPtRange(Double_t ptmin, Double_t ptmax) { fCutPtMin = ptmin; fCutPtMax = ptmax; }
85 Double_t GetCutPtMin() { return fCutPtMin; }
86 Double_t GetCutPtMax() { return fCutPtMax; }
ea3cfeda 87
3dd0b8f4 88 void SetCutEtaRange(Double_t etamin, Double_t etamax) { fCutEtaMin = etamin; fCutEtaMax = etamax; }
89 Double_t GetCutEtaMin() { return fCutEtaMin; }
90 Double_t GetCutEtaMax() { return fCutEtaMax; }
ea3cfeda 91
3dd0b8f4 92 void EnableRelativeCuts() { Printf("[I] Relative Cuts enabled"); fUseRelativeCuts = kTRUE; }
93 Bool_t AreRelativeCutsEnabled() { return fUseRelativeCuts; }
ea3cfeda
PL
94
95 // setter and getter track quality cut parameters
3dd0b8f4 96 void SetFilterBit(Int_t b) { fFilterBit = b; };
97 Int_t GetFilterBit() { return fFilterBit; }
a0036e80 98
3dd0b8f4 99 void SetCutRequireTPCRefit(Bool_t *b) { fCutRequireTPCRefit = b; }
100 Bool_t IsTPCRefitRequired() { return fCutRequireTPCRefit; }
ea3cfeda 101
3dd0b8f4 102 void SetCutRequireITSRefit(Bool_t *b) { fCutRequireITSRefit = b; }
103 Bool_t IsITSRefitRequired() { return fCutRequireITSRefit; }
a0036e80 104
3dd0b8f4 105 void SetCutMinNClustersTPC(Double_t d) { fCutMinNumberOfClusters = d; }
106 Double_t GetCutMinNClustersTPC() { return fCutMinNumberOfClusters; }
ea3cfeda
PL
107
108 void SetCutPercMinNClustersTPC(Double_t d) { Printf("[I] Take only %.2f%% tracks with most clusters", d*100.); fCutPercMinNumberOfClusters = d; }
3dd0b8f4 109 Double_t GetCutPercMinNClustersTPC() { return fCutPercMinNumberOfClusters; }
ea3cfeda
PL
110
111 void SetCutMinNCrossedRowsTPC(Double_t d) { fCutMinNumberOfCrossedRows = d; }
3dd0b8f4 112 Double_t GetCutMinNCrossedRowsTPC() { return fCutMinNumberOfCrossedRows; }
ea3cfeda
PL
113
114 void SetCutPercMinNCrossedRowsTPC(Double_t d) { Printf("[I] Take only %.2f%% tracks with most crossedRows", d*100.); fCutPercMinNumberOfCrossedRows = d; }
3dd0b8f4 115 Double_t GetCutPercMinNCrossedRowsTPC() { return fCutPercMinNumberOfCrossedRows; }
ea3cfeda
PL
116
117 void SetCutMinRatioCrossedRowsOverFindableClustersTPC(Double_t d) { fCutMinRatioCrossedRowsOverFindableClustersTPC = d; }
3dd0b8f4 118 Double_t GetCutMinRatioCrossedRowsOverFindableClustersTPC() { return fCutMinRatioCrossedRowsOverFindableClustersTPC; }
ea3cfeda 119
bc80e684 120 void SetCutLengthInTPCPtDependent(Bool_t b) { fCutLengthInTPCPtDependent = b; }
3dd0b8f4 121 Bool_t DoCutLengthInTPCPtDependent() { return fCutLengthInTPCPtDependent; }
ea3cfeda 122
3dd0b8f4 123 void SetPrefactorLengthInTPCPtDependent(Double_t d) { fPrefactorLengthInTPCPtDependent = d; }
ea3cfeda
PL
124 Double_t GetPrefactorLengthInTPCPtDependent() { return fPrefactorLengthInTPCPtDependent; }
125
126 void SetCutMaxChi2PerClusterTPC(Double_t d) { fCutMaxChi2PerClusterTPC = d; }
3dd0b8f4 127 void SetCutMaxFractionSharedTPCClusters(Double_t d) { fCutMaxFractionSharedTPCClusters = d; }
128 void SetCutMaxDCAToVertexZ(Double_t d) { fCutMaxDCAToVertexZ = d; }
ea3cfeda 129 void SetCutMaxDCAToVertexXY(Double_t d) { fCutMaxDCAToVertexXY = d; }
ea3cfeda 130 void SetCutMaxChi2PerClusterITS(Double_t d) { fCutMaxChi2PerClusterITS = d; }
3dd0b8f4 131 void SetCutDCAToVertex2D(Bool_t *b) { fCutDCAToVertex2D = b; }
ea3cfeda 132 void SetCutRequireSigmaToVertex(Bool_t *b) { fCutRequireSigmaToVertex = b; }
d25bcbe6 133 void SetCutMaxDCAToVertexXYPtDep(Double_t d0, Double_t d1, Double_t d2)
134 {
ea3cfeda
PL
135 fCutMaxDCAToVertexXYPtDepPar0 = d0;
136 fCutMaxDCAToVertexXYPtDepPar1 = d1;
137 fCutMaxDCAToVertexXYPtDepPar2 = d2;
d25bcbe6 138 }
ea3cfeda 139 void SetCutAcceptKinkDaughters(Bool_t *b) { fCutAcceptKinkDaughters = b; }
3dd0b8f4 140 void SetCutMaxChi2TPCConstrainedGlobal(Double_t d) { fCutMaxChi2TPCConstrainedGlobal = d; }
ea3cfeda 141
72bb4ceb 142 // fill function for cross check histos
143 Bool_t FillDebugHisto(Double_t *dCrossCheckVar, Double_t *dKineVar, Double_t dCentrality, Bool_t bIsAccepted);
144
8a4ab847 145 // fill function for cut settings
146 void StoreCutSettingsToHistogram();
147
d0483ba3 148 // getter for DCA
b3341d37 149 Bool_t GetDCA(const AliAODTrack *track, AliAODEvent *evt, Double_t d0z0[2]);
d0483ba3 150
8a4ab847 151 THnSparseF * GetHistZvPtEtaCent() const { return fZvPtEtaCent; }
152 TH1F * GetHistEventStatistics() const { return fEventStatistics; }
d25bcbe6 153
154 const char * GetParticleName(Int_t pdg);
155
156 AliGenHijingEventHeader* GetHijingEventHeader(AliAODMCHeader *header);
157 AliGenPythiaEventHeader* GetPythiaEventHeader(AliAODMCHeader *header);
158
1444967d 159 Double_t RotatePhi(Double_t phiTrack, Double_t phiEP);
0d3e3f7e 160 Double_t MoveEventplane(Double_t dMCEP);
ea3cfeda
PL
161
162 Bool_t SetRelativeCuts(AliAODEvent *event);
163
164 Bool_t IsTrackAccepted(AliAODTrack *tr, Double_t dCentrality, Double_t bMagZ);
d25bcbe6 165 Bool_t IsMCTrackAccepted(AliAODMCParticle *part);
166
167 Bool_t IsHijingParticle(const AliAODMCParticle *part, AliGenHijingEventHeader* hijingGenHeader);
168 Bool_t IsPythiaParticle(const AliAODMCParticle *part, AliGenPythiaEventHeader* pythiaGenHeader);
169
170 static Double_t* GetArrayClone(Int_t n, Double_t* source);
0d3e3f7e 171
172 void SetEventplaneSelector(char *c) { fEPselector = c; }
173 TString GetEventplaneSelector() { return fEPselector; }
d25bcbe6 174
175 private :
176
177 // Output List
3dd0b8f4 178 TList *fOutputList;
d25bcbe6 179
180 // Histograms
3dd0b8f4 181 TH1F *fPt; // simple pT histogramm
182 TH1F *fMCPt; // simple pT truth histogramm
ea3cfeda 183 THnSparseF *fZvPtEtaCent; //-> Zv:Pt:Eta:Cent
bc80e684 184 THnSparseF *fDeltaphiPtEtaCent; //-> Phi:Pt:Eta:Cent
a0036e80 185 THnSparseF *fPtResptCent; //-> 1/pt:ResolutionPt:Cent
ea3cfeda
PL
186 THnSparseF *fMCRecPrimZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent
187 THnSparseF *fMCGenZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent
188 THnSparseF *fMCRecSecZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent, only secondaries
bc80e684 189 THnSparseF *fMCRecPrimDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent
190 THnSparseF *fMCGenDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent
191 THnSparseF *fMCRecSecDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent, only secondaries
3dd0b8f4 192 TH1F *fEventStatistics; // contains statistics of number of events after each cut
8a4ab847 193 TH1F *fEventStatisticsCentrality; // contains number of events vs centrality, events need to have a track in kinematic range
3dd0b8f4 194 TH1F *fMCEventStatisticsCentrality; // contains MC number of events vs centrality, events need to have a track in kinematic range
195 TH1F *fAllEventStatisticsCentrality; // contains number of events vs centrality, events need to be triggered
196 TH2F *fEventStatisticsCentralityTrigger; // contains number of events vs centrality in 1% bins vs trigger
ea3cfeda 197 THnSparseF *fZvMultCent; // Zv:Mult:Cent
3dd0b8f4 198 TH1F *fTriggerStatistics; // contains number of events per trigger
199 TH1F *fCharge; // charge distribution in data
200 TH1F *fMCCharge; // charge distribution in MC
ea3cfeda
PL
201 THnSparseF *fDCAPtAll; //control histo: DCAz:DCAxy:pT:eta:phi for all reconstructed tracks
202 THnSparseF *fDCAPtAccepted; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco tracks
203 THnSparseF *fMCDCAPtSecondary; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco track, which are secondaries (using MC info)
204 THnSparseF *fMCDCAPtPrimary; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco track, which are primaries (using MC info)
bc80e684 205 THnF *fCrossCheckAll[5]; //control histo: {CrossedRows,Ncluster,Chi,Length,CrossedRows/Findable} vs pT,eta,phi,Centrality for all tracks
206 THnF *fCrossCheckAcc[5]; //control histo: {CrossedRows,Ncluster,Chi,Length,CrossedRows/Findable} vs pT,eta,phi,Centrality after cuts
3dd0b8f4 207 TH1F *fCutPercClusters; // control histo: number of clusters, where the relative cut has been set e-by-e
208 TH1F *fCutPercCrossed; // control histo: number of crossed rows, where the relative cut has been set e-by-e
209 TH2F *fCrossCheckRowsLength; // control histo: number of crossed rows vs length in TPC
210 TH2F *fCrossCheckClusterLength; // control histo: number of clusters vs length in TPC
211 TH2F *fCrossCheckRowsLengthAcc; // control histo: number of crossed rows vs length in TPC for all accepted tracks
212 TH2F *fCrossCheckClusterLengthAcc; // control histo: number of clusters vs length in TPC for all accepted tracks
8a4ab847 213 TH1F *fCutSettings; // control histo: cut settings
72bb4ceb 214
bc80e684 215 TH1F *fEventplaneDist; // event plane distribution in phi
216 TH1F *fMCEventplaneDist; // MC event plane distribution in phi
1444967d 217 TH2F *fCorrelEventplaneMCDATA; // correlation between data and MC eventplane
ab1375ce 218
219 // cross check for event plane resolution
220 TH2F *fEPDistCent; // event plane distribution vs centrality
221 TH2F *fPhiCent; // particle phi distribution vs centrality
222 TProfile *fPcosEPCent; // < cos 2 psi_ep > vs centrality
223 TProfile *fPsinEPCent; // < sin 2 psi_ep > vs centrality
224 TProfile *fPcosPhiCent; // < cos 2 phi > vs centrality
225 TProfile *fPsinPhiCent; // < sin 2 phi > vs centrality
226
227 // global variables
ea3cfeda 228 Bool_t fIsMonteCarlo;
0d3e3f7e 229
230 TString fEPselector;
72bb4ceb 231
d25bcbe6 232 // event cut variables
ea3cfeda 233 Double_t fCutMaxZVertex;
d25bcbe6 234
235 // track kinematic cut variables
ea3cfeda
PL
236 Double_t fCutPtMin;
237 Double_t fCutPtMax;
238 Double_t fCutEtaMin;
239 Double_t fCutEtaMax;
d25bcbe6 240
241 // track quality cut variables
3dd0b8f4 242 Int_t fFilterBit;
243 Bool_t fUseRelativeCuts;
244 Bool_t fCutRequireTPCRefit;
245 Bool_t fCutRequireITSRefit;
ea3cfeda
PL
246 Double_t fCutMinNumberOfClusters;
247 Double_t fCutPercMinNumberOfClusters;
248 Double_t fCutMinNumberOfCrossedRows;
249 Double_t fCutPercMinNumberOfCrossedRows;
250 Double_t fCutMinRatioCrossedRowsOverFindableClustersTPC;
251 Double_t fCutMaxChi2PerClusterTPC;
252 Double_t fCutMaxFractionSharedTPCClusters;
253 Double_t fCutMaxDCAToVertexZ;
254 Double_t fCutMaxDCAToVertexXY;
ea3cfeda 255 Double_t fCutMaxChi2PerClusterITS;
8a4ab847 256 Bool_t fCutDCAToVertex2D;
3dd0b8f4 257 Bool_t fCutRequireSigmaToVertex;
ea3cfeda
PL
258 Double_t fCutMaxDCAToVertexXYPtDepPar0;
259 Double_t fCutMaxDCAToVertexXYPtDepPar1;
260 Double_t fCutMaxDCAToVertexXYPtDepPar2;
3dd0b8f4 261 Bool_t fCutAcceptKinkDaughters;
ea3cfeda 262 Double_t fCutMaxChi2TPCConstrainedGlobal;
3dd0b8f4 263 Bool_t fCutLengthInTPCPtDependent;
ea3cfeda 264 Double_t fPrefactorLengthInTPCPtDependent;
d25bcbe6 265
266 //binning for THNsparse
3dd0b8f4 267 Int_t fMultNbins;
268 Int_t fPtNbins;
269 Int_t fPtCorrNbins;
270 Int_t fPtCheckNbins;
271 Int_t fEtaNbins;
272 Int_t fEtaCheckNbins;
273 Int_t fZvNbins;
274 Int_t fCentralityNbins;
275 Int_t fPhiNbins;
276 Double_t* fBinsMult; //[fMultNbins]
277 Double_t* fBinsPt; //[fPtNbins]
278 Double_t* fBinsPtCorr; //[fPtCorrNbins]
279 Double_t* fBinsPtCheck; //[fPtCheckNbins]
280 Double_t* fBinsEta; //[fEtaNbins]
281 Double_t* fBinsEtaCheck; //[fEtaCheckNbins]
282 Double_t* fBinsZv; //[fZvNbins]
283 Double_t* fBinsCentrality; //[fCentralityNbins]
284 Double_t* fBinsPhi; //[fPhiNbins]
d25bcbe6 285
286 AlidNdPtAnalysisPbPbAOD(const AlidNdPtAnalysisPbPbAOD&); // not implemented
287 AlidNdPtAnalysisPbPbAOD& operator=(const AlidNdPtAnalysisPbPbAOD&); // not implemented
288
0d3e3f7e 289 ClassDef(AlidNdPtAnalysisPbPbAOD,8); // has to be at least 1, otherwise not streamable...
d25bcbe6 290};
291
292#endif