CMS 3D CMS Logo

Python11ParameterSet.h
Go to the documentation of this file.
1 #ifndef FWCore_PyBind11ParameterSet_Python11ParameterSet_h
2 #define FWCore_PyBind11ParameterSet_Python11ParameterSet_h
3 #include <pybind11/pybind11.h>
4 
7 
15 
16 #include <string>
17 #include <vector>
18 
20 public:
22 
24 
25  template <typename T>
26  T getParameter(bool tracked, std::string const& name) const {
27  T result;
28  if (tracked) {
29  result = theParameterSet.template getParameter<T>(name);
30  } else {
31  result = theParameterSet.template getUntrackedParameter<T>(name);
32  }
33  return result;
34  }
35 
36  template <typename T>
37  void addParameter(bool tracked, std::string const& name, T const& value) {
38  if (tracked) {
39  theParameterSet.template addParameter<T>(name, value);
40  } else {
41  theParameterSet.template addUntrackedParameter<T>(name, value);
42  }
43  }
44 
46  template <typename T>
47  pybind11::list getParameters(bool tracked, std::string const& name) const {
48  std::vector<T> v = getParameter<std::vector<T> >(tracked, name);
49  return edm::toPython11List(v);
50  }
51 
53  template <typename T>
54  void addParameters(bool tracked, std::string const& name, pybind11::list value) {
55  std::vector<T> v = edm::toVector<T>(value);
56  addParameter(tracked, name, v);
57  }
58 
62  void addPSet(bool tracked, std::string const& name, Python11ParameterSet const& ppset) {
63  addParameter(tracked, name, ppset.theParameterSet);
64  }
65 
66  Python11ParameterSet getPSet(bool tracked, std::string const& name) const {
67  return Python11ParameterSet(getParameter<edm::ParameterSet>(tracked, name));
68  }
69 
70  void addVPSet(bool tracked, std::string const& name, pybind11::list value);
71 
72  pybind11::list getVPSet(bool tracked, std::string const& name);
73 
74  // no way to interface straight into the other python InputTag
77  }
78 
80  return edm::ESInputTag(module, data);
81  }
82 
84  return edm::EventID(run, lumi, event);
85  }
86 
87  edm::LuminosityBlockID newLuminosityBlockID(unsigned int run, unsigned int lumi) {
89  }
90 
92  unsigned int startSub,
93  unsigned int end,
94  unsigned int endSub) {
95  return edm::LuminosityBlockRange(start, startSub, end, endSub);
96  }
97 
100  edm::EventNumber_t startSub,
103  edm::EventNumber_t endSub) {
104  return edm::EventRange(start, startLumi, startSub, end, endLumi, endSub);
105  }
106 
107  void addNewFileInPath(bool tracked, std::string const& name, std::string const& value);
108 
110 
112 
113  edm::ParameterSet const& pset() const { return theParameterSet; }
114 
115  std::string dump() const { return theParameterSet.dump(); }
116 
117 private:
119 };
120 
121 #endif
Definition: start.py:1
edm::LuminosityBlockID newLuminosityBlockID(unsigned int run, unsigned int lumi)
pybind11::list getParameters(bool tracked, std::string const &name) const
templated on the type of the contained object
void addParameter(bool tracked, std::string const &name, T const &value)
edm::LuminosityBlockRange newLuminosityBlockRange(unsigned int start, unsigned int startSub, unsigned int end, unsigned int endSub)
void addNewFileInPath(bool tracked, std::string const &name, std::string const &value)
static PFTauRenderPlugin instance
edm::ESInputTag newESInputTag(std::string const &module, std::string const &data)
std::string dump() const
edm::ParameterSet & pset()
unsigned long long EventNumber_t
edm::ParameterSet theParameterSet
pybind11::list getVPSet(bool tracked, std::string const &name)
Python11ParameterSet getPSet(bool tracked, std::string const &name) const
T getParameter(bool tracked, std::string const &name) const
unsigned int LuminosityBlockNumber_t
char const * label
Python11ParameterSet newPSet() const
void addPSet(bool tracked, std::string const &name, Python11ParameterSet const &ppset)
edm::ParameterSet const & pset() const
Definition: value.py:1
pybind11::list toPython11List(const std::vector< T > &v)
Python11ParameterSet(edm::ParameterSet const &p)
edm::EventRange newEventRange(edm::RunNumber_t start, edm::LuminosityBlockNumber_t startLumi, edm::EventNumber_t startSub, edm::RunNumber_t end, edm::LuminosityBlockNumber_t endLumi, edm::EventNumber_t endSub)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
std::string dump(unsigned int indent=0) const
void addParameters(bool tracked, std::string const &name, pybind11::list value)
unfortunate side effect: destroys the original list!
edm::EventID newEventID(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event)
edm::InputTag newInputTag(std::string const &label, std::string const &instance, std::string const &process)
unsigned int RunNumber_t
void addVPSet(bool tracked, std::string const &name, pybind11::list value)
long double T
Definition: event.py:1