GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSTGeoParams.cpp
Go to the documentation of this file.
1 /*
2  * GGSTGeoParams.cpp
3  *
4  * Created on: 28 Dec 2017
5  * Author: Nicola Mori
6  */
7 
11 
12 #include <stdexcept>
13 
14 void GGSTGeoParams::SetIntGeoParams(const std::map<std::string, int> &intGeoParams) { _intGeoParams = intGeoParams; }
15 
16 void GGSTGeoParams::SetBoolGeoParams(const std::map<std::string, bool> &boolGeoParams) {
17  _boolGeoParams = boolGeoParams;
18 }
19 
20 void GGSTGeoParams::SetRealGeoParams(const std::map<std::string, double> &realGeoParams) {
21  _realGeoParams = realGeoParams;
22 }
23 
24 void GGSTGeoParams::SetStringGeoParams(const std::map<std::string, std::string> &stringGeoParams) {
25  _stringGeoParams = stringGeoParams;
26 }
27 
28 void GGSTGeoParams::SetVectIntGeoParams(const std::map<std::string, std::vector<int>> &vectIntGeoParams) {
29  _vectIntGeoParams = vectIntGeoParams;
30 }
31 
32 void GGSTGeoParams::SetVectBoolGeoParams(const std::map<std::string, std::vector<bool>> &vectBoolGeoParams) {
33  _vectBoolGeoParams = vectBoolGeoParams;
34 }
35 
36 void GGSTGeoParams::SetVectRealGeoParams(const std::map<std::string, std::vector<double>> &vectRealGeoParams) {
37  _vectRealGeoParams = vectRealGeoParams;
38 }
39 
40 void GGSTGeoParams::SetVectStringGeoParams(const std::map<std::string, std::vector<std::string>> &vectStringGeoParams) {
41  _vectStringGeoParams = vectStringGeoParams;
42 }
43 
44 int GGSTGeoParams::GetIntGeoParam(const std::string &name) const {
45  auto valueIter = _intGeoParams.find(name);
46  if (valueIter == _intGeoParams.end()) {
47  throw(std::runtime_error(std::string("Can't find integer geometry parameter \"").append(name).append("\"")));
48  }
49  return valueIter->second;
50 }
51 
52 bool GGSTGeoParams::GetBoolGeoParam(const std::string &name) const {
53  auto valueIter = _boolGeoParams.find(name);
54  if (valueIter == _boolGeoParams.end()) {
55  throw(std::runtime_error(std::string("Can't find boolean geometry parameter \"").append(name).append("\"")));
56  }
57  return valueIter->second;
58 }
59 
60 double GGSTGeoParams::GetRealGeoParam(const std::string &name) const {
61  auto valueIter = _realGeoParams.find(name);
62  if (valueIter == _realGeoParams.end()) {
63  throw(std::runtime_error(std::string("Can't find real geometry parameter \"").append(name).append("\"")));
64  }
65  return valueIter->second;
66 }
67 
68 std::string GGSTGeoParams::GetStringGeoParam(const std::string &name) const {
69  auto valueIter = _stringGeoParams.find(name);
70  if (valueIter == _stringGeoParams.end()) {
71  throw(std::runtime_error(std::string("Can't find string geometry parameter \"").append(name).append("\"")));
72  }
73  return valueIter->second;
74 }
75 
76 std::vector<int> GGSTGeoParams::GetVectIntGeoParam(const std::string &name) const {
77  auto valueIter = _vectIntGeoParams.find(name);
78  if (valueIter == _vectIntGeoParams.end()) {
79  throw(std::runtime_error(
80  std::string("Can't find vector-of-integers geometry parameter \"").append(name).append("\"")));
81  }
82  return valueIter->second;
83 }
84 
85 std::vector<bool> GGSTGeoParams::GetVectBoolGeoParam(const std::string &name) const {
86  auto valueIter = _vectBoolGeoParams.find(name);
87  if (valueIter == _vectBoolGeoParams.end()) {
88  throw(std::runtime_error(
89  std::string("Can't find vector-of-booleans geometry parameter \"").append(name).append("\"")));
90  }
91  return valueIter->second;
92 }
93 
94 std::vector<double> GGSTGeoParams::GetVectRealGeoParam(const std::string &name) const {
95  auto valueIter = _vectRealGeoParams.find(name);
96  if (valueIter == _vectRealGeoParams.end()) {
97  throw(
98  std::runtime_error(std::string("Can't find vector-of-reals geometry parameter \"").append(name).append("\"")));
99  }
100  return valueIter->second;
101 }
102 
103 std::vector<std::string> GGSTGeoParams::GetVectStringGeoParam(const std::string &name) const {
104  auto valueIter = _vectStringGeoParams.find(name);
105  if (valueIter == _vectStringGeoParams.end()) {
106  throw(std::runtime_error(
107  std::string("Can't find vector-of-strings geometry parameter \"").append(name).append("\"")));
108  }
109  return valueIter->second;
110 }
111 
113  if (&params == this)
114  return true;
115  return ((_intGeoParams == params._intGeoParams) && (_realGeoParams == params._realGeoParams) &&
116  (_stringGeoParams == params._stringGeoParams) && (_boolGeoParams == params._boolGeoParams) &&
117  (_vectIntGeoParams == params._vectIntGeoParams) && (_vectRealGeoParams == params._vectRealGeoParams) &&
118  (_vectStringGeoParams == params._vectStringGeoParams) && (_vectBoolGeoParams == params._vectBoolGeoParams));
119 }
bool GetBoolGeoParam(const std::string &name) const
Gets a boolean geometry parameter.
void SetVectBoolGeoParams(const std::map< std::string, std::vector< bool >> &vectBoolGeoParams)
Sets the vector-of-booleans geometry parameters.
std::vector< int > GetVectIntGeoParam(const std::string &name) const
Gets a vector-of-integers geometry parameter.
std::vector< bool > GetVectBoolGeoParam(const std::string &name) const
Gets a vector-of-booleans geometry parameter.
void SetStringGeoParams(const std::map< std::string, std::string > &stringGeoParams)
Sets the string geometry parameters.
bool AreSameParamsAs(const GGSTGeoParams &params) const
Compares two geometry parameter objects.
int GetIntGeoParam(const std::string &name) const
Gets an integer geometry parameter.
std::vector< double > GetVectRealGeoParam(const std::string &name) const
Gets a vector-of-reals geometry parameter.
void SetRealGeoParams(const std::map< std::string, double > &realGeoParams)
Sets the real geometry parameters.
std::vector< std::string > GetVectStringGeoParam(const std::string &name) const
Gets a vector-of-strings geometry parameter.
void SetVectRealGeoParams(const std::map< std::string, std::vector< double >> &vectRealGeoParams)
Sets the vector-of-reals geometry parameters.
std::string GetStringGeoParam(const std::string &name) const
Gets a string geometry parameter.
void SetVectStringGeoParams(const std::map< std::string, std::vector< std::string >> &vectStringGeoParams)
Sets the vector-of-strings geometry parameters.
Class for storing the geometry parameters on Root output file.
Definition: GGSTGeoParams.h:18
double GetRealGeoParam(const std::string &name) const
Gets a real geometry parameter.
void SetVectIntGeoParams(const std::map< std::string, std::vector< int >> &vectIntGeoParams)
Sets the vector-of-integers geometry parameters.
void SetBoolGeoParams(const std::map< std::string, bool > &boolGeoParams)
Sets the boolean geometry parameters.
void SetIntGeoParams(const std::map< std::string, int > &intGeoParams)
Sets the integer geometry parameters.