CMS 3D CMS Logo

Functions
edm::cmspybind11 Namespace Reference

Functions

void makeParameterSets (std::string const &configtext, std::unique_ptr< ParameterSet > &main)
 essentially the same as the previous method More...
 
std::unique_ptr< ParameterSetreadConfig (std::string const &config)
 
std::unique_ptr< ParameterSetreadConfig (std::string const &config, const std::vector< std::string > &args)
 same, but with arguments More...
 
std::unique_ptr< ParameterSetreadPSetsFrom (std::string const &fileOrString)
 

Function Documentation

◆ makeParameterSets()

void edm::cmspybind11::makeParameterSets ( std::string const &  configtext,
std::unique_ptr< ParameterSet > &  main 
)

essentially the same as the previous method

Definition at line 36 of file MakePyBind11ParameterSets.cc.

References makeParameterSets(), and PyBind11ProcessDesc::parameterSet().

Referenced by edm::makeParameterSets().

36  {
37  PyBind11ProcessDesc pythonProcessDesc(configtext, false);
38  main = pythonProcessDesc.parameterSet();
39  }
Definition: main.py:1

◆ readConfig() [1/2]

std::unique_ptr< ParameterSet > edm::cmspybind11::readConfig ( std::string const &  config)

Definition at line 26 of file MakePyBind11ParameterSets.cc.

References PyBind11ProcessDesc::parameterSet(), and readConfig().

Referenced by edm::readConfig().

26  {
27  PyBind11ProcessDesc pythonProcessDesc(config, true);
28  return pythonProcessDesc.parameterSet();
29  }
Definition: config.py:1

◆ readConfig() [2/2]

std::unique_ptr< ParameterSet > edm::cmspybind11::readConfig ( std::string const &  config,
const std::vector< std::string > &  args 
)

same, but with arguments

Definition at line 31 of file MakePyBind11ParameterSets.cc.

References writedatasetfile::args, PyBind11ProcessDesc::parameterSet(), and readConfig().

31  {
32  PyBind11ProcessDesc pythonProcessDesc(config, true, args);
33  return pythonProcessDesc.parameterSet();
34  }
Definition: config.py:1

◆ readPSetsFrom()

std::unique_ptr< ParameterSet > edm::cmspybind11::readPSetsFrom ( std::string const &  fileOrString)

finds all the PSets used in the top level module referred as a file or as a string containing python commands. These PSets are bundled into a top level PSet from which they can be retrieved

Definition at line 41 of file MakePyBind11ParameterSets.cc.

References nnet::cast(), MillePedeFileConverter_cfg::e, cond::persistency::import(), edm::python::initializePyBind11Module(), makePSetsFromFile(), makePSetsFromString(), resolutioncreator_cfi::object, Python11ParameterSet::pset(), edm::pythonToCppException(), and readPSetsFrom().

Referenced by main(), and edm::readPSetsFrom().

41  {
42  pybind11::scoped_interpreter guard{};
44  std::unique_ptr<ParameterSet> retVal;
45  {
46  Python11ParameterSet theProcessPSet;
47  pybind11::object mainModule = pybind11::module::import("__main__");
48  mainModule.attr("topPSet") = pybind11::cast(&theProcessPSet);
49 
50  try {
51  // if it ends with py, it's a file
52  if (module.substr(module.size() - 3) == ".py") {
54  } else {
56  }
57  } catch (pybind11::error_already_set const& e) {
58  pythonToCppException("Configuration", e.what());
59  }
60  retVal = std::make_unique<edm::ParameterSet>(ParameterSet(theProcessPSet.pset()));
61  }
62  return retVal;
63  }
void pythonToCppException(const std::string &iType, const std::string &error)
static void makePSetsFromString(std::string const &module)
std::enable_if< std::is_same< data_T, ap_uint< 1 > >::value &&std::is_same< typename CONFIG_T::weight_t, ap_uint< 1 > >::value, ap_int< nnet::ceillog2(CONFIG_T::n_in)+2 > >::type cast(typename CONFIG_T::accum_t x)
Definition: nnet_mult.h:88
edm::ParameterSet & pset()
static void makePSetsFromFile(std::string const &fileName)
cond::Hash import(Session &source, const cond::Hash &sourcePayloadId, const std::string &inputTypeName, const void *inputPtr, Session &destination)
Definition: CondDBImport.cc:39