]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitz.h
Fix in filling the hit-map of ESDtrack
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaConvDalitz.h
1 #ifndef ALIANALYSISTASKGAMMACONVDALITZ_H
2 #define ALIANALYSISTASKGAMMACONVDALITZ_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 // Analysis task for pi0->e+e-gamma (Dalitz decay)
8
9 #include "AliAnalysisTaskSE.h"
10
11 class AliESDInputHandler;
12 class AliMCEventHandler;
13 class AliESDEvent;
14 class AliESDtrack;
15 class AliESDtrackCuts;
16 class AliESDpidCuts;
17 class AliV0Reader;
18 class AliGammaConversionHistograms;
19 class AliTriggerAnalysis;
20
21 class AliAnalysisTaskGammaConvDalitz: public AliAnalysisTaskSE
22 {
23   public:
24
25         AliAnalysisTaskGammaConvDalitz();
26         AliAnalysisTaskGammaConvDalitz( const char* name );
27         virtual ~AliAnalysisTaskGammaConvDalitz();
28
29         virtual void UserExec(Option_t *option);
30         virtual void UserCreateOutputObjects();
31         virtual void ConnectInputData(Option_t *option);
32         virtual void Terminate(Option_t *option);
33                 
34         enum TrackSelectionCriteria { kITSsaTrack=0, kGlobalTrack=1, kITSsaGlobalTrack=2 };
35         
36         void SetRunStandalone( Bool_t flag=kFALSE ) { fStandalone = flag; }
37         void SetComputeBackground( Bool_t flag=kTRUE ) { fComputeBkg = flag; }
38         void SetUseBayesPID( Bool_t flag=kTRUE ) { fUseBayesPID = flag; }
39         void SetUseESDtrackIndexCut( Bool_t flag=kTRUE) { fUseTrackIndexCut = flag; }
40         void SetUsePsiPairCut(Bool_t flag=kTRUE) { fUsePsiPairCut = flag; }
41         void SetUseMassCut(Bool_t flag=kTRUE) { fUseMassCut = flag; }
42         void SetUseGammaCut(Bool_t flag=kTRUE) { fUseGammaCut = flag; }
43         void SetUseAliKF(Bool_t flag=kFALSE) { fUseAliKF = flag; }
44         void SetTrackSelectionCriteria(AliAnalysisTaskGammaConvDalitz::TrackSelectionCriteria sel=kGlobalTrack) { fTrkSelectionCriteria = sel; }
45         void SetUseCorrectedTPCClsInfo(Bool_t flag){fUseCorrectedTPCClsInfo = flag;}
46         Bool_t GetUseCorrectedTPCClsInfo() const {return fUseCorrectedTPCClsInfo;}
47
48
49         void SetMinClsTPCCutToF(Double_t minClsTPCToF){fMinClsTPCToF=minClsTPCToF;}
50         void SetPsiPairCut(Double_t psi=0.45, Double_t phiMin=0., Double_t phiMax=0.12, Bool_t readMagFieldSgn=kTRUE){fPsiPairCut = psi; fDeltaPhiCutMin = phiMin; fDeltaPhiCutMax = phiMax; fReadMagFieldSign = readMagFieldSgn;}
51         void SetMassCut(Double_t min, Double_t max) {fMassCutMin = min; fMassCutMax = max; }
52
53         void SetDoTOFsigmaCut( Bool_t doTOFsigmaCut){fDoTOFsigmaCut=doTOFsigmaCut;}
54         void SetDoKaonRejectionLowP( Bool_t doKaonRejectionLowP){fDoKaonRejectionLowP=doKaonRejectionLowP;}
55         void SetDoProtonRejectionLowP( Bool_t doProtonRejectionLowP){fDoProtonRejectionLowP=doProtonRejectionLowP;}
56         void SetDoPionRejectionLowP( Bool_t doPionRejectionLowP){fDoPionRejectionLowP=doPionRejectionLowP;}
57
58         void SetNSigmasElecTPC( Double_t min, Double_t max) { fPIDnSigmaBelowElectronLine    = min; fPIDnSigmaAboveElectronLine    = max; }
59         void SetNSigmasElecTOF( Double_t min, Double_t max) { fTofPIDnSigmaBelowElectronLine = min; fTofPIDnSigmaAboveElectronLine = max; }
60         void SetPIDMinMaxPnSigmaAbovePionLine(Double_t min, Double_t max){ fPIDMinPnSigmaAbovePionLine = min; fPIDMaxPnSigmaAbovePionLine =  max;}
61         void SetPIDnSigmaAbovePionLine(Double_t val){ fPIDnSigmaAbovePionLine = val; };
62         void SetPIDnSigmaAbovePionLineHighPt(Double_t val){ fPIDnSigmaAbovePionLineHighPt = val; };
63
64         void SetPIDMinPKaonRejectionLowP  (Double_t val){   fPIDMinPKaonRejectionLowP   = val; }
65         void SetPIDMinPProtonRejectionLowP(Double_t val){   fPIDMinPProtonRejectionLowP = val; }
66         void SetPIDMinPPionRejectionLowP  (Double_t val){   fPIDMinPPionRejectionLowP   = val; }
67
68         void SetPIDnSigmaAtLowPAroundKaonLine(Double_t val)  { fPIDnSigmaAtLowPAroundKaonLine   = val; }
69         void SetPIDnSigmaAtLowPAroundProtonLine(Double_t val){ fPIDnSigmaAtLowPAroundProtonLine = val; }
70         void SetPIDnSigmaAtLowPAroundPionLine(Double_t val)  { fPIDnSigmaAtLowPAroundPionLine   = val; }
71                 
72         void SetV0Reader( AliV0Reader* reader ) { fV0Reader = reader; }
73         void SetDoMC(Bool_t flag) { fDoMC = flag; }
74         void SetBGHandler( AliGammaConversionBGHandler* BG ) {  fBGEventHandler = BG; }
75         
76         void AdoptHistograms( AliGammaConversionHistograms* histograms ) { fHistograms = histograms; }
77         void AdoptITSsaTrackCuts( AliESDtrackCuts* esdCuts = 0 );
78         void AdoptESDtrackCuts( AliESDtrackCuts* esdCuts = 0 );
79         void AdoptESDpidCuts( AliESDpidCuts* esdPIDCuts = 0 );
80         
81
82         void SetBackgroundType(Int_t type){ fBackgroundType = type; }
83         void SetRemovePileUp(Bool_t removePileUp) { fRemovePileUp = removePileUp; }
84         void SetSelectV0AND(Bool_t selectV0AND) { fSelectV0AND = selectV0AND; }
85         void SetUseMultiplicity(Int_t useMultiplicity) {fUseMultiplicity=useMultiplicity;}
86         void SetUseMultiplicityBin(Int_t useMultiplicityBin) {fUseMultiplicityBin=useMultiplicityBin;}
87         void SetUseHBTMultiplicity(Int_t useHBTMultiplicity) {fUseHBTMultiplicity=useHBTMultiplicity;}
88         void SetUseHBTMultiplicityBin(Int_t useHBTMultiplicityBin) {fUseHBTMultiplicityBin=useHBTMultiplicityBin;}
89         void SetUseCentrality(Int_t useCentrality) {fUseCentrality=useCentrality;}
90         void SetUseCentralityBin(Int_t useCentralityBin) {fUseCentralityBin=useCentralityBin;}
91         
92         private:
93
94                 void ProcessMCData();
95                 void CreateListOfDalitzPairCandidates();
96                 void ProcessGammaElectronsForDalitzAnalysis();
97                 
98                 void ESDtrackIndexCut(vector<Int_t>& pos, vector<Int_t>& neg, const TClonesArray* gamma);
99                 void PsiPairCut(vector<Int_t>& pos, vector<Int_t>& neg);
100                 void MassCut(vector<Int_t>& pos, vector<Int_t>& neg);
101                 void CleanArray(vector<Int_t>& x, const vector<Bool_t>& tag);
102                 
103                 TClonesArray* IndexToAliKFParticle(const vector<Int_t>& v, Int_t PDG);
104                 TClonesArray* FindElectronFromPi0Dalitz(const vector<Int_t>& candidates, const Int_t PDG);
105                 TClonesArray* FindGammaFromPi0Dalitz(const TClonesArray* candidates, const vector<Int_t>& pos, const vector<Int_t>& neg);
106                 TClonesArray* FindGamma(const TClonesArray* candidates, const vector<Int_t>& pos, const vector<Int_t>& neg);
107                 TClonesArray* FindDalitzPair(const TClonesArray* pos, const TClonesArray* neg);
108                 TClonesArray* FindDalitzPair(const vector<Int_t>& pos, const vector<Int_t>& neg,Int_t motherOpc);
109                 TClonesArray* FindJpsi(const vector<Int_t>& posIdx, const vector<Int_t>& negIdx,Int_t motherOpc);
110                 TClonesArray* FindParticleDalitz(const TClonesArray* pos, const TClonesArray* neg, const TClonesArray* gamma,Int_t opc);
111                 TClonesArray* FindParticleDalitz(const vector<Int_t>& pos, const vector<Int_t>& neg, const TClonesArray* gamma, const vector<Int_t>& posGam, const vector<Int_t>& negGam,Int_t motherOpc);
112                 TClonesArray* FindParticleChic(const vector<Int_t>& posIdx, const vector<Int_t>& negIdx, const TClonesArray* gamma, const vector<Int_t>& posGam, const vector<Int_t>& negGam,Int_t motherOpc);
113
114                 void SetGammaPoolMaxSize(UInt_t maxSize=10) { fPoolMaxSize = maxSize; }
115                 void UpdateGammaPool(const TClonesArray* gamma);
116                 void UpdateElectronPool(TClonesArray* elec);
117                 TClonesArray* GammasFromBGHandler() const;
118                 TClonesArray* ElectronFromBGHandler() const;
119
120                 Bool_t IsPi0DalitzDaughter( Int_t label ) const;
121                 Bool_t IsDalitzPair( Int_t labelPos, Int_t labelNeg, Int_t motherOpc ) const;
122                 Bool_t IsFromGammaConversion( Int_t labelPos, Int_t labelNeg  ) const;
123                 Bool_t IsFromGammaConversion( Double_t psiPair, Double_t deltaPhi ) const;
124                 Bool_t HaveSameMother( Int_t label1, Int_t label2 ) const;
125                 
126                 Double_t GetPsiPair( const AliKFParticle* pos, const AliKFParticle* neg ) const;
127                 Double_t GetPsiPair( const TLorentzVector* pos, const TLorentzVector* neg ) const;
128                 Double_t GetPsiPair( const AliESDtrack* trackPos, const AliESDtrack* trackNeg ) const;
129                 
130                 Int_t GetMonteCarloPid(const AliESDtrack* t) const;
131                 Int_t GetBayesPid(const AliESDtrack* t, Int_t trackType ) const;
132                 Int_t GetNSigmaPid(const AliESDtrack* t, Int_t trackType ) const;
133                 
134                 void GetGammaCandidates(TClonesArray*& gamma, vector<Int_t>& posIndex, vector<Int_t>& negIndex);
135                 void AngleEposEnegGammaCut( const vector<Int_t>& xPosIndex, const vector<Int_t>& yNegIndex, const TClonesArray* zGamma, TClonesArray*& gamma, vector<Int_t>& posIndex, vector<Int_t>& negIndex);
136                 void FillPsiPair(const TClonesArray* pos, const TClonesArray* neg, const TString& hName);
137                 void FillAngle(const TClonesArray* x, const TClonesArray* y, const TString& hName);
138                 Double_t Rapidity(const TParticle* p) const;
139                 Double_t RapidityKF(const AliKFParticle p) const;
140                 void FillPidTable(const TParticle* p, Int_t pid);
141                 Int_t  CalculateMultiplicityBin();
142
143         
144   // protected:
145         private:
146
147                 AliStack*   fStack;                 //! MC particle stack
148                 AliMCEvent* fGCMCEvent;               //! for CF pointer to the MC Event
149
150                 AliESDEvent* fESDEvent;             //! ESD event
151
152                 vector<Int_t> fEposCandidateIndex;  //! track indexes of e+ candidates
153                 vector<Int_t> fEnegCandidateIndex;  //! track indexes of e- candidates
154                 vector<Int_t> fGammaCandidatePosIndex; //! track indexes for gamma candidates positive track
155                 vector<Int_t> fGammaCandidateNegIndex; //! track indexes for gamma candidates negative track
156
157                 TClonesArray* fGammaCandidates;     //! AliKFParticle gamma candidates
158                 TClonesArray* fGammaPool;           //! AliKFParticle gamma pool of previous events
159                 Int_t fPoolMaxSize; // size of the gamma pool
160                 Int_t fGamPoolPos; // Posisiton of last added gamma in the pool
161                 
162                 AliGammaConversionBGHandler* fBGEventHandler; // Background event handler
163
164                 TList* fOutputContainer;           // Histogram container
165                 AliMCEventHandler* fMCTruth;       // for CF pointer to MCTruth
166                 AliV0Reader* fV0Reader;            // The V0 reader object
167                 AliESDpid* fESDpid;                // for dEdx cut based on nSigma to a particle line
168                 AliESDtrackCuts* fESDtrackCuts;    // ESD global track cuts
169                 AliESDtrackCuts* fITSsaTrackCuts;  // ITS standalone ESD track cuts
170                 AliESDpidCuts* fESDpidCuts;        // ESD PID cuts
171                 
172                 Bool_t fRemovePileUp;                 // Remove Pile Up
173                 Bool_t fSelectV0AND;                 // Select V0AND
174                 AliTriggerAnalysis *fTriggerAnalysis; //! Trigger Analysis for Normalisation
175                 Int_t fMultiplicity;
176                 Int_t fUseMultiplicity;
177                 Int_t fUseMultiplicityBin;
178                 Int_t fUseHBTMultiplicity;
179                 Int_t fUseHBTMultiplicityBin;
180                 Int_t fUseCentrality;
181                 Int_t fUseCentralityBin;
182
183
184
185                 AliGammaConversionHistograms* fHistograms;  // histogram container
186                 
187                 Bool_t fStandalone;        // Run the task as standalone for the V0reader
188                 Bool_t fDoMC;              // process montecarlo simulation
189                 Bool_t fComputeBkg;        // Compute combinatorial background
190                 Bool_t fUseBayesPID;       // use bayesian pid
191                 Bool_t fUseTrackIndexCut;  // use esd track index cut
192                 Bool_t fUsePsiPairCut;     // use psi pair cut
193                 Bool_t fUseMassCut;        // use mass cut
194                 Bool_t fUseGammaCut;       // use e+e- plane angle gamma cut
195                 Bool_t fUseCorrectedTPCClsInfo; // use
196                 Bool_t fReadMagFieldSign;  // Read the magnetic field sign from the ESD for Psi pair cut
197                 Bool_t fUseAliKF;          // Use AliKFParticle to reconstruct the pi0 instead of TLorentzVector class
198                 Int_t fBackgroundType;    
199
200                 Double_t fMinClsTPCToF;              // minimum clusters to findable clusters
201
202                 Int_t fMagFieldSign;                 // Magnetic field sign
203                 const Double_t fkElectronMass;        // Electron mass
204                 Double_t fPsiPairCut;                // Psi pair cut value
205                 Double_t fDeltaPhiCutMin;              // Delta_Phi minimum cut value
206                 Double_t fDeltaPhiCutMax;              // Delta_Phi maximum cut value
207                 Double_t fMassCutMin;                // Minimum value of e+e- mass (GeV/c2)
208                 Double_t fMassCutMax;                // Maximum value of e+e- mass (GeV/c2)
209                 
210                         /*Double_t fNSigmaBelowElecTPCbethe;   // Number of sigmas below the electron BB in the TPC
211                 Double_t fNSigmaAboveElecTPCbethe;   // Number of sigmas above the electron BB in the TPC
212                 Double_t fNSigmaAbovePionTPCbethe;   // Number of sigmas above the Pion BB in the TPC
213                 Double_t fNSigmaAboveKaonTPCbethe;   // Number of sigmas above the Kaon BB in the TPC
214                 Double_t fNSigmaAboveProtonTPCbethe; // Number of sigmas above the Proton BB in the TPC*/
215
216         ////////////////PID de/dx/////////////////////////////////////////////////////
217                 Bool_t   fDoTOFsigmaCut; 
218                 Double_t fPIDnSigmaAboveElectronLine; // sigma cut
219                 Double_t fPIDnSigmaBelowElectronLine; // sigma cut
220                 Double_t fTofPIDnSigmaAboveElectronLine; // sigma cut RRnewTOF
221                 Double_t fTofPIDnSigmaBelowElectronLine; // sigma cut RRnewTOF 
222                 Double_t fPIDnSigmaAbovePionLine;     // sigma cut
223                 Double_t fPIDnSigmaAbovePionLineHighPt;     // sigma cut
224                 Double_t fPIDMinPnSigmaAbovePionLine; // sigma cut
225                 Double_t fPIDMaxPnSigmaAbovePionLine; // sigma cut
226
227
228                 Bool_t fDoKaonRejectionLowP;   // Kaon rejection at low p
229                 Bool_t fDoProtonRejectionLowP; // Proton rejection at low p
230                 Bool_t fDoPionRejectionLowP;   // Pion rejection at low p*/
231
232
233                 Double_t fPIDnSigmaAtLowPAroundKaonLine; // sigma cut
234                 Double_t fPIDnSigmaAtLowPAroundProtonLine; // sigma cut
235                 Double_t fPIDnSigmaAtLowPAroundPionLine; // sigma cut
236
237
238                 Double_t fPIDMinPKaonRejectionLowP; // Momentum limit to apply kaon rejection
239                 Double_t fPIDMinPProtonRejectionLowP; // Momentum limit to apply proton rejection
240                 Double_t fPIDMinPPionRejectionLowP; // Momentum limit to apply proton rejection
241                 ///////////////////////////////////////////////////////////////////////////////////
242
243                 TrackSelectionCriteria fTrkSelectionCriteria;      // Selected criteria for track cuts
244
245         private:
246                 AliAnalysisTaskGammaConvDalitz( const AliAnalysisTaskGammaConvDalitz& ); // Not implemented
247                 AliAnalysisTaskGammaConvDalitz& operator=( const AliAnalysisTaskGammaConvDalitz& ); // Not implemented
248
249                 ClassDef( AliAnalysisTaskGammaConvDalitz, 2 );
250 };
251
252 #endif // ALIANALYSISTASKGAMMACONVDALITZ_H