1 /***************************************************************************
5 * Author: Brian Lasiuk, Sep 1997
6 ***************************************************************************
9 * Parametrization of a physical helix.
11 ***************************************************************************
14 * Revision 1.1.1.1 2007/04/25 15:38:41 panos
15 * Importing the HBT code dir
17 * Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki
18 * First version on CVS
20 * Revision 1.7 2005/07/06 18:49:56 fisyak
21 * Replace StHelixD, StLorentzVectorD,StLorentzVectorF,StMatrixD,StMatrixF,AliFmPhysicalHelixD,StThreeVectorD,StThreeVectorF by templated version
23 * Revision 1.6 2003/09/02 17:59:35 perev
24 * gcc 3.2 updates + WarnOff
26 * Revision 1.5 2002/06/21 17:49:26 genevb
27 * Some minor speed improvements
29 * Revision 1.4 2002/02/20 00:56:23 ullrich
30 * Added methods to calculate signed DCA.
32 * Revision 1.3 1999/02/24 11:42:18 ullrich
33 * Fixed bug in momentum().
35 * Revision 1.2 1999/02/12 01:01:04 wenaus
36 * Fix bug in momentum calculation
38 * Revision 1.1 1999/01/30 03:59:04 fisyak
39 * Root Version of StarClassLibrary
41 * Revision 1.1 1999/01/23 00:29:21 ullrich
44 **************************************************************************/
46 #include "AliFmHelix.h"
47 #include "AliFmPhysicalHelix.h"
48 #include "Base/PhysicalConstants.h"
49 #include "Base/SystemOfUnits.h"
51 ClassImpT(AliFmPhysicalHelix,double);
53 AliFmPhysicalHelix::AliFmPhysicalHelix(){}
55 AliFmPhysicalHelix::~AliFmPhysicalHelix() { /* nop */ }
57 AliFmPhysicalHelix::AliFmPhysicalHelix(const AliFmThreeVector<double>& p,
58 const AliFmThreeVector<double>& o,
61 mH = (q*B <= 0) ? 1 : -1;
62 if(p.y() == 0 && p.x() == 0)
63 setPhase((M_PI/4)*(1-2.*mH));
65 setPhase(atan2(p.y(),p.x())-mH*M_PI/2);
66 setDipAngle(atan2(p.z(),p.perp()));
69 #ifndef ST_NO_NAMESPACES
71 using namespace units;
73 setCurvature(fabs((c_light*nanosecond/meter*q*B/tesla)/
74 (abs(p.mag())/GeV*mCosDipAngle)/meter));
75 #ifndef ST_NO_NAMESPACES
80 AliFmPhysicalHelix::AliFmPhysicalHelix(double c, double d, double phase,
81 const AliFmThreeVector<double>& o, int h)
82 : AliFmHelix(c, d, phase, o, h) { /* nop */}
85 AliFmThreeVector<double> AliFmPhysicalHelix::momentum(double B) const
88 return(AliFmThreeVector<double>(0,0,0));
90 #ifndef ST_NO_NAMESPACES
92 using namespace units;
94 double pt = GeV*fabs(c_light*nanosecond/meter*B/tesla)/(fabs(mCurvature)*meter);
96 return (AliFmThreeVector<double>(pt*cos(mPhase+mH*M_PI/2), // pos part pos field
97 pt*sin(mPhase+mH*M_PI/2),
99 #ifndef ST_NO_NAMESPACES
105 AliFmThreeVector<double> AliFmPhysicalHelix::momentumAt(double S, double B) const
107 // Obtain phase-shifted momentum from phase-shift of origin
108 double xc = this->xcenter();
109 double yc = this->ycenter();
110 double rx = (y(S)-yc)/(mOrigin.y()-yc);
111 double ry = (x(S)-xc)/(mOrigin.x()-xc);
112 return (this->momentum(B)).pseudoProduct(rx,ry,1.0);
115 int AliFmPhysicalHelix::charge(double B) const
117 return (B > 0 ? -mH : mH);
120 double AliFmPhysicalHelix::geometricSignedDistance(double x, double y)
122 // Geometric signed distance
123 double thePath = this->pathLength(x,y);
124 AliFmThreeVector<double> DCA2dPosition = this->at(thePath);
125 DCA2dPosition.setZ(0);
126 AliFmThreeVector<double> position(x,y,0);
127 AliFmThreeVector<double> DCAVec = (DCA2dPosition-position);
128 AliFmThreeVector<double> momVec;
129 // Deal with straight tracks
130 if (this->mSingularity) {
131 momVec = this->at(1)- this->at(0);
135 momVec = this->momentumAt(thePath,1./tesla); // Don't care about Bmag. Helicity is what matters.
139 double cross = DCAVec.x()*momVec.y() - DCAVec.y()*momVec.x();
140 double theSign = (cross>=0) ? 1. : -1.;
141 return theSign*DCAVec.perp();
144 double AliFmPhysicalHelix::curvatureSignedDistance(double x, double y)
146 // Protect against mH = 0 or zero field
147 if (this->mSingularity || abs(this->mH)<=0) {
148 return (this->geometricSignedDistance(x,y));
151 return (this->geometricSignedDistance(x,y))/(this->mH);
156 double AliFmPhysicalHelix::geometricSignedDistance(const AliFmThreeVector<double>& pos)
158 double sdca2d = this->geometricSignedDistance(pos.x(),pos.y());
159 double theSign = (sdca2d>=0) ? 1. : -1.;
160 return (this->distance(pos))*theSign;
163 double AliFmPhysicalHelix::curvatureSignedDistance(const AliFmThreeVector<double>& pos)
165 double sdca2d = this->curvatureSignedDistance(pos.x(),pos.y());
166 double theSign = (sdca2d>=0) ? 1. : -1.;
167 return (this->distance(pos))*theSign;