ATLAS Offline Software
QuadrupoleBender.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 "FPTracker/IBender.h"
7 #include "FPTracker/IParticle.h"
8 #include "FPTracker/Point.h"
11 #include "FPTracker/IQuadFocuser.h"
12 
13 #include <vector> // for std::swap...
14 #include <cmath>
15 #include <iostream>
16 #include <iomanip>
17 
18 namespace FPTracker{
20  double magnetLength,
21  double magnetStrength,
22  int side):
23  m_focuser(focuser),
24  m_length(magnetLength),
25  m_bendConstant(FPTrackerConstants::qkConst*magnetStrength),
26  m_dside(FPTrackerConstants::aside[side]){
27  }
28 
29 
31  std::swap(m_focuser, other.m_focuser);
32  std::swap(m_length, other.m_length);
33  std::swap(m_bendConstant, other.m_bendConstant);
34  std::swap(m_dside, other.m_dside);
35  }
36 
37 
39  // calcualtes new x, y coordinates and direction after deflection
40 
41  //particle is at magnet front face. This method moves it to the rear face.
42 
43 
44  double qk = std::sqrt(m_bendConstant/particle.momentum()) ; // ---- basic formula is m Te GeV
45  //qk = 0.2997925* Magnet_strength[magnet][side]/p ;
46 
47 
48  Point& direction = particle.direction();
49  //
50  double qkl = qk * m_length*m_dside ;
51  double qkc = qk *direction[2] ;
52 
53  m_focuser->focus(qk, qkl, qkc, particle.displacement(), direction);
54 
55 
56  /*
57  std::cout <<std::setprecision(8)
58  <<" quad xe " << m_focuser->xe()
59  <<" quad xae " << m_focuser->xae()
60  <<" quad ye " << m_focuser->ye()
61  <<" quad yae " << m_focuser->yae()<<'\n';
62  */
63 
64  particle.updatePositionFromDisplacement(TransversePoint(m_focuser->xe(), m_focuser->ye()));
65 
66  direction[0] = m_focuser->xae();
67  direction[1] = m_focuser->yae();
68 
69  direction[2] = std::sqrt(1. - (direction[0]*direction[0]) - (direction[1]*direction[1]))*m_dside;
70  direction[0] = direction[0]*direction[2] ;
71  direction[1] = direction[1]*direction[2] ;
72 
73  }
74 
75 
76  const std::string QuadrupoleBender::s_label = "QuadBender";
77  std::string QuadrupoleBender::label() const {
78  return s_label+":"+m_focuser->label();
79  }
80 }
FPTracker::QuadrupoleBender::m_focuser
IQuadFocuser::Ptr_t m_focuser
Definition: QuadrupoleBender.h:30
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
FPTracker::QuadrupoleBender::m_bendConstant
double m_bendConstant
Definition: QuadrupoleBender.h:32
FPTracker::QuadrupoleBender::s_label
static const std::string s_label
Definition: QuadrupoleBender.h:28
Point.h
TransversePoint.h
FPTracker::QuadrupoleBender::label
std::string label() const
Definition: QuadrupoleBender.cxx:77
TRT::Hit::side
@ side
Definition: HitInfo.h:83
IParticle.h
IBender.h
FPTrackerConstants.h
FPTracker::IQuadFocuser::Ptr_t
std::shared_ptr< IQuadFocuser > Ptr_t
Definition: IQuadFocuser.h:30
FPTracker::QuadrupoleBender::QuadrupoleBender
QuadrupoleBender(IQuadFocuser::Ptr_t focuser, double magnetLength, double magnetStrength, int side)
Definition: QuadrupoleBender.cxx:19
FPTracker::QuadrupoleBender::m_dside
double m_dside
Definition: QuadrupoleBender.h:33
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
FPTracker::Point
Definition: FPTracker/FPTracker/Point.h:14
IQuadFocuser.h
FPTracker::FPTrackerConstants
Definition: FPTrackerConstants.h:13
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
FPTracker::QuadrupoleBender::bend
void bend(IParticle &) const
Definition: QuadrupoleBender.cxx:38
FPTracker::QuadrupoleBender::swap
void swap(QuadrupoleBender &)
Definition: QuadrupoleBender.cxx:30
FPTracker::QuadrupoleBender::m_length
double m_length
Definition: QuadrupoleBender.h:31
FPTracker
Definition: FPTracker/FPTracker/Beamline.h:12
QuadrupoleBender.h
FPTracker::magnetStrength
double magnetStrength(int type, double length, double strength, double Brho)
Definition: magnetStrength.cxx:8
FPTracker::IParticle
Definition: ForwardDetectors/FPTracker/FPTracker/IParticle.h:17
FPTracker::TransversePoint
Definition: FPTracker/FPTracker/TransversePoint.h:12
FPTracker::QuadrupoleBender
Definition: QuadrupoleBender.h:15