8cbed5d3e17ddaaeca75bf4f53fa51dc1855b41f
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAnalysisVertexingHF.h
1 #ifndef AliAnalysisVertexingHF_H
2 #define AliAnalysisVertexingHF_H
3 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 //-------------------------------------------------------------------------
7 //                      Class AliAnalysisVertexingHF
8 //            Reconstruction of heavy-flavour decay candidates
9 //      
10 //  Origin: E.Bruna, G.E.Bruno, A.Dainese, F.Prino, R.Romita, X.M.Zhang
11 //  Contact: andrea.dainese@lnl.infn.it
12 //-------------------------------------------------------------------------
13
14 #include <TNamed.h>
15 #include "AliESDVertex.h"
16 #include "AliAODRecoDecayHF.h"
17 #include "AliAODRecoDecayHF2Prong.h"
18 #include "AliAODRecoDecayHF3Prong.h"
19 #include "AliAODRecoDecayHF4Prong.h"
20 #include "AliAODRecoCascadeHF.h"
21 #include "AliAnalysisFilter.h"
22
23 class AliESDtrack;
24 class AliVEvent;
25 class AliAODVertex;
26
27 //-----------------------------------------------------------------------------
28 class AliAnalysisVertexingHF : public TNamed {
29  public:
30   //
31   AliAnalysisVertexingHF();
32   AliAnalysisVertexingHF(const AliAnalysisVertexingHF& source);
33   AliAnalysisVertexingHF& operator=(const AliAnalysisVertexingHF& source); 
34   virtual ~AliAnalysisVertexingHF();
35
36   void FindCandidates(AliVEvent *event,
37                       TClonesArray *aodVerticesHFTClArr,
38                       TClonesArray *aodD0toKpiTClArr,
39                       TClonesArray *aodJPSItoEleTClArr,
40                       TClonesArray *aodCharm3ProngTClArr,
41                       TClonesArray *aodCharm4ProngTClArr,
42                       TClonesArray *aodDstarTClArr);
43
44   void PrintStatus() const;
45   void SetSecVtxWithKF() { fSecVtxWithKF=kTRUE; }
46   void SetD0toKpiOn() { fD0toKpi=kTRUE; }
47   void SetD0toKpiOff() { fD0toKpi=kFALSE; }
48   void SetJPSItoEleOn() { fJPSItoEle=kTRUE; }
49   void SetJPSItoEleOff() { fJPSItoEle=kFALSE; }
50   void Set3ProngOn() { f3Prong=kTRUE; }
51   void Set3ProngOff() { f3Prong=kFALSE; }
52   void Set4ProngOn() { f4Prong=kTRUE; }
53   void Set4ProngOff() { f4Prong=kFALSE; }
54   void SetDstarOn() { fDstar=kTRUE; }
55   void SetDstarOff() { fDstar=kFALSE; }
56   Bool_t GetD0toKpi() { return fD0toKpi; }
57   Bool_t GetJPSItoEle() { return fJPSItoEle; }
58   Bool_t Get3Prong() { return f3Prong; }
59   Bool_t Get4Prong() { return f4Prong; }
60   Bool_t GetDstar()  { return fDstar; }
61   void SetRecoPrimVtxSkippingTrks() 
62     { fRecoPrimVtxSkippingTrks=kTRUE; fRmTrksFromPrimVtx=kFALSE;}
63   void SetRmTrksFromPrimVtx() 
64     {fRmTrksFromPrimVtx=kTRUE; fRecoPrimVtxSkippingTrks=kFALSE; }
65   void SetTrackFilter(AliAnalysisFilter* trackF) { fTrackFilter = trackF; }
66   void SetTrackFilterSoftPi(AliAnalysisFilter* trackF) { fTrackFilterSoftPi = trackF; }
67   void SetD0toKpiCuts(Double_t cut0=1000.,Double_t cut1=100000.,
68                       Double_t cut2=1.1,Double_t cut3=0.,Double_t cut4=0.,
69                       Double_t cut5=100000.,Double_t cut6=100000.,
70                       Double_t cut7=100000000.,Double_t cut8=-1.1); 
71   void SetD0toKpiCuts(const Double_t cuts[9]); 
72   void SetD0fromDstarCuts(Double_t cut0=1000.,Double_t cut1=100000.,
73                           Double_t cut2=1.1,Double_t cut3=0.,Double_t cut4=0.,
74                           Double_t cut5=100000.,Double_t cut6=100000.,
75                           Double_t cut7=100000000.,Double_t cut8=-1.1); 
76   void SetD0fromDstarCuts(const Double_t cuts[9]); 
77   void SetBtoJPSICuts(Double_t cut0=1000.,Double_t cut1=100000.,
78                       Double_t cut2=1.1,Double_t cut3=0.,Double_t cut4=0.,
79                       Double_t cut5=100000.,Double_t cut6=100000.,
80                       Double_t cut7=100000000.,Double_t cut8=-1.1); 
81   void SetBtoJPSICuts(const Double_t cuts[9]); 
82   void SetDplusCuts(Double_t cut0=1000.,Double_t cut1=0.,
83                     Double_t cut2=0.,Double_t cut3=0.,Double_t cut4=0.,
84                     Double_t cut5=0.,Double_t cut6=10000000000.,
85                     Double_t cut7=0.,Double_t cut8=0.,
86                     Double_t cut9=-1.1,Double_t cut10=0.,
87                     Double_t cut11=10000000000.); 
88   void SetDplusCuts(const Double_t cuts[12]); 
89   void SetDsCuts(Double_t cut0=1000.,Double_t cut1=0.,
90                 Double_t cut2=0.,Double_t cut3=0.,Double_t cut4=0.,
91                 Double_t cut5=0.,Double_t cut6=10000000000.,
92                 Double_t cut7=0.,Double_t cut8=0.,
93                 Double_t cut9=-1.1,Double_t cut10=0.,
94                 Double_t cut11=10000000000., Double_t cut12=1000.); 
95   void SetDsCuts(const Double_t cuts[13]); 
96   void SetLcCuts(Double_t cut0=1000.,Double_t cut1=0.,
97                  Double_t cut2=0.,Double_t cut3=0.,Double_t cut4=0.,
98                  Double_t cut5=0.,Double_t cut6=10000000000.,
99                  Double_t cut7=0.,Double_t cut8=0.,
100                  Double_t cut9=-1.1,Double_t cut10=0.,
101                  Double_t cut11=10000000000.); 
102   void SetLcCuts(const Double_t cuts[12]); 
103   void SetDstarCuts(Double_t cut0=1000., Double_t cut1=1000.,
104                       Double_t cut2=-1., Double_t cut3=1000.,
105                       Double_t cut4=1.6); 
106   void SetDstarCuts(const Double_t cuts[5]); 
107
108   //
109  private:
110   //
111   enum { kBitDispl = 0, kBitSoftPi = 1 };
112
113   Bool_t fInputAOD; // input from AOD (kTRUE) or ESD (kFALSE) 
114
115   Int_t *fAODMap; // map between index and ID for AOD tracks
116
117   Double_t fBzkG; // z componenent of field in kG
118
119   Bool_t fSecVtxWithKF; // if kTRUE use KF vertexer, else AliVertexerTracks
120
121   Bool_t fRecoPrimVtxSkippingTrks; // flag for primary vertex reco on the fly
122                                    // for each candidate, w/o its daughters
123   Bool_t fRmTrksFromPrimVtx; // flag for fast removal of daughters from 
124                              // the primary vertex
125
126   AliESDVertex *fV1; // primary vertex
127
128   // flag to enable candidates production
129   Bool_t fD0toKpi;   // D0->Kpi 
130   Bool_t fJPSItoEle; // Jpsi->ee
131   Bool_t f3Prong;    // D+,Ds,Lc
132   Bool_t f4Prong;    // D0->Kpipipi
133   Bool_t fDstar;     // D*->D0pi
134
135   // single-track cuts
136   AliAnalysisFilter *fTrackFilter; //  Track Filter for displaced vertices
137   AliAnalysisFilter *fTrackFilterSoftPi; //  Track Filter for D* soft pion
138   // candidates cuts
139   Double_t fD0toKpiCuts[9]; // cuts on D0->Kpi candidates
140                   // (to be passed to AliAODRecoDecayHF2Prong::SelectD0())
141                           // 0 = inv. mass half width [GeV]   
142                           // 1 = dca [cm]
143                           // 2 = cosThetaStar 
144                           // 3 = pTK [GeV/c]
145                           // 4 = pTPi [GeV/c]
146                           // 5 = d0K [cm]   upper limit!
147                           // 6 = d0Pi [cm]  upper limit!
148                           // 7 = d0d0 [cm^2]
149                           // 8 = cosThetaPoint
150   Double_t fD0fromDstarCuts[9]; // cuts on D0->Kpi candidates from D*
151                         // (to be passed to AliAODRecoCascadeHF::SelectDstar())
152                           // 0 = inv. mass half width [GeV]   
153                           // 1 = dca [cm]
154                           // 2 = cosThetaStar 
155                           // 3 = pTK [GeV/c]
156                           // 4 = pTPi [GeV/c]
157                           // 5 = d0K [cm]   upper limit!
158                           // 6 = d0Pi [cm]  upper limit!
159                           // 7 = d0d0 [cm^2]
160                           // 8 = cosThetaPoint
161   Double_t fBtoJPSICuts[9]; // cuts on JPSI candidates
162                   // (to be passed to AliAODRecoDecayHF2Prong::SelectBtoJPSI())
163                           // 0 = inv. mass half width [GeV]   
164                           // 1 = dca [cm]
165                           // 2 = cosThetaStar (negative electron)
166                           // 3 = pTP [GeV/c]
167                           // 4 = pTN [GeV/c]
168                           // 5 = d0O [cm]   upper limit!
169                           // 6 = d0N [cm]  upper limit!
170                           // 7 = d0d0 [cm^2]
171                           // 8 = cosThetaPoint
172   Double_t fDplusCuts[12]; // cuts on Dplus candidates
173                   // (to be passed to AliAODRecoDecayHF3Prong::SelectDplus())
174                           // 0 = inv. mass half width [GeV]   
175                           // 1 = pTK [GeV/c]
176                           // 2 = pTPi [GeV/c]
177                           // 3 = d0K [cm]   lower limit!
178                           // 4 = d0Pi [cm]  lower limit!
179                           // 5 = dist12 (cm)
180                           // 6 = sigmavert (cm)
181                           // 7 = dist prim-sec (cm)
182                           // 8 = pM=Max{pT1,pT2,pT3} (GeV/c)
183                           // 9 = cosThetaPoint
184                           // 10 = Sum d0^2 (cm^2)
185                           // 11 = dca cut (cm)
186   Double_t fDsCuts[13]; // cuts on Ds candidates
187                         // (to be passed to AliAODRecoDecayHF3Prong::SelectDs())
188                         // 0 = inv. mass half width [GeV]   
189                         // 1 = pTK [GeV/c]
190                         // 2 = pTPi [GeV/c]
191                         // 3 = d0K [cm]   lower limit!
192                         // 4 = d0Pi [cm]  lower limit!
193                         // 5 = dist12 (cm)
194                         // 6 = sigmavert (cm)
195                         // 7 = dist prim-sec (cm)
196                         // 8 = pM=Max{pT1,pT2,pT3} (GeV/c)
197                         // 9 = cosThetaPoint
198                         // 10 = Sum d0^2 (cm^2)
199                         // 11 = dca cut (cm)
200                         // 12 = inv. mass cut arounf phi and K0* [GeV]
201    Double_t fLcCuts[12]; // cuts on Lambdac candidates
202                         // (to be passed to AliAODRecoDecayHF3Prong::SelectLc())
203                         // 0 = inv. mass half width [GeV]   
204                         // 1 = pTP [GeV/c]
205                         // 2 = pTPi abd pTK [GeV/c]
206                         // 3 = d0P [cm]   lower limit!
207                         // 4 = d0Pi and d0K [cm]  lower limit!
208                         // 5 = dist12 (cm)
209                         // 6 = sigmavert (cm)
210                         // 7 = dist prim-sec (cm)
211                         // 8 = pM=Max{pT1,pT2,pT3} (GeV/c)
212                         // 9 = cosThetaPoint
213                         // 10 = Sum d0^2 (cm^2)
214                         // 11 = dca cut (cm)
215   Double_t fDstarCuts[5]; // cuts on D* candidates
216                         // (to be passed to AliAODRecoCascadeHF::SelectDstar())
217                         // 0 = inv. mass half width of D* [GeV]
218                         // 1 = half width of (M_Kpipi-M_Kpi) [GeV]
219                         // 2 = PtMin of pi_s [GeV/c]
220                         // 3 = PtMax of pi_s [GeV/c]
221                         // 4 = theta, angle between the track of pi_s and D0 decay plane [rad]
222
223   //
224   void AddDaughterRefs(AliAODVertex *v,AliVEvent *event,
225                        TObjArray *trkArray) const;
226   AliAODRecoDecayHF2Prong* Make2Prong(TObjArray *twoTrackArray1,AliVEvent *event,
227                                       AliAODVertex *secVert,Double_t dcap1n1,
228                                       Bool_t &okD0,Bool_t &okJPSI,Bool_t &okD0fromDstar) const;
229   AliAODRecoDecayHF3Prong* Make3Prong(TObjArray *threeTrackArray,AliVEvent *event,
230                                       AliAODVertex *secVert,
231                                       Double_t dispersion,
232                                       AliAODVertex *vertexp1n1,
233                                       AliAODVertex *vertexp2n1,
234                                       Double_t dcap1n1,Double_t dcap2n1,Double_t dcap1p2,
235                                       Bool_t &ok3Prong) const;
236   AliAODRecoDecayHF4Prong* Make4Prong(TObjArray *fourTrackArray,AliVEvent *event,
237                                       AliAODVertex *secVert,
238                                       AliAODVertex *vertexp1n1,
239                                       AliAODVertex *vertexp2n1,
240                                       Double_t dcap1n1,Double_t dcap1n2,
241                                       Double_t dcap2n1,
242                                       Bool_t &ok4Prong) const;
243   AliAODRecoCascadeHF* MakeCascade(TObjArray *twoTrackArray,AliVEvent *event,
244                                    AliAODVertex *secVert,
245                                    AliAODRecoDecayHF2Prong *rd2Prong,
246                                    Double_t dca,
247                                    Bool_t &okDstar) const;
248
249   AliAODVertex* PrimaryVertex(TObjArray *trkArray=0x0,AliVEvent *event=0x0) const;
250   AliAODVertex* ReconstructSecondaryVertex(TObjArray *trkArray,Double_t &dispersion) const;
251   Bool_t SelectInvMass(Int_t decay,Int_t nprongs,
252                        Double_t *px,Double_t *py,Double_t *pz) const;
253   void   SelectTracksAndCopyVertex(AliVEvent *event,
254                                    TObjArray &seleTrksArray,Int_t &nSeleTrks,
255                                    UChar_t *seleFlags);
256   void   SetPrimaryVertex(AliESDVertex *v1) { fV1 = v1; }
257   Bool_t SingleTrkCuts(AliESDtrack *trk,Bool_t &okDisplaced,Bool_t &okSoftPi) const;
258   //
259   ClassDef(AliAnalysisVertexingHF,6)  // Reconstruction of HF decay candidates
260 };
261
262
263 #endif
264
265
266
267
268
269
270
271