Update (Andrea)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAODRecoDecayHF3Prong.cxx
CommitLineData
3244eeed 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
27de2dfb 16/* $Id$ */
17
3244eeed 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"
16156b6d 28#include "AliAODTrack.h"
2e153422 29#include "TVector3.h"
30#include "TLorentzVector.h"
3244eeed 31
32ClassImp(AliAODRecoDecayHF3Prong)
33
34//--------------------------------------------------------------------------
35AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong() :
36 AliAODRecoDecayHF(),
37 fSigmaVert(0),
38 fDist12toPrim(0),
39 fDist23toPrim(0)
40{
41 //
42 // Default Constructor
43 //
44}
45//--------------------------------------------------------------------------
46AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
47 Double_t *px,Double_t *py,Double_t *pz,
48 Double_t *d0,Double_t *d0err,
49 Double_t *dca, Double_t sigvert,
50 Double_t dist12,Double_t dist23,Short_t charge) :
51 AliAODRecoDecayHF(vtx2,3,charge,px,py,pz,d0,d0err),
52 fSigmaVert(sigvert),
53 fDist12toPrim(dist12),
54 fDist23toPrim(dist23)
55{
56 //
57 // Constructor with AliAODVertex for decay vertex
58 //
6185d025 59 SetDCAs(3,dca);
3244eeed 60}
61//--------------------------------------------------------------------------
62AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
63 Double_t *d0,Double_t *d0err,
64 Double_t *dca, Double_t sigvert,
65 Double_t dist12,Double_t dist23, Short_t charge) :
66 AliAODRecoDecayHF(vtx2,3,charge,d0,d0err),
67 fSigmaVert(sigvert),
68 fDist12toPrim(dist12),
69 fDist23toPrim(dist23)
70{
71 //
72 // Constructor with AliAODVertex for decay vertex and without prongs momenta
73 //
6185d025 74 SetDCAs(3,dca);
3244eeed 75}
76//--------------------------------------------------------------------------
77AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(const AliAODRecoDecayHF3Prong &source) :
78 AliAODRecoDecayHF(source),
79 fSigmaVert(source.fSigmaVert),
80 fDist12toPrim(source.fDist12toPrim),
81 fDist23toPrim(source.fDist23toPrim)
82{
83 //
84 // Copy constructor
85 //
86}
87//--------------------------------------------------------------------------
88AliAODRecoDecayHF3Prong &AliAODRecoDecayHF3Prong::operator=(const AliAODRecoDecayHF3Prong &source)
89{
90 //
91 // assignment operator
92 //
93 if(&source == this) return *this;
dcb444c9 94
95 AliAODRecoDecayHF::operator=(source);
96
3244eeed 97 fDist12toPrim= source.fDist12toPrim;
98 fDist23toPrim= source.fDist23toPrim;
99 fSigmaVert= source.fSigmaVert;
dcb444c9 100
3244eeed 101 return *this;
102}
103//--------------------------------------------------------------------------
104Bool_t AliAODRecoDecayHF3Prong::SelectDplus(const Double_t *cuts)
105 const {
106//
107// This function compares the Dplus with a set of cuts:
108//
109// cuts[0] = inv. mass half width [GeV]
110// cuts[1] = pTK [GeV/c]
111// cuts[2] = pTPi [GeV/c]
112// cuts[3] = d0K [cm] lower limit!
113// cuts[4] = d0Pi [cm] lower limit!
114// cuts[5] = dist12 (cm)
115// cuts[6] = sigmavert (cm)
116// cuts[7] = dist prim-sec (cm)
117// cuts[8] = pM=Max{pT1,pT2,pT3} (GeV/c)
118// cuts[9] = cosThetaPoint
119// cuts[10] = Sum d0^2 (cm^2)
120// cuts[11] = dca cut (cm)
121//
122// If candidate Dplus does not pass the cuts return kFALSE
123//
124
125 Double_t mDplusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass();
126 Double_t mDplus=InvMassDplus();
127 if(TMath::Abs(mDplus-mDplusPDG)>cuts[0])return kFALSE;
128 //single track
129 if(TMath::Abs(PtProng(1)) < cuts[1] || TMath::Abs(Getd0Prong(1))<cuts[3])return kFALSE;//Kaon
130 if(TMath::Abs(PtProng(0)) < cuts[2] || TMath::Abs(Getd0Prong(0))<cuts[4])return kFALSE;//Pion1
131 if(TMath::Abs(PtProng(2)) < cuts[2] || TMath::Abs(Getd0Prong(2))<cuts[4])return kFALSE;//Pion2
132
133 //DCA
81679460 134 for(Int_t i=0;i<3;i++) if(GetDCA(i)>cuts[11])return kFALSE;
3244eeed 135
136 //2track cuts
137 if(fDist12toPrim<cuts[5] || fDist23toPrim<cuts[5])return kFALSE;
138 if(Getd0Prong(0)*Getd0Prong(1)<0. && Getd0Prong(2)*Getd0Prong(1)<0.)return kFALSE;
139
140 //sec vert
141 if(fSigmaVert>cuts[6])return kFALSE;
142
143 if(DecayLength()<cuts[7])return kFALSE;
144
145 if(TMath::Abs(PtProng(0))<cuts[8] && TMath::Abs(PtProng(1))<cuts[8] && TMath::Abs(PtProng(2))<cuts[8])return kFALSE;
146 if(CosPointingAngle() < cuts[9])return kFALSE;
147 Double_t sum2=Getd0Prong(0)*Getd0Prong(0)+Getd0Prong(1)*Getd0Prong(1)+Getd0Prong(2)*Getd0Prong(2);
148 if(sum2<cuts[10])return kFALSE;
149 return kTRUE;
150}
79250a2b 151//--------------------------------------------------------------------------
9fce5365 152Bool_t AliAODRecoDecayHF3Prong::SelectDs(const Double_t *cuts,Int_t &okDsKKpi,Int_t &okDspiKK, Int_t &okMassPhi, Int_t &okMassK0star)
79250a2b 153 const {
154//
6ea608bf 155// This function compares the Ds with a set of cuts
156// (same variables as D+, for now)
79250a2b 157//
158// cuts[0] = inv. mass half width [GeV]
6ea608bf 159// cuts[1] = pTK [GeV/c]
160// cuts[2] = pTPi [GeV/c]
161// cuts[3] = d0K [cm] lower limit!
162// cuts[4] = d0Pi [cm] lower limit!
163// cuts[5] = dist12 (cm)
164// cuts[6] = sigmavert (cm)
165// cuts[7] = dist prim-sec (cm)
166// cuts[8] = pM=Max{pT1,pT2,pT3} (GeV/c)
167// cuts[9] = cosThetaPoint
168// cuts[10] = Sum d0^2 (cm^2)
169// cuts[11] = dca cut (cm)
9fce5365 170// cuts[12] = max. inv. mass difference(Mphi-MKK) [GeV]
171// cuts[13] = max. inv. mass difference(MK0*-MKpi) [GeV]
79250a2b 172//
173// If candidate Ds does not pass the cuts return kFALSE
174//
175 Double_t mDsKKpi,mDspiKK;
176 okDsKKpi=1; okDspiKK=1;
9fce5365 177 okMassPhi=0; okMassK0star=0;
79250a2b 178
179 Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
180
181 mDsKKpi=InvMassDsKKpi();
182 mDspiKK=InvMassDspiKK();
183
184 if(TMath::Abs(mDsKKpi-mDsPDG)>cuts[0]) okDsKKpi = 0;
185 if(TMath::Abs(mDspiKK-mDsPDG)>cuts[0]) okDspiKK = 0;
186 if(!okDsKKpi && !okDspiKK) return kFALSE;
187
6ea608bf 188 //single track
189 if(TMath::Abs(PtProng(0)) < cuts[1] || TMath::Abs(Getd0Prong(0))<cuts[3])return kFALSE;//Kaon1
190 if(TMath::Abs(PtProng(1)) < cuts[1] || TMath::Abs(Getd0Prong(1))<cuts[3])return kFALSE;//Kaon2
81679460 191 if(TMath::Abs(PtProng(2)) < cuts[2] || TMath::Abs(Getd0Prong(2))<cuts[4])return kFALSE;//Pion
6ea608bf 192
81679460 193 // cuts on resonant decays (via Phi or K0*)
81679460 194 Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
9fce5365 195 Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
196 if(okDsKKpi){
197 Double_t mass01phi=InvMass2Prongs(0,1,321,321);
198 Double_t mass12K0s=InvMass2Prongs(1,2,321,211);
199 if(TMath::Abs(mass01phi-mPhiPDG)<cuts[12]) okMassPhi=1;
200 if(TMath::Abs(mass12K0s-mK0starPDG)<cuts[13]) okMassK0star = 1;
201 if(!okMassPhi && !okMassK0star) okDsKKpi=kFALSE;
202 }
203 if(okDspiKK){
204 Double_t mass01K0s=InvMass2Prongs(0,1,211,321);
205 Double_t mass12phi=InvMass2Prongs(1,2,321,321);
206 if(TMath::Abs(mass01K0s-mK0starPDG)<cuts[13]) okMassK0star = 1;
207 if(TMath::Abs(mass12phi-mPhiPDG)<cuts[12]) okMassPhi=1;
208 if(!okMassPhi && !okMassK0star) okDspiKK=kFALSE;
209 }
210 if(!okDsKKpi && !okDspiKK) return kFALSE;
211
212
213
81679460 214
6ea608bf 215 //DCA
81679460 216 for(Int_t i=0;i<3;i++) if(GetDCA(i)>cuts[11])return kFALSE;
6ea608bf 217
218 //2track cuts
219 if(fDist12toPrim<cuts[5] || fDist23toPrim<cuts[5])return kFALSE;
6ea608bf 220
221 //sec vert
222 if(fSigmaVert>cuts[6])return kFALSE;
223
224 if(DecayLength()<cuts[7])return kFALSE;
225
226 if(TMath::Abs(PtProng(0))<cuts[8] && TMath::Abs(PtProng(1))<cuts[8] && TMath::Abs(PtProng(2))<cuts[8])return kFALSE;
227 if(CosPointingAngle() < cuts[9])return kFALSE;
228 Double_t sum2=Getd0Prong(0)*Getd0Prong(0)+Getd0Prong(1)*Getd0Prong(1)+Getd0Prong(2)*Getd0Prong(2);
229 if(sum2<cuts[10])return kFALSE;
230
79250a2b 231 return kTRUE;
232}
233//--------------------------------------------------------------------------
234Bool_t AliAODRecoDecayHF3Prong::SelectLc(const Double_t *cuts,Int_t &okLcpKpi,Int_t &okLcpiKp)
235 const {
236//
6ea608bf 237// This function compares the Lc with a set of cuts
238// (same variables as D+, for now)
79250a2b 239//
240// cuts[0] = inv. mass half width [GeV]
6ea608bf 241// cuts[1] = pTP [GeV/c]
242// cuts[2] = pTPi and pTK [GeV/c]
243// cuts[3] = d0P [cm] lower limit!
244// cuts[4] = d0Pi and d0K [cm] lower limit!
245// cuts[5] = dist12 (cm)
246// cuts[6] = sigmavert (cm)
247// cuts[7] = dist prim-sec (cm)
248// cuts[8] = pM=Max{pT1,pT2,pT3} (GeV/c)
249// cuts[9] = cosThetaPoint
250// cuts[10] = Sum d0^2 (cm^2)
251// cuts[11] = dca cut (cm)
79250a2b 252//
253// If candidate Lc does not pass the cuts return kFALSE
254//
255 Double_t mLcpKpi,mLcpiKp;
256 okLcpKpi=1; okLcpiKp=1;
257
258 Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
259
260 mLcpKpi=InvMassLcpKpi();
261 mLcpiKp=InvMassLcpiKp();
262
263 if(TMath::Abs(mLcpKpi-mLcPDG)>cuts[0]) okLcpKpi = 0;
264 if(TMath::Abs(mLcpiKp-mLcPDG)>cuts[0]) okLcpiKp = 0;
265 if(!okLcpKpi && !okLcpiKp) return kFALSE;
266
6ea608bf 267 //single track
268 if(TMath::Abs(PtProng(0)) < cuts[1] || TMath::Abs(Getd0Prong(0))<cuts[3])return kFALSE;//Proton
269 if(TMath::Abs(PtProng(1)) < cuts[2] || TMath::Abs(Getd0Prong(1))<cuts[4])return kFALSE;//Kaon
270 if(TMath::Abs(PtProng(2)) < cuts[2] || TMath::Abs(Getd0Prong(2))<cuts[4])return kFALSE;//Pion
271
272 //DCA
81679460 273 for(Int_t i=0;i<3;i++) if(GetDCA(i)>cuts[11])return kFALSE;
6ea608bf 274
275 //2track cuts
276 if(fDist12toPrim<cuts[5] || fDist23toPrim<cuts[5])return kFALSE;
277 if(Getd0Prong(0)*Getd0Prong(1)<0. && Getd0Prong(2)*Getd0Prong(1)<0.)return kFALSE;
278
279 //sec vert
280 if(fSigmaVert>cuts[6])return kFALSE;
281
282 if(DecayLength()<cuts[7])return kFALSE;
283
284 if(TMath::Abs(PtProng(0))<cuts[8] && TMath::Abs(PtProng(1))<cuts[8] && TMath::Abs(PtProng(2))<cuts[8])return kFALSE;
285 if(CosPointingAngle() < cuts[9])return kFALSE;
286 Double_t sum2=Getd0Prong(0)*Getd0Prong(0)+Getd0Prong(1)*Getd0Prong(1)+Getd0Prong(2)*Getd0Prong(2);
287 if(sum2<cuts[10])return kFALSE;
288
79250a2b 289 return kTRUE;
290}
2e153422 291
292
293//----------------------------------------------------------------------
294Double_t AliAODRecoDecayHF3Prong::CosPiKPhiRFrame(Int_t option)
295const {
296 // computes cosine of angle between pi and K in the phi rest frame
297
298 Int_t indexPi;
299 Int_t indexK1;
300 Int_t indexK2;
301
302 if (option==0){ //KKpi
303 indexPi=2;
304 indexK1=0;
305 indexK2=1;
cbe0066f 306 }else{ //piKK
2e153422 307 indexPi=0;
308 indexK1=1;
309 indexK2=2;
310 }
311
312 Double_t ePhi=EProng(indexK1,321)+EProng(indexK2,321);
313 Double_t pxPhi=PxProng(indexK1)+PxProng(indexK2);
314 Double_t pyPhi=PyProng(indexK1)+PyProng(indexK2);
315 Double_t pzPhi=PzProng(indexK1)+PzProng(indexK2);
316 Double_t bxPhi=pxPhi/ePhi;
317 Double_t byPhi=pyPhi/ePhi;
318 Double_t bzPhi=pzPhi/ePhi;
319
320 TVector3 vecK1Phiframe;
321 TLorentzVector* vecK1=new TLorentzVector(PxProng(indexK1),PyProng(indexK1),PzProng(indexK1),EProng(indexK1,321));
322 vecK1->Boost(-bxPhi,-byPhi,-bzPhi);
323 vecK1->Boost(vecK1Phiframe);
324 vecK1Phiframe=vecK1->BoostVector();
325
326 TVector3 vecPiPhiframe;
327 TLorentzVector* vecPi=new TLorentzVector(PxProng(indexPi),PyProng(indexPi),PzProng(indexPi),EProng(indexPi,211));
328 vecPi->Boost(-bxPhi,-byPhi,-bzPhi);
329 vecPi->Boost(vecPiPhiframe);
330 vecPiPhiframe=vecPi->BoostVector();
331
332 Double_t innera=vecPiPhiframe.Dot(vecK1Phiframe);
333 Double_t norm1a=TMath::Sqrt(vecPiPhiframe.Dot(vecPiPhiframe));
334 Double_t norm2a=TMath::Sqrt(vecK1Phiframe.Dot(vecK1Phiframe));
335 Double_t cosK1PhiFrame=innera/(norm1a*norm2a);
336
337 return cosK1PhiFrame;
338
339}
340
341//----------------------------------------------------------------------
342Double_t AliAODRecoDecayHF3Prong::CosPiDsLabFrame(Int_t option)
343const {
344 // computes cosine of angle between pi and Ds in the Ds rest frame
345
346 Int_t indexPi;
2e153422 347
348 if (option==0){ //KKpi
349 indexPi=2;
cbe0066f 350 }else{ //piKK
2e153422 351 indexPi=0;
2e153422 352 }
353
354
355 Double_t bxD=Px()/E(431);
356 Double_t byD=Py()/E(431);
357 Double_t bzD=Pz()/E(431);
358
359 TVector3 piDsframe;
360 TLorentzVector* vecPi=new TLorentzVector(PxProng(indexPi),PyProng(indexPi),PzProng(indexPi),EProng(indexPi,211));
361 vecPi->Boost(-bxD,-byD,-bzD);
362 vecPi->Boost(piDsframe);
363 piDsframe=vecPi->BoostVector();
364
365 TVector3 vecDs(Px(),Py(),Pz());
366
367 Double_t inner=vecDs.Dot(piDsframe);
368 Double_t norm1=TMath::Sqrt(vecDs.Dot(vecDs));
369 Double_t norm2=TMath::Sqrt(piDsframe.Dot(piDsframe));
370 Double_t cosPiDsFrame=inner/(norm1*norm2);
371
372
373 return cosPiDsFrame;
374
375}
376