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
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
Python11ParameterSet::newInputTag
edm::InputTag newInputTag(std::string const &label, std::string const &instance, std::string const &process)
Definition: Python11ParameterSet.h:75
edm::toPython11List
pybind11::list toPython11List(const std::vector< T > &v)
Definition: PyBind11Wrapper.h:17
edm::ESInputTag
Definition: ESInputTag.h:87
start
Definition: start.py:1
Python11ParameterSet::getParameters
pybind11::list getParameters(bool tracked, std::string const &name) const
templated on the type of the contained object
Definition: Python11ParameterSet.h:47
Python11ParameterSet::addParameter
void addParameter(bool tracked, std::string const &name, T const &value)
Definition: Python11ParameterSet.h:37
Python11ParameterSet::addParameters
void addParameters(bool tracked, std::string const &name, pybind11::list value)
unfortunate side effect: destroys the original list!
Definition: Python11ParameterSet.h:54
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RunLumiEventNumber.h
Python11ParameterSet::getVPSet
pybind11::list getVPSet(bool tracked, std::string const &name)
Definition: Python11ParameterSet.cc:17
findQualityFiles.v
v
Definition: findQualityFiles.py:179
Python11ParameterSet
Definition: Python11ParameterSet.h:19
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
LuminosityBlockID.h
end
#define end
Definition: vmac.h:39
Python11ParameterSet::newLuminosityBlockID
edm::LuminosityBlockID newLuminosityBlockID(unsigned int run, unsigned int lumi)
Definition: Python11ParameterSet.h:87
Python11ParameterSet::pset
edm::ParameterSet & pset()
Definition: Python11ParameterSet.h:111
Python11ParameterSet::getPSet
Python11ParameterSet getPSet(bool tracked, std::string const &name) const
Definition: Python11ParameterSet.h:66
Python11ParameterSet::dump
std::string dump() const
Definition: Python11ParameterSet.h:115
edm::ParameterSet::dump
std::string dump(unsigned int indent=0) const
Definition: ParameterSet.cc:825
EventID.h
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
edm::LuminosityBlockID
Definition: LuminosityBlockID.h:31
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:98
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
Python11ParameterSet::theParameterSet
edm::ParameterSet theParameterSet
Definition: Python11ParameterSet.h:118
edm::ParameterSet
Definition: ParameterSet.h:36
Python11ParameterSet::newPSet
Python11ParameterSet newPSet() const
Definition: Python11ParameterSet.h:109
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
Python11ParameterSet::pset
edm::ParameterSet const & pset() const
Definition: Python11ParameterSet.h:113
Python11ParameterSet::getParameter
T getParameter(bool tracked, std::string const &name) const
Definition: Python11ParameterSet.h:26
value
Definition: value.py:1
Python11ParameterSet::addVPSet
void addVPSet(bool tracked, std::string const &name, pybind11::list value)
Definition: Python11ParameterSet.cc:6
module
Definition: vlib.h:198
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
Python11ParameterSet::Python11ParameterSet
Python11ParameterSet()
Definition: Python11ParameterSet.cc:4
InputTag.h
Python11ParameterSet::addPSet
void addPSet(bool tracked, std::string const &name, Python11ParameterSet const &ppset)
Definition: Python11ParameterSet.h:62
ESInputTag.h
writedatasetfile.run
run
Definition: writedatasetfile.py:27
T
long double T
Definition: Basic3DVectorLD.h:48
Python11ParameterSet::Python11ParameterSet
Python11ParameterSet(edm::ParameterSet const &p)
Definition: Python11ParameterSet.h:23
Python11ParameterSet::newESInputTag
edm::ESInputTag newESInputTag(std::string const &module, std::string const &data)
Definition: Python11ParameterSet.h:79
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
PyBind11Wrapper.h
LuminosityBlockRange.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
mps_fire.result
result
Definition: mps_fire.py:303
list
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*", "!HLTx*" if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL. It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of "!*" before the partial wildcard feature was incorporated). Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
ParameterSet.h
Python11ParameterSet::newLuminosityBlockRange
edm::LuminosityBlockRange newLuminosityBlockRange(unsigned int start, unsigned int startSub, unsigned int end, unsigned int endSub)
Definition: Python11ParameterSet.h:91
event
Definition: event.py:1
edm::EventID
Definition: EventID.h:31
edm::EventRange
Definition: EventRange.h:31
Python11ParameterSet::newEventID
edm::EventID newEventID(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event)
Definition: Python11ParameterSet.h:83
lumi
Definition: LumiSectionData.h:20
Python11ParameterSet::addNewFileInPath
void addNewFileInPath(bool tracked, std::string const &name, std::string const &value)
Definition: Python11ParameterSet.cc:31
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
EventRange.h
edm::LuminosityBlockRange
Definition: LuminosityBlockRange.h:32