StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoPhysicalHelix.cxx
1 //
2 // StPicoPhysicalHelix is a parametrization of a particle that moves along the helix
3 //
4 
5 // C++ headers
6 #include <math.h>
7 
8 // PicoDst headers
9 #include "StPicoHelix.h"
10 #include "StPicoPhysicalHelix.h"
11 #ifdef _VANILLA_ROOT_
12 #include "PhysicalConstants.h"
13 #include "SystemOfUnits.h"
14 #else
15 #include "StarClassLibrary/PhysicalConstants.h"
16 #include "StarClassLibrary/SystemOfUnits.h"
17 #endif
18 
19 ClassImpT(StPicoPhysicalHelix, Double_t);
20 
21 //_________________
23  /* no-op */
24 }
25 
26 //_________________
28  /* no-op */
29 }
30 
31 //_________________
33  const TVector3& o,
34  Double_t B, Double_t q) {
35  mH = (q*B <= 0) ? 1 : -1;
36  if(p.y() == 0 && p.x() == 0) {
37  setPhase((M_PI/4)*(1-2.*mH));
38  }
39  else {
40  setPhase(atan2(p.y(),p.x())-mH*M_PI/2);
41  }
42  setDipAngle(atan2(p.z(),p.Perp()));
43  mOrigin = o;
44 
45 #ifndef ST_NO_NAMESPACES
46  {
47  using namespace units;
48 #endif
49  setCurvature( ::fabs( (c_light*nanosecond/meter*q*B/tesla) /
50  ( p.Mag()/GeV*mCosDipAngle) / meter) );
51 #ifndef ST_NO_NAMESPACES
52  }
53 #endif
54 }
55 
56 //_________________
58  Double_t phase, const TVector3& o,
59  Int_t h) : StPicoHelix(c, d, phase, o, h) {
60  /* no-op */
61 }
62 
63 //_________________
64 TVector3 StPicoPhysicalHelix::momentum(Double_t B) const {
65 
66  if (mSingularity) {
67  return(TVector3(0,0,0));
68  }
69  else {
70 #ifndef ST_NO_NAMESPACES
71  {
72  using namespace units;
73 #endif
74  Double_t pt = GeV*fabs(c_light*nanosecond/meter*B/tesla)/(fabs(mCurvature)*meter);
75 
76  return ( TVector3( pt*cos(mPhase+mH*M_PI/2), // pos part pos field
77  pt*sin(mPhase+mH*M_PI/2),
78  pt*tan(mDipAngle) ) );
79 #ifndef ST_NO_NAMESPACES
80  }
81 #endif
82  } //else
83 }
84 
85 //_________________
86 TVector3 StPicoPhysicalHelix::momentumAt(Double_t S, Double_t B) const {
87  // Obtain phase-shifted momentum from phase-shift of origin
88  StPicoPhysicalHelix tmp(*this);
89  tmp.moveOrigin(S);
90  return tmp.momentum(B);
91 }
92 
93 //_________________
94 Int_t StPicoPhysicalHelix::charge(Double_t B) const {
95  return (B > 0 ? -mH : mH);
96 }
97 
98 //_________________
99 Double_t StPicoPhysicalHelix::geometricSignedDistance(Double_t x, Double_t y) {
100  // Geometric signed distance
101  Double_t thePath = this->pathLength(x,y);
102  TVector3 DCA2dPosition = this->at(thePath);
103  DCA2dPosition.SetZ(0);
104  TVector3 position(x,y,0);
105  TVector3 DCAVec = (DCA2dPosition-position);
106  TVector3 momVec;
107  // Deal with straight tracks
108  if (this->mSingularity) {
109  momVec = this->at(1)- this->at(0);
110  momVec.SetZ(0);
111  }
112  else {
113  momVec = this->momentumAt(thePath,1./tesla); // Don't care about Bmag. Helicity is what matters.
114  momVec.SetZ(0);
115  }
116 
117  Double_t cross = DCAVec.x()*momVec.y() - DCAVec.y()*momVec.x();
118  Double_t theSign = (cross>=0) ? 1. : -1.;
119  return theSign*DCAVec.Perp();
120 }
121 
122 //_________________
123 Double_t StPicoPhysicalHelix::curvatureSignedDistance(Double_t x, Double_t y) {
124  // Protect against mH = 0 or zero field
125  if (this->mSingularity || abs(this->mH)<=0) {
126  return (this->geometricSignedDistance(x,y));
127  }
128  else {
129  return (this->geometricSignedDistance(x,y))/(this->mH);
130  }
131 }
132 
133 //_________________
134 Double_t StPicoPhysicalHelix::geometricSignedDistance(const TVector3& pos) {
135  Double_t sdca2d = this->geometricSignedDistance(pos.x(),pos.y());
136  Double_t theSign = (sdca2d>=0) ? 1. : -1.;
137  return (this->distance(pos))*theSign;
138 }
139 
140 //_________________
141 Double_t StPicoPhysicalHelix::curvatureSignedDistance(const TVector3& pos) {
142  Double_t sdca2d = this->curvatureSignedDistance(pos.x(),pos.y());
143  Double_t theSign = (sdca2d>=0) ? 1. : -1.;
144  return (this->distance(pos))*theSign;
145 }
TVector3 momentumAt(Double_t, Double_t) const
Return momemtum at S.
Double_t x(Double_t s) const
coordinates of helix at point s
Definition: StPicoHelix.h:180
Double_t mCurvature
Curvature = 1/R.
Definition: StPicoHelix.h:144
TVector3 momentum(Double_t) const
Int_t h() const
Return -sign(q*B);.
Definition: StPicoHelix.h:172
~StPicoPhysicalHelix()
Destructor.
TVector3 mOrigin
starting point of a helix
Definition: StPicoHelix.h:140
pair< Double_t, Double_t > pathLength(Double_t r) const
path length at given r (cylindrical r)
Int_t mH
-sign(q*B);
Definition: StPicoHelix.h:148
StPicoPhysicalHelix()
Empty constructor.
virtual void moveOrigin(Double_t s)
Move the origin along the helix to s which becomes then s=0.
void setPhase(Double_t)
Set phase of the helix.
Helis parametrization for the particle.
Int_t charge(Double_t) const
Return charge of a particle.
void setDipAngle(Double_t)
Set dip angle of the helix.
Double_t distance(const TVector3 &p, Bool_t scanPeriods=true) const
minimal distance between point and helix
Double_t geometricSignedDistance(Double_t x, Double_t y)
2d DCA to x,y point signed relative to rotation
Double_t mDipAngle
Dip angle.
Definition: StPicoHelix.h:142
Helix parametrization that uses ROOT TVector3.
Definition: StPicoHelix.h:38
Double_t phase() const
Return phase: aziumth in xy-plane measured from ring center.
Definition: StPicoHelix.h:178
Bool_t mSingularity
true for straight line case (B=0)
Definition: StPicoHelix.h:138
Double_t mCosDipAngle
Cos of dip angle.
Definition: StPicoHelix.h:151
Double_t mPhase
Phase.
Definition: StPicoHelix.h:146
void setCurvature(Double_t)
Set curvature of the helix.
Definition: StPicoHelix.cxx:96
Double_t curvatureSignedDistance(Double_t x, Double_t y)
2d DCA to x,y point signed relative to curvature