ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ForwardTracker::Magnet Class Reference

#include <Magnet.h>

Inheritance diagram for ForwardTracker::Magnet:
Collaboration diagram for ForwardTracker::Magnet:

Public Types

enum  Type {
  hbDipole, hfQuadrupole, vfQuadrupole, vbDipole,
  notAMagnet
}
 
typedef std::shared_ptr< const MagnetConstPtr_t
 
typedef std::vector< ConstPtr_tContainer_t
 
typedef Container_t::iterator Iter_t
 
typedef Container_t::const_iterator ConstIter_t
 
typedef std::list< ConstPtr_tList_t
 
typedef List_t::iterator ListIter_t
 
typedef List_t::const_iterator ConstListIter_t
 

Public Member Functions

 Magnet (double x, double y, double z, double length, const std::string &aperType, double A1, double A2, double A3, double A4, Side side, IBender::ConstPtr_t bender, const std::string &label)
 
std::string label () const
 
Side side () const
 
double frontFace () const
 
double rearFace () const
 
Point position () const
 
bool isEndElement () const
 
IBeamElement::ConstPtr_t clone () const
 
void track (IParticle &) const
 
std::string str () const
 

Private Member Functions

bool isOutOfAperture (IParticle &) const
 

Private Attributes

std::string m_label
 
Side m_side
 
double m_frontFace
 
double m_rearFace
 
Point m_position
 
std::string m_aperType
 
double m_A1
 
double m_A2
 
double m_A3
 
double m_A4
 
IBender::ConstPtr_t m_bender
 

Detailed Description

Definition at line 19 of file ForwardTracker/ForwardTracker/Magnet.h.

Member Typedef Documentation

◆ ConstIter_t

typedef Container_t::const_iterator ForwardTracker::IBeamElement::ConstIter_t
inherited

Definition at line 42 of file ForwardTracker/ForwardTracker/IBeamElement.h.

◆ ConstListIter_t

typedef List_t::const_iterator ForwardTracker::IBeamElement::ConstListIter_t
inherited

Definition at line 45 of file ForwardTracker/ForwardTracker/IBeamElement.h.

◆ ConstPtr_t

Definition at line 38 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ Container_t

Definition at line 39 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ Iter_t

typedef Container_t::iterator ForwardTracker::IBeamElement::Iter_t
inherited

Definition at line 41 of file ForwardTracker/ForwardTracker/IBeamElement.h.

◆ List_t

typedef std::list<ConstPtr_t> ForwardTracker::IBeamElement::List_t
inherited

Definition at line 43 of file ForwardTracker/ForwardTracker/IBeamElement.h.

◆ ListIter_t

typedef List_t::iterator ForwardTracker::IBeamElement::ListIter_t
inherited

Definition at line 44 of file ForwardTracker/ForwardTracker/IBeamElement.h.

Member Enumeration Documentation

◆ Type

Enumerator
hbDipole 
hfQuadrupole 
vfQuadrupole 
vbDipole 
notAMagnet 

Definition at line 36 of file ForwardTracker/ForwardTracker/Magnet.h.

Constructor & Destructor Documentation

◆ Magnet()

ForwardTracker::Magnet::Magnet ( double  x,
double  y,
double  z,
double  length,
const std::string &  aperType,
double  A1,
double  A2,
double  A3,
double  A4,
Side  side,
IBender::ConstPtr_t  bender,
const std::string &  label 
)

Definition at line 12 of file ForwardTracker/src/Magnet.cxx.

23  :
24  m_label (label),
25  m_side (side),
26  m_frontFace(z>0 ? z - 0.5*length : z + 0.5*length),
27  m_rearFace (z>0 ? z + 0.5*length : z - 0.5*length),
28  m_position (x, y, z),
29  m_aperType (aperType),
30  m_A1 (aper1),
31  m_A2 (aper2),
32  m_A3 (aper3),
33  m_A4 (aper4),
34  m_bender (bender)
35  {}

Member Function Documentation

◆ clone()

IBeamElement::ConstPtr_t ForwardTracker::Magnet::clone ( ) const
inlinevirtual

Implements ForwardTracker::IBeamElement.

Definition at line 48 of file ForwardTracker/ForwardTracker/Magnet.h.

48 { IBeamElement::ConstPtr_t pm(new Magnet(*this)); return pm; }

◆ frontFace()

double ForwardTracker::Magnet::frontFace ( ) const
inlinevirtual

Implements ForwardTracker::IBeamElement.

Definition at line 43 of file ForwardTracker/ForwardTracker/Magnet.h.

43 { return m_frontFace; }

◆ isEndElement()

bool ForwardTracker::Magnet::isEndElement ( ) const
inlinevirtual

Implements ForwardTracker::IBeamElement.

Definition at line 46 of file ForwardTracker/ForwardTracker/Magnet.h.

46 { return false; }

◆ isOutOfAperture()

bool ForwardTracker::Magnet::isOutOfAperture ( IParticle particle) const
private

Definition at line 50 of file ForwardTracker/src/Magnet.cxx.

50  {
51 
52  TransversePoint offCenter = particle.displacement();
53 
54  if (m_aperType == "\"NONE\"") return false;
55  else if (m_aperType == "\"CIRCLE\"") {
56 
57  if (m_A1 == 0) return false;
58 
59  if (offCenter.mag2() > m_A1*m_A1) {
60 
61  std::ostringstream ost; ost << m_label << " isOutOfAperture ";
62 
63  ost << "radius: " << offCenter.mag2() << " > A1*A1: " << m_A1*m_A1;
64  particle.addMsg(ost.str());
65 
66  return true;
67  }
68 
69  return false;
70  }
71  else if (m_aperType == "\"RECTELLIPSE\"") {
72 
73  double xx = (m_A3) ? offCenter.x()/m_A3 : throw std::runtime_error("ERROR: m_A3 == 0");
74  double yy = (m_A4) ? offCenter.y()/m_A4 : throw std::runtime_error("ERROR: m_A4 == 0");
75  double rr = xx*xx + yy*yy;
76 
77  if (rr > 1) {
78 
79  std::ostringstream ost; ost << m_label << " isOutOfAperture ";
80 
81  ost << " x/A3: " << xx << " y/A4: " << yy << " (Squared sum: " << rr << " > 1)";
82  particle.addMsg(ost.str());
83 
84  return true;
85  }
86 
87  if (m_A1 > 0) {
88 
89  if (std::fabs(offCenter.x()) > m_A1) {
90 
91  std::ostringstream ost; ost << m_label << " isOutOfAperture ";
92 
93  ost << " |x|: " << std::fabs(offCenter.x()) << " > A1: " << m_A1;
94  particle.addMsg(ost.str());
95 
96  return true;
97  }
98  }
99 
100  if (m_A2 > 0) {
101 
102  if (std::fabs(offCenter.y()) > m_A2) {
103 
104  std::ostringstream ost; ost << m_label << " isOutOfAperture ";
105 
106  ost << " |y|: " << std::fabs(offCenter.y()) << " > A2: " << m_A2;
107  particle.addMsg(ost.str());
108 
109  return true;
110  }
111  }
112 
113  return false;
114  }
115  else if (m_aperType == "\"OCTAGON\"") {
116 
117  if ( m_A1 > 0. ) {
118  if( std::fabs(offCenter.x())>m_A1 ) {
119 
120  std::ostringstream ost; ost << m_label << " isOutOfAperture ";
121 
122  ost << " |x|: " << std::fabs(offCenter.x()) << " > A1: " << m_A1;
123  particle.addMsg(ost.str());
124  return true;
125  }
126  }
127  if ( m_A2 > 0. ) {
128  if( std::fabs(offCenter.y())>m_A2) {
129 
130  std::ostringstream ost; ost << m_label << " isOutOfAperture ";
131 
132  ost << " |y|: " << std::fabs(offCenter.y()) << " > A2: " << m_A2;
133  particle.addMsg(ost.str());
134  return true;
135  }
136  }
137  if ( m_A3 > 0. && m_A4 > 0. ) {
138 
139  float B3=std::tan(m_A3)*m_A1;
140  float B4=m_A2/std::tan(m_A4);
141  float d=(m_A1-std::fabs(offCenter.x()))/(m_A1-B4)+(m_A2-std::fabs(offCenter.y()))/(m_A2-B3);
142 
143  if(d<1.) {
144  std::ostringstream ost; ost << m_label << " isOutOfAperture ";
145 
146  ost<<" x: "<<offCenter.x()<<" y: "<<offCenter.y()<<" m_A1 "<<m_A1<<" m_A2 "<<m_A2<<" m_A3 "<<m_A3<<" m_A4 "<<m_A4<<" d: "<<d;
147  particle.addMsg( ost.str() );
148  return true;
149  }
150  }
151 
152  return false;
153  }
154  else {
155 
156  std::stringstream sstr; sstr << " Unknown magnet aperture type " << m_aperType << "\n";
157  throw std::runtime_error(sstr.str().c_str());
158  }
159 
160  return false;
161  }

◆ label()

std::string ForwardTracker::Magnet::label ( ) const
inlinevirtual

Implements ForwardTracker::IBeamElement.

Definition at line 41 of file ForwardTracker/ForwardTracker/Magnet.h.

41 { return m_label; }

◆ position()

Point ForwardTracker::Magnet::position ( ) const
inlinevirtual

Implements ForwardTracker::IBeamElement.

Definition at line 45 of file ForwardTracker/ForwardTracker/Magnet.h.

45 { return m_position; }

◆ rearFace()

double ForwardTracker::Magnet::rearFace ( ) const
inlinevirtual

Implements ForwardTracker::IBeamElement.

Definition at line 44 of file ForwardTracker/ForwardTracker/Magnet.h.

44 { return m_rearFace; }

◆ side()

Side ForwardTracker::Magnet::side ( ) const
inlinevirtual

Implements ForwardTracker::IBeamElement.

Definition at line 42 of file ForwardTracker/ForwardTracker/Magnet.h.

42 { return m_side; }

◆ str()

std::string ForwardTracker::Magnet::str ( ) const
virtual

Implements ForwardTracker::IBeamElement.

Definition at line 163 of file ForwardTracker/src/Magnet.cxx.

163  {
164 
165  std::ostringstream ost;
166 
167  ost << "m_label " << m_label << "\n"
168  << "m_side " << m_side << "\n"
169  << "m_frontFace " << m_frontFace << "\n"
170  << "m_rearFace " << m_rearFace << "\n"
171  << "m_position " << m_position << "\n"
172  << "m_aperType " << m_aperType << "\n"
173  << "m_A1 " << m_A1 << "\n"
174  << "m_A2 " << m_A2 << "\n"
175  << "m_A3 " << m_A3 << "\n"
176  << "m_A4 " << m_A4 << "\n";
177 
178  return ost.str();
179  }

◆ track()

void ForwardTracker::Magnet::track ( IParticle particle) const
virtual

Implements ForwardTracker::IBeamElement.

Definition at line 37 of file ForwardTracker/src/Magnet.cxx.

37  {
38 
39  particle.setBeamCoordinateShift(this);
40 
41  if (particle.isOutOfAperture()) return;
42 
43  m_bender->bend(particle);
44 
45  particle.z() = m_rearFace;
46 
47  if (this->isOutOfAperture(particle)) particle.setOutOfAperture(true);
48  }

Member Data Documentation

◆ m_A1

double ForwardTracker::Magnet::m_A1
private

Definition at line 62 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_A2

double ForwardTracker::Magnet::m_A2
private

Definition at line 63 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_A3

double ForwardTracker::Magnet::m_A3
private

Definition at line 64 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_A4

double ForwardTracker::Magnet::m_A4
private

Definition at line 65 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_aperType

std::string ForwardTracker::Magnet::m_aperType
private

Definition at line 61 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_bender

IBender::ConstPtr_t ForwardTracker::Magnet::m_bender
private

Definition at line 66 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_frontFace

double ForwardTracker::Magnet::m_frontFace
private

Definition at line 58 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_label

std::string ForwardTracker::Magnet::m_label
private

Definition at line 56 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_position

Point ForwardTracker::Magnet::m_position
private

Definition at line 60 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_rearFace

double ForwardTracker::Magnet::m_rearFace
private

Definition at line 59 of file ForwardTracker/ForwardTracker/Magnet.h.

◆ m_side

Side ForwardTracker::Magnet::m_side
private

Definition at line 57 of file ForwardTracker/ForwardTracker/Magnet.h.


The documentation for this class was generated from the following files:
ForwardTracker::Magnet::Magnet
Magnet(double x, double y, double z, double length, const std::string &aperType, double A1, double A2, double A3, double A4, Side side, IBender::ConstPtr_t bender, const std::string &label)
Definition: ForwardTracker/src/Magnet.cxx:12
ForwardTracker::Magnet::m_frontFace
double m_frontFace
Definition: ForwardTracker/ForwardTracker/Magnet.h:58
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
python.trigbs_prescaleL1.ost
ost
Definition: trigbs_prescaleL1.py:104
PlotCalibFromCool.yy
yy
Definition: PlotCalibFromCool.py:714
ForwardTracker::Magnet::m_A2
double m_A2
Definition: ForwardTracker/ForwardTracker/Magnet.h:63
hist_file_dump.d
d
Definition: hist_file_dump.py:137
ForwardTracker::Magnet::vfQuadrupole
@ vfQuadrupole
Definition: ForwardTracker/ForwardTracker/Magnet.h:36
ForwardTracker::IBeamElement::ConstPtr_t
std::shared_ptr< const IBeamElement > ConstPtr_t
Definition: ForwardTracker/ForwardTracker/IBeamElement.h:39
ForwardTracker::Magnet::m_rearFace
double m_rearFace
Definition: ForwardTracker/ForwardTracker/Magnet.h:59
x
#define x
ForwardTracker::Magnet::m_A1
double m_A1
Definition: ForwardTracker/ForwardTracker/Magnet.h:62
ForwardTracker::Magnet::side
Side side() const
Definition: ForwardTracker/ForwardTracker/Magnet.h:42
ForwardTracker::Magnet::hbDipole
@ hbDipole
Definition: ForwardTracker/ForwardTracker/Magnet.h:36
z
#define z
ForwardTracker::Magnet::notAMagnet
@ notAMagnet
Definition: ForwardTracker/ForwardTracker/Magnet.h:36
ForwardTracker::Magnet::m_aperType
std::string m_aperType
Definition: ForwardTracker/ForwardTracker/Magnet.h:61
ForwardTracker::Magnet::m_A4
double m_A4
Definition: ForwardTracker/ForwardTracker/Magnet.h:65
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
ForwardTracker::Magnet::m_bender
IBender::ConstPtr_t m_bender
Definition: ForwardTracker/ForwardTracker/Magnet.h:66
ForwardTracker::Magnet::hfQuadrupole
@ hfQuadrupole
Definition: ForwardTracker/ForwardTracker/Magnet.h:36
ForwardTracker::Magnet::m_label
std::string m_label
Definition: ForwardTracker/ForwardTracker/Magnet.h:56
ForwardTracker::Magnet::m_position
Point m_position
Definition: ForwardTracker/ForwardTracker/Magnet.h:60
ForwardTracker::Magnet::m_side
Side m_side
Definition: ForwardTracker/ForwardTracker/Magnet.h:57
ForwardTracker::Magnet::vbDipole
@ vbDipole
Definition: ForwardTracker/ForwardTracker/Magnet.h:36
y
#define y
ForwardTracker::Magnet::m_A3
double m_A3
Definition: ForwardTracker/ForwardTracker/Magnet.h:64
rr
const boost::regex rr(r_r)
ForwardTracker::Magnet::isOutOfAperture
bool isOutOfAperture(IParticle &) const
Definition: ForwardTracker/src/Magnet.cxx:50
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
ForwardTracker::Magnet::label
std::string label() const
Definition: ForwardTracker/ForwardTracker/Magnet.h:41