ATLAS Offline Software
TrigInDetTrackHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <cmath>
7 
8 
9 /* ---------------------------------------------------------------------- */
10 void TrigInDetTrackHelper::extrapolate(double rC, double zC, double &phiC, double &etaC) const {
11 /*----------------------------------------------------------------------*
12 
13  * pt (I) : pt *
14  * pz (I) : pz *
15  * q (I) : charge *
16  * phi0 (I) : phi of dirn vec at closest approach to (0,0) *
17  * d0 (I) : dist. (mm) of close appr. to (0,0) in xy plane *
18  * z0 (I) : z at r=d0 (mm) *
19  * rC (I) : radius of Cylinder (mm) *
20  * zC (I) : half-length in z of Cylinder (mm) *
21  * phiC (O) : phi of track at (rC, zC) *
22  * etaC (O) : eta of track at (rC, zC) *
23  * *
24  * Note : looping tracks are not treated correctly, phiC is set twopi *
25  * *
26  * Author : John Baines Date : 12/11/97 *
27  * from an original concept by Simon George *
28  * *
29  *----------------------------------------------------------------------*/
30 #define BFIELD 2.0
31  double Rcurv{0}, r{0}, z{0}, xD{0}, xN{0}, dphi{0};
32 
33  double pt = m_param->pT();
34  double eta = m_param->eta();
35  double q = 1.;
36  if (pt < 0) q = -1.;
37  double theta = 2.*atan(exp(-fabs(eta)));
38  double pz = fabs(pt) / tan(theta);
39  if (eta < 0) pz = -pz;
40  double d0 = m_param->a0();
41  double z0 = m_param->z0();
42  double phi0 = m_param->phi0();
43 
44  phiC = 0;
45  etaC = 0;
46  if (rC > 0 && fabs(zC) > 0 && pt != 0 && fabs(z0) < zC) {
47 
48  /* r, z of intersection with cylinder */
49 
50  z = z0 + pz * (rC - fabs(d0)) / fabs(pt);
51  if (fabs(z) > fabs(zC)) {
52  /* track passes through the end of the cylinder */
53  if (z > 0) z = fabs(zC); else z = -fabs(zC);
54  r = fabs(d0) + (z - z0) * fabs(pt) / pz;
55  r = fabs(r); /* NOT SURE IF -ve r is handled correctly */
56  } else r = rC; /* hits barrel of cylinder */
57 
58  theta = atan2(r, fabs(z)) / 2.;
59  if (z > 0) etaC = -log(tan(theta));
60  else etaC = log(tan(theta));
61 
62  /* Now calculate phiC */
63 
64  if (q == 0) { /* Neutral Track */
65  if (fabs(d0) <= r) phiC = phi0 - asin(fabs(d0)/r);
66  } else { /* Charged track */
67  Rcurv = fabs(pt)/(0.3*BFIELD);
68  xD = 2. * r*(Rcurv + d0);
69  if (xD != 0) {
70  xN = d0 * d0 + r * r + 2. * Rcurv * d0;
71  if (fabs(xN)/fabs(xD) > 1) {
72  /* trajectory does not reach r, track loops
73  ***temporary set dphi to 0 for this case */
74  phiC = 2. * M_PI;
75  } else {
76  dphi = q*acos(xN/xD);
77  /* two solutions from the 2 intersections of the 2 circles,
78  but phi0 defines a direction a direction, so the first solution
79  should be the one we want....*/
80  phiC = phi0 - q*M_PI_2 + dphi;
81  }
82  } else phiC = 0; /* means track is orbiting the origin */
83 
84  }
85  /* fold back into -pi to pi */
86  while (phiC > M_PI) phiC = phiC - 2. * M_PI;
87  while (phiC < -M_PI) phiC = phiC + 2. * M_PI;
88  }
89 }
TrigInDetTrackHelper.h
beamspotman.r
def r
Definition: beamspotman.py:676
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
test_pyathena.pt
pt
Definition: test_pyathena.py:11
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TrigInDetTrackFitPar::eta
void eta(const double eta)
Setter: pseudorapidity.
Definition: TrigInDetTrackFitPar.h:219
TrigInDetTrackFitPar::z0
void z0(const double z0)
Setter: longitudinal impact parameter.
Definition: TrigInDetTrackFitPar.h:215
TrigInDetTrackHelper::extrapolate
void extrapolate(double rC, double zC, double &phiC, double &etaC) const
Definition: TrigInDetTrackHelper.cxx:10
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
z
#define z
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
BFIELD
#define BFIELD
TrigInDetTrackFitPar::a0
void a0(const double a0)
Setter: transverse impact parameter.
Definition: TrigInDetTrackFitPar.h:213
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
extractSporadic.q
list q
Definition: extractSporadic.py:98
TrigInDetTrackHelper::m_param
const TrigInDetTrackFitPar * m_param
Definition: TrigInDetTrackHelper.h:25
TrigInDetTrackFitPar::phi0
void phi0(const double phi0)
Setter: azimuthal angle of the momentum.
Definition: TrigInDetTrackFitPar.h:217
TrigInDetTrackFitPar::pT
void pT(const double pT)
Setter: transverse momentum.
Definition: TrigInDetTrackFitPar.h:221