1 #ifndef ALIANLYSISTASKGAMMACALO_cxx
2 #define ALIANLYSISTASKGAMMACALO_cxx
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"
11 #include "AliConvEventCuts.h"
12 #include "AliConversionPhotonCuts.h"
13 #include "AliConversionMesonCuts.h"
14 #include "AliAnalysisManager.h"
15 #include "TProfile2D.h"
19 class AliAnalysisTaskGammaCalo : public AliAnalysisTaskSE {
22 AliAnalysisTaskGammaCalo();
23 AliAnalysisTaskGammaCalo(const char *name);
24 virtual ~AliAnalysisTaskGammaCalo();
26 virtual void UserCreateOutputObjects();
27 virtual Bool_t Notify();
28 virtual void UserExec(Option_t *);
29 virtual void Terminate(const Option_t*);
32 void SetIsHeavyIon(Int_t flag){
36 // base functions for selecting photon and meson candidates in reconstructed data
37 void ProcessClusters();
38 void CalculatePi0Candidates();
41 void SetIsMC(Bool_t isMC){fIsMC=isMC;}
42 void ProcessMCParticles();
43 void ProcessAODMCParticles();
44 void ProcessTrueClusterCandidates( AliAODConversionPhoton* TruePhotonCandidate);
45 void ProcessTrueClusterCandidatesAOD( AliAODConversionPhoton* TruePhotonCandidate);
46 void ProcessTrueMesonCandidates( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
47 void ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
49 // switches for additional analysis streams or outputs
50 void SetDoMesonAnalysis(Bool_t flag){fDoMesonAnalysis = flag;}
51 void SetDoMesonQA(Int_t flag){fDoMesonQA = flag;}
52 void SetDoClusterQA(Int_t flag){fDoClusterQA = flag;}
54 // Setting the cut lists for the conversion photons
55 void SetEventCutList(Int_t nCuts, TList *CutArray){
57 fEventCutArray = CutArray;
60 // Setting the cut lists for the calo photons
61 void SetCaloCutList(Int_t nCuts, TList *CutArray){
63 fClusterCutArray = CutArray;
66 // Setting the cut lists for the meson
67 void SetMesonCutList(Int_t nCuts, TList *CutArray){
69 fMesonCutArray = CutArray;
73 void CalculateBackground();
74 void CalculateBackgroundRP();
75 void RotateParticle(AliAODConversionPhoton *gamma);
76 void RotateParticleAccordingToEP(AliAODConversionPhoton *gamma, Double_t previousEventEP, Double_t thisEventEP);
77 void FillPhotonBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode);
78 void FillPhotonPlusConversionBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode);
79 void UpdateEventByEventData();
81 // Additional functions for convenience
82 void SetLogBinningXTH2(TH2* histoRebin);
83 Int_t GetSourceClassification(Int_t daughter, Int_t pdgCode);
86 AliV0ReaderV1 *fV0Reader; // basic photon Selection Task
87 AliGammaConversionAODBGHandler **fBGHandler; // BG handler for Conversion
88 AliVEvent *fInputEvent; // current event
89 AliMCEvent *fMCEvent; // corresponding MC event
90 AliStack *fMCStack; // stack belonging to MC event
91 TList **fCutFolder; // Array of lists for containers belonging to cut
92 TList **fESDList; // Array of lists with histograms with reconstructed properties
93 TList **fBackList; // Array of lists with BG THnSparseF
94 TList **fMotherList; // Array of lists with Signal THnSparseF
95 TList **fTrueList; // Array of lists with histograms with MC validated reconstructed properties
96 TList **fMCList; // Array of lists with histograms with pure MC information
97 TList **fHeaderNameList; // Array of lists with header names for MC header selection
98 TList *fOutputContainer; // Output container
99 TList *fClusterCandidates; //! current list of cluster candidates
100 TList *fEventCutArray; // List with Event Cuts
101 AliConvEventCuts *fEventCuts; // EventCutObject
102 TList *fClusterCutArray; // List with Cluster Cuts
103 AliCaloPhotonCuts *fCaloPhotonCuts; // CaloPhotonCutObject
104 TList *fMesonCutArray; // List with Meson Cuts
105 AliConversionMesonCuts *fMesonCuts; // MesonCutObject
107 //histograms for mesons reconstructed quantities
108 TH2F **fHistoMotherInvMassPt; //! array of histogram with signal + BG for same event photon pairs, inv Mass, pt
109 TH2F **fHistoMotherInvMass3ClusterPt; //! array of histogram with signal + BG for same event 3 cluster pairs, inv Mass, pt
110 THnSparseF **fSparseMotherInvMassPtZM; //! array of THnSparseF with signal + BG for same event photon pairs, inv Mass, pt
111 TH2F **fHistoMotherBackInvMassPt; //! array of histogram with BG for mixed event photon pairs, inv Mass, pt
112 THnSparseF **fSparseMotherBackInvMassPtZM; //! array of THnSparseF with BG for same event photon pairs, inv Mass, pt
113 TH2F **fHistoMotherInvMassEalpha; //! array of histograms with alpha cut of 0.1 for inv mass vs pt
114 TH2F **fHistoMotherPi0PtY; //! array of histograms with invariant mass cut of 0.05 && pi0cand->M() < 0.17, pt, Y
115 TH2F **fHistoMotherEtaPtY; //! array of histograms with invariant mass cut of 0.45 && pi0cand->M() < 0.65, pt, Y
116 TH2F **fHistoMotherPi0PtAlpha; //! array of histograms with invariant mass cut of 0.05 && pi0cand->M() < 0.17, pt, alpha
117 TH2F **fHistoMotherEtaPtAlpha; //! array of histograms with invariant mass cut of 0.45 && pi0cand->M() < 0.65, pt, alpha
118 TH2F **fHistoMotherPi0PtOpenAngle; //! array of histograms with invariant mass cut of 0.05 && pi0cand->M() < 0.17, pt, openAngle
119 TH2F **fHistoMotherEtaPtOpenAngle; //! array of histograms with invariant mass cut of 0.45 && pi0cand->M() < 0.65, pt, openAngle
120 TH2F **fHistoMotherInvMassECalib; //! array of histogram with signal + BG for same event photon pairs, inv Mass, energy of cluster
121 TH2F **fHistoMotherInvMassECalibalpha; //! array of histogram with signal + BG for same event photon pairs, inv Mass, energy of cluster, alpha cut 0.1
123 // histograms for rec photon clusters
124 TH1F ** fHistoClusGammaPt; //! array of histos with cluster, pt
125 TH1F ** fHistoClusOverlapHeadersGammaPt; //! array of histos with cluster, pt overlapping with other headers
126 //histograms for pure MC quantities
127 TH1I **fHistoMCHeaders; //! array of histos for header names
128 TH1F **fHistoMCAllGammaPt; //! array of histos with all gamma, pT
129 TH1F **fHistoMCDecayGammaPi0Pt; //! array of histos with decay gamma from pi0, pT
130 TH1F **fHistoMCDecayGammaRhoPt; //! array of histos with decay gamma from rho, pT
131 TH1F **fHistoMCDecayGammaEtaPt; //! array of histos with decay gamma from eta, pT
132 TH1F **fHistoMCDecayGammaOmegaPt; //! array of histos with decay gamma from omega, pT
133 TH1F **fHistoMCDecayGammaEtapPt; //! array of histos with decay gamma from eta', pT
134 TH1F **fHistoMCDecayGammaPhiPt; //! array of histos with decay gamma from phi, pT
135 TH1F **fHistoMCDecayGammaSigmaPt; //! array of histos with decay gamma from Sigma0, pT
136 TH1F **fHistoMCPi0Pt; //! array of histos with weighted pi0, pT
137 TH1F **fHistoMCPi0WOWeightPt; //! array of histos with unweighted pi0, pT
138 TH1F **fHistoMCEtaPt; //! array of histos with weighted eta, pT
139 TH1F **fHistoMCEtaWOWeightPt; //! array of histos with unweighted eta, pT
140 TH1F **fHistoMCPi0InAccPt; //! array of histos with weighted pi0 in acceptance, pT
141 TH1F **fHistoMCEtaInAccPt; //! array of histos with weighted eta in acceptance, pT
142 TH2F **fHistoMCPi0PtY; //! array of histos with weighted pi0, pT, Y
143 TH2F **fHistoMCEtaPtY; //! array of histos with weighted eta, pT, Y
144 TH2F **fHistoMCPi0PtAlpha; //! array of histos with weighted pi0, pT, alpha
145 TH2F **fHistoMCEtaPtAlpha; //! array of histos with weighted eta, pT, alpha
146 TH1F **fHistoMCK0sPt; //! array of histos with weighted K0s, pT
147 TH1F **fHistoMCK0sWOWeightPt; //! array of histos with unweighted K0s, pT
148 TH2F **fHistoMCK0sPtY; //! array of histos with weighted K0s, pT, Y
149 TH2F **fHistoMCSecPi0PtvsSource; //! array of histos with secondary pi0, pT, source
150 TH1F **fHistoMCSecPi0Source; //! array of histos with secondary pi0, source
151 TH1F **fHistoMCSecEtaPt; //! array of histos with secondary eta, pT
152 TH1F **fHistoMCSecEtaSource; //! array of histos with secondary eta, source
153 // MC validated reconstructed quantities mesons
154 TH2F **fHistoTruePi0InvMassPt; //! array of histos with validated mothers, invMass, pt
155 TH2F **fHistoTrueEtaInvMassPt; //! array of histos with validated mothers, invMass, pt
156 TH2F **fHistoTruePi0CaloPhotonInvMassPt; //! array of histos with validated mothers, photon leading, invMass, pt
157 TH2F **fHistoTrueEtaCaloPhotonInvMassPt; //! array of histos with validated mothers, photon leading, invMass, pt
158 TH2F **fHistoTruePi0CaloConvertedPhotonInvMassPt; //! array of histos with validated pi0, converted photon leading, invMass, pt
159 TH2F **fHistoTrueEtaCaloConvertedPhotonInvMassPt; //! array of histos with validated eta, converted photon leading, invMass, pt
160 TH2F **fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt; //! array of histos with validated mothers, converted photon leading, invMass, pt
161 TH2F **fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt; //! array of histos with validated mothers, converted photon leading, invMass, pt
162 TH2F **fHistoTruePi0CaloElectronInvMassPt; //! array of histos with validated mothers, electron leading, invMass, pt
163 TH2F **fHistoTrueEtaCaloElectronInvMassPt; //! array of histos with validated mothers, electron leading, invMass, pt
164 TH2F **fHistoTruePi0CaloMergedClusterInvMassPt; //! array of histos with validated mothers, merged cluster invMass, pt
165 TH2F **fHistoTrueEtaCaloMergedClusterInvMassPt; //! array of histos with validated mothers, merged cluster invMass, pt
166 TH2F **fHistoTruePi0CaloMergedClusterPartConvInvMassPt; //! array of histos with validated mothers, merged cluster part conv, invMass, pt
167 TH2F **fHistoTrueEtaCaloMergedClusterPartConvInvMassPt; //! array of histos with validated mothers, merged cluster part conv, invMass, pt
168 TH2F **fHistoTruePi0NonMergedElectronPhotonInvMassPt; //! array of histos with validated mothers, merged cluster invMass, pt
169 TH2F **fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt; //! array of histos with validated mothers, merged cluster invMass, pt
170 TH2F **fHistoTruePi0Category1; //! array of histos with validated pi0, pure real photons
171 TH2F **fHistoTrueEtaCategory1; //! array of histos with validated eta, pure real photons
172 TH2F **fHistoTruePi0Category2; //! array of histos with validated pi0, 1 real photon, 1 merged converted photon
173 TH2F **fHistoTrueEtaCategory2; //! array of histos with validated eta, 1 real photon, 1 merged converted photon
174 TH2F **fHistoTruePi0Category3; //! array of histos with validated pi0, 1 real photon, 1 electron from conversion unmerged
175 TH2F **fHistoTrueEtaCategory3; //! array of histos with validated eta, 1 real photon, 1 electron from conversion unmerged
176 TH2F **fHistoTruePi0Category4_6; //! array of histos with validated pi0, 2 electrons from same conversion
177 TH2F **fHistoTrueEtaCategory4_6; //! array of histos with validated eta, 2 electrons from same conversion
178 TH2F **fHistoTruePi0Category5; //! array of histos with validated pi0, 2 electrons from different conversions, 2 electrons (unseen)
179 TH2F **fHistoTrueEtaCategory5; //! array of histos with validated eta, 2 electrons from different conversions, 2 electrons (unseen)
180 TH2F **fHistoTruePi0Category7; //! array of histos with validated pi0, 1 electron from conversion, 2 electrons from other conversion merged, 1 electron (unseen)
181 TH2F **fHistoTrueEtaCategory7; //! array of histos with validated eta, 1 electron from conversion, 2 electrons from other conversion merged, 1 electron (unseen)
182 TH2F **fHistoTruePi0Category8; //! array of histos with validated pi0, 2 electron from conversion merged, 2 electrons from other conversion merged
183 TH2F **fHistoTrueEtaCategory8; //! array of histos with validated eta, 2 electron from conversion merged, 2 electrons from other conversion merged
184 TH2F **fHistoTruePrimaryPi0InvMassPt; //! array of histos with validated weighted primary mothers, invMass, pt
185 TH2F **fHistoTruePrimaryEtaInvMassPt; //! array of histos with validated weighted primary mothers, invMass, pt
186 TH2F **fHistoTruePrimaryPi0W0WeightingInvMassPt; //! array of histos with validated unweighted primary mothers, invMass, pt
187 TH2F **fHistoTruePrimaryEtaW0WeightingInvMassPt; //! array of histos with validated unweighted primary mothers, invMass, pt
188 TProfile2D **fProfileTruePrimaryPi0WeightsInvMassPt; //! array of profiles with weights for validated primary mothers, invMass, pt
189 TProfile2D **fProfileTruePrimaryEtaWeightsInvMassPt; //! array of profiles with weights for validated primary mothers, invMass, pt
190 TH2F **fHistoTruePrimaryPi0MCPtResolPt; //! array of histos with validated weighted primary pi0, MCpt, resol pt
191 TH2F **fHistoTruePrimaryEtaMCPtResolPt; //! array of histos with validated weighted primary eta, MCpt, resol pt
192 TH2F **fHistoTrueSecondaryPi0InvMassPt; //! array of histos with validated secondary mothers, invMass, pt
193 TH2F **fHistoTrueSecondaryPi0FromK0sInvMassPt; //! array of histos with validated secondary mothers from K0s, invMass, pt
194 TH1F **fHistoTrueK0sWithPi0DaughterMCPt; //! array of histos with K0s with reconstructed pi0 as daughter, pt
195 TH2F **fHistoTrueSecondaryPi0FromEtaInvMassPt; //! array of histos with validated secondary mothers from eta, invMass, pt
196 TH1F **fHistoTrueEtaWithPi0DaughterMCPt; //! array of histos with eta with reconstructed pi0 as daughter, pt
197 TH2F **fHistoTrueSecondaryPi0FromLambdaInvMassPt; //! array of histos with validated secondary mothers from Lambda, invMass, pt
198 TH1F **fHistoTrueLambdaWithPi0DaughterMCPt; //! array of histos with lambda with reconstructed pi0 as daughter, pt
199 TH2F **fHistoTrueBckGGInvMassPt; //! array of histos with pure gamma gamma combinatorial BG, invMass, pt
200 TH2F **fHistoTrueBckContInvMassPt; //! array of histos with contamination BG, invMass, pt
201 TH2F **fHistoTruePi0PtY; //! array of histos with validated pi0, pt, Y
202 TH2F **fHistoTrueEtaPtY; //! array of histos with validated eta, pt, Y
203 TH2F **fHistoTruePi0PtAlpha; //! array of histos with validated pi0, pt, alpha
204 TH2F **fHistoTrueEtaPtAlpha; //! array of histos with validated eta, pt, alpha
205 TH2F **fHistoTruePi0PtOpenAngle; //! array of histos with validated pi0, pt, openAngle
206 TH2F **fHistoTrueEtaPtOpenAngle; //! array of histos with validated eta, pt, openAngle
207 // MC validated reconstructed quantities photons
208 TH2F **fHistoClusPhotonBGPt; //! array of histos with cluster photon BG, pt, source
209 TH2F **fHistoClusPhotonPlusConvBGPt; //! array of histos with cluster photon plus conv BG, pt, source
210 TH1F **fHistoTrueClusGammaPt; //! array of histos with validated cluster (electron or photon), pt
211 TH1F **fHistoTrueClusUnConvGammaPt; //! array of histos with validated unconverted photon, pt
212 TH1F **fHistoTrueClusUnConvGammaMCPt; //! array of histos with validated unconverted photon, pt
213 TH1F **fHistoTrueClusElectronPt; //! array of histos with validated electron, pt
214 TH1F **fHistoTrueClusConvGammaPt; //! array of histos with validated converted photon, pt
215 TH1F **fHistoTrueClusConvGammaMCPt; //! array of histos with validated converted photon, pt
216 TH1F **fHistoTrueClusConvGammaFullyPt; //! array of histos with validated converted photon, fully contained, pt
217 TH1F **fHistoTrueClusMergedGammaPt; //! array of histos with validated merged photons, electrons, dalitz, pt
218 TH1F **fHistoTrueClusMergedPartConvGammaPt; //! array of histos with validated merged partially converted photons, pt
219 TH1F **fHistoTrueClusDalitzPt; //! array of histos with validated Dalitz decay, pt
220 TH1F **fHistoTrueClusDalitzMergedPt; //! array of histos with validated Dalitz decay, more than one decay product in cluster, pt
221 TH1F **fHistoTrueClusPhotonFromElecMotherPt; //! array of histos with validated photon from electron, pt
222 TH1F **fHistoTrueClusShowerPt; //! array of histos with validated shower, pt
223 TH1F **fHistoTrueClusSubLeadingPt; //! array of histos with pi0/eta/eta_prime in subleading contribution
224 TH1I **fHistoTrueClusNParticles; //! array of histos with number of different particles (pi0/eta/eta_prime) contributing to cluster
225 TH1F **fHistoTrueClusEMNonLeadingPt; //! array of histos with cluster with largest energy by hadron
226 TH1F **fHistoTrueNLabelsInClus; //! array of histos with number of labels in cluster
227 TH1F **fHistoTruePrimaryClusGammaPt; //! array of histos with validated primary photon cluster, pt
228 TH2F **fHistoTruePrimaryClusGammaESDPtMCPt; //! array of histos with validated primary photon cluster, rec Pt, MC pt
229 TH1F **fHistoTruePrimaryClusConvGammaPt; //! array of histos with validated primary conv photon cluster, pt
230 TH2F **fHistoTruePrimaryClusConvGammaESDPtMCPt; //! array of histos with validated primary conv photon cluster, rec Pt, MC pt
231 TH1F **fHistoTrueSecondaryClusGammaPt; //! array of histos with validated secondary cluster photon, pt
232 TH1F **fHistoTrueSecondaryClusConvGammaPt; //! array of histos with validated secondary cluster photon, pt
233 TH1F **fHistoTrueSecondaryClusGammaFromXFromK0sPt; //! array of histos with validated secondary cluster photon from K0s, pt
234 TH1F **fHistoTrueSecondaryClusConvGammaFromXFromK0sPt;//! array of histos with validated secondary cluster conversion photon from K0s, pt
235 TH1F **fHistoTrueSecondaryClusGammaFromXFromLambdaPt;//! array of histos with validated secondary cluster photon from Lambda, pt
236 TH1F **fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt;//! array of histos with validated secondary cluster conversion photon from Lambda, pt
237 TH1F **fHistoTrueSecondaryClusGammaFromXFromEtasPt; //! array of histos with validated secondary Cluster photon from Eta, pt
238 TH1F **fHistoTrueSecondaryClusConvGammaFromXFromEtasPt;//! array of histos with validated secondary cluster conversion photon from Eta, pt
241 TH1I **fHistoNEvents; //! array of histos with event information
242 TH1I **fHistoNGoodESDTracks; //! array of histos with number of good tracks (2010 Standard track cuts)
243 TH1I **fHistoNGammaCandidates; //! array of histos with number of gamma candidates per event
244 TH2F **fHistoNGoodESDTracksVsNGammaCanditates; //! array of histos with number of good tracks vs gamma candidates
245 TH1I **fHistoNV0Tracks; //! array of histos with V0 counts
246 TProfile **fProfileEtaShift; //! array of profiles with eta shift
248 // additional variables
249 Double_t fEventPlaneAngle; // EventPlaneAngle
250 TRandom3 fRandom; // random
251 Int_t fnCuts; // number of cuts to be analysed in parallel
252 Int_t fiCut; // current cut
253 Int_t fIsHeavyIon; // switch for pp = 0, PbPb = 1, pPb = 2
254 Bool_t fDoMesonAnalysis; // flag for meson analysis
255 Int_t fDoMesonQA; // flag for meson QA
256 Int_t fDoClusterQA; // flag for cluster QA
257 Bool_t fIsFromMBHeader; // flag for MC headers
258 Bool_t fIsOverlappingWithOtherHeader; // flag for particles in MC overlapping between headers
259 Bool_t fIsMC; // flag for MC information
263 AliAnalysisTaskGammaCalo(const AliAnalysisTaskGammaCalo&); // Prevent copy-construction
264 AliAnalysisTaskGammaCalo &operator=(const AliAnalysisTaskGammaCalo&); // Prevent assignment
266 ClassDef(AliAnalysisTaskGammaCalo, 2);