CMS 3D CMS Logo

PythonParameterSet Class Reference

#include <FWCore/ParameterSet/interface/PythonParameterSet.h>

List of all members.

Public Member Functions

void addNewFileInPath (bool tracked, std::string const &name, std::string const &value)
template<class T>
void addParameter (bool tracked, std::string const &name, T value)
template<class 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, const PythonParameterSet &ppset)
 these custom classes do seem to be a hassle to wrap, compared to, say, InputTag maybe we will need to template these someday
void addVPSet (bool tracked, std::string const &name, boost::python::list value)
std::string dump () const
template<class T>
getParameter (bool tracked, std::string const &name) const
template<class T>
boost::python::list getParameters (bool tracked, const std::string &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::EventID newEventID (unsigned int run, unsigned int event)
edm::InputTag newInputTag (const std::string &label, const std::string &instance, const std::string &process)
edm::LuminosityBlockID newLuminosityBlockID (unsigned int run, unsigned int lumi)
PythonParameterSet newPSet () const
const edm::ParameterSetpset () const
 PythonParameterSet (const edm::ParameterSet &p)
 PythonParameterSet ()

Private Attributes

edm::ParameterSet theParameterSet


Detailed Description

Definition at line 8 of file PythonParameterSet.h.


Constructor & Destructor Documentation

PythonParameterSet::PythonParameterSet (  ) 

Definition at line 4 of file PythonParameterSet.cc.

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

00005 :  theParameterSet()
00006 {
00007 }

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

Definition at line 13 of file PythonParameterSet.h.

00014   : theParameterSet(p) {}


Member Function Documentation

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

Definition at line 50 of file PythonParameterSet.cc.

References addParameter().

Referenced by BOOST_PYTHON_MODULE().

00051 {
00052   addParameter(tracked, name, edm::FileInPath(value));
00053 }

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

Definition at line 35 of file PythonParameterSet.h.

References theParameterSet.

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

00036   {
00037    if(tracked)
00038    {
00039      theParameterSet.template addParameter<T>(name, value);
00040    }
00041    else 
00042    {
00043      theParameterSet.template addUntrackedParameter<T>(name, value);
00044    }
00045   }

template<class 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(), and v.

00062   {
00063     std::vector<T> v = edm::toVector<T>(value);
00064     addParameter(tracked, name, v);
00065   }

void PythonParameterSet::addPSet ( bool  tracked,
std::string const &  name,
const PythonParameterSet 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 71 of file PythonParameterSet.h.

References addParameter(), and theParameterSet.

Referenced by BOOST_PYTHON_MODULE().

00073   {
00074     addParameter(tracked, name, ppset.theParameterSet);
00075   }

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 v2.

Referenced by BOOST_PYTHON_MODULE().

00012 {
00013   std::vector<PythonParameterSet> v
00014     = edm::toVector<PythonParameterSet>(value);
00015   std::vector<edm::ParameterSet> v2;
00016   v2.reserve(v.size());
00017   for(std::vector<PythonParameterSet>::iterator ppsetItr = v.begin(), ppsetItrEnd = v.end();
00018       ppsetItr != ppsetItrEnd; ++ppsetItr)
00019   {
00020     v2.push_back(ppsetItr->theParameterSet);
00021   }
00022   addParameter(tracked, name, v2);
00023 }

std::string PythonParameterSet::dump ( void   )  const [inline]

Definition at line 113 of file PythonParameterSet.h.

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

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

00113 {return theParameterSet.dump();}

template<class T>
T PythonParameterSet::getParameter ( bool  tracked,
std::string const &  name 
) const [inline]

Definition at line 18 of file PythonParameterSet.h.

References HLT_VtxMuL3::result, and theParameterSet.

00019   {
00020     T result;
00021     if(tracked)
00022     {
00023       result = theParameterSet.template getParameter<T>(name);
00024     }
00025     else 
00026     {
00027       result = theParameterSet.template getUntrackedParameter<T>(name, result);
00028     }
00029     return result;
00030   }

template<class T>
boost::python::list PythonParameterSet::getParameters ( bool  tracked,
const std::string &  name 
) const [inline]

templated on the type of the contained object

Definition at line 51 of file PythonParameterSet.h.

References edm::toPythonList(), and v.

00052   {
00053     std::vector<T> v = getParameter<std::vector<T> >(tracked, name);
00054     return edm::toPythonList(v);
00055   }

PythonParameterSet PythonParameterSet::getPSet ( bool  tracked,
std::string const &  name 
) const [inline]

Definition at line 78 of file PythonParameterSet.h.

References PythonParameterSet().

Referenced by BOOST_PYTHON_MODULE().

00079   {
00080     return PythonParameterSet(getParameter<edm::ParameterSet>(tracked, name));
00081   }

boost::python::list PythonParameterSet::getVPSet ( bool  tracked,
std::string const &  name 
)

Definition at line 26 of file PythonParameterSet.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), edm::es::l(), list(), PythonParameterSet(), theParameterSet, and v.

Referenced by BOOST_PYTHON_MODULE().

00027 {
00028   std::vector<edm::ParameterSet> v;
00029   if(tracked)
00030   {
00031     v = theParameterSet.getParameter<std::vector<edm::ParameterSet> >(name);
00032   }
00033   else
00034   {
00035     v = theParameterSet.getUntrackedParameter<std::vector<edm::ParameterSet> >(name);
00036   }
00037 
00038   // convert to PythonParameterSets
00039   boost::python::list l;
00040   for(std::vector<edm::ParameterSet>::const_iterator psetItr = v.begin(), psetItrEnd = v.end();
00041       psetItr != psetItrEnd; ++psetItr)
00042   {
00043     l.append(PythonParameterSet(*psetItr));
00044   }
00045 
00046   return l;
00047 }

edm::EventID PythonParameterSet::newEventID ( unsigned int  run,
unsigned int  event 
) [inline]

Definition at line 97 of file PythonParameterSet.h.

Referenced by BOOST_PYTHON_MODULE().

00098   {
00099     return edm::EventID(run, event);
00100   }

edm::InputTag PythonParameterSet::newInputTag ( const std::string &  label,
const std::string &  instance,
const std::string &  process 
) [inline]

Definition at line 90 of file PythonParameterSet.h.

Referenced by BOOST_PYTHON_MODULE().

00093   {
00094     return edm::InputTag(label, instance, process);
00095   }

edm::LuminosityBlockID PythonParameterSet::newLuminosityBlockID ( unsigned int  run,
unsigned int  lumi 
) [inline]

Definition at line 102 of file PythonParameterSet.h.

Referenced by BOOST_PYTHON_MODULE().

00103   {
00104     return edm::LuminosityBlockID(run, lumi);
00105   }

PythonParameterSet PythonParameterSet::newPSet (  )  const [inline]

Definition at line 109 of file PythonParameterSet.h.

References PythonParameterSet().

Referenced by BOOST_PYTHON_MODULE().

00109 {return PythonParameterSet();}

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

Definition at line 111 of file PythonParameterSet.h.

References theParameterSet.

Referenced by PythonProcessDesc::processDesc().

00111 {return theParameterSet;}


Member Data Documentation

edm::ParameterSet PythonParameterSet::theParameterSet [private]

Definition at line 116 of file PythonParameterSet.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:32 2009 for CMSSW by  doxygen 1.5.4