changed Resolution, Material, and PhotonQA task to be able to run on the grid
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskPi0v2.h
CommitLineData
f7cf81bd 1#ifndef AliAnalysisTaskPi0v2_cxx
2#define AliAnalysisTaskPi0v2_cxx
3
4#include "AliAnalysisTaskSE.h"
5#include "TH1.h"
6#include "TH2.h"
7#include "TH3.h"
0a2b2b4b 8#include "THnSparse.h"
f7cf81bd 9#include "AliLog.h"
10#include "AliConversionSelection.h"
ca91a3e1 11#include "AliConversionMesonCuts.h"
f7cf81bd 12#include "AliV0ReaderV1.h"
13#include "AliEventplane.h"
14#include "TVector2.h"
15
16#include "TProfile.h"
17using namespace std;
18
19class AliAnalysisTaskPi0v2 : public AliAnalysisTaskSE{
20
21public:
22
23 enum EEventPlaneMethod{
24 kTPC=0,
25 kTPCEtaGap=1,
26 kV0A=2,
27 kV0C=3,
28 knEPMethod=4
29 };
30
e5b6e8a6 31 enum EEventPlane{
32 kEPTPC=0,
33 kEPTPCEtaA,
34 kEPTPCEtaC,
35 kEPV0A,
36 kEPV0C,
37 knEP
38 };
39
f7cf81bd 40 enum EPDGCode{
41 kPi0=111,
42 kEta=221
43 };
44
45 static const Int_t knBinsPhi=6;
33bf9167 46 static const Int_t knCentMax=10;
47 static const Int_t knFlatPeriod=2;
f7cf81bd 48
1d9e6011 49 AliAnalysisTaskPi0v2(const char *name="pi0v2",Int_t harmonic=2);
f7cf81bd 50 virtual ~AliAnalysisTaskPi0v2();
51
52 virtual void UserCreateOutputObjects();
53 virtual void UserExec(Option_t *option);
54 virtual void Terminate(Option_t *);
55
56 void SetCentralityBins(Double_t *bins,Int_t nbins);
f7cf81bd 57
58 void SetMeson(EPDGCode meson){fMesonPDGCode=meson;}
59
60 void SetNBinsPhi(Int_t nbins){fNBinsPhi=nbins;}
61 void SetV0Reader(AliV0ReaderV1 *v0Reader){fV0Reader=v0Reader;}
62 void SetInvMassRange(Double_t range[2]){fInvMassRange[0]=range[0];fInvMassRange[1]=range[1];};
63 void SetEtaGap(Double_t gapsize){fEtaGap=gapsize;};
64
e5b6e8a6 65 void SetCuts(AliConversionSelection **conversionselection,Int_t numberOfCuts);
f7cf81bd 66
ca91a3e1 67 void SetFillQA(Bool_t fill){fFillQA=fill;}
f7cf81bd 68
e5b6e8a6 69 void SetEPSelectionMask(Int_t mask[knEPMethod]){for(Int_t ii=0;ii<knEPMethod;ii++)fEPSelectionMask[ii]=mask[ii];};
70
33bf9167 71 void SetFlatteningCoeff(EEventPlane ep,Int_t period,Int_t nCent,Double_t *cc2,Double_t *cs2,Double_t *cc4,Double_t *cs4);
72
73 Int_t GetPeriodIndex(TString period);
74 Int_t GetHarmonic(){return fHarmonic;};
75
f7cf81bd 76private:
70f90d01 77
78 AliAnalysisTaskPi0v2(const AliAnalysisTaskPi0v2&);// private::prevent use of copy constructor
79 AliAnalysisTaskPi0v2& operator=(const AliAnalysisTaskPi0v2&); // private::prevent use of assignment operator
80
f7cf81bd 81 Bool_t InitEvent();
82
83 void ProcessGammas(Int_t iCut,EEventPlaneMethod iEP);
84 void ProcessPi0s(Int_t iCut,EEventPlaneMethod iEP);
85 void ProcessQA();
86
e5b6e8a6 87 Double_t GetPhiwrtRP(Double_t dPhi);
88 Double_t GetPhotonPhiwrtRP(AliAODConversionPhoton *gamma,EEventPlaneMethod iEP,Bool_t bDoFlattening=kTRUE);
89 Double_t GetPi0PhiwrtRP(AliAODConversionMother *pi0,EEventPlaneMethod iEP,Bool_t bDoFlattening=kTRUE);
90 Double_t GetChargedPhiwrtRP(AliVTrack *charged,EEventPlaneMethod iEP,Bool_t bDoFlattening=kTRUE);
f7cf81bd 91 void GetPhotondNdPhi(Int_t *dNdPhi,Int_t iEP,Int_t iCut=0);
92 void GetChargeddNdPhi(Int_t *dNdPhi,Int_t &ntot,Int_t iEP);
93 Int_t GetPhiBin(Double_t phiwrt);
94 Int_t GetPhotonPhiBin(AliAODConversionPhoton *gamma,Int_t iEP);
e5b6e8a6 95 Double_t GetMCPhotonPhiwrtRP(TParticle *gamma,EEventPlaneMethod iEP,Bool_t bDoFlattening=kTRUE);
f7cf81bd 96 TVector2 GetEPContribution(AliAODConversionPhoton *gamma);
e5b6e8a6 97 Double_t GetEventPlaneAngle(EEventPlaneMethod EPmethod,Double_t eta=0,AliAODConversionPhoton *gamma0=NULL,AliAODConversionPhoton *gamma1=NULL,Bool_t bDoFlattening=kTRUE);
98 Double_t GetTPCSubEPEta(EEventPlane ep);
99 Double_t GetCorrectedTPCEPAngle(AliAODConversionPhoton *gamma0=NULL,AliAODConversionPhoton *gamma1=NULL,Bool_t bDoFlattening=kTRUE);
f7cf81bd 100 Bool_t SetCentrality();
101 void ProcessEventPlane();
102 Int_t GetRadialBin(Double_t radius);
103 Int_t GetRunIndex(Int_t run);
e5b6e8a6 104 Double_t ApplyFlattening(Double_t phi,EEventPlane ep);
105 Bool_t GetTPCEventPlane();
f7cf81bd 106
e5b6e8a6 107 void GetV0EP(AliVEvent * event,Double_t &rpv0a,Double_t &rpv0c);
1d9e6011 108 void LoadVZEROCalibration(Int_t run);
109 void LoadTPCCalibration(Int_t run);
110
e5b6e8a6 111 Double_t GetWeight(TObject* track1);
112 Double_t GetPhiWeight(TObject* track1);
113 TH1F* SelectPhiDist(AliVTrack *track);
f7cf81bd 114
e5b6e8a6 115 Double_t GetPsiInRange(Double_t phi);
f7cf81bd 116
e5b6e8a6 117 TObjArray* GetEventPlaneTracks(Int_t &maxID);
118 TVector2 GetContributionEP(AliVTrack *track);
119 Int_t GetAODEPTrackFilterBit();
33bf9167 120
f7cf81bd 121 // Constants
122
ca91a3e1 123 enum Ebinsgamma{
124 kGammaPt=0,
125 kGammadPhi,
126 kGammaCent,
127 kGammaEPM,
128 knbinsGamma
129 };
130
131 enum Ebinspi0{
132 kPi0Pt=0,
133 kPi0Mass,
134 kPi0dPhi,
135 kPi0Cent,
136 kPi0EPM,
137 knbinsPi0
138 };
f7cf81bd 139
a280ac15 140 enum EEventSelection{
141 kEventIn=1,
142 kEventSelV0Reader,
143 kEventCentrality,
144 kEventRun,
145 kEventNoTPCEP,
146 kEventProcessEvent,
147 kEventSelected
148 };
149
150
ca91a3e1 151 static const Int_t knbinsGammaMult=3;
152
f7cf81bd 153 static const Int_t kGCnYBinsSpectra = 80;
a91370e6 154 static const Double_t kGCfirstYBinSpectra;
155 static const Double_t kGClastYBinSpectra;
f7cf81bd 156
157 // Class variables and pointer
158
159 AliV0ReaderV1 *fV0Reader; // V0Reader
1d9e6011 160 Int_t fNCuts; // Number of Photon Cuts for v2 analysis
161 AliConversionSelection **fConversionSelection; //[fNCuts] Selection of Particles for given Cut
70f90d01 162 TClonesArray *fConversionGammas; //! Reconstructed Photons;
f7cf81bd 163 Int_t fNCentralityBins; // Number of Centrality Bins
33bf9167 164 Double_t fCentralityBins[knCentMax]; // CentralityBins for Analysis
70f90d01 165 Float_t fCentrality; //! Event Centrality
166 Int_t fCentralityBin; //! Event Centrality Bin
f7cf81bd 167 Int_t fNBinsPhi; // Number of Phi wrt RP bins
70f90d01 168 AliEventplane *fEP; //! Event Plane Pointer
e5b6e8a6 169 Bool_t fUseTPCOnlyTracks; // Use TPC Only Tracks for EP
f7cf81bd 170 Double_t fEtaMax; // Eta Max for analysis;
171 Double_t fEtaGap; // Eta Gap
70f90d01 172 Double_t fRPTPCEtaA; //! TPCEtaA event plane
173 Double_t fRPTPCEtaC; //! TPCEtaC event plane
174 Double_t fRPV0A; //! V0A event plane
175 Double_t fRPV0C; //! V0C event plane
176 Double_t fRPTPC; //! TPC event plane
177 Double_t fRPTPCEtaABF; //! TPCEtaA event plane before flattening
178 Double_t fRPTPCEtaCBF; //! TPCEtaC event plane before flattening
179 Double_t fRPV0ABF;//! V0A event plane before flattening
180 Double_t fRPV0CBF;//! V0C event plane before flattening
181 Double_t fRPTPCBF;//! TPC event plane before flattening
182 AliConversionCuts *fConversionCuts; //! Cuts used by the V0Reader
183 TRandom3 *fRandomizer; //! Randomizer for Event Plane Randomisation
184 TList *fOutputList; //! List for Output (Histograms etc.)
f7cf81bd 185 EPDGCode fMesonPDGCode; // PDG Code of the processed Meson (for MC truth)
1d9e6011 186 Double_t fInvMassRange[2]; // Inv Mass Range
70f90d01 187 Double_t fDeltaPsiRP; //! Difference between subEventPlane angles
188 Int_t fRunNumber; //! current run number
189 Int_t fRunIndex; //! current internal run index
f7cf81bd 190 Int_t fNEPMethods; // number of EP methods
191 Bool_t fFillQA; // Fill QA Histograms
e5b6e8a6 192 Int_t fHarmonic; // Harmonic to be analyzed (v2,v3,..)
70f90d01 193 Double_t fPsiMax; // Range for Psi
194 TString fPeriod; //! "LHC11h","LHC10h"
195 Bool_t fIsAOD; //! Is AOD? else ESD
196 TH1F* fPhiDist[4]; //! array of Phi distributions used to calculate phi weights
197 THnSparse *fSparseDist; //! THn for eta-charge phi-weighting
198 TH1F *fHruns; //! information about runwise statistics of phi-weights
e5b6e8a6 199 Bool_t fDoEPFlattening; // Do flattening
200 Int_t fEPSelectionMask[knEPMethod]; // Which EP methods shall be applied
33bf9167 201 Double_t fFlatc2[knFlatPeriod][knEP][knCentMax];
202 Double_t fFlats2[knFlatPeriod][knEP][knCentMax];
203 Double_t fFlatc4[knFlatPeriod][knEP][knCentMax];
204 Double_t fFlats4[knFlatPeriod][knEP][knCentMax];
70f90d01 205 Int_t fPeriodIndex; //!
33bf9167 206
f7cf81bd 207 // Histograms
208
70f90d01 209 TH1F *hNEvents; //!
210 TH1F *hEventSelection; //!
f7cf81bd 211
212 // RP
70f90d01 213 TH2F *hRPTPC; //!
214 TH2F *hRPV0A; //!
215 TH2F *hRPV0C; //!
216 TH2F *hRPTPCAC; //!
217 TH2F *hRPV0ATPC; //!
218 TH2F *hRPV0CTPC; //!
219 TH2F *hRPV0AC; //!
220 TH2F *hCos2TPC; //!
221 TH2F *hCos2V0ATPC; //!
222 TH2F *hCos2V0CTPC; //!
223 TH2F *hCos2V0AC; //!
224 TH2F *hRPTPCEtaA; //!
225 TH2F *hRPTPCEtaC; //!
226 TH2F *hRPTPCEtaAC; //!
227 TH2F *hCos2TPCEta; //!
228 TH2F *hCos2V0ATPCEtaA; //!
229 TH2F *hCos2V0ATPCEtaC; //!
230 TH2F *hCos2V0CTPCEtaA; //!
231 TH2F *hCos2V0CTPCEtaC; //!
232 TH2F *hCos2SumWeights; //!
233 TH2F *hEtaTPCEP; //!
f7cf81bd 234
235 // Gamma
70f90d01 236 TH2F *hGammaMultCent; //!
237 TH2F **hGammaPhi; //!
238 TH2F *hMultChargedvsNGamma; //!
239 TH2F *hMultChargedvsVZERO; //!
240 TH2F *hMultChargedvsSPD; //!
f7cf81bd 241
70f90d01 242 THnSparseF *hGammadNdPhi; //!
243 THnSparseF *hGammaMultdPhiTRUE; //!
244 THnSparseF *hGammaMultdPhiRECOTRUE; //!
245 THnSparseF *hGammaMultTRUE; //!
246 THnSparseF *hGammaMultRECOTRUE; //!
247 THnSparseF **hGammaMultdPhi; //!
248 THnSparseF **hGammaMult; //!
f7cf81bd 249
70f90d01 250 THnSparseF **hGamma; //!
251 THnSparseF *hGammaFull; //!
f7cf81bd 252
70f90d01 253 THnSparseF *hCharged; //!
f7cf81bd 254
255 // Pi0
70f90d01 256 THnSparseF **hPi0; //!
257 THnSparseF **hPi0BG; //!
f7cf81bd 258
259 //V0 Calibration
260
261 static const Int_t nCentrBinV0 = 9; // # cenrality bins
70f90d01 262 TProfile *fMultV0; //! object containing VZERO calibration information
263 Float_t fV0Cpol,fV0Apol; //! loaded by OADB
264 Float_t fMeanQ[nCentrBinV0][2][2]; //! and recentering
265 Float_t fWidthQ[nCentrBinV0][2][2]; //! ...
f7cf81bd 266
ca91a3e1 267 //Event Plane
e5b6e8a6 268 //THnSparse *hEPVertex;
70f90d01 269 THnSparse *hEPQA; //!
f7cf81bd 270
70f90d01 271 ClassDef(AliAnalysisTaskPi0v2, 6); // example of analysis
f7cf81bd 272};
273
274#endif
275