14#include <framework/gearbox/GearDir.h>
15#include <framework/logging/Logger.h>
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);
55 std::map<std::string, double>::const_iterator it =
m_params.find(name);
56 if (it !=
m_params.end())
return (*it).second;
64 std::vector<double>
getParArray(
const std::string& name)
const
66 std::map<std::string, std::vector<double>>::const_iterator it =
m_par_arrays.find(name);
68 B2FATAL(
"Requested parameter from BEAMABORT database not found: " << name);
76 std::vector<double>
getParArray(
const std::string& name, std::vector<double> def)
const
78 std::map<std::string, std::vector<double>>::const_iterator it =
m_par_arrays.find(name);
90 if (
m_params.insert(std::pair<std::string, double>(name, val)).second)
return;
101 void addArray(
const std::string& name, std::vector<double> arr)
103 if (
m_par_arrays.insert(std::pair<std::string, std::vector<double>>(name, arr)).second)
return;
124 for (std::pair<std::string, double> element :
m_params) {
125 std::cout << element.first <<
" " << element.second << std::endl;
Geometry parameters of Beamabort.
std::vector< double > getParArray(const std::string &name) const
Get parameter value array.
ClassDef(BeamabortGeo, 1)
ClassDef.
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::map< std::string, std::vector< double > > m_par_arrays
map of numeric parameter arrays
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.
BeamabortGeo()
Default constructor.
void addParameter(const std::string &name, double val)
Add parameter to map of parameters.
std::map< std::string, double > m_params
map of numeric parameters
const std::map< std::string, double > & getParameters() const
Get map of all parameters.
void addArray(const std::string &name, std::vector< double > arr)
Add parameter array to map of parameters.
double getParameter(const std::string &name) const
Get parameter value.
void initialize(const GearDir &content)
Initialze from the gearbox (xml file)
void print() const
Print all parameters.
const std::map< std::string, std::vector< double > > & getParArrays() const
Get map of all parameter arrays.
GearDir is the basic class used for accessing the parameter store.
Abstract base class for different kinds of events.