CMS 3D CMS Logo

Classes | Public Member Functions | Static Public Member Functions | Private Attributes | Friends

gen::ParameterCollector Class Reference

#include <ParameterCollector.h>

List of all members.

Classes

class  const_iterator

Public Member Functions

const_iterator begin () const
const_iterator begin (std::ostream &dump) const
const_iterator begin (const std::string &block, std::ostream &dump) const
const_iterator begin (const std::string &block) const
const_iterator end () const
 ParameterCollector (const edm::ParameterSet &pset)
 ParameterCollector ()
 ~ParameterCollector ()

Static Public Member Functions

static std::string resolve (const std::string &line)

Private Attributes

std::map< std::string,
std::vector< std::string > > 
contents_

Friends

class const_iterator

Detailed Description

Definition at line 26 of file ParameterCollector.h.


Constructor & Destructor Documentation

ParameterCollector::ParameterCollector ( )

Definition at line 14 of file ParameterCollector.cc.

{
}
ParameterCollector::ParameterCollector ( const edm::ParameterSet pset)

Definition at line 18 of file ParameterCollector.cc.

References contents_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), and h::names.

{
   std::vector<std::string> names =
                pset.getParameterNamesForType<std::vector<std::string> >();

   for(std::vector<std::string>::const_iterator it = names.begin();
       it != names.end(); ++it)
      contents_[*it] = pset.getParameter<std::vector<std::string> >(*it);
}
ParameterCollector::~ParameterCollector ( )

Definition at line 28 of file ParameterCollector.cc.

{
}

Member Function Documentation

ParameterCollector::const_iterator ParameterCollector::begin ( void  ) const

Definition at line 95 of file ParameterCollector.cc.

References edm::errors::Configuration, const_iterator, contents_, and pos.

Referenced by Herwig6Hadronizer::initialize(), Pythia8Hadronizer::initializeForExternalPartons(), gen::PomwigHadronizer::initializeForInternalPartons(), Pythia8Hadronizer::initializeForInternalPartons(), and ThePEGInterface::initRepository().

{
   std::map<std::string, std::vector<std::string> >::const_iterator
                                        pos = contents_.find("parameterSets");
   if (pos == contents_.end())
      throw edm::Exception(edm::errors::Configuration)
         << "ParameterCollector could not find \"parameterSets\" block.";

   return const_iterator(this, pos->second.begin(), pos->second.end(), true);
}
ParameterCollector::const_iterator ParameterCollector::begin ( std::ostream &  dump) const

Definition at line 106 of file ParameterCollector.cc.

References edm::errors::Configuration, const_iterator, contents_, ExpressReco_HICollisions_FallBack::dump, and pos.

{
   std::map<std::string, std::vector<std::string> >::const_iterator
                                        pos = contents_.find("parameterSets");
   if (pos == contents_.end())
      throw edm::Exception(edm::errors::Configuration)
         << "ParameterCollector could not find \"parameterSets\" block.";

   return const_iterator(this, pos->second.begin(), pos->second.end(),
                         true, &dump);
}
ParameterCollector::const_iterator ParameterCollector::begin ( const std::string &  block,
std::ostream &  dump 
) const

Definition at line 129 of file ParameterCollector.cc.

References edm::errors::Configuration, const_iterator, contents_, ExpressReco_HICollisions_FallBack::dump, and pos.

{
   std::map<std::string, std::vector<std::string> >::const_iterator
                                                pos = contents_.find(block);
   if (pos == contents_.end())
      throw edm::Exception(edm::errors::Configuration)
         << "ParameterCollector could not find \"" << block << "\" block.";

   dump << "\n####### " << block << " #######" << std::endl;

   return const_iterator(this, pos->second.begin(), pos->second.end(),
                         false, &dump);
}
ParameterCollector::const_iterator ParameterCollector::begin ( const std::string &  block) const

Definition at line 118 of file ParameterCollector.cc.

References edm::errors::Configuration, const_iterator, contents_, and pos.

{
   std::map<std::string, std::vector<std::string> >::const_iterator
                                                pos = contents_.find(block);
   if (pos == contents_.end())
      throw edm::Exception(edm::errors::Configuration)
         << "ParameterCollector could not find \"" << block << "\" block.";

   return const_iterator(this, pos->second.begin(), pos->second.end());
}
const_iterator gen::ParameterCollector::end ( void  ) const [inline]
std::string ParameterCollector::resolve ( const std::string &  line) [static]

Definition at line 143 of file ParameterCollector.cc.

References path(), pos, and query::result.

{
   std::string result(line);

   for(;;) {
      std::string::size_type pos = result.find("${");
      if (pos == std::string::npos)
         break;

      std::string::size_type endpos = result.find('}', pos);
      if (endpos == std::string::npos)
         break;
      else
         ++endpos;

      std::string var = result.substr(pos + 2, endpos - pos - 3);
      const char *path = std::getenv(var.c_str());

      result.replace(pos, endpos - pos, path ? path : "");
   }

   return result;
}

Friends And Related Function Documentation

friend class const_iterator [friend]

Definition at line 85 of file ParameterCollector.h.

Referenced by begin(), and end().


Member Data Documentation

std::map<std::string, std::vector<std::string> > gen::ParameterCollector::contents_ [private]

Definition at line 87 of file ParameterCollector.h.

Referenced by begin(), and ParameterCollector().