Class Reference for E1039 Core & Analysis Software
PHG4Parameters.h
Go to the documentation of this file.
1 #ifndef PHG4PARAMETERS_H
2 #define PHG4PARAMETERS_H
3 
4 #include <phool/PHObject.h>
5 
6 #include <map>
7 #include <string>
8 
9 class PdbParameterMap;
11 class PHCompositeNode;
12 
13 // contains parameters in our units,
14 // convert to G4 units inside get access methods
15 
18 class PHG4Parameters: public PHObject
19 {
20  public:
21 
22  typedef std::map<const std::string, double> dMap;
23  typedef dMap::const_iterator dIter;
24  typedef std::map<const std::string, int> iMap;
25  typedef iMap::const_iterator iIter;
26  typedef std::map<const std::string, std::string> strMap;
27  typedef std::map<const std::string, std::string>::const_iterator strIter;
28 
29  explicit PHG4Parameters(const std::string &name): pdbparam(NULL),detname(name) {}
30  PHG4Parameters(const PHG4Parameters &params, const std::string &name);
31 
32  virtual ~PHG4Parameters() {}
33 
34  void Print() const;
35 
37  size_t get_hash() const;
38 
39  void set_int_param(const std::string &name, const int ival);
40  int get_int_param(const std::string &name) const;
41  bool exist_int_param(const std::string &name) const;
42  std::pair<std::map<const std::string, int>::const_iterator, std::map<const std::string, int>::const_iterator> get_all_int_params() {return std::make_pair(intparams.begin(), intparams.end());}
43 
44  void set_double_param(const std::string &name, const double dval);
45  double get_double_param(const std::string &name) const;
46  bool exist_double_param(const std::string &name) const;
47  std::pair< std::map<const std::string, double>::const_iterator, std::map<const std::string, double>::const_iterator> get_all_double_params() {return std::make_pair(doubleparams.begin(), doubleparams.end());}
48 
49  void set_string_param(const std::string &name, const std::string &str);
50  std::string get_string_param(const std::string &name) const;
51  bool exist_string_param(const std::string &name) const;
52  std::pair< std::map<const std::string, std::string>::const_iterator, std::map<const std::string, std::string>::const_iterator> get_all_string_params() {return std::make_pair(stringparams.begin(), stringparams.end());}
53 
54  void set_name(const std::string &name) {detname = name;}
55  std::string Name() const {return detname;}
56 
57  void FillFrom(const PdbParameterMap *saveparams);
58  void FillFrom(const PdbParameterMapContainer *saveparamcontainer, const int layer);
59  void FillFrom(const PHG4Parameters *saveparams);
60  // save parameters on node tree
61  void SaveToNodeTree(PHCompositeNode *topNode, const std::string &nodename);
62  // save parameters in container on node tree
63  void SaveToNodeTree(PHCompositeNode *topNode, const std::string &nodename, const int layer);
64  int WriteToDB();
65  int ReadFromDB();
66  int ReadFromDB(const std::string &name, const int layer);
67 // int WriteToFile(const std::string &extension, const std::string &dir = ".");
68 // int ReadFromFile(const std::string &name, const std::string &extension, const int layer, const int issuper, const std::string &dir = ".");
70 
71  void printint() const;
72  void printdouble() const;
73  void printstring() const;
74 
75  protected:
76 
77  unsigned int ConvertStringToUint(const std::string &str) const;
79  std::string detname;
83 
84 };
85 
86 #endif
#define NULL
Definition: Pdb.h:9
std::map< const std::string, double > dMap
void Print() const
PdbParameterMap * pdbparam
PHG4Parameters(const std::string &name)
void printstring() const
void set_double_param(const std::string &name, const double dval)
std::map< const std::string, std::string > strMap
size_t get_hash() const
hash of binary information for checking purpose
bool exist_string_param(const std::string &name) const
dMap::const_iterator dIter
std::string get_string_param(const std::string &name) const
void SaveToNodeTree(PHCompositeNode *topNode, const std::string &nodename)
std::map< const std::string, int > iMap
void set_int_param(const std::string &name, const int ival)
void CopyToPdbParameterMap(PdbParameterMap *myparm)
std::pair< std::map< const std::string, int >::const_iterator, std::map< const std::string, int >::const_iterator > get_all_int_params()
double get_double_param(const std::string &name) const
virtual ~PHG4Parameters()
iMap::const_iterator iIter
bool exist_int_param(const std::string &name) const
std::string detname
void FillFrom(const PdbParameterMap *saveparams)
std::map< const std::string, std::string >::const_iterator strIter
std::pair< std::map< const std::string, std::string >::const_iterator, std::map< const std::string, std::string >::const_iterator > get_all_string_params()
void set_string_param(const std::string &name, const std::string &str)
bool exist_double_param(const std::string &name) const
void set_name(const std::string &name)
int get_int_param(const std::string &name) const
void printint() const
std::string Name() const
void printdouble() const
unsigned int ConvertStringToUint(const std::string &str) const
std::pair< std::map< const std::string, double >::const_iterator, std::map< const std::string, double >::const_iterator > get_all_double_params()