6 #include <kaltest/THelicalTrack.h>
8 #include "streamlog/streamlog.h"
16 TVector3 p1( x1[0], x1[1], x1[2] );
17 TVector3 p2( x2[0], x2[1], x2[2] );
18 TVector3 p3( x3[0], x3[1], x3[2] );
20 streamlog_out(DEBUG2) <<
"HelixTrack::HelixTrack Create from hits: \n "
21 <<
"P1 x = " << p1.x() <<
" y = " << p1.y() <<
" z = " << p1.z() <<
" r = " << p1.Perp() <<
"\n "
22 <<
"P2 x = " << p2.x() <<
" y = " << p2.y() <<
" z = " << p2.z() <<
" r = " << p2.Perp() <<
"\n "
23 <<
"P3 x = " << p3.x() <<
" y = " << p3.y() <<
" z = " << p3.z() <<
" r = " << p3.Perp() <<
"\n "
24 <<
"Bz = " << Bz <<
" direction = " << direction
27 THelicalTrack helicalTrack( p1, p2, p3, Bz, direction );
32 _omega = 1. / helicalTrack.GetRho();
33 _z0 = helicalTrack.GetDz();
34 _d0 = - helicalTrack.GetDrho();
53 const double pt = sqrt(p[0]*p[0]+p[1]*p[1]) ;
55 double radius = pt / (2.99792458E-4*Bz) ;
60 _phi0 = atan2(p[1],p[0]);
68 const double radius = 1.0/
_omega ;
70 const double sinPhi0 = sin(
_phi0) ;
71 const double cosPhi0 = cos(
_phi0) ;
76 double phi0Prime = atan2( sinPhi0 - (deltaX/(radius-
_d0)) , cosPhi0 + (deltaY/(radius-
_d0)) ) ;
78 while ( phi0Prime < 0 ) phi0Prime += 2.0*
M_PI ;
79 while ( phi0Prime >= 2.0*
M_PI ) phi0Prime -= 2.0*
M_PI ;
81 const double d0Prime =
_d0 + deltaX*sinPhi0 - deltaY*cosPhi0 + ( ( deltaX*cosPhi0 + deltaY*sinPhi0 ) * tan( (phi0Prime-
_phi0) / 2.0) ) ;
85 const double sinDeltaPhi = ( -
_omega / ( 1.0 - (
_omega * d0Prime ) ) ) * ( deltaX * cosPhi0 + deltaY * sinPhi0 ) ;
87 const double cosDeltaPhi = 1.0 + (
_omega*
_omega / ( 2.0 * ( 1.0 -
_omega * d0Prime ) ) ) * ( d0Prime*d0Prime - ( deltaX +
_d0 * sinPhi0 )*( deltaX +
_d0 * sinPhi0 ) - ( deltaY -
_d0 * cosPhi0 )*( deltaY -
_d0 * cosPhi0 ) ) ;
89 const double s = atan2(-sinDeltaPhi,cosDeltaPhi) /
_omega ;
double toBaseRange(double phi) const
helper function to restrict the range of the azimuthal angle to ]-pi,pi]
HelixTrack(double ref_point_x, double ref_point_y, double ref_point_z, double d0, double z0, double phi0, double omega, double tanLambda)
double moveRefPoint(double x, double y, double z)