19#ifndef BDSMAGNETSTRENGTH_H
20#define BDSMAGNETSTRENGTH_H
71 const G4int precision = 14)
const;
82 const G4double&
operator[](
const G4String& key)
const;
83 const G4double& at(
const G4String& key)
const {
return (*
this)[key];}
89 static G4bool
ValidKey(
const G4String& key);
107 static G4String
UnitName(
const G4String& key);
110 static G4double
Unit(
const G4String& key);
128 const G4double&
GetValue(
const G4String& key)
const;
131 static const std::vector<G4String>
keys;
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.
std::map< G4String, G4double > StrengthMap
Typedefs up first so we can declare public iterators.
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.
static std::vector< G4String > SkewComponentKeys()
Accessor for skew component keys - k1 - k12.
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.
static const std::map< G4String, unitsFactors > & UnitsAndFactors()
Accessor to all units.
friend std::ostream & operator<<(std::ostream &out, BDSMagnetStrength const &st)
Output stream.
static const std::vector< G4String > & AllKeys()
Accessor to all keys.
BDSMagnetStrength()
Default constructor does nothing as class will return 0 for uninitialised keys.
const_iterator end() const
Iterator mechanics.
G4bool empty() const
Iterator mechanics.
iterator end()
Iterator mechanics.
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.
const_iterator begin() const
Iterator mechanics.
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.
StrengthMap::const_iterator const_iterator
Iterator mechanics.
static G4double Unit(const G4String &key)
Access a unit factor for a given key.
iterator begin()
Iterator mechanics.
static std::vector< G4String > NormalComponentKeys()
Accessor for normal component keys - k1 - k12.
StrengthMap::iterator iterator
Iterator mechanics.
static const std::vector< G4String > normalComponentKeys
Vector of the normal component strength parameters.
Structure for unit names and numerical factors from Geant4 to SI(ish).