Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHParameterInterface.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHParameterInterface.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef PHPARAMETER_PHPARAMETERINTERFACE_H
4 #define PHPARAMETER_PHPARAMETERINTERFACE_H
5 
6 #include <map>
7 #include <string>
8 
9 class PHCompositeNode;
10 class PHParameters;
11 
13 {
14  public:
16  // PHParameterInterface contains pointer to memory
17  // copy ctor and = operator need explicit implementation, do just delete it here
20 
21  virtual ~PHParameterInterface();
22 
23  void set_paramname(const std::string &name);
24  virtual void SetDefaultParameters() = 0;
25 
26  // Get/Set parameters from macro
27  void set_double_param(const std::string &name, const double dval);
28  double get_double_param(const std::string &name) const;
29  void set_int_param(const std::string &name, const int ival);
30  int get_int_param(const std::string &name) const;
31  void set_string_param(const std::string &name, const std::string &sval);
32  std::string get_string_param(const std::string &name) const;
33 
35  void SaveToNodeTree(PHCompositeNode *runNode, const std::string &nodename);
36  void PutOnParNode(PHCompositeNode *parNode, const std::string &nodename);
37  void Print() const;
38 
39  protected:
40  void set_default_double_param(const std::string &name, const double dval);
41  void set_default_int_param(const std::string &name, const int ival);
42  void set_default_string_param(const std::string &name, const std::string &sval);
43  void InitializeParameters();
44 
45  private:
46  PHParameters *m_Params = nullptr;
47 
48  bool m_Locked = false;
49  std::map<const std::string, double> m_DoubleParMap;
50  std::map<const std::string, int> m_IntParMap;
51  std::map<const std::string, std::string> m_StringParMap;
52 
53  std::map<const std::string, double> m_DefaultDoubleParMap;
54  std::map<const std::string, int> m_DefaultIntParMap;
55  std::map<const std::string, std::string> m_DefaultStringParMap;
56 };
57 
58 #endif // PHPARAMETER_PHPARAMETERINTERFACE_H