]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AliAODRecoDecayHF3Prong.cxx
fix to the proper NSD
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAODRecoDecayHF3Prong.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 /////////////////////////////////////////////////////////////
19 //
20 // Base class for AOD reconstructed heavy-flavour 3-prong decay
21 //
22 // Author: E.Bruna bruna@to.infn.it, F.Prino prino@to.infn.it
23 /////////////////////////////////////////////////////////////
24
25 #include <TDatabasePDG.h>
26 #include "AliAODRecoDecayHF.h"
27 #include "AliAODRecoDecayHF3Prong.h"
28 #include "AliAODTrack.h"
29
30 ClassImp(AliAODRecoDecayHF3Prong)
31
32 //--------------------------------------------------------------------------
33 AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong() :
34   AliAODRecoDecayHF(), 
35   fSigmaVert(0),
36   fDist12toPrim(0),
37   fDist23toPrim(0)
38 {
39   //
40   // Default Constructor
41   //
42 }
43 //--------------------------------------------------------------------------
44 AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
45                                                  Double_t *px,Double_t *py,Double_t *pz,
46                                                  Double_t *d0,Double_t *d0err,
47                                                  Double_t *dca, Double_t sigvert,
48                                                  Double_t dist12,Double_t dist23,Short_t charge) :
49   AliAODRecoDecayHF(vtx2,3,charge,px,py,pz,d0,d0err),
50   fSigmaVert(sigvert),
51   fDist12toPrim(dist12),
52   fDist23toPrim(dist23)
53 {
54   //
55   // Constructor with AliAODVertex for decay vertex
56   //
57   SetDCAs(3,dca);
58 }
59 //--------------------------------------------------------------------------
60 AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
61                                                  Double_t *d0,Double_t *d0err,
62                                                  Double_t *dca, Double_t sigvert,
63                                                  Double_t dist12,Double_t dist23, Short_t charge) :
64   AliAODRecoDecayHF(vtx2,3,charge,d0,d0err),
65   fSigmaVert(sigvert),
66   fDist12toPrim(dist12),
67   fDist23toPrim(dist23)
68 {
69   //
70   // Constructor with AliAODVertex for decay vertex and without prongs momenta
71   //
72   SetDCAs(3,dca);
73 }
74 //--------------------------------------------------------------------------
75 AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(const AliAODRecoDecayHF3Prong &source) :
76   AliAODRecoDecayHF(source),
77   fSigmaVert(source.fSigmaVert),
78   fDist12toPrim(source.fDist12toPrim),
79   fDist23toPrim(source.fDist23toPrim)
80 {
81   //
82   // Copy constructor
83   //
84 }
85 //--------------------------------------------------------------------------
86 AliAODRecoDecayHF3Prong &AliAODRecoDecayHF3Prong::operator=(const AliAODRecoDecayHF3Prong &source)
87 {
88   //
89   // assignment operator
90   //
91   if(&source == this) return *this;
92
93   AliAODRecoDecayHF::operator=(source);
94
95   fDist12toPrim= source.fDist12toPrim;
96   fDist23toPrim= source.fDist23toPrim;
97   fSigmaVert= source.fSigmaVert;
98
99   return *this;
100 }
101 //-------------Temporary fix: overload AliAODRecoDecay::Charge()-----------
102 Short_t AliAODRecoDecayHF3Prong::Charge() const {
103   Short_t charge=0;
104   for(Int_t daught=0;daught<=2;daught++)charge=charge+((AliAODTrack*)GetDaughter(daught))->Charge();
105   return charge;
106 }
107 //--------------------------------------------------------------------------
108 Bool_t AliAODRecoDecayHF3Prong::SelectDplus(const Double_t *cuts)
109   const {
110 //
111 // This function compares the Dplus with a set of cuts:
112 //
113 // cuts[0] = inv. mass half width [GeV]   
114 // cuts[1] = pTK [GeV/c]
115 // cuts[2] = pTPi [GeV/c]
116 // cuts[3] = d0K [cm]   lower limit!
117 // cuts[4] = d0Pi [cm]  lower limit!
118 // cuts[5] = dist12 (cm)
119 // cuts[6] = sigmavert (cm)
120 // cuts[7] = dist prim-sec (cm)
121 // cuts[8] = pM=Max{pT1,pT2,pT3} (GeV/c)
122 // cuts[9] = cosThetaPoint
123 // cuts[10] = Sum d0^2 (cm^2)
124 // cuts[11] = dca cut (cm)
125 //
126 // If candidate Dplus does not pass the cuts return kFALSE
127 //
128
129   Double_t mDplusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass();
130   Double_t mDplus=InvMassDplus();
131   if(TMath::Abs(mDplus-mDplusPDG)>cuts[0])return kFALSE;
132   //single track
133   if(TMath::Abs(PtProng(1)) < cuts[1] || TMath::Abs(Getd0Prong(1))<cuts[3])return kFALSE;//Kaon
134   if(TMath::Abs(PtProng(0)) < cuts[2] || TMath::Abs(Getd0Prong(0))<cuts[4])return kFALSE;//Pion1
135   if(TMath::Abs(PtProng(2)) < cuts[2] || TMath::Abs(Getd0Prong(2))<cuts[4])return kFALSE;//Pion2
136
137   //DCA
138   for(Int_t i=0;i<3;i++) if(GetDCA(i)>cuts[11])return kFALSE;
139
140   //2track cuts
141   if(fDist12toPrim<cuts[5] || fDist23toPrim<cuts[5])return kFALSE;
142   if(Getd0Prong(0)*Getd0Prong(1)<0. && Getd0Prong(2)*Getd0Prong(1)<0.)return kFALSE;
143
144   //sec vert
145   if(fSigmaVert>cuts[6])return kFALSE;
146
147   if(DecayLength()<cuts[7])return kFALSE;
148
149   if(TMath::Abs(PtProng(0))<cuts[8] && TMath::Abs(PtProng(1))<cuts[8] && TMath::Abs(PtProng(2))<cuts[8])return kFALSE;
150   if(CosPointingAngle()   < cuts[9])return kFALSE;
151   Double_t sum2=Getd0Prong(0)*Getd0Prong(0)+Getd0Prong(1)*Getd0Prong(1)+Getd0Prong(2)*Getd0Prong(2);
152   if(sum2<cuts[10])return kFALSE;
153   return kTRUE;
154 }
155 //--------------------------------------------------------------------------
156 Bool_t AliAODRecoDecayHF3Prong::SelectDs(const Double_t *cuts,Int_t &okDsKKpi,Int_t &okDspiKK, Int_t &okMassPhi, Int_t &okMassK0star)
157   const {
158 //
159 // This function compares the Ds with a set of cuts 
160 // (same variables as D+, for now)
161 //
162 // cuts[0] = inv. mass half width [GeV]   
163 // cuts[1] = pTK [GeV/c]
164 // cuts[2] = pTPi [GeV/c]
165 // cuts[3] = d0K [cm]   lower limit!
166 // cuts[4] = d0Pi [cm]  lower limit!
167 // cuts[5] = dist12 (cm)
168 // cuts[6] = sigmavert (cm)
169 // cuts[7] = dist prim-sec (cm)
170 // cuts[8] = pM=Max{pT1,pT2,pT3} (GeV/c)
171 // cuts[9] = cosThetaPoint
172 // cuts[10] = Sum d0^2 (cm^2)
173 // cuts[11] = dca cut (cm)
174 // cuts[12] = max. inv. mass difference(Mphi-MKK) [GeV] 
175 // cuts[13] = max. inv. mass difference(MK0*-MKpi) [GeV] 
176 //
177 // If candidate Ds does not pass the cuts return kFALSE
178 //
179   Double_t mDsKKpi,mDspiKK;
180   okDsKKpi=1; okDspiKK=1;
181   okMassPhi=0; okMassK0star=0;
182
183   Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
184
185   mDsKKpi=InvMassDsKKpi();
186   mDspiKK=InvMassDspiKK();
187
188   if(TMath::Abs(mDsKKpi-mDsPDG)>cuts[0]) okDsKKpi = 0;
189   if(TMath::Abs(mDspiKK-mDsPDG)>cuts[0]) okDspiKK = 0;
190   if(!okDsKKpi && !okDspiKK) return kFALSE;
191
192   //single track
193   if(TMath::Abs(PtProng(0)) < cuts[1] || TMath::Abs(Getd0Prong(0))<cuts[3])return kFALSE;//Kaon1
194   if(TMath::Abs(PtProng(1)) < cuts[1] || TMath::Abs(Getd0Prong(1))<cuts[3])return kFALSE;//Kaon2
195   if(TMath::Abs(PtProng(2)) < cuts[2] || TMath::Abs(Getd0Prong(2))<cuts[4])return kFALSE;//Pion
196
197   // cuts on resonant decays (via Phi or K0*)
198   Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
199   Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
200   if(okDsKKpi){
201     Double_t mass01phi=InvMass2Prongs(0,1,321,321);
202     Double_t mass12K0s=InvMass2Prongs(1,2,321,211);
203     if(TMath::Abs(mass01phi-mPhiPDG)<cuts[12]) okMassPhi=1;
204     if(TMath::Abs(mass12K0s-mK0starPDG)<cuts[13]) okMassK0star = 1;
205     if(!okMassPhi && !okMassK0star) okDsKKpi=kFALSE;
206   }
207   if(okDspiKK){
208     Double_t mass01K0s=InvMass2Prongs(0,1,211,321);
209     Double_t mass12phi=InvMass2Prongs(1,2,321,321);
210     if(TMath::Abs(mass01K0s-mK0starPDG)<cuts[13]) okMassK0star = 1;
211     if(TMath::Abs(mass12phi-mPhiPDG)<cuts[12]) okMassPhi=1;
212     if(!okMassPhi && !okMassK0star) okDspiKK=kFALSE;
213   }
214   if(!okDsKKpi && !okDspiKK) return kFALSE;
215
216
217
218   
219   //DCA
220   for(Int_t i=0;i<3;i++) if(GetDCA(i)>cuts[11])return kFALSE;
221
222   //2track cuts
223   if(fDist12toPrim<cuts[5] || fDist23toPrim<cuts[5])return kFALSE;
224
225   //sec vert
226   if(fSigmaVert>cuts[6])return kFALSE;
227
228   if(DecayLength()<cuts[7])return kFALSE;
229
230   if(TMath::Abs(PtProng(0))<cuts[8] && TMath::Abs(PtProng(1))<cuts[8] && TMath::Abs(PtProng(2))<cuts[8])return kFALSE;
231   if(CosPointingAngle()   < cuts[9])return kFALSE;
232   Double_t sum2=Getd0Prong(0)*Getd0Prong(0)+Getd0Prong(1)*Getd0Prong(1)+Getd0Prong(2)*Getd0Prong(2);
233   if(sum2<cuts[10])return kFALSE;
234
235   return kTRUE;
236 }
237 //--------------------------------------------------------------------------
238 Bool_t AliAODRecoDecayHF3Prong::SelectLc(const Double_t *cuts,Int_t &okLcpKpi,Int_t &okLcpiKp)
239   const {
240 //
241 // This function compares the Lc with a set of cuts 
242 // (same variables as D+, for now)
243 //
244 // cuts[0] = inv. mass half width [GeV]   
245 // cuts[1] = pTP [GeV/c]
246 // cuts[2] = pTPi and pTK [GeV/c]
247 // cuts[3] = d0P [cm]   lower limit!
248 // cuts[4] = d0Pi and d0K [cm]  lower limit!
249 // cuts[5] = dist12 (cm)
250 // cuts[6] = sigmavert (cm)
251 // cuts[7] = dist prim-sec (cm)
252 // cuts[8] = pM=Max{pT1,pT2,pT3} (GeV/c)
253 // cuts[9] = cosThetaPoint
254 // cuts[10] = Sum d0^2 (cm^2)
255 // cuts[11] = dca cut (cm)
256 //
257 // If candidate Lc does not pass the cuts return kFALSE
258 //
259   Double_t mLcpKpi,mLcpiKp;
260   okLcpKpi=1; okLcpiKp=1;
261
262   Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
263
264   mLcpKpi=InvMassLcpKpi();
265   mLcpiKp=InvMassLcpiKp();
266
267   if(TMath::Abs(mLcpKpi-mLcPDG)>cuts[0]) okLcpKpi = 0;
268   if(TMath::Abs(mLcpiKp-mLcPDG)>cuts[0]) okLcpiKp = 0;
269   if(!okLcpKpi && !okLcpiKp) return kFALSE;
270
271   //single track
272   if(TMath::Abs(PtProng(0)) < cuts[1] || TMath::Abs(Getd0Prong(0))<cuts[3])return kFALSE;//Proton
273   if(TMath::Abs(PtProng(1)) < cuts[2] || TMath::Abs(Getd0Prong(1))<cuts[4])return kFALSE;//Kaon
274   if(TMath::Abs(PtProng(2)) < cuts[2] || TMath::Abs(Getd0Prong(2))<cuts[4])return kFALSE;//Pion
275
276   //DCA
277   for(Int_t i=0;i<3;i++) if(GetDCA(i)>cuts[11])return kFALSE;
278
279   //2track cuts
280   if(fDist12toPrim<cuts[5] || fDist23toPrim<cuts[5])return kFALSE;
281   if(Getd0Prong(0)*Getd0Prong(1)<0. && Getd0Prong(2)*Getd0Prong(1)<0.)return kFALSE;
282
283   //sec vert
284   if(fSigmaVert>cuts[6])return kFALSE;
285
286   if(DecayLength()<cuts[7])return kFALSE;
287
288   if(TMath::Abs(PtProng(0))<cuts[8] && TMath::Abs(PtProng(1))<cuts[8] && TMath::Abs(PtProng(2))<cuts[8])return kFALSE;
289   if(CosPointingAngle()   < cuts[9])return kFALSE;
290   Double_t sum2=Getd0Prong(0)*Getd0Prong(0)+Getd0Prong(1)*Getd0Prong(1)+Getd0Prong(2)*Getd0Prong(2);
291   if(sum2<cuts[10])return kFALSE;
292
293   return kTRUE;
294 }