Belle II Software development
BeamabortGeo Class Reference

Geometry parameters of Beamabort. More...

#include <BeamabortGeo.h>

Inheritance diagram for BeamabortGeo:

Public Member Functions

 BeamabortGeo ()
 Default constructor.
 
double getParameter (const std::string &name) const
 Get parameter value.
 
double getParameter (const std::string &name, double def) const
 Get parameter value with giving default value in case parameter doesn't exist in DB.
 
std::vector< double > getParArray (const std::string &name) const
 Get parameter value array.
 
std::vector< double > getParArray (const std::string &name, std::vector< double > def) const
 Get parameter value array with giving default array in case parameter doesn't exist in DB.
 
void addParameter (const std::string &name, double val)
 Add parameter to map of parameters.
 
void addArray (const std::string &name, std::vector< double > arr)
 Add parameter array to map of parameters.
 
const std::map< std::string, double > & getParameters () const
 Get map of all parameters.
 
const std::map< std::string, std::vector< double > > & getParArrays () const
 Get map of all parameter arrays.
 
void print () const
 Print all parameters.
 
void initialize (const GearDir &content)
 Initialze from the gearbox (xml file)
 

Protected Attributes

std::map< std::string, double > m_params
 map of numeric parameters
 
std::map< std::string, std::vector< double > > m_par_arrays
 map of numeric parameter arrays
 

Private Member Functions

 ClassDef (BeamabortGeo, 1)
 ClassDef.
 

Detailed Description

Geometry parameters of Beamabort.

Definition at line 27 of file BeamabortGeo.h.

Constructor & Destructor Documentation

◆ BeamabortGeo()

BeamabortGeo ( )
inline

Default constructor.

Definition at line 34 of file BeamabortGeo.h.

35 {}

Member Function Documentation

◆ addArray()

void addArray ( const std::string &  name,
std::vector< double >  arr 
)
inline

Add parameter array to map of parameters.

Parameters
nameparameter name
arrparameter array

Definition at line 101 of file BeamabortGeo.h.

102 {
103 if (m_par_arrays.insert(std::pair<std::string, std::vector<double>>(name, arr)).second) return;
104 else {
105 m_par_arrays.find(name)->second = arr;
106 }
107 }
std::map< std::string, std::vector< double > > m_par_arrays
map of numeric parameter arrays
Definition: BeamabortGeo.h:142

◆ addParameter()

void addParameter ( const std::string &  name,
double  val 
)
inline

Add parameter to map of parameters.

Parameters
nameparameter name
valparameter value

Definition at line 88 of file BeamabortGeo.h.

89 {
90 if (m_params.insert(std::pair<std::string, double>(name, val)).second) return;
91 else {
92 m_params.find(name)->second = val;
93 }
94 }
std::map< std::string, double > m_params
map of numeric parameters
Definition: BeamabortGeo.h:141

◆ getParameter() [1/2]

double getParameter ( const std::string &  name) const
inline

Get parameter value.

Parameters
nameparameter name

Definition at line 41 of file BeamabortGeo.h.

42 {
43 std::map<std::string, double>::const_iterator it = m_params.find(name);
44 if (it != m_params.end()) return (*it).second;
45 B2FATAL("Requested parameter from BEAMABORT database not found: " << name);
46 }

◆ getParameter() [2/2]

double getParameter ( const std::string &  name,
double  def 
) const
inline

Get parameter value with giving default value in case parameter doesn't exist in DB.

Parameters
nameparameter name
defdefault parameter value

Definition at line 53 of file BeamabortGeo.h.

54 {
55 std::map<std::string, double>::const_iterator it = m_params.find(name);
56 if (it != m_params.end()) return (*it).second;
57 return def;
58 }

◆ getParameters()

const std::map< std::string, double > & getParameters ( ) const
inline

Get map of all parameters.

Definition at line 112 of file BeamabortGeo.h.

112{ return m_params;}

◆ getParArray() [1/2]

std::vector< double > getParArray ( const std::string &  name) const
inline

Get parameter value array.

Parameters
nameparameter name

Definition at line 64 of file BeamabortGeo.h.

65 {
66 std::map<std::string, std::vector<double>>::const_iterator it = m_par_arrays.find(name);
67 if (it != m_par_arrays.end()) return (*it).second;
68 B2FATAL("Requested parameter from BEAMABORT database not found: " << name);
69 }

◆ getParArray() [2/2]

std::vector< double > getParArray ( const std::string &  name,
std::vector< double >  def 
) const
inline

Get parameter value array with giving default array in case parameter doesn't exist in DB.

Parameters
nameparameter name
defdefault parameter value

Definition at line 76 of file BeamabortGeo.h.

77 {
78 std::map<std::string, std::vector<double>>::const_iterator it = m_par_arrays.find(name);
79 if (it != m_par_arrays.end()) return (*it).second;
80 return def;
81 }

◆ getParArrays()

const std::map< std::string, std::vector< double > > & getParArrays ( ) const
inline

Get map of all parameter arrays.

Definition at line 117 of file BeamabortGeo.h.

117{ return m_par_arrays;}

◆ initialize()

void initialize ( const GearDir content)

Initialze from the gearbox (xml file)

Parameters
contentgearbox folder

Definition at line 13 of file BeamabortGeo.cc.

14{
15 //------------------------------
16 // Get BEAMABORT geometry parameters from the gearbox
17 //------------------------------
18
19 addParameter("stepSize", content.getWithUnit("stepSize"));
20 addParameter("BeamBackgroundStudy", content.getInt("BeamBackgroundStudy"));
21 addParameter("divisions", content.getInt("divisions"));
22 addParameter("foo", content.getBool("foo"));
23 addArray("bar", content.getArray("bar"));
24 addParameter("WorkFunction", content.getDouble("WorkFunction"));
25 addParameter("FanoFactor", content.getDouble("FanoFactor"));
26
27 GearDir cActive(content, "Active/");
28 addParameter("Active.phase", cActive.getInt("phase"));
29 addArray("Active.z", cActive.getArray("z"));
30 addArray("Active.r_dia", cActive.getArray("r_dia"));
31 addArray("Active.ThetaZ", cActive.getArray("ThetaZ"));
32 addArray("Active.Phi", cActive.getArray("Phi"));
33 addArray("Active.deltaX", cActive.getArray("deltaX"));
34 addArray("Active.addAngle", cActive.getArray("addAngle"));
35}
void addParameter(const std::string &name, double val)
Add parameter to map of parameters.
Definition: BeamabortGeo.h:88
void addArray(const std::string &name, std::vector< double > arr)
Add parameter array to map of parameters.
Definition: BeamabortGeo.h:101
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31

◆ print()

void print ( ) const
inline

Print all parameters.

Definition at line 122 of file BeamabortGeo.h.

123 {
124 for (std::pair<std::string, double> element : m_params) {
125 std::cout << element.first << " " << element.second << std::endl;
126 }
127 }

Member Data Documentation

◆ m_par_arrays

std::map<std::string, std::vector<double> > m_par_arrays
protected

map of numeric parameter arrays

Definition at line 142 of file BeamabortGeo.h.

◆ m_params

std::map<std::string, double> m_params
protected

map of numeric parameters

Definition at line 141 of file BeamabortGeo.h.


The documentation for this class was generated from the following files: