ATLAS Offline Software
Loading...
Searching...
No Matches
magnetFactory.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "FPTracker/Magnet.h"
7#include "FPTracker/IBender.h"
15#include <string>
16#include <stdexcept>
17
18namespace 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
67 {
69 length,
70 strength,
71 side)
72 );
73 }
74
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.get(),
119 label
120 )
121 );
122
123 }
124
125}
double length(const pvec &v)
#define y
#define x
std::shared_ptr< IBender > ConstPtr_t
std::shared_ptr< IQuadFocuser > Ptr_t
std::shared_ptr< Magnet > Ptr_t
std::string label(const std::string &format, int i)
Definition label.h:19
IQuadFocuser::Ptr_t quadFocuserFactory(Magnet::Type type)
std::string typeToString(Magnet::Type type)
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)
IBender::ConstPtr_t benderFactory(Magnet::Type type, double length, double strength, double pbeam0, int side)