ATLAS Offline Software
Loading...
Searching...
No Matches
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
9
10namespace ForwardTracker {
11
12 BenderQuadrupole::BenderQuadrupole(Side side, double length, double strength, double beamEnergy, Bendplane bendplane):
13 m_side (side),
15 m_strength (strength),
16 m_beamEnergy(beamEnergy),
17 m_bendplane (bendplane)
18 {}
19
20 void BenderQuadrupole::bend(IParticle& particle) const {
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
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}
double length(const pvec &v)
BenderQuadrupole(Side side, double length, double strength, double beamEnergy, Bendplane bendplane)