ATLAS Offline Software
BenderQuadrupole.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "ForwardTracker/Point.h"
9 
10 namespace ForwardTracker {
11 
12  BenderQuadrupole::BenderQuadrupole(Side side, double length, double strength, double beamEnergy, Bendplane bendplane):
13  m_side (side),
14  m_length (length),
15  m_strength (strength),
16  m_beamEnergy(beamEnergy),
17  m_bendplane (bendplane)
18  {}
19 
21 
22  // Calculates (x, y) position and direction after deflection (charge dependent).
23  // Particle is at magnet front face and is moved to the rear face.
24 
25  double aside = ForwardTrackerConstants::aside[m_side];
26  Point& direction = particle.direction_nc();
27  TransversePoint displacement = particle.displacement();
28 
29  if (!particle.charged()) displacement += m_length*aside/direction[2]*direction.transverse(); // Linear drift
30  else {
31 
32  double exitPos[2];
33  double exitDir[2];
34 
35  double qk = std::sqrt(m_beamEnergy*std::fabs(m_strength)/m_length/particle.momentum());
36  double qkl = aside*qk*m_length;
37 
38  exitPos[ m_bendplane] = std::cos (qkl)*displacement[ m_bendplane] + std::sin (qkl)*direction[ m_bendplane]/direction[2]/qk;
39  exitDir[ m_bendplane] = -qk*std::sin (qkl)*displacement[ m_bendplane] + std::cos (qkl)*direction[ m_bendplane]/direction[2];
40 
41  exitPos[!m_bendplane] = std::cosh(qkl)*displacement[!m_bendplane] + std::sinh(qkl)*direction[!m_bendplane]/direction[2]/qk;
42  exitDir[!m_bendplane] = +qk*std::sinh(qkl)*displacement[!m_bendplane] + std::cosh(qkl)*direction[!m_bendplane]/direction[2];
43 
44  displacement[ m_bendplane] = exitPos[ m_bendplane];
45  displacement[!m_bendplane] = exitPos[!m_bendplane];
46 
47  direction[ m_bendplane] = exitDir[ m_bendplane];
48  direction[!m_bendplane] = exitDir[!m_bendplane];
49 
50  direction[2] = aside/std::sqrt(1 + direction[0]*direction[0] + direction[1]*direction[1]);
51 
52  direction[0] *= direction[2];
53  direction[1] *= direction[2];
54  }
55 
56  particle.updatePositionFromDisplacement(displacement);
57  }
58 }
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
ForwardTracker::BenderQuadrupole::m_length
double m_length
Definition: BenderQuadrupole.h:26
ForwardTracker::ForwardTrackerConstants::aside
static const double aside[2]
Definition: ForwardTrackerConstants.h:20
ForwardTracker::Bendplane
Bendplane
Definition: ForwardTrackerConstants.h:12
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ForwardTracker::Point
Definition: ForwardTracker/ForwardTracker/Point.h:15
IParticle.h
TRT::Hit::side
@ side
Definition: HitInfo.h:83
ForwardTracker::BenderQuadrupole::m_side
Side m_side
Definition: BenderQuadrupole.h:25
TransversePoint.h
Side
Definition: WaferTree.h:36
ForwardTracker::TransversePoint
Definition: ForwardTracker/ForwardTracker/TransversePoint.h:13
ForwardTracker::BenderQuadrupole::bend
void bend(IParticle &) const
Definition: BenderQuadrupole.cxx:20
ForwardTracker::IParticle
Definition: ForwardDetectors/ForwardTracker/ForwardTracker/IParticle.h:16
ForwardTracker::BenderQuadrupole::m_bendplane
Bendplane m_bendplane
Definition: BenderQuadrupole.h:29
ForwardTracker::BenderQuadrupole::m_beamEnergy
double m_beamEnergy
Definition: BenderQuadrupole.h:28
ForwardTracker::Point::transverse
TransversePoint transverse() const
Definition: ForwardTracker/ForwardTracker/Point.h:28
RunTileTBMonitoring.beamEnergy
beamEnergy
Definition: RunTileTBMonitoring.py:248
BenderQuadrupole.h
ForwardTracker::BenderQuadrupole::BenderQuadrupole
BenderQuadrupole(Side side, double length, double strength, double beamEnergy, Bendplane bendplane)
Definition: BenderQuadrupole.cxx:12
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Point.h
ForwardTracker
Definition: ForwardTracker/ForwardTracker/Beamline.h:12
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
ForwardTracker::BenderQuadrupole::m_strength
double m_strength
Definition: BenderQuadrupole.h:27