28 {
29
31 EvtRecVeeVertex* ks =
const_cast<EvtRecVeeVertex*
>( aKs.
navKshort() );
32
33 if ( ks->
vertexId() != 310 )
return false;
34
35 if ( !m_useBFC )
36 {
38 if ( (
mass <= m_minMass ) || (
mass >= m_maxMass ) )
return false;
39 if ( ks->
chi2() >= m_maxChisq )
return false;
40
41 if ( !m_doSecondaryVFit ) return true;
42 }
43
44
45
46
47
49 RecMdcKalTrack* veeKalTrack1 = veeTrack1->
mdcKalTrack();
51 WTrackParameter veeInitialWTrack1 =
53
55 RecMdcKalTrack* veeKalTrack2 = veeTrack2->
mdcKalTrack();
57 WTrackParameter veeInitialWTrack2 =
59
60
62 HepSymMatrix evWideVertex( 3, 0 );
63
64 evWideVertex[0][0] = 1.0e12;
65 evWideVertex[1][1] = 1.0e12;
66 evWideVertex[2][2] = 1.0e12;
67
68
70 HepSymMatrix evBeamSpot( 3, 0 );
71
72 IVertexDbSvc* vtxsvc;
73 StatusCode sc = serviceLocator()->service( "VertexDbSvc", vtxsvc );
75 {
78 for ( unsigned int ivx = 0; ivx < 3; ivx++ )
79 {
80 vBeamSpot[ivx] = dbv[ivx];
81 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
82 }
83 }
84 else
85 {
86 cout << "KSSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
87 return false;
88 }
89
90 if ( m_useVFrefine )
91 {
92
93 VertexParameter wideVertex;
94
95 wideVertex.
setVx( vWideVertex );
96 wideVertex.
setEvx( evWideVertex );
97
98
101
104 vtxfitr->
AddVertex( 0, wideVertex, 0, 1 );
105
106 bool fitok = vtxfitr->
Fit();
107
108 HepLorentzVector ppi1 = vtxfitr->
pfit( 0 );
109 HepLorentzVector ppi2 = vtxfitr->
pfit( 1 );
110 HepLorentzVector pks = ppi1 + ppi2;
111
112 double mass = pks.m();
113 double chisqvtx = vtxfitr->
chisq( 0 );
114
115 if ( m_useBFC )
116 {
117 if ( (
mass <= m_minMass ) || (
mass >= m_maxMass ) )
return false;
118
119 if ( chisqvtx >= m_maxChisq ) return false;
120
121 if ( !m_doSecondaryVFit ) return true;
122 }
123
124
127
128
129 VertexParameter beamSpot;
130
131 beamSpot.
setVx( vBeamSpot );
132 beamSpot.
setEvx( evBeamSpot );
133
134 VertexParameter primaryVertex( beamSpot );
136
137
139
140
142
143
144
145 if ( !svtxfit->
Fit() )
return false;
146
147
150 double vfitchi2 = svtxfit->
chisq();
151 double flightsig = 0;
152 if ( vfiterror != 0 ) flightsig = vfitlength / vfiterror;
153
154
155
156 if ( vfitchi2 > m_maxVFitChisq ) return false;
157 if ( flightsig < m_minFlightSig ) return false;
158
159 return true;
160 }
161 else
162 {
163 VertexParameter wideVertex;
164
165 wideVertex.
setVx( vWideVertex );
166 wideVertex.
setEvx( evWideVertex );
167
168
171
172
173 vtxfit->
AddTrack( 0, veeInitialWTrack1 );
174 vtxfit->
AddTrack( 1, veeInitialWTrack2 );
175 vtxfit->
AddVertex( 0, wideVertex, 0, 1 );
176
177
181
183 WTrackParameter wkspi1 = vtxfit->
wtrk( 0 );
184 WTrackParameter wkspi2 = vtxfit->
wtrk( 1 );
185
186 HepLorentzVector pks = wks.
p();
187
188 double mass = pks.m();
189 double chisqvtx = vtxfit->
chisq( 0 );
190
191 if ( m_useBFC )
192 {
193 if ( (
mass <= m_minMass ) || (
mass >= m_maxMass ) )
return false;
194
195 if ( chisqvtx >= m_maxChisq ) return false;
196
197 if ( !m_doSecondaryVFit ) return true;
198 }
199
200
203
204
205 VertexParameter beamSpot;
206
207 beamSpot.
setVx( vBeamSpot );
208 beamSpot.
setEvx( evBeamSpot );
209
210 VertexParameter primaryVertex( beamSpot );
212
213
215
216
218
219
220
221 if ( !svtxfit->
Fit() )
return false;
222
223
226 double vfitchi2 = svtxfit->
chisq();
227 double flightsig = 0;
228 if ( vfiterror != 0 ) flightsig = vfitlength / vfiterror;
229
230
231
232 if ( vfitchi2 > m_maxVFitChisq ) return false;
233 if ( flightsig < m_minFlightSig ) return false;
234
235 return true;
236 }
237}
HepGeom::Point3D< double > HepPoint3D
virtual const EvtRecVeeVertex * navKshort() const
static void setPidType(PidType pidType)
RecMdcKalTrack * mdcKalTrack()
std::pair< SmartRef< EvtRecTrack >, SmartRef< EvtRecTrack > > & pairDaughters()
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
const HepVector & getZHelix() const
const HepSymMatrix & getZError() const
void setPrimaryVertex(const VertexParameter vpar)
double decayLength() const
double decayLengthError() const
static SecondVertexFit * instance()
void setVpar(const VertexParameter vpar)
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
WTrackParameter wVirtualTrack(int n) const
HepLorentzVector pfit(int n) const
void AddTrack(const int index, RecMdcKalTrack *p, const RecMdcKalTrack::PidType pid)
static VertexFitRefine * instance()
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
VertexParameter vpar(int n) const
WTrackParameter wtrk(int n) const
WTrackParameter wVirtualTrack(int n) const
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
static VertexFit * instance()
VertexParameter vpar(int n) const
void BuildVirtualParticle(int number)
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
HepLorentzVector p() const