ATLAS Offline Software
cfNewP.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <cmath>
7 
8 namespace Trk {
9 
10 void cfnewp(const long int ich, double *parold, double *ref, double *s, double *parnew, double *per)
11 {
12 
13  double dphi, coth, hper, zper, zeps, r__, cs, xc, yc, sn, sipart, eps;
14 
15 /* ------------------------------------------------------------*/
16 /* This routine propagates the trajectory parameters */
17 /* w.r.t to a new reference point. */
18 /* RETURNED POSITION IS NOT A POSITION OF CLOSEST APPROACH */
19 /* BUT PERIGEE ASSUMIMG THAT REF IS */
20 /* A CENTER OF COORDINATE SYSTEM */
21 /* */
22 /* INPUT: ICH Charge(-1,0,1) */
23 /* PAROLD Initial parameters(EPS,H,THE,PHI,1./R) */
24 /* REF Position of new reference point */
25 /* OUTPUT: S Curved abcissa of new perigee */
26 /* PARNEW Parameters evaluated at new perigee */
27 /* PER Position of new perigee */
28 /* Author: V.Kostyukhin */
29 /* ------------------------------------------------------------*/
30  /* Parameter adjustments */
31  --per;
32  --parnew;
33  --ref;
34  --parold;
35 
36  eps = parold[1];
37  sn = sin(parold[4]);
38  cs = cos(parold[4]);
39  coth = 1. / tan(parold[3]);
40  zeps = parold[2];
41 
42 /* Neutral track */
43  if ( ich == 0) {
44  hper = eps - ref[1] * sn + ref[2] * cs;
45  dphi = 0.;
46  (*s) = ref[1] * cs + ref[2] * sn;
47  zper = zeps + coth * (*s) - ref[3];
48  } else {
49  r__ = 1. / parold[5];
50  sipart = 1.;
51  if (r__ < 0.) sipart = -1.;
52 /* -- Centre of the circle and perigee */
53  xc = (eps - r__) * sn - ref[1];
54  yc = -(eps - r__) * cs- ref[2];
55  hper = r__ - sipart * sqrt(xc*xc + yc*yc);
56 /* -- Phi */
57  double tmp_prec= - eps - cs*ref[2] + sn*ref[1];
58  dphi = atan2(sipart * (ref[1]*cs + ref[2]*sn),
59  sipart * (r__ + tmp_prec) );
60  (*s) = r__*dphi;
61 /* -- Z at VXOLD */
62  zper = zeps + coth * (*s) - ref[3];
63  }
64  parnew[1] = hper;
65  parnew[2] = zper;
66  parnew[3] = parold[3];
67  parnew[4] = parold[4] + dphi;
68 
69 /* check 2*pi period in phi */
70  while (parnew[4] > 6.2831853071794) parnew[4] -= 6.2831853071794;
71  while (parnew[4] <-6.2831853071794) parnew[4] += 6.2831853071794;
72 
73 
74 
75  parnew[5] = parold[5];
76  per[1] = ref[1] + sin(parold[4] + dphi) * hper;
77  per[2] = ref[2] - cos(parold[4] + dphi) * hper;
78  per[3] = ref[3] + zper;
79 }
80 
81 
82 } /* End of VKalVrtCore namespace */
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Trk::cfnewp
void cfnewp(const long int ich, double *parold, double *ref, double *s, double *parnew, double *per)
Definition: cfNewP.cxx:10
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
ref
const boost::regex ref(r_ef)
cfNewP.h
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36