CMS 3D CMS Logo

Python11ParameterSet.h
Go to the documentation of this file.
1 #ifndef FWCore_PyDevParameterSet_Python11ParameterSet_h
2 #define FWCore_PyDevParameterSet_Python11ParameterSet_h
3 #include <pybind11/pybind11.h>
4 
7 
15 
16 #include <string>
17 #include <vector>
18 
19 namespace cmspython3 {
21  public:
23 
25 
26  template <typename T>
27  T getParameter(bool tracked, std::string const& name) const {
28  T result;
29  if (tracked) {
30  result = theParameterSet.template getParameter<T>(name);
31  } else {
32  result = theParameterSet.template getUntrackedParameter<T>(name);
33  }
34  return result;
35  }
36 
37  template <typename T>
38  void addParameter(bool tracked, std::string const& name, T const& value) {
39  if (tracked) {
40  theParameterSet.template addParameter<T>(name, value);
41  } else {
42  theParameterSet.template addUntrackedParameter<T>(name, value);
43  }
44  }
45 
47  template <typename T>
48  pybind11::list getParameters(bool tracked, std::string const& name) const {
49  std::vector<T> v = getParameter<std::vector<T> >(tracked, name);
51  }
52 
54  template <typename T>
55  void addParameters(bool tracked, std::string const& name, pybind11::list value) {
56  std::vector<T> v = cmspython3::toVector<T>(value);
57  addParameter(tracked, name, v);
58  }
59 
63  void addPSet(bool tracked, std::string const& name, Python11ParameterSet const& ppset) {
64  addParameter(tracked, name, ppset.theParameterSet);
65  }
66 
67  Python11ParameterSet getPSet(bool tracked, std::string const& name) const {
68  return Python11ParameterSet(getParameter<edm::ParameterSet>(tracked, name));
69  }
70 
71  void addVPSet(bool tracked, std::string const& name, pybind11::list value);
72 
73  pybind11::list getVPSet(bool tracked, std::string const& name);
74 
75  // no way to interface straight into the other python InputTag
78  }
79 
81  return edm::ESInputTag(module, data);
82  }
83 
85  return edm::EventID(run, lumi, event);
86  }
87 
88  edm::LuminosityBlockID newLuminosityBlockID(unsigned int run, unsigned int lumi) {
90  }
91 
93  unsigned int startSub,
94  unsigned int end,
95  unsigned int endSub) {
96  return edm::LuminosityBlockRange(start, startSub, end, endSub);
97  }
98 
101  edm::EventNumber_t startSub,
104  edm::EventNumber_t endSub) {
105  return edm::EventRange(start, startLumi, startSub, end, endLumi, endSub);
106  }
107 
108  void addNewFileInPath(bool tracked, std::string const& name, std::string const& value);
109 
111 
113 
114  edm::ParameterSet const& pset() const { return theParameterSet; }
115 
116  std::string dump() const { return theParameterSet.dump(); }
117 
118  private:
120  };
121 } // namespace cmspython3
122 #endif
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
cmspython3::Python11ParameterSet::addVPSet
void addVPSet(bool tracked, std::string const &name, pybind11::list value)
Definition: Python11ParameterSet.cc:7
edm::ESInputTag
Definition: ESInputTag.h:87
start
Definition: start.py:1
cmspython3::Python11ParameterSet::newPSet
Python11ParameterSet newPSet() const
Definition: Python11ParameterSet.h:110
cmspython3::Python11ParameterSet::theParameterSet
edm::ParameterSet theParameterSet
Definition: Python11ParameterSet.h:119
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RunLumiEventNumber.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
cmspython3::Python11ParameterSet::dump
std::string dump() const
Definition: Python11ParameterSet.h:116
LuminosityBlockID.h
cmspython3::Python11ParameterSet::newInputTag
edm::InputTag newInputTag(std::string const &label, std::string const &instance, std::string const &process)
Definition: Python11ParameterSet.h:76
cmspython3
Definition: PyBind11ProcessDesc.h:16
edm::ParameterSet::dump
std::string dump(unsigned int indent=0) const
Definition: ParameterSet.cc:832
EventID.h
mps_fire.end
end
Definition: mps_fire.py:242
cmspython3::Python11ParameterSet::getParameter
T getParameter(bool tracked, std::string const &name) const
Definition: Python11ParameterSet.h:27
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
edm::LuminosityBlockID
Definition: LuminosityBlockID.h:31
cmspython3::Python11ParameterSet::addPSet
void addPSet(bool tracked, std::string const &name, Python11ParameterSet const &ppset)
Definition: Python11ParameterSet.h:63
cmspython3::Python11ParameterSet::newLuminosityBlockRange
edm::LuminosityBlockRange newLuminosityBlockRange(unsigned int start, unsigned int startSub, unsigned int end, unsigned int endSub)
Definition: Python11ParameterSet.h:92
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
cmspython3::Python11ParameterSet::getVPSet
pybind11::list getVPSet(bool tracked, std::string const &name)
Definition: Python11ParameterSet.cc:19
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
value
Definition: value.py:1
cmspython3::Python11ParameterSet::addParameters
void addParameters(bool tracked, std::string const &name, pybind11::list value)
unfortunate side effect: destroys the original list!
Definition: Python11ParameterSet.h:55
PyBind11Wrapper.h
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
InputTag.h
cmspython3::Python11ParameterSet::Python11ParameterSet
Python11ParameterSet(edm::ParameterSet const &p)
Definition: Python11ParameterSet.h:24
cmspython3::Python11ParameterSet::getParameters
pybind11::list getParameters(bool tracked, std::string const &name) const
templated on the type of the contained object
Definition: Python11ParameterSet.h:48
ESInputTag.h
writedatasetfile.run
run
Definition: writedatasetfile.py:27
cmspython3::Python11ParameterSet::newLuminosityBlockID
edm::LuminosityBlockID newLuminosityBlockID(unsigned int run, unsigned int lumi)
Definition: Python11ParameterSet.h:88
T
long double T
Definition: Basic3DVectorLD.h:48
cmspython3::Python11ParameterSet
Definition: Python11ParameterSet.h:20
cmspython3::Python11ParameterSet::addNewFileInPath
void addNewFileInPath(bool tracked, std::string const &name, std::string const &value)
Definition: Python11ParameterSet.cc:34
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
LuminosityBlockRange.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
cmspython3::Python11ParameterSet::newESInputTag
edm::ESInputTag newESInputTag(std::string const &module, std::string const &data)
Definition: Python11ParameterSet.h:80
mps_fire.result
result
Definition: mps_fire.py:311
ParameterSet.h
cmspython3::Python11ParameterSet::Python11ParameterSet
Python11ParameterSet()
Definition: Python11ParameterSet.cc:5
event
Definition: event.py:1
edm::EventID
Definition: EventID.h:31
cmspython3::Python11ParameterSet::newEventRange
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)
Definition: Python11ParameterSet.h:99
edm::EventRange
Definition: EventRange.h:31
lumi
Definition: LumiSectionData.h:20
cmspython3::Python11ParameterSet::pset
edm::ParameterSet const & pset() const
Definition: Python11ParameterSet.h:114
cmspython3::Python11ParameterSet::addParameter
void addParameter(bool tracked, std::string const &name, T const &value)
Definition: Python11ParameterSet.h:38
edm::InputTag
Definition: InputTag.h:15
cmspython3::toPython11List
pybind11::list toPython11List(const std::vector< T > &v)
Definition: PyBind11Wrapper.h:17
label
const char * label
Definition: PFTauDecayModeTools.cc:11
cmspython3::Python11ParameterSet::getPSet
Python11ParameterSet getPSet(bool tracked, std::string const &name) const
Definition: Python11ParameterSet.h:67
cmspython3::Python11ParameterSet::pset
edm::ParameterSet & pset()
Definition: Python11ParameterSet.h:112
cmspython3::Python11ParameterSet::newEventID
edm::EventID newEventID(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event)
Definition: Python11ParameterSet.h:84
EventRange.h
edm::LuminosityBlockRange
Definition: LuminosityBlockRange.h:32