7 #include <pybind11/embed.h> 11 "from FWCore.ParameterSet.Types import makeCppPSet\n" 13 initCommand += fileName +
"').read())";
14 pybind11::exec(initCommand);
15 pybind11::exec(
"makeCppPSet(locals(), topPSet)");
20 command +=
"\nfrom FWCore.ParameterSet.Types import makeCppPSet\nmakeCppPSet(locals(), topPSet)";
21 pybind11::exec(command);
25 namespace cmspybind11 {
42 pybind11::scoped_interpreter guard{};
44 std::unique_ptr<ParameterSet> retVal;
48 mainModule.attr(
"topPSet") = pybind11::cast(&theProcessPSet);
52 if (module.substr(module.size() - 3) ==
".py") {
57 }
catch (pybind11::error_already_set
const&
e) {
60 retVal = std::make_unique<edm::ParameterSet>(
ParameterSet(theProcessPSet.
pset()));
std::unique_ptr< edm::ParameterSet > parameterSet() const
void initializePyBind11Module()
void pythonToCppException(const std::string &iType, const std::string &error)
edm::ParameterSet & pset()
std::unique_ptr< ParameterSet > readPSetsFrom(std::string const &fileOrString)
cond::Hash import(Session &source, const cond::Hash &sourcePayloadId, const std::string &inputTypeName, const void *inputPtr, Session &destination)
static void makePSetsFromString(std::string const &module)
std::unique_ptr< ParameterSet > readConfig(std::string const &config)
static void makePSetsFromFile(std::string const &fileName)
void makeParameterSets(std::string const &configtext, std::unique_ptr< ParameterSet > &main)
essentially the same as the previous method