20#include "BDSException.hh"
21#include "BDSMagnetStrength.hh"
25#include "CLHEP/Units/SystemOfUnits.h"
94 {
"beta0" , {
"", 1.0}},
95 {
"field" , {
"T", CLHEP::tesla}},
96 {
"efield" , {
"", CLHEP::megavolt}},
103 {
"e1" , {
"rad", CLHEP::rad}},
104 {
"e2" , {
"rad", CLHEP::rad}},
105 {
"h1" , {
"rad", CLHEP::rad}},
106 {
"h2" , {
"rad", CLHEP::rad}},
107 {
"angle" , {
"rad", CLHEP::rad}},
108 {
"length" , {
"m", CLHEP::m}},
109 {
"fint" , {
"", 1.0}},
110 {
"fintx" , {
"", 1.0}},
111 {
"fintk2" , {
"", 1.0}},
112 {
"fintxk2" , {
"", 1.0}},
113 {
"hgap" , {
"m", CLHEP::m}},
114 {
"hkick" , {
"", 1.0}},
115 {
"vkick" , {
"", 1.0}},
138 {
"k10s" , {
"", 1.0}},
139 {
"k11s" , {
"", 1.0}},
140 {
"k12s" , {
"", 1.0}},
141 {
"frequency" , {
"", CLHEP::megahertz}},
142 {
"tOffset" , {
"s", CLHEP::s}},
143 {
"phase" , {
"rad", CLHEP::rad}},
144 {
"synchronousT0" , {
"s", CLHEP::s}},
145 {
"equatorradius" , {
"m", CLHEP::m}},
146 {
"nominalenergy" , {
"GeV", CLHEP::GeV}},
147 {
"scaling" , {
"", 1.0}},
148 {
"scalingOuter" , {
"", 1.0}},
149 {
"isentrance" , {
"", 1.0}},
150 {
"kick1" , {
"", 1.0}},
151 {
"kick2" , {
"", 1.0}},
152 {
"kick3" , {
"", 1.0}},
153 {
"kick4" , {
"", 1.0}},
154 {
"rmat11" , {
"", 1.0}},
155 {
"rmat12" , {
"", 1.0}},
156 {
"rmat13" , {
"", 1.0}},
157 {
"rmat14" , {
"", 1.0}},
158 {
"rmat21" , {
"", 1.0}},
159 {
"rmat22" , {
"", 1.0}},
160 {
"rmat23" , {
"", 1.0}},
161 {
"rmat24" , {
"", 1.0}},
162 {
"rmat31" , {
"", 1.0}},
163 {
"rmat32" , {
"", 1.0}},
164 {
"rmat33" , {
"", 1.0}},
165 {
"rmat34" , {
"", 1.0}},
166 {
"rmat41" , {
"", 1.0}},
167 {
"rmat42" , {
"", 1.0}},
168 {
"rmat43" , {
"", 1.0}},
169 {
"rmat44" , {
"", 1.0}}
173 "k1",
"k2",
"k3",
"k4",
"k5",
"k6",
"k7",
"k8",
"k9",
"k10",
"k11",
"k12"};
176 "k1s",
"k2s",
"k3s",
"k4s",
"k5s",
"k6s",
"k7s",
"k8s",
"k9s",
"k10s",
"k11s",
"k12s"};
183 for (
const auto& keyValue : sts)
186 {(*this)[keyValue.first] = keyValue.second;}
193 {out << key <<
": " << st.
GetValue(key) <<
", ";}
198 const G4int precision)
const
200 for (
auto& key :
keys)
210 {
throw BDSException(__METHOD_NAME__,
"Invalid key \"" + key +
"\"");}
218 {
throw BDSException(__METHOD_NAME__,
"Invalid key \"" + key +
"\"");}
237 {
throw BDSException(__METHOD_NAME__,
"Invalid key \"" + key +
"\"");}
245 {
throw BDSException(__METHOD_NAME__,
"Invalid key \"" + key +
"\"");}
250 std::vector<G4double> result;
259 std::vector<G4double> result;
268 if (std::find(
keys.begin(),
keys.end(), key) !=
keys.end())
General exception with possible name of object and message.
Efficient storage of magnet strengths.
std::vector< G4double > NormalComponents() const
Accessor for all normal components - k1 - k12.
std::vector< G4double > SkewComponents() const
Accessor for all skew components - k1 - k12.
G4bool KeyHasBeenSet(const G4String &key) const
Whether a key has been set.
std::ostream & WriteValuesInSIUnitsForSuvey(std::ostream &out, const G4int precision=14) const
static G4double variable
Dummy variable that can be overwritten.
static G4bool ValidKey(const G4String &key)
Whether or not the supplied key is a valid magnet strength parameter.
const G4double & GetValue(const G4String &key) const
G4double & operator[](const G4String &key)
Accessors with array / map [] operator.
static const std::vector< G4String > keys
Vector of the allowed strength parameters.
BDSMagnetStrength()
Default constructor does nothing as class will return 0 for uninitialised keys.
static const G4double zero
Keep a single copy of 0.0 as it needs to be returned as a reference not a value.
static const std::vector< G4String > skewComponentKeys
Vector of the normal component strength parameters.
static const std::map< G4String, unitsFactors > unitsFactorsMap
Map of each unit name and numerical factor to each key.
static G4String UnitName(const G4String &key)
Access a unit name for a given key.
static G4double Unit(const G4String &key)
Access a unit factor for a given key.
static const std::vector< G4String > normalComponentKeys
Vector of the normal component strength parameters.