hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ParameterSet.h
Go to the documentation of this file.
1
7#ifndef _PARAMETER_SET_H_
8#define _PARAMETER_SET_H_
9
10//----------------//
11// C++ StdLib //
12//----------------//
13#include <map>
14#include <stdexcept>
15#include <vector>
16#include <string>
17
23
24 public:
30 int getInteger(const std::string& name) const;
31
40 int getInteger(const std::string& name, int defaultValue) const;
41
48 double getDouble(const std::string& name) const;
49
58 double getDouble(const std::string& name, double defaultValue) const;
59
64 const std::string& getString(const std::string& name) const;
65
74 const std::string& getString(const std::string& name, const std::string& defaultValue) const;
75
81 const std::vector<int>& getVInteger(const std::string& name) const;
82
91 const std::vector<int>& getVInteger(const std::string& name, const std::vector<int>& defaultValue) const;
92
98 const std::vector<double>& getVDouble(const std::string& name) const;
99
108 const std::vector<double>& getVDouble(const std::string& name, const std::vector<double>& defaultValue) const;
109
115 const std::vector<std::string>& getVString(const std::string& name) const;
116
125 const std::vector<std::string>& getVString(const std::string& name, const std::vector<std::string>& defaultValue) const;
126
133 void insert(const std::string& name, int value);
134
141 void insert(const std::string& name, double value);
142
149 void insert(const std::string& name, const std::string& value);
150
157 void insert(const std::string& name, const std::vector<int>& values);
158
165 void insert(const std::string& name, const std::vector<double>& values);
166
173 void insert(const std::string& name, const std::vector<std::string>& values);
174
189
196 struct Element {
197
199
200 Element(bool inval) : et_{et_Bool}, boolval_{inval} {;}
201
202 Element(int inval) : et_{et_Integer}, intval_{inval} {;}
203
204 Element(double inval) : et_ {et_Double}, doubleval_{inval} {;}
205
206 Element(const std::string& inval) : et_ { et_String }, strval_ { inval } {;}
207
208 Element(const std::vector<int>& inval);
209
210 Element(const std::vector<double>& inval);
211
212 Element(const std::vector<std::string>& inval);
213
215 bool boolval_{false};
216 int intval_{0};
217 double doubleval_{0};
218 std::string strval_;
219 std::vector<int> ivecVal_;
220 std::vector<double> dvecVal_;
221 std::vector<std::string> svecVal_;
223 };
224
225 std::map<std::string, Element> elements_;
226};
227
228#endif // _PARAMETER_SET_H_
description
const std::vector< int > & getVInteger(const std::string &name) const
Get a vector of integers by name or throw an exception if not available, or not the right type.
const std::vector< double > & getVDouble(const std::string &name) const
Get a vector of doubles by name or throw an exception if not available, or not the right type.
const std::string & getString(const std::string &name) const
const std::vector< std::string > & getVString(const std::string &name) const
Get a vector of strings by name or throw an exception if not available, or not the right type.
void insert(const std::string &name, int value)
Add an integer to the ParameterSet.
std::map< std::string, Element > elements_
double getDouble(const std::string &name) const
Get a double by name or throw an exception if not available, or not the right type.
int getInteger(const std::string &name) const
Get an integer by name or throw an exception if not available, or not the right type.
Backing data structure containing parameter values.
std::vector< double > dvecVal_
Element(double inval)
std::vector< std::string > svecVal_
ParameterSet * subsetVal_
Element(const std::string &inval)
std::vector< int > ivecVal_