Coverity
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAODRecoDecayHF2Prong.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 2-prong decay
21//
22// Author: A.Dainese, andrea.dainese@lnl.infn.it
23/////////////////////////////////////////////////////////////
24
25#include <TDatabasePDG.h>
26#include "AliAODRecoDecayHF.h"
27#include "AliAODRecoDecayHF2Prong.h"
28
29ClassImp(AliAODRecoDecayHF2Prong)
30
31//--------------------------------------------------------------------------
32AliAODRecoDecayHF2Prong::AliAODRecoDecayHF2Prong() :
33 AliAODRecoDecayHF()
34{
35 //
36 // Default Constructor
37 //
38}
39//--------------------------------------------------------------------------
40AliAODRecoDecayHF2Prong::AliAODRecoDecayHF2Prong(AliAODVertex *vtx2,
41 Double_t *px,Double_t *py,Double_t *pz,
42 Double_t *d0,Double_t *d0err,Float_t dca) :
43 AliAODRecoDecayHF(vtx2,2,0,px,py,pz,d0,d0err)
44{
45 //
46 // Constructor with AliAODVertex for decay vertex
47 //
48 SetDCA(dca);
49}
50//--------------------------------------------------------------------------
51AliAODRecoDecayHF2Prong::AliAODRecoDecayHF2Prong(AliAODVertex *vtx2,
52 Double_t *d0,Double_t *d0err,Float_t dca) :
53 AliAODRecoDecayHF(vtx2,2,0,d0,d0err)
54{
55 //
56 // Constructor with AliAODVertex for decay vertex and without prongs momenta
57 //
58 SetDCA(dca);
59}
60//--------------------------------------------------------------------------
61AliAODRecoDecayHF2Prong::AliAODRecoDecayHF2Prong(const AliAODRecoDecayHF2Prong &source) :
62 AliAODRecoDecayHF(source)
63{
64 //
65 // Copy constructor
66 //
67}
68//--------------------------------------------------------------------------
69AliAODRecoDecayHF2Prong &AliAODRecoDecayHF2Prong::operator=(const AliAODRecoDecayHF2Prong &source)
70{
71 //
72 // assignment operator
73 //
74 if(&source == this) return *this;
dcb444c9 75
76 AliAODRecoDecayHF::operator=(source);
77
3244eeed 78 return *this;
79}
80//--------------------------------------------------------------------------
81Bool_t AliAODRecoDecayHF2Prong::SelectD0(const Double_t *cuts,Int_t &okD0,Int_t &okD0bar)
82 const {
83//
84// This function compares the D0 with a set of cuts:
85//
86// cuts[0] = inv. mass half width [GeV]
87// cuts[1] = dca [cm]
88// cuts[2] = cosThetaStar
89// cuts[3] = pTK [GeV/c]
90// cuts[4] = pTPi [GeV/c]
91// cuts[5] = d0K [cm] upper limit!
92// cuts[6] = d0Pi [cm] upper limit!
93// cuts[7] = d0d0 [cm^2]
94// cuts[8] = cosThetaPoint
95//
96// If the D0/D0bar doesn't pass the cuts it sets the weights to 0
97// If neither D0 nor D0bar pass the cuts return kFALSE
98//
99 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
100 okD0=1; okD0bar=1;
101
102 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
103
104 if(PtProng(1) < cuts[3] || PtProng(0) < cuts[4]) okD0 = 0;
105 if(PtProng(0) < cuts[3] || PtProng(1) < cuts[4]) okD0bar = 0;
106 if(!okD0 && !okD0bar) return kFALSE;
107
108 if(TMath::Abs(Getd0Prong(1)) > cuts[5] ||
109 TMath::Abs(Getd0Prong(0)) > cuts[6]) okD0 = 0;
110 if(TMath::Abs(Getd0Prong(0)) > cuts[6] ||
111 TMath::Abs(Getd0Prong(1)) > cuts[5]) okD0bar = 0;
112 if(!okD0 && !okD0bar) return kFALSE;
113
114 if(GetDCA() > cuts[1]) { okD0 = okD0bar = 0; return kFALSE; }
115
116 InvMassD0(mD0,mD0bar);
117 if(TMath::Abs(mD0-mD0PDG) > cuts[0]) okD0 = 0;
118 if(TMath::Abs(mD0bar-mD0PDG) > cuts[0]) okD0bar = 0;
119 if(!okD0 && !okD0bar) return kFALSE;
120
121 CosThetaStarD0(ctsD0,ctsD0bar);
122 if(TMath::Abs(ctsD0) > cuts[2]) okD0 = 0;
123 if(TMath::Abs(ctsD0bar) > cuts[2]) okD0bar = 0;
124 if(!okD0 && !okD0bar) return kFALSE;
125
126 if(Prodd0d0() > cuts[7]) { okD0 = okD0bar = 0; return kFALSE; }
127
128 if(CosPointingAngle() < cuts[8]) { okD0 = okD0bar = 0; return kFALSE; }
129
130 return kTRUE;
131}
132//-----------------------------------------------------------------------------
133Bool_t AliAODRecoDecayHF2Prong::SelectBtoJPSI(const Double_t *cuts,Int_t &okB)
134 const {
135//
136// This function compares the Secondary JPSI candidates with a set of cuts:
137//
138// cuts[0] = inv. mass half width [GeV]
139// cuts[1] = dca [cm]
140// cuts[2] = cosThetaStar (negative electron)
141// cuts[3] = pTP [GeV/c]
142// cuts[4] = pTN [GeV/c]
143// cuts[5] = d0P [cm] upper limit!
144// cuts[6] = d0N [cm] upper limit!
145// cuts[7] = d0d0 [cm^2]
146// cuts[8] = cosThetaPoint
147//
148// If the candidate doesn't pass the cuts it sets the weight to 0
149// and return kFALSE
150//
151 Double_t mJPsi,ctsJPsi;
152 okB=1;
153
154 Double_t mJPSIPDG = TDatabasePDG::Instance()->GetParticle(443)->Mass();
155
156 if(PtProng(1) < cuts[3] || PtProng(0) < cuts[4]) okB = 0;
157 if(!okB) return kFALSE;
158
159 if(TMath::Abs(Getd0Prong(1)) > cuts[5] ||
160 TMath::Abs(Getd0Prong(0)) > cuts[6]) okB = 0;
161 if(!okB) return kFALSE;
162
163 if(GetDCA() > cuts[1]) { okB = 0; return kFALSE; }
164
165 mJPsi=InvMassJPSIee();
166 if(TMath::Abs(mJPsi-mJPSIPDG) > cuts[0]) okB = 0;
167 if(!okB) return kFALSE;
168
169 ctsJPsi=CosThetaStarJPSI();
170 if(TMath::Abs(ctsJPsi) > cuts[2]) okB = 0;
171 if(!okB) return kFALSE;
172
173 if(Prodd0d0() > cuts[7]) { okB = 0; return kFALSE; }
174
175 if(CosPointingAngle() < cuts[8]) { okB = 0; return kFALSE; }
176
177 return kTRUE;
178}
179//-----------------------------------------------------------------------------