1 #ifndef ALIANLYSISTASKGAMMACONVCALO_cxx
2 #define ALIANLYSISTASKGAMMACONVCALO_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 AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
22 AliAnalysisTaskGammaConvCalo();
23 AliAnalysisTaskGammaConvCalo(const char *name);
24 virtual ~AliAnalysisTaskGammaConvCalo();
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 ProcessPhotonCandidates();
40 void CalculatePi0Candidates();
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);
49 void ProcessTrueClusterCandidatesAOD( AliAODConversionPhoton* TruePhotonCandidate);
50 void ProcessTruePhotonCandidatesAOD( AliAODConversionPhoton* TruePhotonCandidate);
51 void ProcessTrueMesonCandidates( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
52 void ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
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;}
58 void SetDoClusterQA(Int_t flag){fDoClusterQA = flag;}
60 // Setting the cut lists for the conversion photons
61 void SetEventCutList(Int_t nCuts, TList *CutArray){
63 fEventCutArray = CutArray;
66 // Setting the cut lists for the conversion photons
67 void SetConversionCutList(Int_t nCuts, TList *CutArray){
72 // Setting the cut lists for the calo photons
73 void SetCaloCutList(Int_t nCuts, TList *CutArray){
75 fClusterCutArray = CutArray;
78 // Setting the cut lists for the meson
79 void SetMesonCutList(Int_t nCuts, TList *CutArray){
81 fMesonCutArray = CutArray;
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;
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();
98 // Additional functions for convenience
99 void SetLogBinningXTH2(TH2* histoRebin);
100 Int_t GetSourceClassification(Int_t daughter, Int_t pdgCode);
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
131 TList *fEventCutArray; // List with Event Cuts
132 AliConvEventCuts *fEventCuts; // EventCutObject
133 TList *fCutArray; // List with Conversion Cuts
134 AliConversionPhotonCuts *fConversionCuts; // ConversionCutObject
135 TList *fClusterCutArray; // List with Cluster Cuts
136 AliCaloPhotonCuts *fCaloPhotonCuts; // CaloPhotonCutObject
137 TList *fMesonCutArray; // List with Meson Cuts
138 AliConversionMesonCuts *fMesonCuts; // MesonCutObject
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
153 // 2: secondary photon not from eta or k0s,
154 // 3: secondary photon from eta,
155 // 4: secondary photon from k0s,
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 TH2F **fHistoMotherInvMassECalib; //! array of histogram with signal + BG for same event photon pairs, inv Mass, energy of cluster
171 TH2F **fHistoMotherInvMassECalibalpha; //! array of histogram with signal + BG for same event photon pairs, inv Mass, energy of cluster, alpha cut 0.1
172 TTree **fTreeMesonsInvMassPtDcazMinDcazMaxFlag; //! array of trees with dca information for mesons
173 Float_t fInvMass; // inv mass for meson tree
174 Float_t fPt; // pt for meson tree
175 Float_t fDCAzGammaMin; // dcaz for meson tree gamma 1
176 Float_t fDCAzGammaMax; // dcaz for meson tree gamma 2
177 UChar_t fCharFlag; // category of meson for tree
178 UChar_t fCharMesonMCInfo; // MC information meson for tree
181 // 2: secondary meson not from eta or k0s,
182 // 3: secondary meson from eta,
183 // 4: secondary meson from k0s,
185 // 6: primary meson gamma-gamma-channel
187 // histograms for rec photons tagged by Calo
188 TH1F **fHistoConvGammaUntagged; //! array of histo for untagged photon candidates vs pt
189 TH1F **fHistoConvGammaTagged; //! array of histo for tagged photon candidates vs pt
190 TH1F **fHistoConvGammaPi0Tagged; //! array of histo for tagged photon candidates vs pt
191 TH1F **fHistoConvGammaEtaTagged; //! array of histo for tagged photon candidates vs pt
192 TH2F **fHistoPhotonPairAll; //! array of histo for pairs
193 TH2F **fHistoPhotonPairAllGam; //! array of histo for pairs vs. pt of converted photon
194 // histograms for rec photon clusters
195 TH1F ** fHistoClusGammaPt; //! array of histos with cluster, pt
197 //histograms for pure MC quantities
198 TH1I **fHistoMCHeaders; //! array of histos for header names
199 TH1F **fHistoMCAllGammaPt; //! array of histos with all gamma, pT
200 TH1F **fHistoMCAllGammaEMCALAccPt; //! array of histos with all gamma in EMCAL acceptance, pT
201 TH1F **fHistoMCDecayGammaPi0Pt; //! array of histos with decay gamma from pi0, pT
202 TH1F **fHistoMCDecayGammaRhoPt; //! array of histos with decay gamma from rho, pT
203 TH1F **fHistoMCDecayGammaEtaPt; //! array of histos with decay gamma from eta, pT
204 TH1F **fHistoMCDecayGammaOmegaPt; //! array of histos with decay gamma from omega, pT
205 TH1F **fHistoMCDecayGammaEtapPt; //! array of histos with decay gamma from eta', pT
206 TH1F **fHistoMCDecayGammaPhiPt; //! array of histos with decay gamma from phi, pT
207 TH1F **fHistoMCDecayGammaSigmaPt; //! array of histos with decay gamma from Sigma0, pT
208 TH1F **fHistoMCConvGammaPt; //! array of histos with converted gamma, pT
209 TH1F **fHistoMCConvGammaR; //! array of histos with converted gamma, R
210 TH1F **fHistoMCConvGammaEta; //! array of histos with converted gamma, Eta
211 TH1F **fHistoMCPi0Pt; //! array of histos with weighted pi0, pT
212 TH1F **fHistoMCPi0WOWeightPt; //! array of histos with unweighted pi0, pT
213 TH1F **fHistoMCEtaPt; //! array of histos with weighted eta, pT
214 TH1F **fHistoMCEtaWOWeightPt; //! array of histos with unweighted eta, pT
215 TH1F **fHistoMCPi0InAccPt; //! array of histos with weighted pi0 in acceptance, pT
216 TH1F **fHistoMCEtaInAccPt; //! array of histos with weighted eta in acceptance, pT
217 TH2F **fHistoMCPi0PtY; //! array of histos with weighted pi0, pT, Y
218 TH2F **fHistoMCEtaPtY; //! array of histos with weighted eta, pT, Y
219 TH1F **fHistoMCK0sPt; //! array of histos with weighted K0s, pT
220 TH1F **fHistoMCK0sWOWeightPt; //! array of histos with unweighted K0s, pT
221 TH2F **fHistoMCK0sPtY; //! array of histos with weighted K0s, pT, Y
222 TH2F **fHistoMCSecPi0PtvsSource; //! array of histos with secondary pi0, pT, source
223 TH1F **fHistoMCSecPi0Source; //! array of histos with secondary pi0, source
224 TH1F **fHistoMCSecEtaPt; //! array of histos with secondary eta, pT
225 TH1F **fHistoMCSecEtaSource; //! array of histos with secondary eta, source
226 // MC validated reconstructed quantities mesons
227 TH2F **fHistoTrueMotherInvMassPt; //! array of histos with validated mothers, invMass, pt
228 TH2F **fHistoTrueMotherCaloPhotonInvMassPt; //! array of histos with validated mothers, photon leading, invMass, pt
229 TH2F **fHistoTrueMotherCaloConvertedPhotonInvMassPt; //! array of histos with validated mothers, converted photon leading, invMass, pt
230 TH2F **fHistoTruePi0CaloConvertedPhotonInvMassPt; //! array of histos with validated pi0, converted photon leading, invMass, pt
231 TH2F **fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt; //! array of histos with validated pi0 matched with conv photon, converted photon leading, invMass, pt
232 TH2F **fHistoTrueEtaCaloConvertedPhotonInvMassPt; //! array of histos with validated eta, converted photon leading, invMass, pt
233 TH2F **fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt; //! array of histos with validated eta matched with conv photon, converted photon leading, invMass, pt
234 TH2F **fHistoTrueMotherCaloElectronInvMassPt; //! array of histos with validated mothers, electron leading, invMass, pt
235 TH2F **fHistoTrueMotherCaloMergedClusterInvMassPt; //! array of histos with validated mothers, merged cluster invMass, pt
236 TH2F **fHistoTrueMotherCaloEMNonLeadingInvMassPt; //! array of histos with validated mothers, EM non leading, invMass, pt
237 TH2F **fHistoTrueMotherCaloMergedClusterPartConvInvMassPt; //! array of histos with validated mothers, merged cluster part conv, invMass, pt
238 TH2F **fHistoTruePrimaryMotherInvMassPt; //! array of histos with validated weighted primary mothers, invMass, pt
239 TH2F **fHistoTruePrimaryMotherW0WeightingInvMassPt; //! array of histos with validated unweighted primary mothers, invMass, pt
240 TProfile2D **fProfileTruePrimaryMotherWeightsInvMassPt; //! array of profiles with weights for validated primary mothers, invMass, pt
241 TH2F **fHistoTruePrimaryPi0MCPtResolPt; //! array of histos with validated weighted primary pi0, MCpt, resol pt
242 TH2F **fHistoTruePrimaryEtaMCPtResolPt; //! array of histos with validated weighted primary eta, MCpt, resol pt
243 TH2F **fHistoTrueSecondaryMotherInvMassPt; //! array of histos with validated secondary mothers, invMass, pt
244 TH2F **fHistoTrueSecondaryMotherFromK0sInvMassPt; //! array of histos with validated secondary mothers from K0s, invMass, pt
245 TH1F **fHistoTrueK0sWithPi0DaughterMCPt; //! array of histos with K0s with reconstructed pi0 as daughter, pt
246 TH2F **fHistoTrueSecondaryMotherFromEtaInvMassPt; //! array of histos with validated secondary mothers from eta, invMass, pt
247 TH1F **fHistoTrueEtaWithPi0DaughterMCPt; //! array of histos with eta with reconstructed pi0 as daughter, pt
248 TH2F **fHistoTrueSecondaryMotherFromLambdaInvMassPt; //! array of histos with validated secondary mothers from Lambda, invMass, pt
249 TH1F **fHistoTrueLambdaWithPi0DaughterMCPt; //! array of histos with lambda with reconstructed pi0 as daughter, pt
250 TH2F **fHistoTrueBckGGInvMassPt; //! array of histos with pure gamma gamma combinatorial BG, invMass, pt
251 TH2F **fHistoTrueBckContInvMassPt; //! array of histos with contamination BG, invMass, pt
252 TH2F **fHistoTruePi0PtY; //! array of histos with validated pi0, pt, Y
253 TH2F **fHistoTrueEtaPtY; //! array of histos with validated eta, pt, Y
254 TH2F **fHistoTruePi0PtAlpha; //! array of histos with validated pi0, pt, alpha
255 TH2F **fHistoTrueEtaPtAlpha; //! array of histos with validated eta, pt, alpha
256 TH2F **fHistoTruePi0PtOpenAngle; //! array of histos with validated pi0, pt, openAngle
257 TH2F **fHistoTrueEtaPtOpenAngle; //! array of histos with validated eta, pt, openAngle
258 // MC validated reconstructed quantities photons
259 TH1F **fHistoTrueConvGammaPt; //! array of histos with validated conversion photon, pt
260 TH1F **fHistoTrueConvPi0GammaPt; //! array of histos with validated conversion photon from pi0, pt
261 TH1F **fHistoTrueConvGammaEta; //! array of histos with validated conversion photon, eta
262 TH2F **fHistoCombinatorialPt; //! array of histos with combinatorial BG, pt, source
263 TH1F **fHistoTruePrimaryConvGammaPt; //! array of histos with validated primary conversion photon, pt
264 TH2F **fHistoTruePrimaryConvGammaESDPtMCPt; //! array of histos with validated primary conversion photon, rec pt, mc pt
265 TH1F **fHistoTrueSecondaryConvGammaPt; //! array of histos with validated secondary conversion photon, pt
266 TH1F **fHistoTrueSecondaryConvGammaFromXFromK0sPt; //! array of histos with validated secondary conversion photon from K0s, pt
267 TH1F **fHistoTrueSecondaryConvGammaFromXFromLambdaPt;//! array of histos with validated secondary conversion photon from Lambda, pt
268 TH1F **fHistoTrueClusGammaPt; //! array of histos with validated cluster (electron or photon), pt
269 TH1F **fHistoTrueClusUnConvGammaPt; //! array of histos with validated unconverted photon, pt
270 TH1F **fHistoTrueClusUnConvGammaMCPt; //! array of histos with validated unconverted photon, pt
271 TH1F **fHistoTrueClusElectronPt; //! array of histos with validated electron, pt
272 TH1F **fHistoTrueClusConvGammaPt; //! array of histos with validated converted photon, pt
273 TH1F **fHistoTrueClusConvGammaMCPt; //! array of histos with validated converted photon, pt
274 TH1F **fHistoTrueClusConvGammaFullyPt; //! array of histos with validated converted photon, fully contained, pt
275 TH1F **fHistoTrueClusMergedGammaPt; //! array of histos with validated merged photons, electrons, dalitz, pt
276 TH1F **fHistoTrueClusMergedPartConvGammaPt; //! array of histos with validated merged partially converted photons, pt
277 TH1F **fHistoTrueClusDalitzPt; //! array of histos with validated Dalitz decay, pt
278 TH1F **fHistoTrueClusDalitzMergedPt; //! array of histos with validated Dalitz decay, more than one decay product in cluster, pt
279 TH1F **fHistoTrueClusPhotonFromElecMotherPt; //! array of histos with validated photon from electron, pt
280 TH1F **fHistoTrueClusShowerPt; //! array of histos with validated shower, pt
281 TH1F **fHistoTrueClusSubLeadingPt; //! array of histos with pi0/eta/eta_prime in subleading contribution
282 TH1I **fHistoTrueClusNParticles; //! array of histos with number of different particles (pi0/eta/eta_prime) contributing to cluster
283 TH1F **fHistoTrueClusEMNonLeadingPt; //! array of histos with cluster with largest energy by hadron
284 TH1F **fHistoTrueNLabelsInClus; //! array of histos with number of labels in cluster
285 TH1F **fHistoTruePrimaryClusGammaPt; //! array of histos with validated primary cluster, pt
286 TH2F **fHistoTruePrimaryClusGammaESDPtMCPt; //! array of histos with validated primary cluster, rec Pt, MC pt
289 TH1I **fHistoNEvents; //! array of histos with event information
290 TH1I **fHistoNGoodESDTracks; //! array of histos with number of good tracks (2010 Standard track cuts)
291 TH1I **fHistoNGammaCandidates; //! array of histos with number of gamma candidates per event
292 TH2F **fHistoNGoodESDTracksVsNGammaCanditates; //! array of histos with number of good tracks vs gamma candidates
293 TH1I **fHistoNV0Tracks; //! array of histos with V0 counts
294 TProfile **fProfileEtaShift; //! array of profiles with eta shift
296 // additional variables
297 Double_t fEventPlaneAngle; // EventPlaneAngle
298 TRandom3 fRandom; // random
299 Int_t fNGammaCandidates; // number of gamma candidates in event
300 Double_t *fUnsmearedPx; //[fNGammaCandidates]
301 Double_t *fUnsmearedPy; //[fNGammaCandidates]
302 Double_t *fUnsmearedPz; //[fNGammaCandidates]
303 Double_t *fUnsmearedE; //[fNGammaCandidates]
304 Int_t *fMCStackPos; //[fNGammaCandidates]
305 Int_t *fMCStackNeg; //[fNGammaCandidates]
306 Int_t *fESDArrayPos; //[fNGammaCandidates]
307 Int_t *fESDArrayNeg; //[fNGammaCandidates]
308 Int_t fnCuts; // number of cuts to be analysed in parallel
309 Int_t fiCut; // current cut
310 Bool_t fMoveParticleAccordingToVertex; // boolean for BG calculation
311 Int_t fIsHeavyIon; // switch for pp = 0, PbPb = 1, pPb = 2
312 Bool_t fDoMesonAnalysis; // flag for meson analysis
313 Int_t fDoMesonQA; // flag for meson QA
314 Int_t fDoPhotonQA; // flag for photon QA
315 Int_t fDoClusterQA; // flag for cluster QA
316 Bool_t fIsFromMBHeader; // flag for MC headers
317 Bool_t fIsMC; // flag for MC information
320 // cluster cut variables
324 //double fMinErat = 0;
325 //double fMinEcc = 0;
328 // TString fClusName; // cluster branch name (def="")
329 // const TObjArray *fRecPoints; // pointer to rec points (AliAnalysisTaskEMCALClusterizeFast)
330 // const TClonesArray *fDigits; // pointer to digits (AliAnalysisTaskEMCALClusterizeFast)
333 AliAnalysisTaskGammaConvCalo(const AliAnalysisTaskGammaConvCalo&); // Prevent copy-construction
334 AliAnalysisTaskGammaConvCalo &operator=(const AliAnalysisTaskGammaConvCalo&); // Prevent assignment
336 ClassDef(AliAnalysisTaskGammaConvCalo, 3);