CMS 3D CMS Logo

Public Member Functions | Private Attributes

PythonParameterSet Class Reference

#include <PythonParameterSet.h>

List of all members.

Public Member Functions

void addNewFileInPath (bool tracked, std::string const &name, std::string const &value)
template<typename T >
void addParameter (bool tracked, std::string const &name, T const &value)
template<typename T >
void addParameters (bool tracked, std::string const &name, boost::python::list value)
 unfortunate side effect: destroys the original list!
void addPSet (bool tracked, std::string const &name, PythonParameterSet const &ppset)
void addVPSet (bool tracked, std::string const &name, boost::python::list value)
std::string dump () const
template<typename T >
T getParameter (bool tracked, std::string const &name) const
template<typename T >
boost::python::list getParameters (bool tracked, std::string const &name) const
 templated on the type of the contained object
PythonParameterSet getPSet (bool tracked, std::string const &name) const
boost::python::list getVPSet (bool tracked, std::string const &name)
edm::ESInputTag newESInputTag (std::string const &module, std::string const &data)
edm::EventID newEventID (unsigned int run, unsigned int lumi, unsigned int event)
edm::EventRange newEventRange (unsigned int start, unsigned int startLumi, unsigned int startSub, unsigned int end, unsigned int endLumi, unsigned int endSub)
edm::InputTag newInputTag (std::string const &label, std::string const &instance, std::string const &process)
edm::LuminosityBlockID newLuminosityBlockID (unsigned int run, unsigned int lumi)
edm::LuminosityBlockRange newLuminosityBlockRange (unsigned int start, unsigned int startSub, unsigned int end, unsigned int endSub)
PythonParameterSet newPSet () const
edm::ParameterSet const & pset () const
edm::ParameterSetpset ()
 PythonParameterSet ()
 PythonParameterSet (edm::ParameterSet const &p)

Private Attributes

edm::ParameterSet theParameterSet

Detailed Description

Definition at line 18 of file PythonParameterSet.h.


Constructor & Destructor Documentation

PythonParameterSet::PythonParameterSet ( )

Definition at line 4 of file PythonParameterSet.cc.

Referenced by getPSet(), getVPSet(), and newPSet().

PythonParameterSet::PythonParameterSet ( edm::ParameterSet const &  p) [inline]

Definition at line 22 of file PythonParameterSet.h.


Member Function Documentation

void PythonParameterSet::addNewFileInPath ( bool  tracked,
std::string const &  name,
std::string const &  value 
)

Definition at line 43 of file PythonParameterSet.cc.

References addParameter().

Referenced by BOOST_PYTHON_MODULE().

template<typename T >
void PythonParameterSet::addParameter ( bool  tracked,
std::string const &  name,
T const &  value 
) [inline]

Definition at line 40 of file PythonParameterSet.h.

References mergeVDriftHistosByStation::name, theParameterSet, and relativeConstraints::value.

Referenced by addNewFileInPath(), addParameters(), addPSet(), and addVPSet().

                                                                    {
   if(tracked) {
     theParameterSet.template addParameter<T>(name, value);
   } else {
     theParameterSet.template addUntrackedParameter<T>(name, value);
   }
  }
template<typename T >
void PythonParameterSet::addParameters ( bool  tracked,
std::string const &  name,
boost::python::list  value 
) [inline]

unfortunate side effect: destroys the original list!

Definition at line 60 of file PythonParameterSet.h.

References addParameter(), v, and relativeConstraints::value.

                                        {
    std::vector<T> v = edm::toVector<T>(value);
    addParameter(tracked, name, v);
  }
void PythonParameterSet::addPSet ( bool  tracked,
std::string const &  name,
PythonParameterSet const &  ppset 
) [inline]

these custom classes do seem to be a hassle to wrap, compared to, say, InputTag maybe we will need to template these someday

Definition at line 70 of file PythonParameterSet.h.

References addParameter(), and theParameterSet.

Referenced by BOOST_PYTHON_MODULE().

                                                {
    addParameter(tracked, name, ppset.theParameterSet);
  }
void PythonParameterSet::addVPSet ( bool  tracked,
std::string const &  name,
boost::python::list  value 
)

Definition at line 10 of file PythonParameterSet.cc.

References addParameter(), v, and relativeConstraints::value.

Referenced by BOOST_PYTHON_MODULE().

{
  std::vector<PythonParameterSet> v
    = edm::toVector<PythonParameterSet>(value);
  std::vector<edm::ParameterSet> v2;
  v2.reserve(v.size());
  for(std::vector<PythonParameterSet>::iterator ppsetItr = v.begin(), ppsetItrEnd = v.end();
      ppsetItr != ppsetItrEnd; ++ppsetItr)
  {
    v2.push_back(ppsetItr->theParameterSet);
  }
  addParameter(tracked, name, v2);
}
std::string PythonParameterSet::dump ( void  ) const [inline]

Definition at line 124 of file PythonParameterSet.h.

References edm::ParameterSet::dump(), and theParameterSet.

Referenced by BOOST_PYTHON_MODULE(), and PythonProcessDesc::dump().

{return theParameterSet.dump();}
template<typename T >
T PythonParameterSet::getParameter ( bool  tracked,
std::string const &  name 
) const [inline]

Definition at line 27 of file PythonParameterSet.h.

References mergeVDriftHistosByStation::name, query::result, and theParameterSet.

                                                          {
    T result;
    if(tracked) {
      result = theParameterSet.template getParameter<T>(name);
    } else {
      result = theParameterSet.template getUntrackedParameter<T>(name);
    }
    return result;
  }
template<typename T >
boost::python::list PythonParameterSet::getParameters ( bool  tracked,
std::string const &  name 
) const [inline]

templated on the type of the contained object

Definition at line 52 of file PythonParameterSet.h.

References mergeVDriftHistosByStation::name, edm::toPythonList(), and v.

                                                           {
    std::vector<T> v = getParameter<std::vector<T> >(tracked, name);
    return edm::toPythonList(v);
  }
PythonParameterSet PythonParameterSet::getPSet ( bool  tracked,
std::string const &  name 
) const [inline]

Definition at line 76 of file PythonParameterSet.h.

References PythonParameterSet().

Referenced by BOOST_PYTHON_MODULE().

                                                                        {
    return PythonParameterSet(getParameter<edm::ParameterSet>(tracked, name));
  }
boost::python::list PythonParameterSet::getVPSet ( bool  tracked,
std::string const &  name 
)

Definition at line 26 of file PythonParameterSet.cc.

References edm::ParameterSet::getParameterSetVector(), edm::ParameterSet::getUntrackedParameterSetVector(), prof2calltree::l, list(), PythonParameterSet(), theParameterSet, and v.

Referenced by BOOST_PYTHON_MODULE().

{
  std::vector<edm::ParameterSet> const& v =
    (tracked ? theParameterSet.getParameterSetVector(name) : theParameterSet.getUntrackedParameterSetVector(name));

  // convert to PythonParameterSets
  boost::python::list l;
  for(std::vector<edm::ParameterSet>::const_iterator psetItr = v.begin(), psetItrEnd = v.end();
      psetItr != psetItrEnd; ++psetItr)
  {
    l.append(PythonParameterSet(*psetItr));
  }

  return l;
}
edm::ESInputTag PythonParameterSet::newESInputTag ( std::string const &  module,
std::string const &  data 
) [inline]

Definition at line 93 of file PythonParameterSet.h.

Referenced by BOOST_PYTHON_MODULE().

                                                    {
      return edm::ESInputTag(module, data);
   }
edm::EventID PythonParameterSet::newEventID ( unsigned int  run,
unsigned int  lumi,
unsigned int  event 
) [inline]

Definition at line 98 of file PythonParameterSet.h.

Referenced by BOOST_PYTHON_MODULE().

                                                                                  {
    return edm::EventID(run, lumi, event);
  }
edm::EventRange PythonParameterSet::newEventRange ( unsigned int  start,
unsigned int  startLumi,
unsigned int  startSub,
unsigned int  end,
unsigned int  endLumi,
unsigned int  endSub 
) [inline]

Definition at line 111 of file PythonParameterSet.h.

Referenced by BOOST_PYTHON_MODULE().

                                                                                               {
    return edm::EventRange(start, startLumi, startSub, end, endLumi, endSub);
  }
edm::InputTag PythonParameterSet::newInputTag ( std::string const &  label,
std::string const &  instance,
std::string const &  process 
) [inline]

Definition at line 87 of file PythonParameterSet.h.

Referenced by BOOST_PYTHON_MODULE().

                                                      {
    return edm::InputTag(label, instance, process);
  }
edm::LuminosityBlockID PythonParameterSet::newLuminosityBlockID ( unsigned int  run,
unsigned int  lumi 
) [inline]

Definition at line 102 of file PythonParameterSet.h.

Referenced by BOOST_PYTHON_MODULE().

edm::LuminosityBlockRange PythonParameterSet::newLuminosityBlockRange ( unsigned int  start,
unsigned int  startSub,
unsigned int  end,
unsigned int  endSub 
) [inline]

Definition at line 106 of file PythonParameterSet.h.

Referenced by BOOST_PYTHON_MODULE().

                                                                                             {
    return edm::LuminosityBlockRange(start, startSub, end, endSub);
  }
PythonParameterSet PythonParameterSet::newPSet ( ) const [inline]

Definition at line 118 of file PythonParameterSet.h.

References PythonParameterSet().

Referenced by BOOST_PYTHON_MODULE().

{return PythonParameterSet();}
edm::ParameterSet& PythonParameterSet::pset ( ) [inline]

Definition at line 120 of file PythonParameterSet.h.

References theParameterSet.

Referenced by PythonProcessDesc::parameterSet(), and edm::readPSetsFrom().

{return theParameterSet;}
edm::ParameterSet const& PythonParameterSet::pset ( ) const [inline]

Definition at line 122 of file PythonParameterSet.h.

References theParameterSet.

{return theParameterSet;}

Member Data Documentation

Definition at line 127 of file PythonParameterSet.h.

Referenced by addParameter(), addPSet(), dump(), getParameter(), getVPSet(), and pset().