Base class for IR geometry parameters.
More...
#include <IRGeoBase.h>
|
| IRGeoBase () |
| 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.
|
|
const std::string & | getParameterStr (const std::string &name) const |
| Get string parameter.
|
|
const std::string & | getParameterStr (const std::string &name, const std::string &def) const |
| Get string parameter with giving default value in case of non-existence.
|
|
const std::map< std::string, double > & | getParameters () const |
| Get map of all parameters.
|
|
const std::map< std::string, std::string > & | getParametersStr () const |
| Get map of all string parameters.
|
|
void | addParameter (const std::string &name, double val) |
| Add parameter to map of parameters.
|
|
void | addParameter (const std::string &name, const std::string &val) |
| Add string parameter to map of parameters.
|
|
void | addParameters (const GearDir &content, const std::string §ion) |
| Add parameters from Gearbox.
|
|
void | print () const |
| Print all parameters.
|
|
|
std::map< std::string, double > | m_params |
| map of numeric parameters
|
|
std::map< std::string, std::string > | m_strparams |
| map of string parameters
|
|
Base class for IR geometry parameters.
Definition at line 27 of file IRGeoBase.h.
◆ IRGeoBase()
◆ addParameter() [1/2]
void addParameter |
( |
const std::string & |
name, |
|
|
const std::string & |
val |
|
) |
| |
|
inline |
Add string parameter to map of parameters.
- Parameters
-
name | parameter name |
val | parameter value |
Definition at line 111 of file IRGeoBase.h.
112 {
113 if (
m_strparams.insert(std::pair<std::string, std::string>(name, val)).second)
return;
114 else {
116 }
117 }
std::map< std::string, std::string > m_strparams
map of string parameters
◆ addParameter() [2/2]
void addParameter |
( |
const std::string & |
name, |
|
|
double |
val |
|
) |
| |
|
inline |
Add parameter to map of parameters.
- Parameters
-
name | parameter name |
val | parameter value |
Definition at line 98 of file IRGeoBase.h.
99 {
100 if (
m_params.insert(std::pair<std::string, double>(name, val)).second)
return;
101 else {
103 }
104 }
std::map< std::string, double > m_params
map of numeric parameters
◆ addParameters()
void addParameters |
( |
const GearDir & |
content, |
|
|
const std::string & |
section |
|
) |
| |
|
inline |
Add parameters from Gearbox.
- Parameters
-
content | gearbox folder |
section | name of section of parameters to add |
Definition at line 124 of file IRGeoBase.h.
125 {
126
127 for (const GearDir& slot : content.getNodes("sec")) {
128 std::string name = slot.getString("@name");
129 std::string unt = slot.getString("@unit");
130 double value;
131 if (unt.find("rad") != std::string::npos) value = slot.getAngle();
132 else value = slot.getLength();
134 }
135 if (content.exists(
"Material"))
addParameter(section +
".Material", content.getString(
"Material"));
136 if (content.exists(
"HeadMaterial"))
addParameter(section +
".HeadMaterial", content.getString(
"HeadMaterial"));
137 if (content.exists(
"Intersect"))
addParameter(section +
".Intersect", content.getString(
"Intersect"));
138 if (content.exists(
"Subtract"))
addParameter(section +
".Subtract", content.getString(
"Subtract"));
139 if (content.exists(
"MotherVolume"))
addParameter(section +
".MotherVolume", content.getString(
"MotherVolume"));
140 if (content.exists(
"N"))
addParameter(section +
".N",
double(content.getInt(
"N")));
141 if (content.exists(
"@type"))
addParameter(section +
".type", content.getString(
"@type"));
142 };
void addParameter(const std::string &name, double val)
Add parameter to map of parameters.
◆ getParameter() [1/2]
double getParameter |
( |
const std::string & |
name | ) |
const |
|
inline |
Get parameter value.
- Parameters
-
Definition at line 41 of file IRGeoBase.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 IR 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
-
name | parameter name |
def | default parameter value |
Definition at line 53 of file IRGeoBase.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 86 of file IRGeoBase.h.
◆ getParametersStr()
const std::map< std::string, std::string > & getParametersStr |
( |
| ) |
const |
|
inline |
Get map of all string parameters.
Definition at line 91 of file IRGeoBase.h.
◆ getParameterStr() [1/2]
const std::string & getParameterStr |
( |
const std::string & |
name | ) |
const |
|
inline |
Get string parameter.
- Parameters
-
Definition at line 64 of file IRGeoBase.h.
65 {
66 std::map<std::string, std::string>::const_iterator it =
m_strparams.find(name);
68 B2FATAL("Requested parameter from IR database not found: " << name);
69 }
◆ getParameterStr() [2/2]
const std::string & getParameterStr |
( |
const std::string & |
name, |
|
|
const std::string & |
def |
|
) |
| const |
|
inline |
Get string parameter with giving default value in case of non-existence.
- Parameters
-
name | parameter name |
def | default parameter value |
Definition at line 76 of file IRGeoBase.h.
77 {
78 std::map<std::string, std::string>::const_iterator it =
m_strparams.find(name);
80 return def;
81 }
◆ print()
Print all parameters.
Definition at line 147 of file IRGeoBase.h.
148 {
149 for (std::pair<std::string, double> element :
m_params) {
150 std::cout << element.first << " " << element.second << std::endl;
151 }
152
153 for (std::pair<std::string, std::string> element :
m_strparams) {
154 std::cout << element.first << " " << element.second << std::endl;
155 }
156 }
◆ m_params
std::map<std::string, double> m_params |
|
protected |
◆ m_strparams
std::map<std::string, std::string> m_strparams |
|
protected |
The documentation for this class was generated from the following file: