ATLAS Offline Software
magnetFactory.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "FPTracker/Magnet.h"
7 #include "FPTracker/IBender.h"
9 #include "FPTracker/NullBender.h"
15 #include <string>
16 #include <stdexcept>
17 
18 namespace FPTracker{
19 
21  {
22  if ( type == Magnet::hbDipole ) { return "hbDipole"; }
23  if ( type == Magnet::vbDipole ) { return "vbDipole"; }
24  if ( type == Magnet::hfQuadrupole ){ return "hfQuad"; }
25  if ( type == Magnet::vfQuadrupole) { return "vfQuad"; }
26  throw std::logic_error("unknown magnet type");
27  }
28 
30  {
31 
34 
35  throw std::logic_error("bad magnet type for QuadFocuser");
36  }
37 
38 
40  double length,
41  double strength,
42  double pbeam0,
43  int side
44  )
45  {
46  if( type == Magnet::hbDipole )
47  {
49  length,
50  strength,
51  pbeam0,
52  side)
53  );
54  }
55 
56  if ( type == Magnet::vbDipole )
57  {
59  length,
60  strength,
61  pbeam0,
62  side)
63  );
64  }
65 
66  if ( type == Magnet::hfQuadrupole )
67  {
69  length,
70  strength,
71  side)
72  );
73  }
74 
75  if ( type == Magnet::vfQuadrupole )
76  {
78  length,
79  strength,
80  side)
81  );
82  }
83 
84  throw std::logic_error("unknown magnet type");
85  }
86 
88  double x,
89  double y,
90  double center,
91  double strength,
92  double length,
93  int apertype,
94  double A1,
95  double A2,
96  double A3,
97  double A4,
98  double X,
99  double pbeam0,
100  Side side,
102 
103  IBender::ConstPtr_t bender( benderFactory(type, length, strength, pbeam0, side) );
104  std::string label( typeToString(type) );
105 
106  return Magnet::Ptr_t(new Magnet( x,
107  y,
108  center,
109  strength,
110  length,
111  apertype,
112  A1,
113  A2,
114  A3,
115  A4,
116  X,
117  side,
118  bender,
119  label
120  )
121  );
122 
123  }
124 
125 }
FPTracker::Magnet
Definition: FPTracker/FPTracker/Magnet.h:20
FPTracker::IBender::ConstPtr_t
std::shared_ptr< IBender > ConstPtr_t
Definition: FPTracker/FPTracker/IBender.h:18
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
FPTracker::Magnet::vbDipole
@ vbDipole
Definition: FPTracker/FPTracker/Magnet.h:64
QuadFocuserNull.h
FPTracker::benderFactory
IBender::ConstPtr_t benderFactory(Magnet::Type type, double length, double strength, double pbeam0, int side)
Definition: magnetFactory.cxx:39
FPTracker::Magnet::hfQuadrupole
@ hfQuadrupole
Definition: FPTracker/FPTracker/Magnet.h:64
FPTracker::QuadFocuserHorizontal
Definition: QuadFocuserHorizontal.h:11
FPTracker::Magnet::hbDipole
@ hbDipole
Definition: FPTracker/FPTracker/Magnet.h:64
x
#define x
QuadFocuserVertical.h
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
TRT::Hit::side
@ side
Definition: HitInfo.h:83
IBender.h
FPTracker::hBendplane
@ hBendplane
Definition: FPTrackerConstants.h:11
FPTrackerConstants.h
magnetFactory.h
FPTracker::IQuadFocuser::Ptr_t
std::shared_ptr< IQuadFocuser > Ptr_t
Definition: IQuadFocuser.h:30
FPTracker::DipoleBender
Definition: DipoleBender.h:15
Side
Definition: WaferTree.h:36
FPTracker::quadFocuserFactory
IQuadFocuser::Ptr_t quadFocuserFactory(Magnet::Type type)
Definition: magnetFactory.cxx:29
FPTracker::vBendplane
@ vBendplane
Definition: FPTrackerConstants.h:11
FPTracker::Magnet::vfQuadrupole
@ vfQuadrupole
Definition: FPTracker/FPTracker/Magnet.h:64
FPTracker::magnetFactory
Magnet::Ptr_t magnetFactory(double x, double y, double center, double strength, double length, int apertype, double A1, double A2, double A3, double A4, double X, double pbeam0, Side side, Magnet::Type type)
Definition: magnetFactory.cxx:87
FPTracker::typeToString
std::string typeToString(Magnet::Type type)
Definition: magnetFactory.cxx:20
FPTracker::QuadFocuserVertical
Definition: QuadFocuserVertical.h:12
FPTracker::Magnet::Ptr_t
std::shared_ptr< Magnet > Ptr_t
Definition: FPTracker/FPTracker/Magnet.h:61
y
#define y
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
QuadFocuserHorizontal.h
DipoleBender.h
FPTracker
Definition: FPTracker/FPTracker/Beamline.h:12
Magnet.h
QuadrupoleBender.h
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
NullBender.h
FPTracker::QuadrupoleBender
Definition: QuadrupoleBender.h:15
FPTracker::Magnet::Type
Type
Definition: FPTracker/FPTracker/Magnet.h:64