BOSS 6.6.4.p01
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 (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.
 
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 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
 

Static Public Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ Helix() [1/3]

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

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

Definition at line 49 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

52 : //m_bField(-10.0),
53 //m_alpha(-333.564095),
54 m_pivot(pivot),
55 m_a(a),
56 m_matrixValid(true),
57 m_Ea(Ea) {
58 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
59 if(scmgn!=StatusCode::SUCCESS) {
60 std::cout<< "Unable to open Magnetic field service"<<std::endl;
61 }
62 m_bField = 10000*(m_pmgnIMF->getReferField());
63 m_alpha = 10000. / 2.99792458 / m_bField;
64 // m_alpha = 10000. / 2.99792458 / m_bField;
65 // m_alpha = 333.564095;
66 updateCache();
67}
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/3]

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

Constructor without error matrix.

Definition at line 69 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

71 : //m_bField(-10.0),
72 //m_alpha(-333.564095),
73 m_pivot(pivot),
74 m_a(a),
75 m_matrixValid(false),
76 m_Ea(HepSymMatrix(5,0)) {
77 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
78 if(scmgn!=StatusCode::SUCCESS) {
79 // log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq;
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 = 333.564095;
85 //cout<<"MdcFastTrakAlg:: bField,alpha: "<<m_bField<<" , "<<m_alpha<<endl;
86 updateCache();
87}

◆ Helix() [3/3]

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

Constructor with position, momentum, and charge.

Definition at line 89 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

92 : //m_bField(-10.0),
93 //m_alpha(-333.564095),
94 m_pivot(position),
95 m_a(HepVector(5,0)),
96 m_matrixValid(false),
97 m_Ea(HepSymMatrix(5,0)) {
98 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
99 if(scmgn!=StatusCode::SUCCESS) {
100 // log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq;
101 std::cout<< "Unable to open Magnetic field service"<<std::endl;
102 }
103 m_bField = 10000*(m_pmgnIMF->getReferField());
104 m_alpha = 10000. / 2.99792458 / m_bField;
105
106 m_a[0] = 0.;
107 m_a[1] = fmod(atan2(- momentum.x(), momentum.y())
108 + M_PI4, M_PI2);
109 m_a[3] = 0.;
110 double perp(momentum.perp());
111 if (perp != 0.0) {
112 m_a[2] = charge / perp;
113 m_a[4] = momentum.z() / perp;
114 }
115 else {
116 m_a[2] = charge * (DBL_MAX);
117 if (momentum.z() >= 0) {
118 m_a[4] = (DBL_MAX);
119 } else {
120 m_a[4] = -(DBL_MAX);
121 }
122 }
123 // m_alpha = 333.564095;
124 updateCache();
125}
**********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()

Helix::~Helix ( )
virtual

Destructor.

Definition at line 127 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

127 {
128}

Member Function Documentation

◆ a() [1/2]

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

sets helix parameters.

Definition at line 266 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

266 {
267 m_a = i;
268 updateCache();
269 return m_a;
270}

◆ a() [2/2]

◆ alpha()

double Helix::alpha ( void  ) const
inline

Definition at line 292 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

292 {
293
294 return m_alpha;
295}

◆ approach() [1/2]

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

Definition at line 208 of file KalFitDoca.cxx.

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

◆ approach() [2/2]

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

Definition at line 16 of file KalFitDoca.cxx.

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

280 {
281 m_bField = a;
282 m_alpha = 10000. / 2.99792458 / m_bField;
283
284 //std::cout<<"m_alpha: "<<m_alpha<<std::endl;
285 updateCache();
286 return m_bField;
287}

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

◆ bFieldZ() [2/2]

double Helix::bFieldZ ( void  ) const
inline

Definition at line 300 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

300 {
301 return m_bField;
302}

Referenced by KalFitTrack::KalFitTrack().

◆ center()

const HepPoint3D & Helix::center ( void  ) const
inline

◆ cosPhi0()

double Helix::cosPhi0 ( void  ) const
inline

Definition at line 312 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

312 {
313 return m_cp;
314}

◆ curv()

double Helix::curv ( void  ) const
inline

Definition at line 248 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

248 {
249 return m_r;
250}

◆ del4MDelA()

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

Definition at line 605 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

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

Referenced by momentum().

◆ del4MXDelA()

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

Definition at line 651 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

651 {
652 //
653 // Calculate Jacobian (@4mx/@a)
654 // Vector a is helix parameters and phi is internal parameter.
655 // Vector 4xm is 4 momentum and position.
656 //
657
658 HepMatrix d4MXDA(7,5,0);
659
660 const double & dr = m_ac[0];
661 const double & phi0 = m_ac[1];
662 const double & cpa = m_ac[2];
663 const double & dz = m_ac[3];
664 const double & tnl = m_ac[4];
665
666 double cosf0phi = cos(phi0+phi);
667 double sinf0phi = sin(phi0+phi);
668
669 double rho;
670 if(cpa != 0.)rho = 1./cpa;
671 else rho = (DBL_MAX);
672
673 double charge = 1.;
674 if(cpa < 0.)charge = -1.;
675
676 double E = sqrt(rho * rho * (1. + tnl * tnl) + mass * mass);
677
678 d4MXDA[0][1] = - fabs(rho) * cosf0phi;
679 d4MXDA[0][2] = charge * rho * rho * sinf0phi;
680
681 d4MXDA[1][1] = - fabs(rho) * sinf0phi;
682 d4MXDA[1][2] = - charge * rho * rho * cosf0phi;
683
684 d4MXDA[2][2] = - charge * rho * rho * tnl;
685 d4MXDA[2][4] = fabs(rho);
686
687 if (cpa != 0.0 && E != 0.0) {
688 d4MXDA[3][2] = (- 1. - tnl * tnl) / (cpa * cpa * cpa * E);
689 d4MXDA[3][4] = tnl / (cpa * cpa * E);
690 } else {
691 d4MXDA[3][2] = (DBL_MAX);
692 d4MXDA[3][4] = (DBL_MAX);
693 }
694
695 d4MXDA[4][0] = m_cp;
696 d4MXDA[4][1] = - dr * m_sp + m_r * (- m_sp + sinf0phi);
697 if (cpa != 0.0) {
698 d4MXDA[4][2] = - (m_r / cpa) * (m_cp - cosf0phi);
699 } else {
700 d4MXDA[4][2] = (DBL_MAX);
701 }
702
703 d4MXDA[5][0] = m_sp;
704 d4MXDA[5][1] = dr * m_cp + m_r * (m_cp - cosf0phi);
705 if (cpa != 0.0) {
706 d4MXDA[5][2] = - (m_r / cpa) * (m_sp - sinf0phi);
707
708 d4MXDA[6][2] = (m_r / cpa) * tnl * phi;
709 } else {
710 d4MXDA[5][2] = (DBL_MAX);
711
712 d4MXDA[6][2] = (DBL_MAX);
713 }
714
715 d4MXDA[6][3] = 1.;
716 d4MXDA[6][4] = - m_r * phi;
717
718 return d4MXDA;
719}
double dr(void) const
returns an element of parameters.

Referenced by momentum().

◆ delApDelA()

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

Definition at line 446 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

446 {
447 //
448 // Calculate Jacobian (@ap/@a)
449 // Vector ap is new helix parameters and a is old helix parameters.
450 //
451
452 HepMatrix dApDA(5,5,0);
453
454 const double & dr = m_ac[0];
455 const double & phi0 = m_ac[1];
456 const double & cpa = m_ac[2];
457 const double & dz = m_ac[3];
458 const double & tnl = m_ac[4];
459
460 double drp = ap[0];
461 double phi0p = ap[1];
462 double cpap = ap[2];
463 double dzp = ap[3];
464 double tnlp = ap[4];
465
466 double rdr = m_r + dr;
467 double rdrpr;
468 if ((m_r + drp) != 0.0) {
469 rdrpr = 1. / (m_r + drp);
470 } else {
471 rdrpr = (DBL_MAX);
472 }
473 // double csfd = cos(phi0)*cos(phi0p) + sin(phi0)*sin(phi0p);
474 // double snfd = cos(phi0)*sin(phi0p) - sin(phi0)*cos(phi0p);
475 double csfd = cos(phi0p - phi0);
476 double snfd = sin(phi0p - phi0);
477 double phid = fmod(phi0p - phi0 + M_PI8, M_PI2);
478 if (phid > M_PI) phid = phid - M_PI2;
479
480 dApDA[0][0] = csfd;
481 dApDA[0][1] = rdr*snfd;
482 if(cpa!=0.0) {
483 dApDA[0][2] = (m_r/cpa)*( 1.0 - csfd );
484 } else {
485 dApDA[0][2] = (DBL_MAX);
486 }
487
488 dApDA[1][0] = - rdrpr*snfd;
489 dApDA[1][1] = rdr*rdrpr*csfd;
490 if(cpa!=0.0) {
491 dApDA[1][2] = (m_r/cpa)*rdrpr*snfd;
492 } else {
493 dApDA[1][2] = (DBL_MAX);
494 }
495
496 dApDA[2][2] = 1.0;
497
498 dApDA[3][0] = m_r*rdrpr*tnl*snfd;
499 dApDA[3][1] = m_r*tnl*(1.0 - rdr*rdrpr*csfd);
500 if(cpa!=0.0) {
501 dApDA[3][2] = (m_r/cpa)*tnl*(phid - m_r*rdrpr*snfd);
502 } else {
503 dApDA[3][2] = (DBL_MAX);
504 }
505 dApDA[3][3] = 1.0;
506 dApDA[3][4] = - m_r*phid;
507
508 dApDA[4][4] = 1.0;
509
510 return dApDA;
511}
#define M_PI
Definition: TConstant.h:4

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

◆ delMDelA()

HepMatrix Helix::delMDelA ( double  phi) const

Definition at line 568 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

568 {
569 //
570 // Calculate Jacobian (@m/@a)
571 // Vector a is helix parameters and phi is internal parameter.
572 // Vector m is momentum.
573 //
574
575 HepMatrix dMDA(3,5,0);
576
577 const double & phi0 = m_ac[1];
578 const double & cpa = m_ac[2];
579 const double & tnl = m_ac[4];
580
581 double cosf0phi = cos(phi0+phi);
582 double sinf0phi = sin(phi0+phi);
583
584 double rho;
585 if(cpa != 0.)rho = 1./cpa;
586 else rho = (DBL_MAX);
587
588 double charge = 1.;
589 if(cpa < 0.)charge = -1.;
590
591 dMDA[0][1] = -fabs(rho)*cosf0phi;
592 dMDA[0][2] = charge*rho*rho*sinf0phi;
593
594 dMDA[1][1] = -fabs(rho)*sinf0phi;
595 dMDA[1][2] = -charge*rho*rho*cosf0phi;
596
597 dMDA[2][2] = -charge*rho*rho*tnl;
598 dMDA[2][4] = fabs(rho);
599
600 return dMDA;
601}

Referenced by momentum().

◆ delXDelA()

HepMatrix Helix::delXDelA ( double  phi) const

Definition at line 514 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

514 {
515 //
516 // Calculate Jacobian (@x/@a)
517 // Vector a is helix parameters and phi is internal parameter
518 // which specifys the point to be calculated for Ex(phi).
519 //
520
521 HepMatrix dXDA(3,5,0);
522
523 const double & dr = m_ac[0];
524 const double & phi0 = m_ac[1];
525 const double & cpa = m_ac[2];
526 const double & dz = m_ac[3];
527 const double & tnl = m_ac[4];
528
529 double cosf0phi = cos(phi0 + phi);
530 double sinf0phi = sin(phi0 + phi);
531
532 dXDA[0][0] = m_cp;
533 dXDA[0][1] = - dr * m_sp + m_r * (- m_sp + sinf0phi);
534 if(cpa!=0.0) {
535 dXDA[0][2] = - (m_r / cpa) * (m_cp - cosf0phi);
536 } else {
537 dXDA[0][2] = (DBL_MAX);
538 }
539 // dXDA[0][3] = 0.0;
540 // dXDA[0][4] = 0.0;
541
542 dXDA[1][0] = m_sp;
543 dXDA[1][1] = dr * m_cp + m_r * (m_cp - cosf0phi);
544 if(cpa!=0.0) {
545 dXDA[1][2] = - (m_r / cpa) * (m_sp - sinf0phi);
546 } else {
547 dXDA[1][2] = (DBL_MAX);
548 }
549 // dXDA[1][3] = 0.0;
550 // dXDA[1][4] = 0.0;
551
552 // dXDA[2][0] = 0.0;
553 // dXDA[2][1] = 0.0;
554 if(cpa!=0.0) {
555 dXDA[2][2] = (m_r / cpa) * tnl * phi;
556 } else {
557 dXDA[2][2] = (DBL_MAX);
558 }
559 dXDA[2][3] = 1.0;
560 dXDA[2][4] = - m_r * phi;
561
562 return dXDA;
563}

Referenced by 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 212 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

212 {
213 return momentum(phi).unit();
214}

◆ dr()

double Helix::dr ( void  ) const
inline

returns an element of parameters.

Definition at line 218 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

218 {
219 return m_ac[0];
220}

Referenced by del4MXDelA(), delApDelA(), delXDelA(), pivot(), KalFitTrack::pivot_numf(), and KalFitTrack::radius_numf().

◆ dz()

double Helix::dz ( void  ) const
inline

◆ Ea() [1/2]

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

sets helix paramters and error matrix.

Definition at line 274 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

274 {
275 return m_Ea = i;
276}

◆ Ea() [2/2]

◆ 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 722 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

722 {
723 m_matrixValid = false;
724 m_Ea *= 0.;
725}

Referenced by 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().

◆ 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 229 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

229 {
230 //
231 // Calculate momentum.
232 //
233 // Pt = | 1/kappa | (GeV/c)
234 //
235 // Px = -Pt * sin(phi0 + phi)
236 // Py = Pt * cos(phi0 + phi)
237 // Pz = Pt * tan(lambda)
238 //
239 // E = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
240
241 double pt = fabs(m_pt);
242 double px = - pt * sin(m_ac[1] + phi);
243 double py = pt * cos(m_ac[1] + phi);
244 double pz = pt * m_ac[4];
245 double E = sqrt(pt*pt*(1.+m_ac[4]*m_ac[4])+mass*mass);
246
247 return HepLorentzVector(px, py, pz, E);
248}

◆ 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 277 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

280 {
281 //
282 // Calculate momentum.
283 //
284 // Pt = | 1/kappa | (GeV/c)
285 //
286 // Px = -Pt * sin(phi0 + phi)
287 // Py = Pt * cos(phi0 + phi)
288 // Pz = Pt * tan(lambda)
289 //
290 // E = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
291
292 double pt = fabs(m_pt);
293 double px = - pt * sin(m_ac[1] + phi);
294 double py = pt * cos(m_ac[1] + phi);
295 double pz = pt * m_ac[4];
296 double E = sqrt(pt * pt * (1. + m_ac[4] * m_ac[4]) + mass * mass);
297
298 x.setX(m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi)));
299 x.setY(m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi)));
300 x.setZ(m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi);
301
302 if (m_matrixValid) Emx = m_Ea.similarity(del4MXDelA(phi,mass));
303 else Emx = m_Ea;
304
305 return HepLorentzVector(px, py, pz, E);
306}

◆ 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 252 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

252 {
253 //
254 // Calculate momentum.
255 //
256 // Pt = | 1/kappa | (GeV/c)
257 //
258 // Px = -Pt * sin(phi0 + phi)
259 // Py = Pt * cos(phi0 + phi)
260 // Pz = Pt * tan(lambda)
261 //
262 // E = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
263
264 double pt = fabs(m_pt);
265 double px = - pt * sin(m_ac[1] + phi);
266 double py = pt * cos(m_ac[1] + phi);
267 double pz = pt * m_ac[4];
268 double E = sqrt(pt*pt*(1.+m_ac[4]*m_ac[4])+mass*mass);
269
270 if (m_matrixValid) Em = m_Ea.similarity(del4MDelA(phi,mass));
271 else Em = m_Ea;
272
273 return HepLorentzVector(px, py, pz, E);
274}

◆ momentum() [4/5]

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

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 206 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/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 if (m_matrixValid) Em = m_Ea.similarity(delMDelA(phi));
223 else Em = m_Ea;
224
225 return Hep3Vector(px, py, pz);
226}

◆ momentum() [5/5]

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

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 186 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

186 {
187 //
188 // Calculate momentum.
189 //
190 // Pt = | 1/kappa | (GeV/c)
191 //
192 // Px = -Pt * sin(phi0 + phi)
193 // Py = Pt * cos(phi0 + phi)
194 // Pz = Pt * tan(lambda)
195 //
196
197 double pt = fabs(m_pt);
198 double px = - pt * sin(m_ac[1] + phi);
199 double py = pt * cos(m_ac[1] + phi);
200 double pz = pt * m_ac[4];
201
202 return Hep3Vector(px, py, pz);
203}

Referenced by KalFitAlg::complete_track(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::smoother_anal(), and KalFitAlg::smoother_calib().

◆ operator=()

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

Copy operator.

Definition at line 386 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

386 {
387 if (this == & i) return * this;
388
389 m_bField = i.m_bField;
390 m_alpha = i.m_alpha;
391 m_pivot = i.m_pivot;
392 m_a = i.m_a;
393 m_Ea = i.m_Ea;
394 m_matrixValid = i.m_matrixValid;
395
396 m_center = i.m_center;
397 m_cp = i.m_cp;
398 m_sp = i.m_sp;
399 m_pt = i.m_pt;
400 m_r = i.m_r;
401 m_ac[0] = i.m_ac[0];
402 m_ac[1] = i.m_ac[1];
403 m_ac[2] = i.m_ac[2];
404 m_ac[3] = i.m_ac[3];
405 m_ac[4] = i.m_ac[4];
406
407 return * this;
408}

◆ phi0()

◆ pivot() [1/2]

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

sets pivot position.

Definition at line 310 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

310 {
311
312 //std::cout<<" in Helix::pivot:"<<std::endl;
313 //std::cout<<" m_alpha: "<<m_alpha<<std::endl;
314
315 const double & dr = m_ac[0];
316 const double & phi0 = m_ac[1];
317 const double & kappa = m_ac[2];
318 const double & dz = m_ac[3];
319 const double & tanl = m_ac[4];
320
321 double rdr = dr + m_r;
322 double phi = fmod(phi0 + M_PI4, M_PI2);
323 double csf0 = cos(phi);
324 double snf0 = (1. - csf0) * (1. + csf0);
325 snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
326 if(phi > M_PI) snf0 = - snf0;
327
328 double xc = m_pivot.x() + rdr * csf0;
329 double yc = m_pivot.y() + rdr * snf0;
330 double csf, snf;
331 if(m_r != 0.0) {
332 csf = (xc - newPivot.x()) / m_r;
333 snf = (yc - newPivot.y()) / m_r;
334 double anrm = sqrt(csf * csf + snf * snf);
335 if(anrm != 0.0) {
336 csf /= anrm;
337 snf /= anrm;
338 phi = atan2(snf, csf);
339 } else {
340 csf = 1.0;
341 snf = 0.0;
342 phi = 0.0;
343 }
344 } else {
345 csf = 1.0;
346 snf = 0.0;
347 phi = 0.0;
348 }
349 double phid = fmod(phi - phi0 + M_PI8, M_PI2);
350 if(phid > M_PI) phid = phid - M_PI2;
351 double drp = (m_pivot.x() + dr * csf0 + m_r * (csf0 - csf) - newPivot.x())
352 * csf
353 + (m_pivot.y() + dr * snf0 + m_r * (snf0 - snf) - newPivot.y()) * snf;
354 double dzp = m_pivot.z() + dz - m_r * tanl * phid - newPivot.z();
355
356 HepVector ap(5);
357 ap[0] = drp;
358 ap[1] = fmod(phi + M_PI4, M_PI2);
359 ap[2] = kappa;
360 ap[3] = dzp;
361 ap[4] = tanl;
362
363 // if (m_matrixValid) m_Ea.assign(delApDelA(ap) * m_Ea * delApDelA(ap).T());
364 if (m_matrixValid) m_Ea = m_Ea.similarity(delApDelA(ap));
365
366 m_a = ap;
367 m_pivot = newPivot;
368
369 //...Are these needed?...iw...
370 updateCache();
371 return m_pivot;
372}

◆ pivot() [2/2]

◆ 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 375 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

377 {
378 m_pivot = pivot;
379 m_a = a;
380 m_Ea = Ea;
381 m_matrixValid = true;
382 updateCache();
383}

◆ sinPhi0()

double Helix::sinPhi0 ( void  ) const
inline

Definition at line 306 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

306 {
307 return m_sp;
308}

◆ tanl()

◆ x() [1/3]

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

Definition at line 148 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

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

◆ x() [2/3]

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

returns position and convariance matrix(Ex) after rotation.

Definition at line 165 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

165 {
166 double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] +phi));
167 double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] +phi));
168 double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
169
170 //
171 // Calculate position error matrix.
172 // Ex(phi) = (@x/@a)(Ea)(@x/@a)^T, phi is deflection angle to specify the
173 // point to be calcualted.
174 //
175 // HepMatrix dXDA(3, 5, 0);
176 // dXDA = delXDelA(phi);
177 // Ex.assign(dXDA * m_Ea * dXDA.T());
178
179 if (m_matrixValid) Ex = m_Ea.similarity(delXDelA(phi));
180 else Ex = m_Ea;
181
182 return HepPoint3D(x, y, z);
183}
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 131 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/src/helix/Helix.cxx.

131 {
132 //
133 // Calculate position (x,y,z) along helix.
134 //
135 // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi))
136 // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi))
137 // z = z0 + dz - (alpha / kappa) * tan(lambda) * phi
138 //
139
140 double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] +phi));
141 double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] +phi));
142 double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
143
144 return HepPoint3D(x, y, z);
145}

Referenced by approach(), KalFitTrack::chi2_next(), KalFitAlg::complete_track(), KalFitAlg::fillTds_back(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitTrack::getDriftTime(), 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(), and x().

Member Data Documentation

◆ ConstantAlpha

const double Helix::ConstantAlpha = 333.564095
static

Constant alpha for uniform field.

Definition at line 162 of file Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h.

Referenced by approach().


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