CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Attributes | Friends
gen::ParameterCollector Class Reference

#include <ParameterCollector.h>

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) const
 
const_iterator begin (const std::string &block, std::ostream &dump) const
 
const_iterator end () const
 
 ParameterCollector ()
 
 ParameterCollector (const edm::ParameterSet &pset)
 
 ~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() [1/2]

ParameterCollector::ParameterCollector ( )

Definition at line 14 of file ParameterCollector.cc.

14 {}

◆ ParameterCollector() [2/2]

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

Definition at line 16 of file ParameterCollector.cc.

References contents_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, names, and muonDTDigis_cfi::pset.

16  {
17  std::vector<std::string> names = pset.getParameterNamesForType<std::vector<std::string> >();
18 
19  for (std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); ++it)
20  contents_[*it] = pset.getParameter<std::vector<std::string> >(*it);
21 }
const std::string names[nVars_]
std::map< std::string, std::vector< std::string > > contents_

◆ ~ParameterCollector()

ParameterCollector::~ParameterCollector ( )

Definition at line 23 of file ParameterCollector.cc.

23 {}

Member Function Documentation

◆ begin() [1/4]

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

Definition at line 83 of file ParameterCollector.cc.

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

Referenced by gen::ParameterCollector::const_iterator::const_iterator(), Herwig7Interface::createInputFile(), gen::Py8HMC3InterfaceBase::readSettings(), and gen::Py8InterfaceBase::readSettings().

83  {
84  std::map<std::string, std::vector<std::string> >::const_iterator pos = contents_.find("parameterSets");
85  if (pos == contents_.end())
86  throw edm::Exception(edm::errors::Configuration) << "ParameterCollector could not find \"parameterSets\" block.";
87 
88  return const_iterator(this, pos->second.begin(), pos->second.end(), true);
89 }
std::map< std::string, std::vector< std::string > > contents_

◆ begin() [2/4]

ParameterCollector::const_iterator ParameterCollector::begin ( std::ostream &  dump) const

Definition at line 91 of file ParameterCollector.cc.

References edm::errors::Configuration, const_iterator, contents_, and GCP_Ntuples_cfg::dump.

91  {
92  std::map<std::string, std::vector<std::string> >::const_iterator pos = contents_.find("parameterSets");
93  if (pos == contents_.end())
94  throw edm::Exception(edm::errors::Configuration) << "ParameterCollector could not find \"parameterSets\" block.";
95 
96  return const_iterator(this, pos->second.begin(), pos->second.end(), true, &dump);
97 }
std::map< std::string, std::vector< std::string > > contents_

◆ begin() [3/4]

ParameterCollector::const_iterator ParameterCollector::begin ( const std::string &  block) const

Definition at line 99 of file ParameterCollector.cc.

References groupFilesInBlocks::block, edm::errors::Configuration, const_iterator, and contents_.

99  {
100  std::map<std::string, std::vector<std::string> >::const_iterator pos = contents_.find(block);
101  if (pos == contents_.end())
102  throw edm::Exception(edm::errors::Configuration) << "ParameterCollector could not find \"" << block << "\" block.";
103 
104  return const_iterator(this, pos->second.begin(), pos->second.end());
105 }
std::map< std::string, std::vector< std::string > > contents_

◆ begin() [4/4]

ParameterCollector::const_iterator ParameterCollector::begin ( const std::string &  block,
std::ostream &  dump 
) const

Definition at line 107 of file ParameterCollector.cc.

References groupFilesInBlocks::block, edm::errors::Configuration, const_iterator, contents_, and GCP_Ntuples_cfg::dump.

107  {
108  std::map<std::string, std::vector<std::string> >::const_iterator pos = contents_.find(block);
109  if (pos == contents_.end())
110  throw edm::Exception(edm::errors::Configuration) << "ParameterCollector could not find \"" << block << "\" block.";
111 
112  dump << "\n####### " << block << " #######" << std::endl;
113 
114  return const_iterator(this, pos->second.begin(), pos->second.end(), false, &dump);
115 }
std::map< std::string, std::vector< std::string > > contents_

◆ end()

const_iterator gen::ParameterCollector::end ( void  ) const
inline

◆ resolve()

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

Definition at line 117 of file ParameterCollector.cc.

References mps_splice::line, EnsembleCalibrationLA_cfg::path, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, and ALCARECOEcalPhiSym_cff::var.

Referenced by Herwig::HerwigUIProvider::HerwigUIProvider().

117  {
119 
120  for (;;) {
121  std::string::size_type pos = result.find("${");
122  if (pos == std::string::npos)
123  break;
124 
125  std::string::size_type endpos = result.find('}', pos);
126  if (endpos == std::string::npos)
127  break;
128  else
129  ++endpos;
130 
131  std::string var = result.substr(pos + 2, endpos - pos - 3);
132  const char *path = std::getenv(var.c_str());
133 
134  result.replace(pos, endpos - pos, path ? path : "");
135  }
136 
137  return result;
138 }
uint16_t size_type

Friends And Related Function Documentation

◆ const_iterator

friend class const_iterator
friend

Definition at line 83 of file ParameterCollector.h.

Referenced by begin(), and end().

Member Data Documentation

◆ contents_

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

Definition at line 85 of file ParameterCollector.h.

Referenced by begin(), and ParameterCollector().