30 const HepSymMatrix err ) {
35 HepSymMatrix Wc( 2, 0 );
37 Wc[0][1] = Wc[1][0] = err[0][3];
39 Wc = Wc.inverse( ifail );
41 HepVector p0( 3, 0 ), v0( 3, 0 );
42 double pxy = 1. / fabs( helix[2] );
43 p0[0] = 0 - pxy *
sin( helix[1] );
44 p0[1] = pxy *
cos( helix[1] );
45 p0[2] = pxy * helix[4];
46 v0[0] = helix[0] *
cos( helix[1] );
47 v0[1] = helix[0] *
sin( helix[1] );
53 int charge = ( helix[2] > 0 ? +1 : -1 );
54 double a =
alpha * bField * charge;
55 double T0 = sqrt( ( p0[0] + a * p0[1] ) * ( p0[0] + a * p0[1] ) +
56 ( p0[1] - a * p0[0] ) * ( p0[1] - a * p0[0] ) );
58 HepMatrix Dc( 2, 3, 0 );
59 Dc[0][0] = ( p0[1] - a * v0[0] ) / T0;
60 Dc[0][1] = 0 - ( p0[0] + a * v0[1] ) / T0;
61 Dc[1][0] = 0 - ( p0[2] / T0 ) * ( p0[0] + a * v0[1] ) / T0;
62 Dc[1][1] = 0 - ( p0[2] / T0 ) * ( p0[1] - a * v0[0] ) / T0;
68 HepSymMatrix DTWD( 3, 0 );
69 DTWD = Wc.similarity( Dc.T() );
70 HepVector qTrk( 2, 0 );
75 m_DTWD.push_back( DTWD );
80 bool fitResult =
false;
83 HepSymMatrix total_DTWD( 3, 0 );
84 HepVector total_xp( 3, 0 );
86 for (
int i = 0; i < m_DTWD.size(); i++ )
88 total_DTWD += m_DTWD[i];
89 total_xp += m_DTWD[i] * m_xp[i];
91 m_Vx = total_DTWD.inverse( ifail ) * total_xp;
92 m_Evx = total_DTWD.inverse( ifail );
95 for (
int i = 0; i < m_xp.size(); i++ )
97 double chi2 = ( m_DTWD[i].similarity( ( m_xp[i] - m_Vx ).T() ) )[0][0];