153 m_hel = HepVector( 5, 0 );
154 m_eHel = HepSymMatrix( 5, 0 );
169 double pxy = sqrt( px * px + py * py );
170 double T = sqrt( ( px + a * y ) * ( px + a * y ) + ( py - a *
x ) * ( py - a *
x ) );
171 double J = (
x * px + y * py ) / T * a /
pxy;
173 double drho = (
pxy / a ) - ( T / a );
175 fmod( ( 4 * CLHEP::pi ) + atan2( 0 - px - a * y, py - a *
x ), ( 2 * CLHEP::pi ) );
177 double dz = z - ( pz / a ) * asin( J );
206 double T = sqrt( ( px + a * y ) * ( px + a * y ) + ( py - a *
x ) * ( py - a *
x ) );
209 HepMatrix m_A( 5, 3, 0 );
211 m_A[0][0] = ( py - a *
x ) / T;
212 m_A[0][1] = 0 - ( px + a * y ) / T;
213 m_A[1][0] = 0 - a * ( px + a * y ) / T / T;
214 m_A[1][1] = 0 - a * ( py - a *
x ) / T / T;
215 m_A[3][0] = 0 - ( pz / T ) * ( px + a * y ) / T;
216 m_A[3][1] = 0 - ( pz / T ) * ( py - a *
x ) / T;
239 double pxy = sqrt( px * px + py * py );
240 double T = sqrt( ( px + a * y ) * ( px + a * y ) + ( py - a *
x ) * ( py - a *
x ) );
241 double J = (
x * px + y * py ) / T * a /
pxy;
243 HepMatrix m_B( 5, 3, 0 );
245 m_B[0][0] = ( px /
pxy - ( px + a * y ) / T ) / a;
246 m_B[0][1] = ( py /
pxy - ( py - a *
x ) / T ) / a;
247 m_B[1][0] = 0 - ( py - a *
x ) / T / T;
248 m_B[1][1] = ( px + a * y ) / T / T;
251 m_B[3][0] = ( pz / a ) * ( py /
pxy /
pxy - ( py - a *
x ) / T / T );
252 m_B[3][1] = 0 - ( pz / a ) * ( px /
pxy /
pxy - ( px + a * y ) / T / T );
253 m_B[3][2] = 0 - asin( J ) / a;
254 m_B[4][0] = 0 - ( px /
pxy ) * ( pz /
pxy ) /
pxy;
255 m_B[4][1] = 0 - ( py /
pxy ) * ( pz /
pxy ) /
pxy;
337 double rad2 = htrk.
radius();
354 double xt = xc2.x() - xc1.x();
355 double yt = xc2.y() - xc1.y();
356 if ( xt == 0 && yt == 0 )
return HepPoint3D( 999, 999, 999 );
357 double rt = rad1 * rad1 - rad2 * rad2 - xc1.perp2() + xc2.perp2();
358 double x1, y1, x2, y2;
361 double a = 1 + yt * yt / ( xt * xt );
362 if ( a == 0 )
return HepPoint3D( 999, 999, 999 );
363 double b = 2 * xc1.x() * yt / xt - yt * rt / ( xt * xt ) - 2 * xc1.y();
364 double c = rt * rt / ( 4 * xt * xt ) - xc1.x() * rt / xt - rad1 * rad1 + xc1.perp2();
365 double d = b * b - 4 * a * c;
366 if ( d < 0 )
return HepPoint3D( 999, 999, 999 );
370 y1 = ( -b + d ) / ( 2 * a );
371 x1 = ( rt - 2 * yt * y1 ) / ( 2 * xt );
373 y2 = ( -b - d ) / ( 2 * a );
374 x2 = ( rt - 2 * yt * y2 ) / ( 2 * xt );
378 double a = 1 + xt * xt / ( yt * yt );
379 if ( a == 0 )
return HepPoint3D( 999, 999, 999 );
380 double b = 2 * xc1.y() * xt / yt - xt * rt / ( yt * yt ) - 2 * xc1.x();
381 double c = rt * rt / ( 4 * yt * yt ) - xc1.y() * rt / yt - rad1 * rad1 + xc1.perp2();
382 double d = b * b - 4 * a * c;
383 if ( d < 0 )
return HepPoint3D( 999, 999, 999 );
387 x1 = ( -b + d ) / ( 2 * a );
388 y1 = ( rt - 2 * xt * x1 ) / ( 2 * yt );
390 x2 = ( -b - d ) / ( 2 * a );
391 y2 = ( rt - 2 * xt * x2 ) / ( 2 * yt );
394 double z1[2], z2[2], J1[2], J2[2];
399 J1[0] = a1 * ( ( x1 -
x3().x() ) *
p3().x() + ( y1 -
x3().y() ) *
p3().y() ) /
p3().perp2();
401 ( ( x1 - htrk.
x3().
x() ) * htrk.
p3().x() + ( y1 - htrk.
x3().y() ) * htrk.
p3().y() ) /
403 z1[0] =
x3().z() +
p3().z() / a1 * asin( J1[0] );
404 z1[1] = htrk.
x3().z() + htrk.
p3().z() / a2 * asin( J1[1] );
406 J2[0] = a1 * ( ( x2 -
x3().x() ) *
p3().x() + ( y2 -
x3().y() ) *
p3().y() ) /
p3().perp2();
408 ( ( x2 - htrk.
x3().
x() ) * htrk.
p3().x() + ( y2 - htrk.
x3().y() ) * htrk.
p3().y() ) /
410 z2[0] =
x3().z() +
p3().z() / a2 * asin( J2[0] );
411 z2[1] = htrk.
x3().z() + htrk.
p3().z() / a2 * asin( J2[1] );
415 if ( fabs( z1[0] - z1[1] ) < fabs( z2[0] - z2[1] ) )
416 {
return HepPoint3D( x1, y1, 0.5 * ( z1[0] + z1[1] ) ); }
417 else {
return HepPoint3D( x2, y2, 0.5 * ( z2[0] + z2[1] ) ); }
450 double phiH0 = fmod( ( 4 * CLHEP::pi ) + atan2(
p3().y(),
p3().
x() ), ( 2 * CLHEP::pi ) );
452 fmod( ( 4 * CLHEP::pi ) + atan2( G.
p3().y(), G.
p3().x() ), ( 2 * CLHEP::pi ) );
455 double a =
x3().x() - G.
x3().x() + g *
sin( phiG0 ) - h *
sin( phiH0 );
456 double b =
x3().y() - G.
x3().y() - g *
cos( phiG0 ) + h *
cos( phiH0 );
457 double c1 = h * lamH * lamH;
458 double c2 = 0 - g * lamG * lamG;
459 double d1 = 0 - g * lamG * lamH;
460 double d2 = h * lamG * lamH;
461 double e1 = lamH * (
x3().z() - G.
x3().z() - h * phiH0 * lamH + g * phiG0 * lamG );
462 double e2 = lamG * (
x3().z() - G.
x3().z() - h * phiH0 * lamH + g * phiG0 * lamG );
464 HepVector phiE( 2, 0 );
470 HepSymMatrix Omega( 2, 0 );
471 double phiH = phiE[0];
472 double phiG = phiE[1];
473 z[0] =
cos( phiH ) * ( a - g *
sin( phiG ) ) +
sin( phiH ) * ( b + g *
cos( phiG ) ) +
474 c1 * phiH + d1 * phiG +
e1;
475 z[1] =
cos( phiG ) * ( a + h *
sin( phiH ) ) +
sin( phiG ) * ( b - h *
cos( phiH ) ) +
476 c2 * phiG + d2 * phiH +
e2;
478 0 -
sin( phiH ) * ( a - g *
sin( phiG ) ) +
cos( phiH ) * ( b + g *
cos( phiG ) ) + c1;
479 Omega[0][1] = -g *
cos( phiH ) *
cos( phiG ) - g *
sin( phiH ) *
sin( phiG ) + d1;
480 Omega[1][0] = h *
cos( phiH ) *
cos( phiG ) + h *
sin( phiG ) *
sin( phiH ) + d2;
482 -
sin( phiG ) * ( a + h *
sin( phiH ) ) +
cos( phiG ) * ( b - h *
cos( phiH ) ) + c2;
483 HepVector phi( 2, 0 );
484 phi = phiE - Omega.inverse( ifail ) * z;
485 if ( ( fabs( phi[0] - phiE[0] ) < 1E-3 ) && ( fabs( phi[1] - phiE[1] ) < 1E-3 ) )
494 double phiH = phiE[0];
495 double phiG = phiE[1];
497 x3().y() + h * (
cos( phiH0 ) -
cos( phiH ) ),
498 x3().z() + lamH * ( phiH - phiH0 ) );
500 G.
x3().y() + g * (
cos( phiG0 ) -
cos( phiG ) ),
501 G.
x3().z() + lamG * ( phiG - phiG0 ) );
502 double dis = ( posH - posG ).rho();
503 mpos = 0.5 * ( posH + posG );