- fixed MC routines in CaloConv task, added corresponding addtasks
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaConvCalo.h
CommitLineData
8bdca7f1 1#ifndef ALIANLYSISTASKGAMMACONVCALO_cxx
2#define ALIANLYSISTASKGAMMACONVCALO_cxx
3
4#include "AliAnalysisTaskSE.h"
5#include "AliESDtrack.h"
6#include "AliV0ReaderV1.h"
7#include "AliKFConversionPhoton.h"
8#include "AliGammaConversionAODBGHandler.h"
9#include "AliConversionAODBGHandlerRP.h"
10#include "AliCaloPhotonCuts.h"
344100c4 11#include "AliConvEventCuts.h"
12#include "AliConversionPhotonCuts.h"
8bdca7f1 13#include "AliConversionMesonCuts.h"
14#include "AliAnalysisManager.h"
15#include "TProfile2D.h"
16#include "TH3.h"
17#include "TH3F.h"
18
19class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
20 public:
21
22 AliAnalysisTaskGammaConvCalo();
23 AliAnalysisTaskGammaConvCalo(const char *name);
24 virtual ~AliAnalysisTaskGammaConvCalo();
25
26 virtual void UserCreateOutputObjects();
27 virtual Bool_t Notify();
28 virtual void UserExec(Option_t *);
29 virtual void Terminate(const Option_t*);
30 void InitBack();
31
32 void SetIsHeavyIon(Int_t flag){
33 fIsHeavyIon = flag;
34 }
35
36 // base functions for selecting photon and meson candidates in reconstructed data
37 void ProcessClusters();
38 void ProcessPhotonCandidates();
39 void PhotonTagging();
40 void CalculatePi0Candidates();
41
42 // MC functions
43 void SetIsMC(Bool_t isMC){fIsMC=isMC;}
44 void ProcessMCParticles();
45 void ProcessAODMCParticles();
46 void RelabelAODPhotonCandidates(Bool_t mode);
47 void ProcessTruePhotonCandidates( AliAODConversionPhoton* TruePhotonCandidate);
48 void ProcessTrueClusterCandidates( AliAODConversionPhoton* TruePhotonCandidate);
fd94f234 49 void ProcessTrueClusterCandidatesAOD( AliAODConversionPhoton* TruePhotonCandidate);
8bdca7f1 50 void ProcessTruePhotonCandidatesAOD( AliAODConversionPhoton* TruePhotonCandidate);
51 void ProcessTrueMesonCandidates( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
52 void ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
53
54 // switches for additional analysis streams or outputs
55 void SetDoMesonAnalysis(Bool_t flag){fDoMesonAnalysis = flag;}
56 void SetDoMesonQA(Int_t flag){fDoMesonQA = flag;}
57 void SetDoPhotonQA(Int_t flag){fDoPhotonQA = flag;}
fd94f234 58 void SetDoClusterQA(Int_t flag){fDoClusterQA = flag;}
8bdca7f1 59
60 // Setting the cut lists for the conversion photons
344100c4 61 void SetEventCutList(Int_t nCuts, TList *CutArray){
62 fnCuts = nCuts;
63 fEventCutArray = CutArray;
64 }
65
66 // Setting the cut lists for the conversion photons
8bdca7f1 67 void SetConversionCutList(Int_t nCuts, TList *CutArray){
68 fnCuts = nCuts;
69 fCutArray = CutArray;
70 }
71
72 // Setting the cut lists for the calo photons
73 void SetCaloCutList(Int_t nCuts, TList *CutArray){
74 fnCuts = nCuts;
75 fClusterCutArray = CutArray;
76 }
77
78 // Setting the cut lists for the meson
79 void SetMesonCutList(Int_t nCuts, TList *CutArray){
80 fnCuts = nCuts;
81 fMesonCutArray = CutArray;
82 }
83
84 // emcal functions
85 Double_t GetMaxCellEnergy(const AliVCluster *c) const { Short_t id=-1; return GetMaxCellEnergy(c,id); }
86 Double_t GetMaxCellEnergy(const AliVCluster *c, Short_t &id) const;
87
88 // BG HandlerSettings
89 void CalculateBackground();
90 void CalculateBackgroundRP();
91 void RotateParticle(AliAODConversionPhoton *gamma);
92 void RotateParticleAccordingToEP(AliAODConversionPhoton *gamma, Double_t previousEventEP, Double_t thisEventEP);
93 void SetMoveParticleAccordingToVertex(Bool_t flag){fMoveParticleAccordingToVertex = flag;}
94 void FillPhotonCombinatorialBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode[]);
95 void MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex);
96 void UpdateEventByEventData();
97
98 // Additional functions for convenience
99 void SetLogBinningXTH2(TH2* histoRebin);
100 Int_t GetSourceClassification(Int_t daughter, Int_t pdgCode);
101
102 protected:
103 AliV0ReaderV1 *fV0Reader; // basic photon Selection Task
104 AliGammaConversionAODBGHandler **fBGHandler; // BG handler for Conversion
105 AliConversionAODBGHandlerRP **fBGHandlerRP; // BG handler for Conversion (possibility to mix with respect to RP)
106 AliGammaConversionAODBGHandler **fBGClusHandler; // BG handler for Cluster
107 AliConversionAODBGHandlerRP **fBGClusHandlerRP; // BG handler for Cluster (possibility to mix with respect to RP)
108 AliVEvent *fInputEvent; // current event
109 AliMCEvent *fMCEvent; // corresponding MC event
110 AliStack *fMCStack; // stack belonging to MC event
111// AliESDEvent *fEsdEv; //!pointer to input esd event
112// AliAODEvent *fAodEv; //!pointer to input aod event
113// TObjArray *fEsdClusters; //!pointer to esd clusters
114// AliESDCaloCells *fEsdCells; //!pointer to esd cells
115// TObjArray *fAodClusters; //!pointer to aod clusters
116// AliAODCaloCells *fAodCells; //!pointer to aod cells
117 TList **fCutFolder; // Array of lists for containers belonging to cut
118 TList **fESDList; // Array of lists with histograms with reconstructed properties
119 TList **fBackList; // Array of lists with BG THnSparseF
120 TList **fMotherList; // Array of lists with Signal THnSparseF
121 TList **fPhotonDCAList; // Array of lists with photon dca trees
122 TList **fMesonDCAList; // Array of lists with meson dca trees
123 TList **fTrueList; // Array of lists with histograms with MC validated reconstructed properties
124 TList **fMCList; // Array of lists with histograms with pure MC information
125 TList **fHeaderNameList; // Array of lists with header names for MC header selection
126 TList **fTagOutputList; //!Array of lists of output histograms for tagged photons
127 TList *fOutputContainer; // Output container
128 TClonesArray *fReaderGammas; // Array with conversion photons selected by V0Reader Cut
129 TList *fGammaCandidates; // current list of photon candidates
130 TList *fClusterCandidates; //! current list of cluster candidates
344100c4 131 TList *fEventCutArray; // List with Event Cuts
132 AliConvEventCuts *fEventCuts; // EventCutObject
8bdca7f1 133 TList *fCutArray; // List with Conversion Cuts
344100c4 134 AliConversionPhotonCuts *fConversionCuts; // ConversionCutObject
8bdca7f1 135 TList *fClusterCutArray; // List with Cluster Cuts
136 AliCaloPhotonCuts *fCaloPhotonCuts; // CaloPhotonCutObject
137 TList *fMesonCutArray; // List with Meson Cuts
138 AliConversionMesonCuts *fMesonCuts; // MesonCutObject
139
140 //histograms for Conversions reconstructed quantities
141 TH1F **fHistoConvGammaPt; //! histogram conversion photon pT
142 TH1F **fHistoConvGammaR; //! histogram conversion photon R
143 TH1F **fHistoConvGammaEta; //! histogram conversion photon Eta
144 TTree **fTreeConvGammaPtDcazCat; //! tree with dca for conversions
145 Float_t fPtGamma; //! pt of conversion for tree
146 Float_t fDCAzPhoton; //! dcaz of conversion for tree
147 Float_t fRConvPhoton; //! R of conversion for tree
148 Float_t fEtaPhoton; //! eta of conversion for tree
149 UChar_t fCharCatPhoton; //! category of conversion for tree
150 UChar_t fCharPhotonMCInfo; //! MC info of conversion for tree
151 // 0: garbage,
152 // 1: background
153 // 2: secondary photon not from eta or k0s,
154 // 3: secondary photon from eta,
155 // 4: secondary photon from k0s,
156 // 5: dalitz
157 // 6: primary gamma
158 //histograms for mesons reconstructed quantities
159 TH2F **fHistoMotherInvMassPt; //! array of histogram with signal + BG for same event photon pairs, inv Mass, pt
160 THnSparseF **fSparseMotherInvMassPtZM; //! array of THnSparseF with signal + BG for same event photon pairs, inv Mass, pt
161 TH2F **fHistoMotherBackInvMassPt; //! array of histogram with BG for mixed event photon pairs, inv Mass, pt
162 THnSparseF **fSparseMotherBackInvMassPtZM; //! array of THnSparseF with BG for same event photon pairs, inv Mass, pt
163 TH2F **fHistoMotherInvMassEalpha; //! array of histograms with alpha cut of 0.1 for inv mass vs pt
164 TH2F **fHistoMotherPi0PtY; //! array of histograms with invariant mass cut of 0.05 && pi0cand->M() < 0.17, pt, Y
165 TH2F **fHistoMotherEtaPtY; //! array of histograms with invariant mass cut of 0.45 && pi0cand->M() < 0.65, pt, Y
166 TH2F **fHistoMotherPi0PtAlpha; //! array of histograms with invariant mass cut of 0.05 && pi0cand->M() < 0.17, pt, alpha
167 TH2F **fHistoMotherEtaPtAlpha; //! array of histograms with invariant mass cut of 0.45 && pi0cand->M() < 0.65, pt, alpha
168 TH2F **fHistoMotherPi0PtOpenAngle; //! array of histograms with invariant mass cut of 0.05 && pi0cand->M() < 0.17, pt, openAngle
169 TH2F **fHistoMotherEtaPtOpenAngle; //! array of histograms with invariant mass cut of 0.45 && pi0cand->M() < 0.65, pt, openAngle
170 TTree **fTreeMesonsInvMassPtDcazMinDcazMaxFlag; //! array of trees with dca information for mesons
171 Float_t fInvMass; // inv mass for meson tree
172 Float_t fPt; // pt for meson tree
173 Float_t fDCAzGammaMin; // dcaz for meson tree gamma 1
174 Float_t fDCAzGammaMax; // dcaz for meson tree gamma 2
175 UChar_t fCharFlag; // category of meson for tree
176 UChar_t fCharMesonMCInfo; // MC information meson for tree
177 // 0: garbage,
178 // 1: background
179 // 2: secondary meson not from eta or k0s,
180 // 3: secondary meson from eta,
181 // 4: secondary meson from k0s,
182 // 5: dalitz
183 // 6: primary meson gamma-gamma-channel
184
185 // histograms for rec photons tagged by Calo
186 TH1F **fHistoConvGammaUntagged; //! array of histo for untagged photon candidates vs pt
187 TH1F **fHistoConvGammaTagged; //! array of histo for tagged photon candidates vs pt
188 TH1F **fHistoConvGammaPi0Tagged; //! array of histo for tagged photon candidates vs pt
189 TH1F **fHistoConvGammaEtaTagged; //! array of histo for tagged photon candidates vs pt
190 TH2F **fHistoPhotonPairAll; //! array of histo for pairs
191 TH2F **fHistoPhotonPairAllGam; //! array of histo for pairs vs. pt of converted photon
192 // histograms for rec photon clusters
193 TH1F ** fHistoClusGammaPt; //! array of histos with cluster, pt
194
195 //histograms for pure MC quantities
196 TH1I **fHistoMCHeaders; //! array of histos for header names
197 TH1F **fHistoMCAllGammaPt; //! array of histos with all gamma, pT
198 TH1F **fHistoMCDecayGammaPi0Pt; //! array of histos with decay gamma from pi0, pT
199 TH1F **fHistoMCDecayGammaRhoPt; //! array of histos with decay gamma from rho, pT
200 TH1F **fHistoMCDecayGammaEtaPt; //! array of histos with decay gamma from eta, pT
201 TH1F **fHistoMCDecayGammaOmegaPt; //! array of histos with decay gamma from omega, pT
202 TH1F **fHistoMCDecayGammaEtapPt; //! array of histos with decay gamma from eta', pT
203 TH1F **fHistoMCDecayGammaPhiPt; //! array of histos with decay gamma from phi, pT
204 TH1F **fHistoMCDecayGammaSigmaPt; //! array of histos with decay gamma from Sigma0, pT
205 TH1F **fHistoMCConvGammaPt; //! array of histos with converted gamma, pT
206 TH1F **fHistoMCConvGammaR; //! array of histos with converted gamma, R
207 TH1F **fHistoMCConvGammaEta; //! array of histos with converted gamma, Eta
208 TH1F **fHistoMCPi0Pt; //! array of histos with weighted pi0, pT
209 TH1F **fHistoMCPi0WOWeightPt; //! array of histos with unweighted pi0, pT
210 TH1F **fHistoMCEtaPt; //! array of histos with weighted eta, pT
211 TH1F **fHistoMCEtaWOWeightPt; //! array of histos with unweighted eta, pT
212 TH1F **fHistoMCPi0InAccPt; //! array of histos with weighted pi0 in acceptance, pT
213 TH1F **fHistoMCEtaInAccPt; //! array of histos with weighted eta in acceptance, pT
214 TH2F **fHistoMCPi0PtY; //! array of histos with weighted pi0, pT, Y
215 TH2F **fHistoMCEtaPtY; //! array of histos with weighted eta, pT, Y
216 TH1F **fHistoMCK0sPt; //! array of histos with weighted K0s, pT
217 TH1F **fHistoMCK0sWOWeightPt; //! array of histos with unweighted K0s, pT
218 TH2F **fHistoMCK0sPtY; //! array of histos with weighted K0s, pT, Y
219 TH2F **fHistoMCSecPi0PtvsSource; //! array of histos with secondary pi0, pT, source
220 TH1F **fHistoMCSecPi0Source; //! array of histos with secondary pi0, source
221 TH1F **fHistoMCSecEtaPt; //! array of histos with secondary eta, pT
222 TH1F **fHistoMCSecEtaSource; //! array of histos with secondary eta, source
223 // MC validated reconstructed quantities mesons
224 TH2F **fHistoTrueMotherInvMassPt; //! array of histos with validated mothers, invMass, pt
fd94f234 225 TH2F **fHistoTrueMotherCaloPhotonInvMassPt; //! array of histos with validated mothers, photon leading, invMass, pt
226 TH2F **fHistoTrueMotherCaloConvertedPhotonInvMassPt; //! array of histos with validated mothers, converted photon leading, invMass, pt
227 TH2F **fHistoTrueMotherCaloElectronInvMassPt; //! array of histos with validated mothers, electron leading, invMass, pt
228 TH2F **fHistoTrueMotherCaloMergedClusterInvMassPt; //! array of histos with validated mothers, merged cluster invMass, pt
229 TH2F **fHistoTrueMotherCaloEMNonLeadingInvMassPt; //! array of histos with validated mothers, EM non leading, invMass, pt
230 TH2F **fHistoTrueMotherCaloMergedClusterPartConvInvMassPt; //! array of histos with validated mothers, merged cluster part conv, invMass, pt
8bdca7f1 231 TH2F **fHistoTruePrimaryMotherInvMassPt; //! array of histos with validated weighted primary mothers, invMass, pt
232 TH2F **fHistoTruePrimaryMotherW0WeightingInvMassPt; //! array of histos with validated unweighted primary mothers, invMass, pt
233 TProfile2D **fProfileTruePrimaryMotherWeightsInvMassPt; //! array of profiles with weights for validated primary mothers, invMass, pt
234 TH2F **fHistoTruePrimaryPi0MCPtResolPt; //! array of histos with validated weighted primary pi0, MCpt, resol pt
235 TH2F **fHistoTruePrimaryEtaMCPtResolPt; //! array of histos with validated weighted primary eta, MCpt, resol pt
236 TH2F **fHistoTrueSecondaryMotherInvMassPt; //! array of histos with validated secondary mothers, invMass, pt
237 TH2F **fHistoTrueSecondaryMotherFromK0sInvMassPt; //! array of histos with validated secondary mothers from K0s, invMass, pt
238 TH1F **fHistoTrueK0sWithPi0DaughterMCPt; //! array of histos with K0s with reconstructed pi0 as daughter, pt
239 TH2F **fHistoTrueSecondaryMotherFromEtaInvMassPt; //! array of histos with validated secondary mothers from eta, invMass, pt
240 TH1F **fHistoTrueEtaWithPi0DaughterMCPt; //! array of histos with eta with reconstructed pi0 as daughter, pt
241 TH2F **fHistoTrueSecondaryMotherFromLambdaInvMassPt; //! array of histos with validated secondary mothers from Lambda, invMass, pt
242 TH1F **fHistoTrueLambdaWithPi0DaughterMCPt; //! array of histos with lambda with reconstructed pi0 as daughter, pt
243 TH2F **fHistoTrueBckGGInvMassPt; //! array of histos with pure gamma gamma combinatorial BG, invMass, pt
fd94f234 244 TH2F **fHistoTrueBckContInvMassPt; //! array of histos with contamination BG, invMass, pt
245 TH2F **fHistoTruePi0PtY; //! array of histos with validated pi0, pt, Y
8bdca7f1 246 TH2F **fHistoTrueEtaPtY; //! array of histos with validated eta, pt, Y
247 TH2F **fHistoTruePi0PtAlpha; //! array of histos with validated pi0, pt, alpha
248 TH2F **fHistoTrueEtaPtAlpha; //! array of histos with validated eta, pt, alpha
249 TH2F **fHistoTruePi0PtOpenAngle; //! array of histos with validated pi0, pt, openAngle
250 TH2F **fHistoTrueEtaPtOpenAngle; //! array of histos with validated eta, pt, openAngle
8bdca7f1 251 // MC validated reconstructed quantities photons
252 TH1F **fHistoTrueConvGammaPt; //! array of histos with validated conversion photon, pt
253 TH1F **fHistoTrueConvPi0GammaPt; //! array of histos with validated conversion photon from pi0, pt
254 TH1F **fHistoTrueConvGammaEta; //! array of histos with validated conversion photon, eta
255 TH2F **fHistoCombinatorialPt; //! array of histos with combinatorial BG, pt, source
256 TH1F **fHistoTruePrimaryConvGammaPt; //! array of histos with validated primary conversion photon, pt
257 TH2F **fHistoTruePrimaryConvGammaESDPtMCPt; //! array of histos with validated primary conversion photon, rec pt, mc pt
258 TH1F **fHistoTrueSecondaryConvGammaPt; //! array of histos with validated secondary conversion photon, pt
259 TH1F **fHistoTrueSecondaryConvGammaFromXFromK0sPt; //! array of histos with validated secondary conversion photon from K0s, pt
260 TH1F **fHistoTrueSecondaryConvGammaFromXFromLambdaPt;//! array of histos with validated secondary conversion photon from Lambda, pt
fd94f234 261 TH1F **fHistoTrueClusGammaPt; //! array of histos with validated cluster (electron or photon), pt
262 TH1F **fHistoTrueClusUnConvGammaPt; //! array of histos with validated unconverted photon, pt
263 TH1F **fHistoTrueClusElectronPt; //! array of histos with validated electron, pt
264 TH1F **fHistoTrueClusConvGammaPt; //! array of histos with validated converted photon, pt
265 TH1F **fHistoTrueClusConvGammaFullyPt; //! array of histos with validated converted photon, fully contained, pt
266 TH1F **fHistoTrueClusMergedGammaPt; //! array of histos with validated merged photons, electrons, dalitz, pt
267 TH1F **fHistoTrueClusMergedPartConvGammaPt; //! array of histos with validated merged partially converted photons, pt
268 TH1F **fHistoTrueClusDalitzPt; //! array of histos with validated Dalitz decay, pt
269 TH1F **fHistoTrueClusDalitzMergedPt; //! array of histos with validated Dalitz decay, more than one decay product in cluster, pt
270 TH1F **fHistoTrueClusPhotonFromElecMotherPt; //! array of histos with validated photon from electron, pt
271 TH1F **fHistoTrueClusShowerPt; //! array of histos with validated shower, pt
272 TH1F **fHistoTrueClusEMNonLeadingPt; //! array of histos with cluster with largest energy by hadron
273 TH1F **fHistoTrueNLabelsInClus; //! array of histos with number of labels in cluster
274 TH1F **fHistoTruePrimaryClusGammaPt; //! array of histos with validated primary cluster, pt
275 TH2F **fHistoTruePrimaryClusGammaESDPtMCPt; //! array of histos with validated primary cluster, rec Pt, MC pt
8bdca7f1 276
277 // event histograms
278 TH1I **fHistoNEvents; //! array of histos with event information
279 TH1I **fHistoNGoodESDTracks; //! array of histos with number of good tracks (2010 Standard track cuts)
280 TH1I **fHistoNGammaCandidates; //! array of histos with number of gamma candidates per event
281 TH2F **fHistoNGoodESDTracksVsNGammaCanditates; //! array of histos with number of good tracks vs gamma candidates
282 TH1I **fHistoNV0Tracks; //! array of histos with V0 counts
283 TProfile **fProfileEtaShift; //! array of profiles with eta shift
284
285 // additional variables
286 Double_t fEventPlaneAngle; // EventPlaneAngle
287 TRandom3 fRandom; // random
288 Int_t fNGammaCandidates; // number of gamma candidates in event
289 Double_t *fUnsmearedPx; //[fNGammaCandidates]
290 Double_t *fUnsmearedPy; //[fNGammaCandidates]
291 Double_t *fUnsmearedPz; //[fNGammaCandidates]
292 Double_t *fUnsmearedE; //[fNGammaCandidates]
293 Int_t *fMCStackPos; //[fNGammaCandidates]
294 Int_t *fMCStackNeg; //[fNGammaCandidates]
295 Int_t *fESDArrayPos; //[fNGammaCandidates]
296 Int_t *fESDArrayNeg; //[fNGammaCandidates]
297 Int_t fnCuts; // number of cuts to be analysed in parallel
298 Int_t fiCut; // current cut
299 Bool_t fMoveParticleAccordingToVertex; // boolean for BG calculation
300 Int_t fIsHeavyIon; // switch for pp = 0, PbPb = 1, pPb = 2
301 Bool_t fDoMesonAnalysis; // flag for meson analysis
302 Int_t fDoMesonQA; // flag for meson QA
303 Int_t fDoPhotonQA; // flag for photon QA
fd94f234 304 Int_t fDoClusterQA; // flag for cluster QA
8bdca7f1 305 Bool_t fIsFromMBHeader; // flag for MC headers
306 Bool_t fIsMC; // flag for MC information
307
308
309 // cluster cut variables
310 Double_t fMinE;
311 Int_t fNminCells;
312 Double_t fEMCm02cut;
313 //double fMinErat = 0;
314 //double fMinEcc = 0;
315
316
317 // TString fClusName; // cluster branch name (def="")
318 // const TObjArray *fRecPoints; // pointer to rec points (AliAnalysisTaskEMCALClusterizeFast)
319 // const TClonesArray *fDigits; // pointer to digits (AliAnalysisTaskEMCALClusterizeFast)
320
321 private:
322 AliAnalysisTaskGammaConvCalo(const AliAnalysisTaskGammaConvCalo&); // Prevent copy-construction
323 AliAnalysisTaskGammaConvCalo &operator=(const AliAnalysisTaskGammaConvCalo&); // Prevent assignment
324
fd94f234 325 ClassDef(AliAnalysisTaskGammaConvCalo, 3);
8bdca7f1 326};
327
328#endif