ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHParametersContainer.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHParametersContainer.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef PHPARAMETER_PHPARAMETERSCONTAINER_H
4 #define PHPARAMETER_PHPARAMETERSCONTAINER_H
5 
6 #include <phool/PHObject.h>
7 
8 #include <map>
9 #include <string>
10 #include <utility>
11 
12 class PHParameters;
14 class PHCompositeNode;
15 
17 {
18  public:
19  typedef std::map<int, PHParameters *> Map;
20  typedef Map::iterator Iterator;
21  typedef Map::const_iterator ConstIterator;
22  typedef std::pair<Iterator, Iterator> Range;
23  typedef std::pair<ConstIterator, ConstIterator> ConstRange;
24 
25  explicit PHParametersContainer(const std::string &name = "NONE");
26  ~PHParametersContainer() override;
27 
28  void AddPHParameters(const int detid, PHParameters *params);
29  const PHParameters *GetParameters(const int detid) const;
30  PHParameters *GetParametersToModify(const int detid);
31  int WriteToFile(const std::string &extension, const std::string &dir);
32  int WriteToDB();
33 
34  void set_name(const std::string &name) { superdetectorname = name; }
35  std::string Name() const { return superdetectorname; }
36  // std::pair<std::map<int, PHParameters *>::const_iterator, std::map<int, PHParameters *>::const_iterator> GetAllParameters() {return std::make_pair(parametermap.begin(),parametermap.end());}
37  ConstRange GetAllParameters() const { return std::make_pair(parametermap.begin(), parametermap.end()); }
38  void Print(Option_t *option = "") const override;
39  void SaveToNodeTree(PHCompositeNode *topNode, const std::string &nodename);
40  void UpdateNodeTree(PHCompositeNode *topNode, const std::string &nodename);
41  int ExistDetid(const int detid) const;
42  void clear() { parametermap.clear(); }
43  void FillFrom(const PdbParameterMapContainer *saveparamcontainer);
44  void CreateAndFillFrom(const PdbParameterMapContainer *saveparamcontainer, const std::string &name);
45 
46  private:
49  std::string superdetectorname;
50  std::map<int, PHParameters *> parametermap;
51 };
52 
53 #endif // PHPARAMETER_PHPARAMETERSCONTAINER_H