ATLAS Offline Software
Loading...
Searching...
No Matches
QuadrupoleBender.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include "FPTracker/Point.h"
10
11#include <utility> // for std::swap...
12#include <cmath>
13
14namespace FPTracker{
16 double magnetLength,
17 double magnetStrength,
18 int side):
19 m_focuser(std::move(focuser)),
20 m_length(magnetLength),
22 m_dside(FPTrackerConstants::aside[side]){
23 }
24
25
27 std::swap(m_focuser, other.m_focuser);
28 std::swap(m_length, other.m_length);
29 std::swap(m_bendConstant, other.m_bendConstant);
30 std::swap(m_dside, other.m_dside);
31 }
32
33
34 void QuadrupoleBender::bend(IParticle& particle) const {
35 // calculates new x, y coordinates and direction after deflection
36
37 //particle is at magnet front face. This method moves it to the rear face.
38
39
40 double qk = std::sqrt(m_bendConstant/particle.momentum()) ; // ---- basic formula is m Te GeV
41 //qk = 0.2997925* Magnet_strength[magnet][side]/p ;
42
43
44 Point& direction = particle.direction();
45 //
46 double qkl = qk * m_length*m_dside ;
47 double qkc = qk *direction[2] ;
48
49 m_focuser->focus(qk, qkl, qkc, particle.displacement(), direction);
50
51 particle.updatePositionFromDisplacement(TransversePoint(m_focuser->xe(), m_focuser->ye()));
52
53 direction[0] = m_focuser->xae();
54 direction[1] = m_focuser->yae();
55
56 direction[2] = std::sqrt(1. - (direction[0]*direction[0]) - (direction[1]*direction[1]))*m_dside;
57 direction[0] = direction[0]*direction[2] ;
58 direction[1] = direction[1]*direction[2] ;
59
60 }
61
62
63 const std::string QuadrupoleBender::s_label = "QuadBender";
64 std::string QuadrupoleBender::label() const {
65 return s_label+":"+m_focuser->label();
66 }
67}
std::shared_ptr< IQuadFocuser > Ptr_t
static const std::string s_label
QuadrupoleBender(IQuadFocuser::Ptr_t focuser, double magnetLength, double magnetStrength, int side)
void swap(QuadrupoleBender &)
void bend(IParticle &) const
IQuadFocuser::Ptr_t m_focuser
double magnetStrength(int type, double length, double strength, double Brho)
STL namespace.
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)