- added special histograms for Jason
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaCalo.h
1 #ifndef ALIANLYSISTASKGAMMACALO_cxx
2 #define ALIANLYSISTASKGAMMACALO_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"
11 #include "AliConvEventCuts.h"
12 #include "AliConversionPhotonCuts.h"
13 #include "AliConversionMesonCuts.h"
14 #include "AliAnalysisManager.h"
15 #include "TProfile2D.h"
16 #include "TH3.h"
17 #include "TH3F.h"
18
19 class AliAnalysisTaskGammaCalo : public AliAnalysisTaskSE {
20         public:
21
22                 AliAnalysisTaskGammaCalo();
23                 AliAnalysisTaskGammaCalo(const char *name);
24                 virtual ~AliAnalysisTaskGammaCalo();
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 CalculatePi0Candidates();
39                 
40                 // MC functions
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);
48                 
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;}
53                 
54             // Setting the cut lists for the conversion photons
55                 void SetEventCutList(Int_t nCuts, TList *CutArray){
56                         fnCuts = nCuts;
57                         fEventCutArray = CutArray;
58                 }
59
60             // Setting the cut lists for the calo photons
61                 void SetCaloCutList(Int_t nCuts, TList *CutArray){
62                         fnCuts = nCuts;
63                         fClusterCutArray = CutArray;
64                 }
65                 
66                 // Setting the cut lists for the meson
67                 void SetMesonCutList(Int_t nCuts, TList *CutArray){
68                         fnCuts = nCuts;
69                         fMesonCutArray = CutArray;
70                 }
71
72                 // BG HandlerSettings
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();
80                 
81                 // Additional functions for convenience
82                 void SetLogBinningXTH2(TH2* histoRebin);
83                 Int_t GetSourceClassification(Int_t daughter, Int_t pdgCode);
84         
85         protected:
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
106                 
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
122
123                 // histograms for rec photon clusters
124                 TH1F                                                            ** fHistoClusGammaPt;                           //! array of histos with cluster, pt
125                                                                                 
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                 TH1F                                                            **fHistoMCK0sPt;                                        //! array of histos with weighted K0s, pT
145                 TH1F                                                            **fHistoMCK0sWOWeightPt;                        //! array of histos with unweighted K0s, pT
146                 TH2F                                                            **fHistoMCK0sPtY;                                       //! array of histos with weighted K0s, pT, Y
147                 TH2F                                                            **fHistoMCSecPi0PtvsSource;                     //! array of histos with secondary pi0, pT, source
148                 TH1F                                                            **fHistoMCSecPi0Source;                         //! array of histos with secondary pi0, source
149                 TH1F                                                            **fHistoMCSecEtaPt;                                     //! array of histos with secondary eta, pT
150                 TH1F                                                            **fHistoMCSecEtaSource;                         //! array of histos with secondary eta, source
151                 // MC validated reconstructed quantities mesons
152                 TH2F                                                            **fHistoTruePi0InvMassPt;                                       //! array of histos with validated mothers, invMass, pt
153                 TH2F                                                            **fHistoTrueEtaInvMassPt;                                       //! array of histos with validated mothers, invMass, pt
154                 TH2F                                                            **fHistoTruePi0CaloPhotonInvMassPt;                     //! array of histos with validated mothers, photon leading, invMass, pt
155                 TH2F                                                            **fHistoTrueEtaCaloPhotonInvMassPt;                     //! array of histos with validated mothers, photon leading, invMass, pt
156                 TH2F                                                            **fHistoTruePi0CaloConvertedPhotonInvMassPt;    //! array of histos with validated pi0, converted photon leading, invMass, pt
157                 TH2F                                                            **fHistoTrueEtaCaloConvertedPhotonInvMassPt;    //! array of histos with validated eta, converted photon leading, invMass, pt
158                 TH2F                                                            **fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt; //! array of histos with validated mothers, converted photon leading, invMass, pt
159                 TH2F                                                            **fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt; //! array of histos with validated mothers, converted photon leading, invMass, pt
160                 TH2F                                                            **fHistoTruePi0CaloElectronInvMassPt;           //! array of histos with validated mothers, electron leading, invMass, pt
161                 TH2F                                                            **fHistoTrueEtaCaloElectronInvMassPt;           //! array of histos with validated mothers, electron leading, invMass, pt
162                 TH2F                                                            **fHistoTruePi0CaloMergedClusterInvMassPt;      //! array of histos with validated mothers, merged cluster invMass, pt
163                 TH2F                                                            **fHistoTrueEtaCaloMergedClusterInvMassPt;      //! array of histos with validated mothers, merged cluster invMass, pt
164                 TH2F                                                            **fHistoTruePi0CaloMergedClusterPartConvInvMassPt; //! array of histos with validated mothers, merged cluster part conv, invMass, pt
165                 TH2F                                                            **fHistoTrueEtaCaloMergedClusterPartConvInvMassPt; //! array of histos with validated mothers, merged cluster part conv, invMass, pt
166                 TH2F                                                            **fHistoTruePi0NonMergedElectronPhotonInvMassPt;        //! array of histos with validated mothers, merged cluster invMass, pt
167                 TH2F                                                            **fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt;  //! array of histos with validated mothers, merged cluster invMass, pt
168                 TH2F                                                            **fHistoTruePrimaryPi0InvMassPt;                                //! array of histos with validated weighted primary mothers, invMass, pt
169                 TH2F                                                            **fHistoTruePrimaryEtaInvMassPt;                                //! array of histos with validated weighted primary mothers, invMass, pt
170                 TH2F                                                            **fHistoTruePrimaryPi0W0WeightingInvMassPt;     //! array of histos with validated unweighted primary mothers, invMass, pt
171                 TH2F                                                            **fHistoTruePrimaryEtaW0WeightingInvMassPt;     //! array of histos with validated unweighted primary mothers, invMass, pt
172                 TProfile2D                                                      **fProfileTruePrimaryPi0WeightsInvMassPt;       //! array of profiles with weights for validated primary mothers, invMass, pt   
173                 TProfile2D                                                      **fProfileTruePrimaryEtaWeightsInvMassPt;       //! array of profiles with weights for validated primary mothers, invMass, pt   
174                 TH2F                                                            **fHistoTruePrimaryPi0MCPtResolPt;                              //! array of histos with validated weighted primary pi0, MCpt, resol pt
175                 TH2F                                                            **fHistoTruePrimaryEtaMCPtResolPt;                              //! array of histos with validated weighted primary eta, MCpt, resol pt
176                 TH2F                                                            **fHistoTrueSecondaryPi0InvMassPt;                      //! array of histos with validated secondary mothers, invMass, pt
177                 TH2F                                                            **fHistoTrueSecondaryEtaInvMassPt;                      //! array of histos with validated secondary mothers, invMass, pt
178                 TH2F                                                            **fHistoTrueSecondaryPi0FromK0sInvMassPt;       //! array of histos with validated secondary mothers from K0s, invMass, pt
179                 TH1F                                                            **fHistoTrueK0sWithPi0DaughterMCPt;                             //! array of histos with K0s with reconstructed pi0 as daughter, pt
180                 TH2F                                                            **fHistoTrueSecondaryPi0FromEtaInvMassPt;       //! array of histos with validated secondary mothers from eta, invMass, pt
181                 TH1F                                                            **fHistoTrueEtaWithPi0DaughterMCPt;                             //! array of histos with eta with reconstructed pi0 as daughter, pt
182                 TH2F                                                            **fHistoTrueSecondaryPi0FromLambdaInvMassPt;    //! array of histos with validated secondary mothers from Lambda, invMass, pt
183                 TH1F                                                            **fHistoTrueLambdaWithPi0DaughterMCPt;                  //! array of histos with lambda with reconstructed pi0 as daughter, pt
184                 TH2F                                                            **fHistoTrueBckGGInvMassPt;                                             //! array of histos with pure gamma gamma combinatorial BG, invMass, pt
185                 TH2F                                                            **fHistoTrueBckContInvMassPt;                                   //! array of histos with contamination BG, invMass, pt
186                 TH2F                                                            **fHistoTruePi0PtY;                                                             //! array of histos with validated pi0, pt, Y
187                 TH2F                                                            **fHistoTrueEtaPtY;                                                             //! array of histos with validated eta, pt, Y
188                 TH2F                                                            **fHistoTruePi0PtAlpha;                                                 //! array of histos with validated pi0, pt, alpha
189                 TH2F                                                            **fHistoTrueEtaPtAlpha;                                                 //! array of histos with validated eta, pt, alpha
190                 TH2F                                                            **fHistoTruePi0PtOpenAngle;                                             //! array of histos with validated pi0, pt, openAngle
191                 TH2F                                                            **fHistoTrueEtaPtOpenAngle;                                             //! array of histos with validated eta, pt, openAngle
192                 // MC validated reconstructed quantities photons
193                 TH2F                                                            **fHistoClusPhotonBGPt;                                                 //! array of histos with cluster photon BG, pt, source
194                 TH2F                                                            **fHistoClusPhotonPlusConvBGPt;                                 //! array of histos with cluster photon plus conv BG, pt, source
195                 TH1F                                                            **fHistoTrueClusGammaPt;                                                //! array of histos with validated cluster (electron or photon), pt
196                 TH1F                                                            **fHistoTrueClusUnConvGammaPt;                                  //! array of histos with validated unconverted photon, pt
197                 TH1F                                                            **fHistoTrueClusUnConvGammaMCPt;                                        //! array of histos with validated unconverted photon, pt
198                 TH1F                                                            **fHistoTrueClusElectronPt;                                             //! array of histos with validated electron, pt
199                 TH1F                                                            **fHistoTrueClusConvGammaPt;                                    //! array of histos with validated converted photon, pt
200                 TH1F                                                            **fHistoTrueClusConvGammaMCPt;                                  //! array of histos with validated converted photon, pt
201                 TH1F                                                            **fHistoTrueClusConvGammaFullyPt;                               //! array of histos with validated converted photon, fully contained, pt
202                 TH1F                                                            **fHistoTrueClusMergedGammaPt;                                  //! array of histos with validated merged photons, electrons, dalitz, pt
203                 TH1F                                                            **fHistoTrueClusMergedPartConvGammaPt;                  //! array of histos with validated merged partially converted photons, pt
204                 TH1F                                                            **fHistoTrueClusDalitzPt;                                               //! array of histos with validated Dalitz decay, pt
205                 TH1F                                                            **fHistoTrueClusDalitzMergedPt;                                 //! array of histos with validated Dalitz decay, more than one decay product in cluster, pt
206                 TH1F                                                            **fHistoTrueClusPhotonFromElecMotherPt;                 //! array of histos with validated photon from electron, pt
207                 TH1F                                                            **fHistoTrueClusShowerPt;                                               //! array of histos with validated shower, pt
208         TH1F                                **fHistoTrueClusSubLeadingPt;                   //! array of histos with pi0/eta/eta_prime in subleading contribution
209         TH1I                                **fHistoTrueClusNParticles;                     //! array of histos with number of different particles (pi0/eta/eta_prime) contributing to cluster
210                 TH1F                                                            **fHistoTrueClusEMNonLeadingPt;                                 //! array of histos with cluster with largest energy by hadron
211                 TH1F                                                            **fHistoTrueNLabelsInClus;                                              //! array of histos with number of labels in cluster 
212                 TH1F                                                            **fHistoTruePrimaryClusGammaPt;                                 //! array of histos with validated primary photon cluster, pt
213                 TH2F                                                            **fHistoTruePrimaryClusGammaESDPtMCPt;                  //! array of histos with validated primary photon cluster, rec Pt, MC pt
214                 TH1F                                                            **fHistoTruePrimaryClusConvGammaPt;                             //! array of histos with validated primary conv photon cluster, pt
215                 TH2F                                                            **fHistoTruePrimaryClusConvGammaESDPtMCPt;              //! array of histos with validated primary conv photon cluster, rec Pt, MC pt
216                 TH1F                                                            **fHistoTrueSecondaryClusGammaPt;                               //! array of histos with validated secondary cluster photon, pt  
217                 TH1F                                                            **fHistoTrueSecondaryClusConvGammaPt;                   //! array of histos with validated secondary cluster photon, pt  
218                 TH1F                                                            **fHistoTrueSecondaryClusGammaFromXFromK0sPt;   //! array of histos with validated secondary cluster photon from K0s, pt  
219                 TH1F                                                            **fHistoTrueSecondaryClusConvGammaFromXFromK0sPt;//! array of histos with validated secondary cluster conversion photon from K0s, pt  
220                 TH1F                                                            **fHistoTrueSecondaryClusGammaFromXFromLambdaPt;//! array of histos with validated secondary cluster photon from Lambda, pt  
221                 TH1F                                                            **fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt;//! array of histos with validated secondary cluster conversion photon from Lambda, pt  
222                 TH1F                                                            **fHistoTrueSecondaryClusGammaFromXFromEtasPt;  //! array of histos with validated secondary Cluster photon from Eta, pt  
223                 TH1F                                                            **fHistoTrueSecondaryClusConvGammaFromXFromEtasPt;//! array of histos with validated secondary cluster conversion photon from Eta, pt  
224
225                 // event histograms
226                 TH1I                                                            **fHistoNEvents;                                                                //! array of histos with event information
227                 TH1I                                                            **fHistoNGoodESDTracks;                                                 //! array of histos with number of good tracks (2010 Standard track cuts)
228                 TH1I                                                            **fHistoNGammaCandidates;                                               //! array of histos with number of gamma candidates per event
229                 TH2F                                                            **fHistoNGoodESDTracksVsNGammaCanditates;               //! array of histos with number of good tracks vs gamma candidates
230                 TH1I                                                            **fHistoNV0Tracks;                                                              //! array of histos with V0 counts
231                 TProfile                                                        **fProfileEtaShift;                                                             //! array of profiles with eta shift
232                 
233                 // additional variables
234                 Double_t                                                        fEventPlaneAngle;                                       // EventPlaneAngle
235                 TRandom3                                                        fRandom;                                                        // random 
236                 Int_t                                                           fnCuts;                                                         // number of cuts to be analysed in parallel
237                 Int_t                                                           fiCut;                                                          // current cut  
238                 Int_t                                                           fIsHeavyIon;                                            // switch for pp = 0, PbPb = 1, pPb = 2
239                 Bool_t                                                          fDoMesonAnalysis;                                       // flag for meson analysis
240                 Int_t                                                           fDoMesonQA;                                                     // flag for meson QA
241                 Int_t                                                           fDoClusterQA;                                           // flag for cluster QA
242                 Bool_t                                                          fIsFromMBHeader;                                        // flag for MC headers
243                 Bool_t                                                          fIsMC;                                                          // flag for MC information
244
245
246         private:
247                 AliAnalysisTaskGammaCalo(const AliAnalysisTaskGammaCalo&); // Prevent copy-construction
248                 AliAnalysisTaskGammaCalo &operator=(const AliAnalysisTaskGammaCalo&); // Prevent assignment
249
250                 ClassDef(AliAnalysisTaskGammaCalo, 1);
251 };
252
253 #endif