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 (const std::string &block) const
 
const_iterator begin (const std::string &block, std::ostream &dump) const
 
const_iterator begin (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.

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 }

References contents_, names, and muonDTDigis_cfi::pset.

◆ ~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.

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 }

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

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

◆ begin() [2/4]

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

Definition at line 99 of file ParameterCollector.cc.

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 }

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

◆ begin() [3/4]

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

Definition at line 107 of file ParameterCollector.cc.

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 }

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

◆ begin() [4/4]

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

Definition at line 91 of file ParameterCollector.cc.

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 }

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

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

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 }

References mps_splice::line, castor_dqm_sourceclient_file_cfg::path, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, and trigObjTnPSource_cfi::var.

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

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().

pos
Definition: PixelAliasList.h:18
edm::Exception
Definition: EDMException.h:77
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:122
gen::ParameterCollector::contents_
std::map< std::string, std::vector< std::string > > contents_
Definition: ParameterCollector.h:85
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FrontierConditions_GlobalTag_cff.dump
dump
Definition: FrontierConditions_GlobalTag_cff.py:12
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
mps_fire.result
result
Definition: mps_fire.py:303
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
mps_splice.line
line
Definition: mps_splice.py:76
edm::errors::Configuration
Definition: EDMException.h:36
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
gen::ParameterCollector::const_iterator
friend class const_iterator
Definition: ParameterCollector.h:83