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

#include <Magnet.h>

Inheritance diagram for FPTracker::Magnet:
Collaboration diagram for FPTracker::Magnet:

Public Types

enum  Type {
  hbDipole, hfQuadrupole, vfQuadrupole, vbDipole,
  notAMagnet
}
 
typedef std::shared_ptr< MagnetPtr_t
 
typedef std::vector< Ptr_tContainer_t
 
typedef std::shared_ptr< const IBeamElementConstPtr_t
 
typedef Container_t::iterator Iter_t
 
typedef Container_t::const_iterator ConstIter_t
 
typedef std::list< Ptr_tList_t
 
typedef List_t::iterator ListIter_t
 
typedef List_t::const_iterator ConstListIter_t
 

Public Member Functions

 Magnet (double x, double y, double center, double strength, double length, int apertype, double aper_A1, double aper_A2, double aper_A3, double aper_A4, double xb, Side side, IBender::ConstPtr_t bender, const std::string &label)
 
double frontFace () const
 
double rearFace () const
 
double zabspos () const
 
double zsignedpos () const
 
double centerZ () const
 
Point position () const
 
Side side () const
 
bool isEndElement () const
 
std::string str () const
 
std::string label () const
 
void track (IParticle &) const
 
void calibrate (IParticle &)
 
IBeamElement::ConstPtr_t clone () const
 

Private Member Functions

bool isOutOfAperture (IParticle &) const
 
double frontface () const
 
void swap (Magnet &)
 

Private Attributes

Point m_center
 
double m_frontFace
 
double m_rearFace
 
double m_strength
 
int m_apertype
 
double m_aper_A1
 
double m_aper_A2
 
double m_aper_A3
 
double m_aper_A4
 
double m_xb
 
Side m_side
 
IBender::ConstPtr_t m_bender
 
std::string m_label
 

Detailed Description

Definition at line 20 of file FPTracker/FPTracker/Magnet.h.

Member Typedef Documentation

◆ ConstIter_t

typedef Container_t::const_iterator FPTracker::IBeamElement::ConstIter_t
inherited

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

◆ ConstListIter_t

typedef List_t::const_iterator FPTracker::IBeamElement::ConstListIter_t
inherited

Definition at line 49 of file FPTracker/FPTracker/IBeamElement.h.

◆ ConstPtr_t

typedef std::shared_ptr< const IBeamElement > FPTracker::IBeamElement::ConstPtr_t
inherited

Definition at line 40 of file FPTracker/FPTracker/IBeamElement.h.

◆ Container_t

typedef std::vector< Ptr_t > FPTracker::Magnet::Container_t

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

◆ Iter_t

typedef Container_t::iterator FPTracker::IBeamElement::Iter_t
inherited

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

◆ List_t

typedef std::list< Ptr_t > FPTracker::IBeamElement::List_t
inherited

Definition at line 47 of file FPTracker/FPTracker/IBeamElement.h.

◆ ListIter_t

typedef List_t::iterator FPTracker::IBeamElement::ListIter_t
inherited

Definition at line 48 of file FPTracker/FPTracker/IBeamElement.h.

◆ Ptr_t

typedef std::shared_ptr< Magnet > FPTracker::Magnet::Ptr_t

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

Member Enumeration Documentation

◆ Type

Enumerator
hbDipole 
hfQuadrupole 
vfQuadrupole 
vbDipole 
notAMagnet 

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

Constructor & Destructor Documentation

◆ Magnet()

FPTracker::Magnet::Magnet ( double  x,
double  y,
double  center,
double  strength,
double  length,
int  apertype,
double  aper_A1,
double  aper_A2,
double  aper_A3,
double  aper_A4,
double  xb,
Side  side,
IBender::ConstPtr_t  bender,
const std::string &  label 
)

Definition at line 20 of file FPTracker/src/Magnet.cxx.

34  :
35  m_center(x, y, center),
36  m_frontFace(center>0 ? center-0.5*length:center+0.5*length),
37  m_rearFace(center>0 ? center+0.5*length:center-0.5*length),
38  m_strength(strength),
39  m_apertype(apertype),
40  m_aper_A1(aper_A1),
41  m_aper_A2(aper_A2),
42  m_aper_A3(aper_A3),
43  m_aper_A4(aper_A4),
44  m_xb(xb),
45  m_side(side),
46  m_bender(bender),
47  m_label(label){
48  if (m_apertype == 1){ assert(m_aper_A1 != 0.);}
49  if (m_apertype == 2 || m_apertype == 3){ assert(m_aper_A3 != 0. and m_aper_A4 != 0.);}
50  }

Member Function Documentation

◆ calibrate()

void FPTracker::Magnet::calibrate ( IParticle particle)
virtual

Implements FPTracker::IBeamElement.

Definition at line 99 of file FPTracker/src/Magnet.cxx.

100  {
101  return this->track(particle);
102  }

◆ centerZ()

double FPTracker::Magnet::centerZ ( ) const

◆ clone()

IBeamElement::ConstPtr_t FPTracker::Magnet::clone ( ) const
virtual

Implements FPTracker::IBeamElement.

Definition at line 51 of file FPTracker/src/Magnet.cxx.

51  {
52  IBeamElement::ConstPtr_t pm(new Magnet(*this));
53  return pm;
54  }

◆ frontFace()

double FPTracker::Magnet::frontFace ( ) const
virtual

Implements FPTracker::IBeamElement.

Definition at line 56 of file FPTracker/src/Magnet.cxx.

56 {return m_frontFace;}

◆ frontface()

double FPTracker::Magnet::frontface ( ) const
private

◆ isEndElement()

bool FPTracker::Magnet::isEndElement ( ) const
virtual

Implements FPTracker::IBeamElement.

Definition at line 63 of file FPTracker/src/Magnet.cxx.

63 {return false;}

◆ isOutOfAperture()

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

Definition at line 104 of file FPTracker/src/Magnet.cxx.

104  {
105 
106  TransversePoint offCenter = particle.displacement();
107  if(m_apertype == 1)
108  {
109 
110  double radius = m_aper_A1;
111  bool out = offCenter.mag2() > radius*radius;
112 
113  if(out)
114  {
115  std::ostringstream ost;
116  ost<<"pos "<<offCenter.mag2()<<" radiusSq "<<radius*radius<<'\n';
117  particle.addMsg( ost.str() );
118  return true;
119  }
120 
121  return false;
122  }
123 
124  if(m_apertype == 2)
125  {
126  double part_x = offCenter.x();
127  double part_y = offCenter.y();
128 
129  double xx = part_x/m_aper_A3;
130  double yy = part_y/m_aper_A4;
131 
132  bool out = xx*xx + yy*yy >1.;
133  if(out)
134  {
135  std::ostringstream ost;
136  ost<<"outside for aperture type 2 x xx, xaper "<<part_x<<" "<<xx<<" "<<m_aper_A3<<" y yy yaper "<<part_y<<" "<<yy<<" "<<m_aper_A4<<'\n';
137  particle.addMsg( ost.str() );
138  return true;
139  }
140 
141 
142  if ( m_aper_A1>0.)
143  {
144  if( std::fabs(part_x)>m_aper_A1 )
145  {
146  std::ostringstream ost;
147  ost<<"outside for aperture type 2 x test: particle x "<<part_x<<" m_aper_A1 "<<m_aper_A1<<"\n";
148  particle.addMsg( ost.str() );
149  return true;
150  }
151  }
152  if ( m_aper_A2>0.)
153  {
154  if( std::fabs(part_y)>m_aper_A2)
155  {
156  std::ostringstream ost;
157  ost<<"outside for aperture type 2 y test: particle y "<<part_y<<" m_aper_A2 "<<m_aper_A2<<"\n";
158  particle.addMsg( ost.str() );
159  return true;
160  }
161  }
162 
163  return false;
164  }
165  if(m_apertype == 3)
166  {
167  double part_x = offCenter.x();
168  double part_y = offCenter.y();
169 
170  if ( m_aper_A1 > 0. )
171  {
172  if( std::fabs(part_x)>m_aper_A1 )
173  {
174  std::ostringstream ost;
175  ost<<"outside for aperture type 3 x test: particle x "<<part_x<<" m_aper_A1 "<<m_aper_A1<<"\n";
176  particle.addMsg( ost.str() );
177  return true;
178  }
179  }
180  if ( m_aper_A2 > 0. )
181  {
182  if( std::fabs(part_y)>m_aper_A2)
183  {
184  std::ostringstream ost;
185  ost<<"outside for aperture type 3 y test: particle y "<<part_y<<" m_aper_A2 "<<m_aper_A2<<"\n";
186  particle.addMsg( ost.str() );
187  return true;
188  }
189  }
190  if ( m_aper_A3 > 0. && m_aper_A4 > 0. )
191  {
192  float B3=std::tan(m_aper_A3)*m_aper_A1;
193  float B4=m_aper_A2/std::tan(m_aper_A4);
194  float d=(m_aper_A1-std::fabs(part_x))/(m_aper_A1-B4)+(m_aper_A2-std::fabs(part_y))/(m_aper_A2-B3);
195 
196  if(d<1.)
197  {
198  std::ostringstream ost;
199  ost<<"outside for aperture type 3 test: particle x "<<part_x<<" particle y "<<part_y<<"; m_aper_A1 "<<m_aper_A1<<" m_aper_A2 "<<m_aper_A2<<" m_aper_A3 "<<m_aper_A3<<" m_aper_A4 "<<m_aper_A4<<"\n";
200  particle.addMsg( ost.str() );
201  return true;
202  }
203  }
204 
205  return false;
206  }
207 
208  // aperture is checked anly if aperture type i s 1, 2, or 3
209  return false;
210  }

◆ label()

std::string FPTracker::Magnet::label ( ) const
virtual

Implements FPTracker::IBeamElement.

Definition at line 16 of file FPTracker/src/Magnet.cxx.

16  {
17  return m_label+":"+m_bender->label();
18  }

◆ position()

Point FPTracker::Magnet::position ( ) const
virtual

Implements FPTracker::IBeamElement.

Definition at line 60 of file FPTracker/src/Magnet.cxx.

60 {return m_center;}

◆ rearFace()

double FPTracker::Magnet::rearFace ( ) const
virtual

Implements FPTracker::IBeamElement.

Definition at line 57 of file FPTracker/src/Magnet.cxx.

57 {return m_rearFace;}

◆ side()

Side FPTracker::Magnet::side ( ) const
virtual

Implements FPTracker::IBeamElement.

Definition at line 61 of file FPTracker/src/Magnet.cxx.

61 {return m_side;}

◆ str()

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

Implements FPTracker::IBeamElement.

Definition at line 213 of file FPTracker/src/Magnet.cxx.

213  {
214  std::ostringstream ost;
215  ost <<" \n\n-- Magnet --\n"
216  << "label " << m_label <<'\n'
217  << "center " << m_center <<'\n'
218  << "frontFace " << m_frontFace <<'\n'
219  << "rearFace " << m_rearFace <<'\n'
220  << "m_strength " << m_strength <<'\n'
221  << "m_apertyp " << m_apertype <<'\n'
222  << "m_aper_A1 " << m_aper_A1 <<'\n'
223  << "m_aper_A2 " << m_aper_A2 <<'\n'
224  << "m_aper_A3 " << m_aper_A3 <<'\n'
225  << "m_aper_A4 " << m_aper_A4 <<'\n'
226  << "m_xb " << m_xb <<'\n'
227  << "m_side " << m_side <<'\n';
228  return ost.str();
229  }

◆ swap()

void FPTracker::Magnet::swap ( Magnet )
private

◆ track()

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

Implements FPTracker::IBeamElement.

Definition at line 65 of file FPTracker/src/Magnet.cxx.

65  {
66 
67  particle.setBeamCoordinateShift(this);
68  if ( particle.isOutOfAperture() ){return;}
69 
70 
71  // check if particle x,y coordinates wrt to the magnet are in the aperture.
72  if( this->isOutOfAperture( particle ) ){
73  //std::cout<<"lost at front face "<<std::endl;
74  particle.setOutOfAperture(true);
75  return;
76  }
77 
78  // update the particle position and direction affected by the bending of the magnet.
79  m_bender->bend(particle);
80  particle.z() = m_rearFace;
81 
82  /*
83  std::cout<<"Magnet::track after bend "<<this->m_frontFace<<" "<<this->label()<<'\n'
84  <<"\n position "<<particle.position()
85  <<"\n p dir "<<particle.direction()
86  <<"\n m pos "<<this->position()<<'\n'<<std::endl;
87 
88 
89  std::cout<<particle<<'\n';
90  */
91 
92  if ( this->isOutOfAperture( particle ) )
93  {
94  particle.setOutOfAperture(true);
95  }
96 
97  }

◆ zabspos()

double FPTracker::Magnet::zabspos ( ) const
virtual

Implements FPTracker::IBeamElement.

Definition at line 59 of file FPTracker/src/Magnet.cxx.

59 {return std::fabs(m_center.z());}

◆ zsignedpos()

double FPTracker::Magnet::zsignedpos ( ) const
virtual

Implements FPTracker::IBeamElement.

Definition at line 58 of file FPTracker/src/Magnet.cxx.

58 {return m_center.z();}

Member Data Documentation

◆ m_aper_A1

double FPTracker::Magnet::m_aper_A1
private

Definition at line 76 of file FPTracker/FPTracker/Magnet.h.

◆ m_aper_A2

double FPTracker::Magnet::m_aper_A2
private

Definition at line 77 of file FPTracker/FPTracker/Magnet.h.

◆ m_aper_A3

double FPTracker::Magnet::m_aper_A3
private

Definition at line 78 of file FPTracker/FPTracker/Magnet.h.

◆ m_aper_A4

double FPTracker::Magnet::m_aper_A4
private

Definition at line 79 of file FPTracker/FPTracker/Magnet.h.

◆ m_apertype

int FPTracker::Magnet::m_apertype
private

Definition at line 75 of file FPTracker/FPTracker/Magnet.h.

◆ m_bender

IBender::ConstPtr_t FPTracker::Magnet::m_bender
private

Definition at line 82 of file FPTracker/FPTracker/Magnet.h.

◆ m_center

Point FPTracker::Magnet::m_center
private

Definition at line 71 of file FPTracker/FPTracker/Magnet.h.

◆ m_frontFace

double FPTracker::Magnet::m_frontFace
private

Definition at line 72 of file FPTracker/FPTracker/Magnet.h.

◆ m_label

std::string FPTracker::Magnet::m_label
private

Definition at line 83 of file FPTracker/FPTracker/Magnet.h.

◆ m_rearFace

double FPTracker::Magnet::m_rearFace
private

Definition at line 73 of file FPTracker/FPTracker/Magnet.h.

◆ m_side

Side FPTracker::Magnet::m_side
private

Definition at line 81 of file FPTracker/FPTracker/Magnet.h.

◆ m_strength

double FPTracker::Magnet::m_strength
private

Definition at line 74 of file FPTracker/FPTracker/Magnet.h.

◆ m_xb

double FPTracker::Magnet::m_xb
private

Definition at line 80 of file FPTracker/FPTracker/Magnet.h.


The documentation for this class was generated from the following files:
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
hist_file_dump.d
d
Definition: hist_file_dump.py:137
FPTracker::Magnet::vbDipole
@ vbDipole
Definition: FPTracker/FPTracker/Magnet.h:64
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
FPTracker::Magnet::hfQuadrupole
@ hfQuadrupole
Definition: FPTracker/FPTracker/Magnet.h:64
FPTracker::Magnet::side
Side side() const
Definition: FPTracker/src/Magnet.cxx:61
FPTracker::Magnet::hbDipole
@ hbDipole
Definition: FPTracker/FPTracker/Magnet.h:64
x
#define x
FPTracker::Magnet::m_label
std::string m_label
Definition: FPTracker/FPTracker/Magnet.h:83
FPTracker::Magnet::m_xb
double m_xb
Definition: FPTracker/FPTracker/Magnet.h:80
FPTracker::Magnet::m_center
Point m_center
Definition: FPTracker/FPTracker/Magnet.h:71
FPTracker::Magnet::m_strength
double m_strength
Definition: FPTracker/FPTracker/Magnet.h:74
FPTracker::Magnet::m_rearFace
double m_rearFace
Definition: FPTracker/FPTracker/Magnet.h:73
FPTracker::IBeamElement::ConstPtr_t
std::shared_ptr< const IBeamElement > ConstPtr_t
Definition: FPTracker/FPTracker/IBeamElement.h:40
FPTracker::Magnet::notAMagnet
@ notAMagnet
Definition: FPTracker/FPTracker/Magnet.h:64
FPTracker::Magnet::isOutOfAperture
bool isOutOfAperture(IParticle &) const
Definition: FPTracker/src/Magnet.cxx:104
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
FPTracker::Magnet::m_aper_A1
double m_aper_A1
Definition: FPTracker/FPTracker/Magnet.h:76
FPTracker::Point::z
double z() const
Definition: FPTracker/src/Point.cxx:19
FPTracker::Magnet::track
void track(IParticle &) const
Definition: FPTracker/src/Magnet.cxx:65
FPTracker::Magnet::vfQuadrupole
@ vfQuadrupole
Definition: FPTracker/FPTracker/Magnet.h:64
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
DataModelTestDataCommonDict::xb
DMTest::CView::Pers_t xb
Definition: DataModelTestDataCommonDict.h:55
FPTracker::Magnet::label
std::string label() const
Definition: FPTracker/src/Magnet.cxx:16
FPTracker::Magnet::m_aper_A2
double m_aper_A2
Definition: FPTracker/FPTracker/Magnet.h:77
FPTracker::Magnet::m_aper_A3
double m_aper_A3
Definition: FPTracker/FPTracker/Magnet.h:78
FPTracker::Magnet::m_apertype
int m_apertype
Definition: FPTracker/FPTracker/Magnet.h:75
y
#define y
FPTracker::Magnet::m_frontFace
double m_frontFace
Definition: FPTracker/FPTracker/Magnet.h:72
FPTracker::Magnet::m_side
Side m_side
Definition: FPTracker/FPTracker/Magnet.h:81
FPTracker::Magnet::m_aper_A4
double m_aper_A4
Definition: FPTracker/FPTracker/Magnet.h:79
FPTracker::Magnet::Magnet
Magnet(double x, double y, double center, double strength, double length, int apertype, double aper_A1, double aper_A2, double aper_A3, double aper_A4, double xb, Side side, IBender::ConstPtr_t bender, const std::string &label)
Definition: FPTracker/src/Magnet.cxx:20
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
FPTracker::Magnet::m_bender
IBender::ConstPtr_t m_bender
Definition: FPTracker/FPTracker/Magnet.h:82