CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
KalmanFit::Helix Class Reference

Helix parameter class. More...

#include <Helix.h>

+ Inheritance diagram for KalmanFit::Helix:

Public Member Functions

 Helix ()
 
 Helix (const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
 Constructor with pivot, helix parameter a, and its error matrix.
 
 Helix (const HepPoint3D &pivot, const HepVector &a)
 Constructor without error matrix.
 
 Helix (const HepPoint3D &position, const Hep3Vector &momentum, double charge)
 Constructor with position, momentum, and charge.
 
 Helix (const Helix &i)
 
virtual ~Helix ()
 Destructor.
 
const HepPoint3Dcenter (void) const
 returns position of helix center(z = 0.);
 
const HepPoint3Dpivot (void) const
 returns pivot position.
 
double radius (void) const
 returns radious of helix.
 
HepPoint3D x (double dPhi=0.) const
 returns position after rotating angle dPhi in phi direction.
 
double * x (double dPhi, double p[3]) const
 
HepPoint3D x (double dPhi, HepSymMatrix &Ex) const
 returns position and convariance matrix(Ex) after rotation.
 
Hep3Vector direction (double dPhi=0.) const
 returns direction vector after rotating angle dPhi in phi direction.
 
Hep3Vector momentum (double dPhi=0.) const
 returns momentum vector after rotating angle dPhi in phi direction.
 
Hep3Vector momentum (double dPhi, HepSymMatrix &Em) const
 returns momentum vector after rotating angle dPhi in phi direction.
 
HepLorentzVector momentum (double dPhi, double mass) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
 
HepLorentzVector momentum (double dPhi, double mass, HepSymMatrix &Em) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
 
HepLorentzVector momentum (double dPhi, double mass, HepPoint3D &x, HepSymMatrix &Emx) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
 
double dr (void) const
 returns an element of parameters.
 
double phi0 (void) const
 
double kappa (void) const
 
double dz (void) const
 
double tanl (void) const
 
double curv (void) const
 
double sinPhi0 (void) const
 
double cosPhi0 (void) const
 
const HepVector & a (void) const
 returns helix parameters.
 
const HepSymMatrix & Ea (void) const
 returns error matrix.
 
double pt (void) const
 
double cosTheta (void) const
 
double approach (KalFitHitMdc &hit, bool doSagCorrection) const
 
double approach (HepPoint3D pfwd, HepPoint3D pbwd, bool doSagCorrection) const
 
const HepVector & a (const HepVector &newA)
 sets helix parameters.
 
const HepSymMatrix & Ea (const HepSymMatrix &newdA)
 sets helix paramters and error matrix.
 
const HepPoint3Dpivot (const HepPoint3D &newPivot)
 sets pivot position.
 
void set (const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
 sets helix pivot position, parameters, and error matrix.
 
void ignoreErrorMatrix (void)
 unsets error matrix. Error calculations will be ignored after this function call until an error matrix be set again. 0 matrix will be return as a return value for error matrix when you call functions which returns an error matrix.
 
double bFieldZ (double)
 sets/returns z componet of the magnetic field.
 
double bFieldZ (void) const
 
double alpha (void) const
 
Helixoperator= (const Helix &)
 Copy operator.
 
HepMatrix delApDelA (const HepVector &ap) const
 
HepMatrix delXDelA (double phi) const
 
HepMatrix delMDelA (double phi) const
 
HepMatrix del4MDelA (double phi, double mass) const
 
HepMatrix del4MXDelA (double phi, double mass) const
 
double IntersectCylinder (double r) const
 
double flightArc (HepPoint3D &hit) const
 
double flightLength (HepPoint3D &hit) const
 
double flightArc (double r) const
 
double flightLength (double r) const
 
double dPhi (HepPoint3D &hit) const
 

Static Public Attributes

static const double ConstantAlpha = 333.564095
 Constant alpha for uniform field.
 

Detailed Description

Constructor & Destructor Documentation

◆ Helix() [1/5]

Helix::Helix ( )

Definition at line 48 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

49: m_matrixValid(true)
50{
51 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
52 if(scmgn!=StatusCode::SUCCESS) {
53 std::cout<< "Unable to open Magnetic field service"<<std::endl;
54 }
55 m_bField = 10000*(m_pmgnIMF->getReferField());//zhangr 2012-09-06 for MagnField
56 //m_bField = 10000*(m_pmgnIMF->getReferField());
57 m_alpha = 10000. / 2.99792458 / m_bField;
58
59 HepPoint3D pivot(0,0,0);
60 HepVector a(5,0);
61 HepSymMatrix Ea(5,0);
62 m_pivot = pivot;
63 m_a = a;
64 m_Ea = Ea;
65 updateCache();
66}
virtual double getReferField()=0
const HepSymMatrix & Ea(void) const
returns error matrix.
const HepVector & a(void) const
returns helix parameters.
const HepPoint3D & pivot(void) const
returns pivot position.

◆ Helix() [2/5]

Helix::Helix ( const HepPoint3D & pivot,
const HepVector & a,
const HepSymMatrix & Ea )

Constructor with pivot, helix parameter a, and its error matrix.

Definition at line 69 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

72 : //m_bField(-10.0),
73 //m_alpha(-333.564095),
74 m_pivot(pivot),
75 m_a(a),
76 m_matrixValid(true),
77 m_Ea(Ea) {
78 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
79 if(scmgn!=StatusCode::SUCCESS) {
80 std::cout<< "Unable to open Magnetic field service"<<std::endl;
81 }
82 m_bField = 10000*(m_pmgnIMF->getReferField());
83 m_alpha = 10000. / 2.99792458 / m_bField;
84 // m_alpha = 10000. / 2.99792458 / m_bField;
85 // m_alpha = 333.564095;
86 updateCache();
87}

◆ Helix() [3/5]

Helix::Helix ( const HepPoint3D & pivot,
const HepVector & a )

Constructor without error matrix.

Definition at line 89 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

91 : //m_bField(-10.0),
92 //m_alpha(-333.564095),
93 m_pivot(pivot),
94 m_a(a),
95 m_matrixValid(false),
96 m_Ea(HepSymMatrix(5,0)) {
97 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
98 if(scmgn!=StatusCode::SUCCESS) {
99 // log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq;
100 std::cout<< "Unable to open Magnetic field service"<<std::endl;
101 }
102 m_bField = 10000*(m_pmgnIMF->getReferField());
103 m_alpha = 10000. / 2.99792458 / m_bField;
104 // m_alpha = 333.564095;
105 //cout<<"MdcFastTrakAlg:: bField,alpha: "<<m_bField<<" , "<<m_alpha<<endl;
106 updateCache();
107}

◆ Helix() [4/5]

Helix::Helix ( const HepPoint3D & position,
const Hep3Vector & momentum,
double charge )

Constructor with position, momentum, and charge.

Definition at line 109 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

112 : //m_bField(-10.0),
113 //m_alpha(-333.564095),
114 m_pivot(position),
115 m_a(HepVector(5,0)),
116 m_matrixValid(false),
117 m_Ea(HepSymMatrix(5,0)) {
118 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
119 if(scmgn!=StatusCode::SUCCESS) {
120 // log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq;
121 std::cout<< "Unable to open Magnetic field service"<<std::endl;
122 }
123 m_bField = 10000*(m_pmgnIMF->getReferField());
124 m_alpha = 10000. / 2.99792458 / m_bField;
125
126 m_a[0] = 0.;
127 m_a[1] = fmod(atan2(- momentum.x(), momentum.y())
128 + M_PI4, M_PI2);
129 m_a[3] = 0.;
130 double perp(momentum.perp());
131 if (perp != 0.0) {
132 m_a[2] = charge / perp;
133 m_a[4] = momentum.z() / perp;
134 }
135 else {
136 m_a[2] = charge * (DBL_MAX);
137 if (momentum.z() >= 0) {
138 m_a[4] = (DBL_MAX);
139 } else {
140 m_a[4] = -(DBL_MAX);
141 }
142 }
143 // m_alpha = 333.564095;
144 updateCache();
145}
**********INTEGER nmxhep !maximum number of particles DOUBLE PRECISION vhep INTEGER jdahep COMMON hepevt $ !serial number $ !number of particles $ !status code $ !particle ident KF $ !parent particles $ !childreen particles $ !four momentum
#define DBL_MAX
Definition KalFitAlg.h:13

◆ Helix() [5/5]

Helix::Helix ( const Helix & i)

Definition at line 430 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

431{
432 m_bField = i.m_bField;
433 m_alpha = i.m_alpha;
434 m_pivot = i.m_pivot;
435 m_a = i.m_a;
436 m_Ea = i.m_Ea;
437 m_matrixValid = i.m_matrixValid;
438
439 m_center = i.m_center;
440 m_cp = i.m_cp;
441 m_sp = i.m_sp;
442 m_pt = i.m_pt;
443 m_r = i.m_r;
444 m_ac[0] = i.m_ac[0];
445 m_ac[1] = i.m_ac[1];
446 m_ac[2] = i.m_ac[2];
447 m_ac[3] = i.m_ac[3];
448 m_ac[4] = i.m_ac[4];
449}

◆ ~Helix()

Helix::~Helix ( )
virtual

Destructor.

Definition at line 147 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

147 {
148}

Member Function Documentation

◆ a() [1/2]

const HepVector & Helix::a ( const HepVector & newA)
inline

sets helix parameters.

Definition at line 277 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

277 {
278 m_a = i;
279 updateCache();
280 return m_a;
281}

◆ a() [2/2]

◆ alpha()

double Helix::alpha ( void ) const
inline

◆ approach() [1/2]

double Helix::approach ( HepPoint3D pfwd,
HepPoint3D pbwd,
bool doSagCorrection ) const

Definition at line 211 of file KalFitDoca.cxx.

212{
213// ...Cal. dPhi to rotate...
214// const TMDCWire & w = * link.wire();
215 HepPoint3D positionOnWire, positionOnTrack;
216 HepPoint3D pv = pivot();
217 HepVector Va = a();
218 HepSymMatrix Ma = Ea();
219
220 Helix _helix(pv, Va ,Ma);
221 Hep3Vector Wire;
222 Wire[0] = (pfwd - pbwd).x();
223 Wire[1] = (pfwd - pbwd).y();
224 Wire[2] = (pfwd - pbwd).z();
225// xyPosition(), returns middle position of a wire. z componet is 0.
226// w.xyPosition(wp);
227 double wp[3];
228 wp[0] = 0.5*(pfwd + pbwd).x();
229 wp[1] = 0.5*(pfwd + pbwd).y();
230 wp[2] = 0.;
231 double wb[3];
232// w.backwardPosition(wb);
233 wb[0] = pbwd.x();
234 wb[1] = pbwd.y();
235 wb[2] = pbwd.z();
236 double v[3];
237 v[0] = Wire.unit().x();
238 v[1] = Wire.unit().y();
239 v[2] = Wire.unit().z();
240// std::cout<<"Wire.unit() is "<<Wire.unit()<<std::endl;
241
242// ...Sag correction...
243 /* if (doSagCorrection) {
244 HepVector3D dir = w.direction();
245 HepPoint3D xw(wp[0], wp[1], wp[2]);
246 HepPoint3D wireBackwardPosition(wb[0], wb[1], wb[2]);
247 w.wirePosition(link.positionOnTrack().z(),
248 xw,
249 wireBackwardPosition,
250 dir);
251 v[0] = dir.x();
252 v[1] = dir.y();
253 v[2] = dir.z();
254 wp[0] = xw.x();
255 wp[1] = xw.y();
256 wp[2] = xw.z();
257 wb[0] = wireBackwardPosition.x();
258 wb[1] = wireBackwardPosition.y();
259 wb[2] = wireBackwardPosition.z();
260 }
261 */
262 // ...Cal. dPhi to rotate...
263 const HepPoint3D & xc = _helix.center();
264 double xt[3];
265 _helix.x(0., xt);
266 double x0 = - xc.x();
267 double y0 = - xc.y();
268 double x1 = wp[0] + x0;
269 double y1 = wp[1] + y0;
270 x0 += xt[0];
271 y0 += xt[1];
272 //std::cout<<" x0 is: "<<x0<<" y0 is: "<<y0<<std::endl;
273 //std::cout<<" x1 is: "<<x1<<" y1 is: "<<y1<<std::endl;
274 //std::cout<<" xt[0] is: "<<xt[0]<<" xt[1] is: "<<xt[1]<<std::endl;
275
276 double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1);
277 //std::cout<<" x0 * y1 - y0 * x1 is: "<<(x0 * y1 - y0 * x1)<<std::endl;
278 //std::cout<<" x0 * x1 + y0 * y1 is: "<<(x0 * x1 + y0 * y1)<<std::endl;
279 //std::cout<<" before loop dPhi is "<<dPhi<<std::endl;
280 //...Setup...
281 double kappa = _helix.kappa();
282 double phi0 = _helix.phi0();
283
284 //...Axial case...
285 /* if (!w.stereo()) {
286 positionOnTrack = _helix.x(dPhi);
287 HepPoint3D x(wp[0], wp[1], wp[2]);
288 x.setZ(positionOnTrack.z());
289 positionOnWire = x;
290 //link.dPhi(dPhi);
291 std::cout<<" in axial wire : positionOnTrack is "<<positionOnTrack
292 <<" positionOnWire is "<<positionOnWire<<std::endl;
293 return (positionOnTrack - positionOnWire).mag();
294 }
295 */
296 double firstdfdphi = 0.;
297 static bool first = true;
298 if (first) {
299// extern BelleTupleManager * BASF_Histogram;
300// BelleTupleManager * m = BASF_Histogram;
301// h_nTrial = m->histogram("TTrack::approach nTrial", 100, 0., 100.);
302 }
303//#endif
304
305 //...Stereo case...
306 double rho = Helix::ConstantAlpha / kappa;
307 double tanLambda = _helix.tanl();
308 static HepPoint3D x;
309 double t_x[3];
310 double t_dXdPhi[3];
311 const double convergence = 1.0e-5;
312 double l;
313 unsigned nTrial = 0;
314 while (nTrial < 100) {
315
316// x = link.positionOnTrack(_helix->x(dPhi));
317 positionOnTrack = _helix.x(dPhi);
318 x = _helix.x(dPhi);
319 t_x[0] = x[0];
320 t_x[1] = x[1];
321 t_x[2] = x[2];
322
323 l = v[0] * t_x[0] + v[1] * t_x[1] + v[2] * t_x[2]
324 - v[0] * wb[0] - v[1] * wb[1] - v[2] * wb[2];
325
326 double rcosPhi = rho * cos(phi0 + dPhi);
327 double rsinPhi = rho * sin(phi0 + dPhi);
328 t_dXdPhi[0] = rsinPhi;
329 t_dXdPhi[1] = - rcosPhi;
330 t_dXdPhi[2] = - rho * tanLambda;
331
332 //...f = d(Distance) / d phi...
333 double t_d2Xd2Phi[2];
334 t_d2Xd2Phi[0] = rcosPhi;
335 t_d2Xd2Phi[1] = rsinPhi;
336
337 //...iw new...
338 double n[3];
339 n[0] = t_x[0] - wb[0];
340 n[1] = t_x[1] - wb[1];
341 n[2] = t_x[2] - wb[2];
342
343 double a[3];
344 a[0] = n[0] - l * v[0];
345 a[1] = n[1] - l * v[1];
346 a[2] = n[2] - l * v[2];
347 double dfdphi = a[0] * t_dXdPhi[0]
348 + a[1] * t_dXdPhi[1]
349 + a[2] * t_dXdPhi[2];
350
351 if (nTrial == 0) {
352// break;
353 firstdfdphi = dfdphi;
354 }
355
356 //...Check bad case...
357 if (nTrial > 3) {
358// std::cout<<" BAD CASE!!, calculate approach ntrial = "<<nTrial<< endl;
359 }
360 //...Is it converged?...
361 if (fabs(dfdphi) < convergence)
362 break;
363
364 double dv = v[0] * t_dXdPhi[0]
365 + v[1] * t_dXdPhi[1]
366 + v[2] * t_dXdPhi[2];
367 double t0 = t_dXdPhi[0] * t_dXdPhi[0]
368 + t_dXdPhi[1] * t_dXdPhi[1]
369 + t_dXdPhi[2] * t_dXdPhi[2];
370 double d2fd2phi = t0 - dv * dv
371 + a[0] * t_d2Xd2Phi[0]
372 + a[1] * t_d2Xd2Phi[1];
373 // + a[2] * t_d2Xd2Phi[2];
374
375 dPhi -= dfdphi / d2fd2phi;
376 ++nTrial;
377 }
378 //std::cout<<" dPhi is: "<<dPhi<<std::endl;
379 //...Cal. positions...
380 positionOnWire[0] = wb[0] + l * v[0];
381 positionOnWire[1] = wb[1] + l * v[1];
382 positionOnWire[2] = wb[2] + l * v[2];
383
384 //std::cout<<"wb[0] is: "<<wb[0]<<" l is: "<<l<<" v[0] is: "<<v[0]<<std::endl;
385 //std::cout<<"wb[1] is: "<<wb[1]<<" v[1] is: "<<v[1]<<std::endl;
386 //std::cout<<"wb[2] is: "<<wb[2]<<" v[2] is: "<<v[2]<<std::endl;
387
388 //std::cout<<" positionOnTrack is "<<positionOnTrack
389 // <<" positionOnWire is "<<positionOnWire<<std::endl;
390
391 return (positionOnTrack - positionOnWire).mag();
392 // link.dPhi(dPhi);
393 // return nTrial;
394}
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213
const Int_t n
Double_t x[10]
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
static const double ConstantAlpha
Constant alpha for uniform field.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
Index first(Pair i)

◆ approach() [2/2]

double Helix::approach ( KalFitHitMdc & hit,
bool doSagCorrection ) const

Definition at line 19 of file KalFitDoca.cxx.

19 {
20 //...Cal. dPhi to rotate...
21 //const TMDCWire & w = * link.wire();
22 HepPoint3D positionOnWire, positionOnTrack;
23 HepPoint3D pv = pivot();
24 //std::cout<<"the track pivot in approach is "<<pv<<std::endl;
25 HepVector Va = a();
26 //std::cout<<"the track parameters is "<<Va<<std::endl;
27 HepSymMatrix Ma = Ea();
28 //std::cout<<"the error matrix is "<<Ma<<std::endl;
29
30 Helix _helix(pv, Va ,Ma);
31 //_helix.pivot(IP);
32 const KalFitWire& w = hit.wire();
33 Hep3Vector Wire = w.fwd() - w.bck();
34 //xyPosition(), returns middle position of a wire. z componet is 0.
35 //w.xyPosition(wp);
36 double wp[3];
37 wp[0] = 0.5*(w.fwd() + w.bck()).x();
38 wp[1] = 0.5*(w.fwd() + w.bck()).y();
39 wp[2] = 0.;
40 double wb[3];
41 //w.backwardPosition(wb);
42 wb[0] = w.bck().x();
43 wb[1] = w.bck().y();
44 wb[2] = w.bck().z();
45 double v[3];
46 v[0] = Wire.unit().x();
47 v[1] = Wire.unit().y();
48 v[2] = Wire.unit().z();
49 //std::cout<<"Wire.unit() is "<<Wire.unit()<<std::endl;
50
51 //...Sag correction...
52 /* if (doSagCorrection) {
53 HepVector3D dir = w.direction();
54 HepPoint3D xw(wp[0], wp[1], wp[2]);
55 HepPoint3D wireBackwardPosition(wb[0], wb[1], wb[2]);
56 w.wirePosition(link.positionOnTrack().z(),
57 xw,
58 wireBackwardPosition,
59 dir);
60 v[0] = dir.x();
61 v[1] = dir.y();
62 v[2] = dir.z();
63 wp[0] = xw.x();
64 wp[1] = xw.y();
65 wp[2] = xw.z();
66 wb[0] = wireBackwardPosition.x();
67 wb[1] = wireBackwardPosition.y();
68 wb[2] = wireBackwardPosition.z();
69 }
70 */
71 //...Cal. dPhi to rotate...
72 const HepPoint3D & xc = _helix.center();
73
74 //std::cout<<" helix center: "<<xc<<std::endl;
75
76 double xt[3]; _helix.x(0., xt);
77 double x0 = - xc.x();
78 double y0 = - xc.y();
79 double x1 = wp[0] + x0;
80 double y1 = wp[1] + y0;
81 x0 += xt[0];
82 y0 += xt[1];
83 double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1);
84
85 //std::cout<<"dPhi is "<<dPhi<<std::endl;
86
87 //...Setup...
88 double kappa = _helix.kappa();
89 double phi0 = _helix.phi0();
90
91 //...Axial case...
92 /* if (!w.stereo()) {
93 positionOnTrack = _helix.x(dPhi);
94 HepPoint3D x(wp[0], wp[1], wp[2]);
95 x.setZ(positionOnTrack.z());
96 positionOnWire = x;
97 //link.dPhi(dPhi);
98 std::cout<<" in axial wire : positionOnTrack is "<<positionOnTrack
99 <<" positionOnWire is "<<positionOnWire<<std::endl;
100 return (positionOnTrack - positionOnWire).mag();
101 }
102 */
103 double firstdfdphi = 0.;
104 static bool first = true;
105 if (first) {
106// extern BelleTupleManager * BASF_Histogram;
107// BelleTupleManager * m = BASF_Histogram;
108// h_nTrial = m->histogram("TTrack::approach nTrial", 100, 0., 100.);
109 }
110//#endif
111
112 //...Stereo case...
113 double rho = Helix::ConstantAlpha / kappa;
114 double tanLambda = _helix.tanl();
115 static HepPoint3D x;
116 double t_x[3];
117 double t_dXdPhi[3];
118 const double convergence = 1.0e-5;
119 double l;
120 unsigned nTrial = 0;
121 while (nTrial < 100) {
122
123// x = link.positionOnTrack(_helix->x(dPhi));
124 positionOnTrack = _helix.x(dPhi);
125 x = _helix.x(dPhi);
126 t_x[0] = x[0];
127 t_x[1] = x[1];
128 t_x[2] = x[2];
129
130 l = v[0] * t_x[0] + v[1] * t_x[1] + v[2] * t_x[2]
131 - v[0] * wb[0] - v[1] * wb[1] - v[2] * wb[2];
132
133 double rcosPhi = rho * cos(phi0 + dPhi);
134 double rsinPhi = rho * sin(phi0 + dPhi);
135 t_dXdPhi[0] = rsinPhi;
136 t_dXdPhi[1] = - rcosPhi;
137 t_dXdPhi[2] = - rho * tanLambda;
138
139 //...f = d(Distance) / d phi...
140 double t_d2Xd2Phi[2];
141 t_d2Xd2Phi[0] = rcosPhi;
142 t_d2Xd2Phi[1] = rsinPhi;
143
144 //...iw new...
145 double n[3];
146 n[0] = t_x[0] - wb[0];
147 n[1] = t_x[1] - wb[1];
148 n[2] = t_x[2] - wb[2];
149
150 double a[3];
151 a[0] = n[0] - l * v[0];
152 a[1] = n[1] - l * v[1];
153 a[2] = n[2] - l * v[2];
154 double dfdphi = a[0] * t_dXdPhi[0]
155 + a[1] * t_dXdPhi[1]
156 + a[2] * t_dXdPhi[2];
157
158//#ifdef TRKRECO_DEBUG
159 if (nTrial == 0) {
160// break;
161 firstdfdphi = dfdphi;
162 }
163
164 //...Check bad case...
165 if (nTrial > 3) {
166 std::cout<<" bad case, calculate approach ntrial = "<<nTrial<< std::endl;
167 }
168//#endif
169
170 //...Is it converged?...
171 if (fabs(dfdphi) < convergence)
172 break;
173
174 double dv = v[0] * t_dXdPhi[0]
175 + v[1] * t_dXdPhi[1]
176 + v[2] * t_dXdPhi[2];
177 double t0 = t_dXdPhi[0] * t_dXdPhi[0]
178 + t_dXdPhi[1] * t_dXdPhi[1]
179 + t_dXdPhi[2] * t_dXdPhi[2];
180 double d2fd2phi = t0 - dv * dv
181 + a[0] * t_d2Xd2Phi[0]
182 + a[1] * t_d2Xd2Phi[1];
183// + a[2] * t_d2Xd2Phi[2];
184
185 dPhi -= dfdphi / d2fd2phi;
186
187// cout << "nTrial=" << nTrial << endl;
188// cout << "iw f,df,dphi=" << dfdphi << "," << d2fd2phi << "," << dPhi << endl;
189
190 ++nTrial;
191 }
192 //...Cal. positions...
193 positionOnWire[0] = wb[0] + l * v[0];
194 positionOnWire[1] = wb[1] + l * v[1];
195 positionOnWire[2] = wb[2] + l * v[2];
196
197 //std::cout<<" positionOnTrack is "<<positionOnTrack
198 // <<" positionOnWire is "<<positionOnWire<<std::endl;
199 return (positionOnTrack - positionOnWire).mag();
200
201 //link.dPhi(dPhi);
202
203 // #ifdef TRKRECO_DEBUG
204 // h_nTrial->accumulate((float) nTrial + .5);
205 // #endif
206 // return nTrial;
207}
const KalFitWire & wire(void) const
Description of a Wire class.
Definition KalFitWire.h:46
HepPoint3D bck(void) const
Definition KalFitWire.h:93
HepPoint3D fwd(void) const
Geometry :
Definition KalFitWire.h:92

◆ bFieldZ() [1/2]

double Helix::bFieldZ ( double a)
inline

sets/returns z componet of the magnetic field.

Definition at line 291 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

291 {
292 m_bField = a;
293 m_alpha = 10000. / 2.99792458 / m_bField;
294
295 //std::cout<<"m_alpha: "<<m_alpha<<std::endl;
296 updateCache();
297 return m_bField;
298}

Referenced by KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew(), and DotsHelixFitter::updateBField().

◆ bFieldZ() [2/2]

double Helix::bFieldZ ( void ) const
inline

Definition at line 311 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

311 {
312 return m_bField;
313}

Referenced by KalFitTrack::KalFitTrack().

◆ center()

◆ cosPhi0()

double Helix::cosPhi0 ( void ) const
inline

Definition at line 323 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

323 {
324 return m_cp;
325}

◆ cosTheta()

double KalmanFit::Helix::cosTheta ( void ) const
inline

Definition at line 116 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

116{ return m_a[4]/sqrt(1.+ m_a[4]*m_a[4]); }

◆ curv()

double Helix::curv ( void ) const
inline

Definition at line 259 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

259 {
260 return m_r;
261}

◆ del4MDelA()

HepMatrix Helix::del4MDelA ( double phi,
double mass ) const

Definition at line 647 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

647 {
648 //
649 // Calculate Jacobian (@4m/@a)
650 // Vector a is helix parameters and phi is internal parameter.
651 // Vector 4m is 4 momentum.
652 //
653
654 HepMatrix d4MDA(4,5,0);
655
656 double phi0 = m_ac[1];
657 double cpa = m_ac[2];
658 double tnl = m_ac[4];
659
660 double cosf0phi = cos(phi0+phi);
661 double sinf0phi = sin(phi0+phi);
662
663 double rho;
664 if(cpa != 0.)rho = 1./cpa;
665 else rho = (DBL_MAX);
666
667 double charge = 1.;
668 if(cpa < 0.)charge = -1.;
669
670 double E = sqrt(rho*rho*(1.+tnl*tnl)+mass*mass);
671
672 d4MDA[0][1] = -fabs(rho)*cosf0phi;
673 d4MDA[0][2] = charge*rho*rho*sinf0phi;
674
675 d4MDA[1][1] = -fabs(rho)*sinf0phi;
676 d4MDA[1][2] = -charge*rho*rho*cosf0phi;
677
678 d4MDA[2][2] = -charge*rho*rho*tnl;
679 d4MDA[2][4] = fabs(rho);
680
681 if (cpa != 0.0 && E != 0.0) {
682 d4MDA[3][2] = (-1.-tnl*tnl)/(cpa*cpa*cpa*E);
683 d4MDA[3][4] = tnl/(cpa*cpa*E);
684 } else {
685 d4MDA[3][2] = (DBL_MAX);
686 d4MDA[3][4] = (DBL_MAX);
687 }
688 return d4MDA;
689}
double mass

Referenced by momentum().

◆ del4MXDelA()

HepMatrix Helix::del4MXDelA ( double phi,
double mass ) const

Definition at line 693 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

693 {
694 //
695 // Calculate Jacobian (@4mx/@a)
696 // Vector a is helix parameters and phi is internal parameter.
697 // Vector 4xm is 4 momentum and position.
698 //
699
700 HepMatrix d4MXDA(7,5,0);
701
702 const double & dr = m_ac[0];
703 const double & phi0 = m_ac[1];
704 const double & cpa = m_ac[2];
705 const double & dz = m_ac[3];
706 const double & tnl = m_ac[4];
707
708 double cosf0phi = cos(phi0+phi);
709 double sinf0phi = sin(phi0+phi);
710
711 double rho;
712 if(cpa != 0.)rho = 1./cpa;
713 else rho = (DBL_MAX);
714
715 double charge = 1.;
716 if(cpa < 0.)charge = -1.;
717
718 double E = sqrt(rho * rho * (1. + tnl * tnl) + mass * mass);
719
720 d4MXDA[0][1] = - fabs(rho) * cosf0phi;
721 d4MXDA[0][2] = charge * rho * rho * sinf0phi;
722
723 d4MXDA[1][1] = - fabs(rho) * sinf0phi;
724 d4MXDA[1][2] = - charge * rho * rho * cosf0phi;
725
726 d4MXDA[2][2] = - charge * rho * rho * tnl;
727 d4MXDA[2][4] = fabs(rho);
728
729 if (cpa != 0.0 && E != 0.0) {
730 d4MXDA[3][2] = (- 1. - tnl * tnl) / (cpa * cpa * cpa * E);
731 d4MXDA[3][4] = tnl / (cpa * cpa * E);
732 } else {
733 d4MXDA[3][2] = (DBL_MAX);
734 d4MXDA[3][4] = (DBL_MAX);
735 }
736
737 d4MXDA[4][0] = m_cp;
738 d4MXDA[4][1] = - dr * m_sp + m_r * (- m_sp + sinf0phi);
739 if (cpa != 0.0) {
740 d4MXDA[4][2] = - (m_r / cpa) * (m_cp - cosf0phi);
741 } else {
742 d4MXDA[4][2] = (DBL_MAX);
743 }
744
745 d4MXDA[5][0] = m_sp;
746 d4MXDA[5][1] = dr * m_cp + m_r * (m_cp - cosf0phi);
747 if (cpa != 0.0) {
748 d4MXDA[5][2] = - (m_r / cpa) * (m_sp - sinf0phi);
749
750 d4MXDA[6][2] = (m_r / cpa) * tnl * phi;
751 } else {
752 d4MXDA[5][2] = (DBL_MAX);
753
754 d4MXDA[6][2] = (DBL_MAX);
755 }
756
757 d4MXDA[6][3] = 1.;
758 d4MXDA[6][4] = - m_r * phi;
759
760 return d4MXDA;
761}
double dr(void) const
returns an element of parameters.

Referenced by momentum().

◆ delApDelA()

HepMatrix Helix::delApDelA ( const HepVector & ap) const

Definition at line 488 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

488 {
489 //
490 // Calculate Jacobian (@ap/@a)
491 // Vector ap is new helix parameters and a is old helix parameters.
492 //
493
494 HepMatrix dApDA(5,5,0);
495
496 const double & dr = m_ac[0];
497 const double & phi0 = m_ac[1];
498 const double & cpa = m_ac[2];
499 const double & dz = m_ac[3];
500 const double & tnl = m_ac[4];
501
502 double drp = ap[0];
503 double phi0p = ap[1];
504 double cpap = ap[2];
505 double dzp = ap[3];
506 double tnlp = ap[4];
507
508 double rdr = m_r + dr;
509 double rdrpr;
510 if ((m_r + drp) != 0.0) {
511 rdrpr = 1. / (m_r + drp);
512 } else {
513 rdrpr = (DBL_MAX);
514 }
515 // double csfd = cos(phi0)*cos(phi0p) + sin(phi0)*sin(phi0p);
516 // double snfd = cos(phi0)*sin(phi0p) - sin(phi0)*cos(phi0p);
517 double csfd = cos(phi0p - phi0);
518 double snfd = sin(phi0p - phi0);
519 double phid = fmod(phi0p - phi0 + M_PI8, M_PI2);
520 if (phid > M_PI) phid = phid - M_PI2;
521
522 dApDA[0][0] = csfd;
523 dApDA[0][1] = rdr*snfd;
524 if(cpa!=0.0) {
525 dApDA[0][2] = (m_r/cpa)*( 1.0 - csfd );
526 } else {
527 dApDA[0][2] = (DBL_MAX);
528 }
529
530 dApDA[1][0] = - rdrpr*snfd;
531 dApDA[1][1] = rdr*rdrpr*csfd;
532 if(cpa!=0.0) {
533 dApDA[1][2] = (m_r/cpa)*rdrpr*snfd;
534 } else {
535 dApDA[1][2] = (DBL_MAX);
536 }
537
538 dApDA[2][2] = 1.0;
539
540 dApDA[3][0] = m_r*rdrpr*tnl*snfd;
541 dApDA[3][1] = m_r*tnl*(1.0 - rdr*rdrpr*csfd);
542 if(cpa!=0.0) {
543 dApDA[3][2] = (m_r/cpa)*tnl*(phid - m_r*rdrpr*snfd);
544 } else {
545 dApDA[3][2] = (DBL_MAX);
546 }
547 dApDA[3][3] = 1.0;
548 dApDA[3][4] = - m_r*phid;
549
550 dApDA[4][4] = 1.0;
551
552 return dApDA;
553}
#define M_PI
Definition TConstant.h:4

Referenced by pivot(), KalFitTrack::pivot_numf(), and KalFitTrack::pivot_numf().

◆ delMDelA()

HepMatrix Helix::delMDelA ( double phi) const

Definition at line 610 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

610 {
611 //
612 // Calculate Jacobian (@m/@a)
613 // Vector a is helix parameters and phi is internal parameter.
614 // Vector m is momentum.
615 //
616
617 HepMatrix dMDA(3,5,0);
618
619 const double & phi0 = m_ac[1];
620 const double & cpa = m_ac[2];
621 const double & tnl = m_ac[4];
622
623 double cosf0phi = cos(phi0+phi);
624 double sinf0phi = sin(phi0+phi);
625
626 double rho;
627 if(cpa != 0.)rho = 1./cpa;
628 else rho = (DBL_MAX);
629
630 double charge = 1.;
631 if(cpa < 0.)charge = -1.;
632
633 dMDA[0][1] = -fabs(rho)*cosf0phi;
634 dMDA[0][2] = charge*rho*rho*sinf0phi;
635
636 dMDA[1][1] = -fabs(rho)*sinf0phi;
637 dMDA[1][2] = -charge*rho*rho*cosf0phi;
638
639 dMDA[2][2] = -charge*rho*rho*tnl;
640 dMDA[2][4] = fabs(rho);
641
642 return dMDA;
643}

Referenced by momentum().

◆ delXDelA()

HepMatrix Helix::delXDelA ( double phi) const

Definition at line 556 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

556 {
557 //
558 // Calculate Jacobian (@x/@a)
559 // Vector a is helix parameters and phi is internal parameter
560 // which specifys the point to be calculated for Ex(phi).
561 //
562
563 HepMatrix dXDA(3,5,0);
564
565 const double & dr = m_ac[0];
566 const double & phi0 = m_ac[1];
567 const double & cpa = m_ac[2];
568 const double & dz = m_ac[3];
569 const double & tnl = m_ac[4];
570
571 double cosf0phi = cos(phi0 + phi);
572 double sinf0phi = sin(phi0 + phi);
573
574 dXDA[0][0] = m_cp;
575 dXDA[0][1] = - dr * m_sp + m_r * (- m_sp + sinf0phi);
576 if(cpa!=0.0) {
577 dXDA[0][2] = - (m_r / cpa) * (m_cp - cosf0phi);
578 } else {
579 dXDA[0][2] = (DBL_MAX);
580 }
581 // dXDA[0][3] = 0.0;
582 // dXDA[0][4] = 0.0;
583
584 dXDA[1][0] = m_sp;
585 dXDA[1][1] = dr * m_cp + m_r * (m_cp - cosf0phi);
586 if(cpa!=0.0) {
587 dXDA[1][2] = - (m_r / cpa) * (m_sp - sinf0phi);
588 } else {
589 dXDA[1][2] = (DBL_MAX);
590 }
591 // dXDA[1][3] = 0.0;
592 // dXDA[1][4] = 0.0;
593
594 // dXDA[2][0] = 0.0;
595 // dXDA[2][1] = 0.0;
596 if(cpa!=0.0) {
597 dXDA[2][2] = (m_r / cpa) * tnl * phi;
598 } else {
599 dXDA[2][2] = (DBL_MAX);
600 }
601 dXDA[2][3] = 1.0;
602 dXDA[2][4] = - m_r * phi;
603
604 return dXDA;
605}

Referenced by CgemSegmentFun::CalculateHelix(), KalFitTrack::filter(), and x().

◆ direction()

Hep3Vector Helix::direction ( double dPhi = 0.) const
inline

returns direction vector after rotating angle dPhi in phi direction.

Definition at line 223 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

223 {
224 return momentum(phi).unit();
225}

◆ dPhi()

double Helix::dPhi ( HepPoint3D & hit) const

Definition at line 832 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

833{
834 double isClockWise = m_r/fabs(m_r);
835 double x_cw = center().x()-hit.x();
836 double y_cw = center().y()-hit.y();
837 x_cw = isClockWise*x_cw;
838 y_cw = isClockWise*y_cw;
839 double phi_cw = atan2(y_cw,x_cw);
840 double dphi = phi_cw-phi0();
841 //while(dphi> M_PI) dphi-=2*M_PI;
842 //while(dphi<-M_PI) dphi+=2*M_PI;
843 if(isClockWise>0)
844 {
845 while(dphi>0) dphi-=2*M_PI;
846 while(dphi<-2*M_PI) dphi+=2*M_PI;
847 }
848 else {
849 while(dphi<0) dphi+=2*M_PI;
850 while(dphi>2*M_PI) dphi-=2*M_PI;
851 }
852 double delZ_2pi=2*M_PI*fabs(m_r)*m_ac[4];
853 double delZ_current=hit.z()-x(dphi).z();
854 double n2pi=0;
855 if(delZ_2pi!=0&&fabs(delZ_current)>0.5*fabs(delZ_2pi))
856 {
857 double sign=delZ_current/delZ_2pi;
858 sign/=fabs(sign);
859 n2pi=floor(fabs(delZ_current/delZ_2pi)+0.5);
860 n2pi=-isClockWise*sign*n2pi;
861 }
862 dphi+=n2pi*2*M_PI;
863 return dphi;
864}
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);

Referenced by approach(), approach(), flightArc(), KalFitTrack::intersect_cylinder(), IntersectCylinder(), and KalFitTrack::update_hits().

◆ dr()

◆ dz()

◆ Ea() [1/2]

const HepSymMatrix & Helix::Ea ( const HepSymMatrix & newdA)
inline

sets helix paramters and error matrix.

Definition at line 285 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

285 {
286 return m_Ea = i;
287}

◆ Ea() [2/2]

◆ flightArc() [1/2]

double Helix::flightArc ( double r) const

Definition at line 866 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

867{
868 double phi_turn = IntersectCylinder(r);
869 double arcLength = m_r*phi_turn;
870 arcLength = fabs(arcLength);
871 return arcLength;
872}

◆ flightArc() [2/2]

double Helix::flightArc ( HepPoint3D & hit) const

Definition at line 785 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

786{
787 /*
788 double rc = center().perp();
789 //double l = center().perp(hit);
790 double l = sqrt( (center().x()-hit.x()) * (center().x()-hit.x()) + (center().y()-hit.y()) * (center().y()-hit.y()) );
791 double rHit = hit.perp();
792 double cosPhi = (rc*rc + l * l - rHit * rHit) / (2 * rc * l);
793 //double cosPhi = (m_rad * m_rad + l * l - r * r) / (2 * m_rad * l);
794 if(cosPhi < -1 || cosPhi > 1) return 0;
795 double dPhi = acos(cosPhi);// [0, pi)
796 //double phiTrkFlt = IntersectCylinder(rHit);
797 //double arcLength = rc*dPhi;
798 double xHit = hit.getHitPoint().x();
799 double yHit = hit.getHitPoint().y();
800 double xCenter = center().x();
801 double yCenter = center().y();
802 double leftOrRight = xHit*yCenter - xCenter*yHit;
803 */
804 double dphi = dPhi(hit);
805 double arcLength = fabs(m_r*dphi);
806 return arcLength;
807}

Referenced by flightLength(), flightLength(), and DotsHelixFitter::getSZ().

◆ flightLength() [1/2]

double Helix::flightLength ( double r) const

Definition at line 874 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

875{
876 double arcLength = flightArc(r);
877 double cosLambda = 1/sqrt(1+m_ac[4]*m_ac[4]);
878 double flightLength = arcLength/cosLambda;
879 return flightLength;
880}

◆ flightLength() [2/2]

double Helix::flightLength ( HepPoint3D & hit) const

Definition at line 809 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

810{
811 /*
812 double rc = center().perp();
813 //double l = center().perp(hit);
814 double l = sqrt( (center().x()-hit.x()) * (center().x()-hit.x()) + (center().y()-hit.y()) * (center().y()-hit.y()) );
815 double rHit = hit.perp();
816 double cosPhi = (rc*rc + l * l - rHit * rHit) / (2 * rc * l);
817 //double cosPhi = (m_rad * m_rad + l * l - r * r) / (2 * m_rad * l);
818 if(cosPhi < -1 || cosPhi > 1) return 0;
819 double dPhi = acos(cosPhi);
820 //double dPhi = center().phi() - acos(cosPhi) - phi0();
821 //double phiTrkFlt = IntersectCylinder(rHit);
822 double arcLength = rc*dPhi;
823 */
824
825 double arcLength = flightArc(hit);
826
827 double cosLambda = 1/sqrt(1+m_ac[4]*m_ac[4]);
828 double flightLength = arcLength/cosLambda;
829 return flightLength;
830}

Referenced by flightLength(), and flightLength().

◆ ignoreErrorMatrix()

void Helix::ignoreErrorMatrix ( void )

unsets error matrix. Error calculations will be ignored after this function call until an error matrix be set again. 0 matrix will be return as a return value for error matrix when you call functions which returns an error matrix.

Definition at line 764 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

764 {
765 m_matrixValid = false;
766 m_Ea *= 0.;
767}

Referenced by KalFitTrack::chi2_next(), KalFitTrack::chi2_next(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitTrack::order_wirhit(), KalFitTrack::pivot_numf(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), KalFitTrack::smoother_Mdc_csmalign(), and KalFitTrack::update_hits_csmalign().

◆ IntersectCylinder()

double Helix::IntersectCylinder ( double r) const

Definition at line 769 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

770{
771 double m_rad = radius();
772 double l = center().perp();
773
774 double cosPhi = (m_rad * m_rad + l * l - r * r) / (2 * m_rad * l);
775
776 if(cosPhi < -1 || cosPhi > 1) return 0;
777
778 double dPhi = center().phi() - acos(cosPhi) - phi0();
779
780 if(dPhi < -M_PI) dPhi += 2 * M_PI;
781
782 return dPhi;
783}

Referenced by flightArc().

◆ kappa()

◆ momentum() [1/5]

HepLorentzVector Helix::momentum ( double dPhi,
double mass ) const

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 249 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

249 {
250 //
251 // Calculate momentum.
252 //
253 // Pt = | 1/kappa | (GeV/c)
254 //
255 // Px = -Pt * sin(phi0 + phi)
256 // Py = Pt * cos(phi0 + phi)
257 // Pz = Pt * tan(lambda)
258 //
259 // E = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
260
261 double pt = fabs(m_pt);
262 double px = - pt * sin(m_ac[1] + phi);
263 double py = pt * cos(m_ac[1] + phi);
264 double pz = pt * m_ac[4];
265 double E = sqrt(pt*pt*(1.+m_ac[4]*m_ac[4])+mass*mass);
266
267 return HepLorentzVector(px, py, pz, E);
268}

◆ momentum() [2/5]

HepLorentzVector Helix::momentum ( double dPhi,
double mass,
HepPoint3D & x,
HepSymMatrix & Emx ) const

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 297 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

300 {
301 //
302 // Calculate momentum.
303 //
304 // Pt = | 1/kappa | (GeV/c)
305 //
306 // Px = -Pt * sin(phi0 + phi)
307 // Py = Pt * cos(phi0 + phi)
308 // Pz = Pt * tan(lambda)
309 //
310 // E = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
311
312 double pt = fabs(m_pt);
313 double px = - pt * sin(m_ac[1] + phi);
314 double py = pt * cos(m_ac[1] + phi);
315 double pz = pt * m_ac[4];
316 double E = sqrt(pt * pt * (1. + m_ac[4] * m_ac[4]) + mass * mass);
317
318 x.setX(m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi)));
319 x.setY(m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi)));
320 x.setZ(m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi);
321
322 if (m_matrixValid) Emx = m_Ea.similarity(del4MXDelA(phi,mass));
323 else Emx = m_Ea;
324
325 return HepLorentzVector(px, py, pz, E);
326}

◆ momentum() [3/5]

HepLorentzVector Helix::momentum ( double dPhi,
double mass,
HepSymMatrix & Em ) const

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 272 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

272 {
273 //
274 // Calculate momentum.
275 //
276 // Pt = | 1/kappa | (GeV/c)
277 //
278 // Px = -Pt * sin(phi0 + phi)
279 // Py = Pt * cos(phi0 + phi)
280 // Pz = Pt * tan(lambda)
281 //
282 // E = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
283
284 double pt = fabs(m_pt);
285 double px = - pt * sin(m_ac[1] + phi);
286 double py = pt * cos(m_ac[1] + phi);
287 double pz = pt * m_ac[4];
288 double E = sqrt(pt*pt*(1.+m_ac[4]*m_ac[4])+mass*mass);
289
290 if (m_matrixValid) Em = m_Ea.similarity(del4MDelA(phi,mass));
291 else Em = m_Ea;
292
293 return HepLorentzVector(px, py, pz, E);
294}

◆ momentum() [4/5]

Hep3Vector Helix::momentum ( double dPhi,
HepSymMatrix & Em ) const

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 226 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

226 {
227 //
228 // Calculate momentum.
229 //
230 // Pt = | 1/kappa | (GeV/c)
231 //
232 // Px = -Pt * sin(phi0 + phi)
233 // Py = Pt * cos(phi0 + phi)
234 // Pz = Pt * tan(lambda)
235 //
236
237 double pt = fabs(m_pt);
238 double px = - pt * sin(m_ac[1] + phi);
239 double py = pt * cos(m_ac[1] + phi);
240 double pz = pt * m_ac[4];
241
242 if (m_matrixValid) Em = m_Ea.similarity(delMDelA(phi));
243 else Em = m_Ea;
244
245 return Hep3Vector(px, py, pz);
246}

◆ momentum() [5/5]

Hep3Vector Helix::momentum ( double dPhi = 0.) const

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 206 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

206 {
207 //
208 // Calculate momentum.
209 //
210 // Pt = | 1/kappa | (GeV/c)
211 //
212 // Px = -Pt * sin(phi0 + phi)
213 // Py = Pt * cos(phi0 + phi)
214 // Pz = Pt * tan(lambda)
215 //
216
217 double pt = fabs(m_pt);
218 double px = - pt * sin(m_ac[1] + phi);
219 double py = pt * cos(m_ac[1] + phi);
220 double pz = pt * m_ac[4];
221
222 return Hep3Vector(px, py, pz);
223}

Referenced by DotsHelixFitter::calculateCirclePar_Taubin(), DotsHelixFitter::calculateNewHelix(), KalFitAlg::complete_track(), KalFitAlg::complete_track(), CgemSegmentFitAlg::exe_v2(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), and DotsHelixFitter::updateDcDigiInfo().

◆ operator=()

Helix & Helix::operator= ( const Helix & i)

Copy operator.

Definition at line 406 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

406 {
407 if (this == & i) return * this;
408
409 m_bField = i.m_bField;
410 m_alpha = i.m_alpha;
411 m_pivot = i.m_pivot;
412 m_a = i.m_a;
413 m_Ea = i.m_Ea;
414 m_matrixValid = i.m_matrixValid;
415
416 m_center = i.m_center;
417 m_cp = i.m_cp;
418 m_sp = i.m_sp;
419 m_pt = i.m_pt;
420 m_r = i.m_r;
421 m_ac[0] = i.m_ac[0];
422 m_ac[1] = i.m_ac[1];
423 m_ac[2] = i.m_ac[2];
424 m_ac[3] = i.m_ac[3];
425 m_ac[4] = i.m_ac[4];
426
427 return * this;
428}

◆ phi0()

◆ pivot() [1/2]

const HepPoint3D & Helix::pivot ( const HepPoint3D & newPivot)

sets pivot position.

Definition at line 330 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

330 {
331
332 //std::cout<<" in Helix::pivot:"<<std::endl;
333 //std::cout<<" m_alpha: "<<m_alpha<<std::endl;
334
335 const double & dr = m_ac[0];
336 const double & phi0 = m_ac[1];
337 const double & kappa = m_ac[2];
338 const double & dz = m_ac[3];
339 const double & tanl = m_ac[4];
340
341 double rdr = dr + m_r;
342 double phi = fmod(phi0 + M_PI4, M_PI2);
343 double csf0 = cos(phi);
344 double snf0 = (1. - csf0) * (1. + csf0);
345 snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
346 if(phi > M_PI) snf0 = - snf0;
347
348 double xc = m_pivot.x() + rdr * csf0;
349 double yc = m_pivot.y() + rdr * snf0;
350 double csf, snf;
351 if(m_r != 0.0) {
352 csf = (xc - newPivot.x()) / m_r;
353 snf = (yc - newPivot.y()) / m_r;
354 double anrm = sqrt(csf * csf + snf * snf);
355 if(anrm != 0.0) {
356 csf /= anrm;
357 snf /= anrm;
358 phi = atan2(snf, csf);
359 } else {
360 csf = 1.0;
361 snf = 0.0;
362 phi = 0.0;
363 }
364 } else {
365 csf = 1.0;
366 snf = 0.0;
367 phi = 0.0;
368 }
369 double phid = fmod(phi - phi0 + M_PI8, M_PI2);
370 if(phid > M_PI) phid = phid - M_PI2;
371 double drp = (m_pivot.x() + dr * csf0 + m_r * (csf0 - csf) - newPivot.x())
372 * csf
373 + (m_pivot.y() + dr * snf0 + m_r * (snf0 - snf) - newPivot.y()) * snf;
374 double dzp = m_pivot.z() + dz - m_r * tanl * phid - newPivot.z();
375
376 HepVector ap(5);
377 ap[0] = drp;
378 ap[1] = fmod(phi + M_PI4, M_PI2);
379 ap[2] = kappa;
380 ap[3] = dzp;
381 ap[4] = tanl;
382
383 // if (m_matrixValid) m_Ea.assign(delApDelA(ap) * m_Ea * delApDelA(ap).T());
384 if (m_matrixValid) m_Ea = m_Ea.similarity(delApDelA(ap));
385
386 m_a = ap;
387 m_pivot = newPivot;
388
389 //...Are these needed?...iw...
390 updateCache();
391 return m_pivot;
392}

◆ pivot() [2/2]

◆ pt()

double KalmanFit::Helix::pt ( void ) const
inline

◆ radius()

◆ set()

void Helix::set ( const HepPoint3D & pivot,
const HepVector & a,
const HepSymMatrix & Ea )

sets helix pivot position, parameters, and error matrix.

Definition at line 395 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

397 {
398 m_pivot = pivot;
399 m_a = a;
400 m_Ea = Ea;
401 m_matrixValid = true;
402 updateCache();
403}

Referenced by KalFitAlg::fitGemHits().

◆ sinPhi0()

double Helix::sinPhi0 ( void ) const
inline

Definition at line 317 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

317 {
318 return m_sp;
319}

◆ tanl()

◆ x() [1/3]

double * Helix::x ( double dPhi,
double p[3] ) const

Definition at line 168 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

168 {
169 //
170 // Calculate position (x,y,z) along helix.
171 //
172 // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi))
173 // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi))
174 // z = z0 + dz - (alpha / kappa) * tan(lambda) * phi
175 //
176
177 p[0] = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi));
178 p[1] = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi));
179 p[2] = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
180
181 return p;
182}

◆ x() [2/3]

HepPoint3D Helix::x ( double dPhi,
HepSymMatrix & Ex ) const

returns position and convariance matrix(Ex) after rotation.

Definition at line 185 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

185 {
186 double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] +phi));
187 double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] +phi));
188 double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
189
190 //
191 // Calculate position error matrix.
192 // Ex(phi) = (@x/@a)(Ea)(@x/@a)^T, phi is deflection angle to specify the
193 // point to be calcualted.
194 //
195 // HepMatrix dXDA(3, 5, 0);
196 // dXDA = delXDelA(phi);
197 // Ex.assign(dXDA * m_Ea * dXDA.T());
198
199 if (m_matrixValid) Ex = m_Ea.similarity(delXDelA(phi));
200 else Ex = m_Ea;
201
202 return HepPoint3D(x, y, z);
203}
HepGeom::Point3D< double > HepPoint3D
Definition Gam4pikp.cxx:37

◆ x() [3/3]

HepPoint3D Helix::x ( double dPhi = 0.) const

returns position after rotating angle dPhi in phi direction.

Definition at line 151 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/src/helix/Helix.cxx.

151 {
152 //
153 // Calculate position (x,y,z) along helix.
154 //
155 // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi))
156 // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi))
157 // z = z0 + dz - (alpha / kappa) * tan(lambda) * phi
158 //
159
160 double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] +phi));
161 double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] +phi));
162 double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
163
164 return HepPoint3D(x, y, z);
165}

Referenced by approach(), approach(), DotsHelixFitter::calculateCirclePar_Taubin(), CgemSegmentFun::CalculateHelix(), DotsHelixFitter::calculateNewHelix(), KalFitAlg::Cgem_filter_anal(), KalFitTrack::chi2_next(), KalFitTrack::chi2_next(), KalFitAlg::complete_track(), KalFitAlg::complete_track(), DotsHelixFitter::dxda_cgem(), CgemSegmentFitAlg::exe_v2(), KalFitAlg::fillTds_back(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::fitGemHits(), KalFitAlg::fromFHitToInnerWall(), CgemSegmentFun::GetChisqF(), KalFitTrack::getDriftTime(), CgemSegmentFun::GetLikelihoodF(), DotsHelixFitter::getPosAtCgem(), KalFitAlg::innerwall(), KalFitCylinder::intersect(), KalFitCylinder::intersect(), KalFitCylinder::intersect(), KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew(), KalFitTrack::order_wirhit(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), DotsHelixFitter::updateDcDigiInfo(), x(), and x().

Member Data Documentation

◆ ConstantAlpha

const double Helix::ConstantAlpha = 333.564095
static

Constant alpha for uniform field.

Definition at line 173 of file Reconstruction/KalFitAlg/KalFitAlg-00-15-20/KalFitAlg/helix/Helix.h.

Referenced by approach(), and approach().


The documentation for this class was generated from the following files: