]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/AliAODRecoDecayHF3Prong.cxx
bugfix: corrected defines to use right default algorithms
[u/mrichter/AliRoot.git] / PWG3 / 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 /////////////////////////////////////////////////////////////
17 //
18 // Base class for AOD reconstructed heavy-flavour 3-prong decay
19 //
20 // Author: E.Bruna bruna@to.infn.it, F.Prino prino@to.infn.it
21 /////////////////////////////////////////////////////////////
22
23 #include <TDatabasePDG.h>
24 #include "AliAODRecoDecayHF.h"
25 #include "AliAODRecoDecayHF3Prong.h"
26
27 ClassImp(AliAODRecoDecayHF3Prong)
28
29 //--------------------------------------------------------------------------
30 AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong() :
31   AliAODRecoDecayHF(), 
32   fSigmaVert(0),
33   fDist12toPrim(0),
34   fDist23toPrim(0)
35 {
36   //
37   // Default Constructor
38   //
39 }
40 //--------------------------------------------------------------------------
41 AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
42                                                  Double_t *px,Double_t *py,Double_t *pz,
43                                                  Double_t *d0,Double_t *d0err,
44                                                  Double_t *dca, Double_t sigvert,
45                                                  Double_t dist12,Double_t dist23,Short_t charge) :
46   AliAODRecoDecayHF(vtx2,3,charge,px,py,pz,d0,d0err),
47   fSigmaVert(sigvert),
48   fDist12toPrim(dist12),
49   fDist23toPrim(dist23)
50 {
51   //
52   // Constructor with AliAODVertex for decay vertex
53   //
54   Double_t dcafloat[3];
55   for(Int_t i=0;i<3;i++)dcafloat[i]=dca[i];
56   SetDCAs(3,dcafloat);
57 }
58 //--------------------------------------------------------------------------
59 AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
60                                                  Double_t *d0,Double_t *d0err,
61                                                  Double_t *dca, Double_t sigvert,
62                                                  Double_t dist12,Double_t dist23, Short_t charge) :
63   AliAODRecoDecayHF(vtx2,3,charge,d0,d0err),
64   fSigmaVert(sigvert),
65   fDist12toPrim(dist12),
66   fDist23toPrim(dist23)
67 {
68   //
69   // Constructor with AliAODVertex for decay vertex and without prongs momenta
70   //
71   Double_t dcafloat[3];
72   for(Int_t i=0;i<3;i++)dcafloat[i]=dca[i];
73   SetDCAs(3,dcafloat);
74 }
75 //--------------------------------------------------------------------------
76 AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(const AliAODRecoDecayHF3Prong &source) :
77   AliAODRecoDecayHF(source),
78   fSigmaVert(source.fSigmaVert),
79   fDist12toPrim(source.fDist12toPrim),
80   fDist23toPrim(source.fDist23toPrim)
81 {
82   //
83   // Copy constructor
84   //
85 }
86 //--------------------------------------------------------------------------
87 AliAODRecoDecayHF3Prong &AliAODRecoDecayHF3Prong::operator=(const AliAODRecoDecayHF3Prong &source)
88 {
89   //
90   // assignment operator
91   //
92   if(&source == this) return *this;
93   fOwnPrimaryVtx = source.fOwnPrimaryVtx;
94   fSecondaryVtx = source.fSecondaryVtx;
95   fCharge = source.fCharge;
96   fNProngs = source.fNProngs;
97   fNDCA = source.fNDCA;
98   fNPID = source.fNPID;
99   fEventNumber = source.fEventNumber;
100   fRunNumber = source.fRunNumber;
101   fDist12toPrim= source.fDist12toPrim;
102   fDist23toPrim= source.fDist23toPrim;
103   fSigmaVert= source.fSigmaVert;
104   if(source.GetNProngs()>0) {
105     fd0 = new Double_t[GetNProngs()];
106     fd0err = new Double_t[GetNProngs()];
107     memcpy(fd0,source.fd0,GetNProngs()*sizeof(Double_t));
108     memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
109     if(source.fPx) {
110       fPx = new Double_t[GetNProngs()];
111       fPy = new Double_t[GetNProngs()];
112       fPz = new Double_t[GetNProngs()];
113       memcpy(fPx,source.fPx,GetNProngs()*sizeof(Double_t));
114       memcpy(fPy,source.fPy,GetNProngs()*sizeof(Double_t));
115       memcpy(fPz,source.fPz,GetNProngs()*sizeof(Double_t));
116     }
117     if(source.fPID) {
118       fPID = new Double_t[5*GetNProngs()];
119       memcpy(fPID,source.fPID,GetNProngs()*sizeof(Double_t));
120     }
121     if(source.fDCA) {
122       fDCA = new Double32_t[GetNProngs()*(GetNProngs()-1)/2];
123       memcpy(fDCA,source.fDCA,(GetNProngs()*(GetNProngs()-1)/2)*sizeof(Float_t));
124     }
125   }
126   return *this;
127 }
128 //--------------------------------------------------------------------------
129 Bool_t AliAODRecoDecayHF3Prong::SelectDplus(const Double_t *cuts)
130   const {
131 //
132 // This function compares the Dplus with a set of cuts:
133 //
134 // cuts[0] = inv. mass half width [GeV]   
135 // cuts[1] = pTK [GeV/c]
136 // cuts[2] = pTPi [GeV/c]
137 // cuts[3] = d0K [cm]   lower limit!
138 // cuts[4] = d0Pi [cm]  lower limit!
139 // cuts[5] = dist12 (cm)
140 // cuts[6] = sigmavert (cm)
141 // cuts[7] = dist prim-sec (cm)
142 // cuts[8] = pM=Max{pT1,pT2,pT3} (GeV/c)
143 // cuts[9] = cosThetaPoint
144 // cuts[10] = Sum d0^2 (cm^2)
145 // cuts[11] = dca cut (cm)
146 //
147 // If candidate Dplus does not pass the cuts return kFALSE
148 //
149
150   Double_t mDplusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass();
151   Double_t mDplus=InvMassDplus();
152   if(TMath::Abs(mDplus-mDplusPDG)>cuts[0])return kFALSE;
153   //single track
154   if(TMath::Abs(PtProng(1)) < cuts[1] || TMath::Abs(Getd0Prong(1))<cuts[3])return kFALSE;//Kaon
155   if(TMath::Abs(PtProng(0)) < cuts[2] || TMath::Abs(Getd0Prong(0))<cuts[4])return kFALSE;//Pion1
156   if(TMath::Abs(PtProng(2)) < cuts[2] || TMath::Abs(Getd0Prong(2))<cuts[4])return kFALSE;//Pion2
157
158   //DCA
159   for(Int_t i=0;i<3;i++) if(cuts[11]>0 && GetDCA(i)>cuts[11])return kFALSE;
160
161   //2track cuts
162   if(fDist12toPrim<cuts[5] || fDist23toPrim<cuts[5])return kFALSE;
163   if(Getd0Prong(0)*Getd0Prong(1)<0. && Getd0Prong(2)*Getd0Prong(1)<0.)return kFALSE;
164
165   //sec vert
166   if(fSigmaVert>cuts[6])return kFALSE;
167
168   if(DecayLength()<cuts[7])return kFALSE;
169
170   if(TMath::Abs(PtProng(0))<cuts[8] && TMath::Abs(PtProng(1))<cuts[8] && TMath::Abs(PtProng(2))<cuts[8])return kFALSE;
171   if(CosPointingAngle()   < cuts[9])return kFALSE;
172   Double_t sum2=Getd0Prong(0)*Getd0Prong(0)+Getd0Prong(1)*Getd0Prong(1)+Getd0Prong(2)*Getd0Prong(2);
173   if(sum2<cuts[10])return kFALSE;
174   return kTRUE;
175 }