CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::ParameterSetConverter Class Reference

#include <ParameterSetConverter.h>

Public Types

typedef std::map< ParameterSetID, ParameterSetIDParameterSetIdConverter
 
typedef std::list< std::string > StringList
 
typedef std::map< std::string, std::string > StringMap
 
typedef std::list< std::pair< std::string, ParameterSetID > > StringWithIDList
 

Public Member Functions

ParameterSetConverteroperator= (const ParameterSetConverter &)=delete
 
 ParameterSetConverter (const ParameterSetConverter &)=delete
 
 ParameterSetConverter (ParameterSetMap const &psetMap, ParameterSetIdConverter &idConverter, bool alreadyByReference)
 
ParameterSetIdConverter const & parameterSetIdConverter () const
 
 ~ParameterSetConverter ()
 

Private Member Functions

void convertParameterSets ()
 
void noConvertParameterSets ()
 

Private Attributes

std::vector< MainParameterSetmainParameterSets_
 
ParameterSetIdConverterparameterSetIdConverter_
 
StringWithIDList parameterSets_
 
StringMap replace_
 
std::vector< TriggerPathtriggerPaths_
 

Detailed Description

Definition at line 40 of file ParameterSetConverter.h.

Member Typedef Documentation

◆ ParameterSetIdConverter

Definition at line 45 of file ParameterSetConverter.h.

◆ StringList

typedef std::list<std::string> edm::ParameterSetConverter::StringList

Definition at line 42 of file ParameterSetConverter.h.

◆ StringMap

typedef std::map<std::string, std::string> edm::ParameterSetConverter::StringMap

Definition at line 43 of file ParameterSetConverter.h.

◆ StringWithIDList

typedef std::list<std::pair<std::string, ParameterSetID> > edm::ParameterSetConverter::StringWithIDList

Definition at line 44 of file ParameterSetConverter.h.

Constructor & Destructor Documentation

◆ ParameterSetConverter() [1/2]

edm::ParameterSetConverter::ParameterSetConverter ( ParameterSetMap const &  psetMap,
ParameterSetIdConverter idConverter,
bool  alreadyByReference 
)

Definition at line 59 of file ParameterSetConverter.cc.

63  for (ParameterSetMap::const_iterator i = psetMap.begin(), iEnd = psetMap.end(); i != iEnd; ++i) {
64  parameterSets_.push_back(std::make_pair(i->second.pset(), i->first));
65  }
66  if (alreadyByReference) {
68  } else {
69  replace_.insert(std::make_pair(std::string("=+p({})"), std::string("=+q({})")));
71  }
72  for (std::vector<MainParameterSet>::iterator j = mainParameterSets_.begin(), jEnd = mainParameterSets_.end();
73  j != jEnd;
74  ++j) {
75  for (std::vector<TriggerPath>::iterator i = triggerPaths_.begin(), iEnd = triggerPaths_.end(); i != iEnd; ++i) {
76  if (i->triggerPaths_ == j->triggerPaths_) {
77  j->parameterSet_.addParameter("@trigger_paths", i->parameterSet_);
78  break;
79  }
80  }
81  }
82  for (std::vector<MainParameterSet>::iterator i = mainParameterSets_.begin(), iEnd = mainParameterSets_.end();
83  i != iEnd;
84  ++i) {
85  ParameterSet& pset = i->parameterSet_;
86  pset.registerIt();
87  ParameterSetID newID(pset.id());
88  if (i->oldID_ != newID && i->oldID_ != ParameterSetID()) {
89  parameterSetIdConverter_.insert(std::make_pair(i->oldID_, newID));
90  }
91  }
92  }

References convertParameterSets(), mps_fire::i, dqmiolumiharvest::j, mainParameterSets_, noConvertParameterSets(), parameterSetIdConverter_, parameterSets_, muonDTDigis_cfi::pset, replace_, AlCaHLTBitMon_QueryRunRegistry::string, and triggerPaths_.

◆ ~ParameterSetConverter()

edm::ParameterSetConverter::~ParameterSetConverter ( )

Definition at line 94 of file ParameterSetConverter.cc.

94 {}

◆ ParameterSetConverter() [2/2]

edm::ParameterSetConverter::ParameterSetConverter ( const ParameterSetConverter )
delete

Member Function Documentation

◆ convertParameterSets()

void edm::ParameterSetConverter::convertParameterSets ( )
private

Definition at line 111 of file ParameterSetConverter.cc.

111  {
112  std::string const comma(",");
113  std::string const rparam(")");
114  std::string const rvparam("})");
115  std::string const loldparam("=+P(");
116  std::string const loldvparam("=+p({");
117  std::string const lparam("=+Q(");
118  std::string const lvparam("=+q({");
119  bool doItAgain = false;
120  for (StringMap::const_iterator j = replace_.begin(), jEnd = replace_.end(); j != jEnd; ++j) {
121  for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) {
122  for (std::string::size_type it = i->first.find(j->first); it != std::string::npos;
123  it = i->first.find(j->first)) {
124  i->first.replace(it, j->first.size(), j->second);
125  doItAgain = true;
126  }
127  }
128  }
129  for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) {
130  if (i->first.find("+P") == std::string::npos && i->first.find("+p") == std::string::npos) {
131  if (i->first.find("@all_sources") != std::string::npos) {
132  mainParameterSets_.push_back(MainParameterSet(i->second, i->first));
133  } else {
134  ParameterSet pset(i->first);
135  pset.registerIt();
136  std::string& from = i->first;
137  std::string to;
138  ParameterSetID newID(pset.id());
139  newID.toString(to);
140  insertIntoReplace(replace_, loldparam, from, rparam, lparam, to, rparam);
141  insertIntoReplace(replace_, comma, from, comma, comma, to, comma);
142  insertIntoReplace(replace_, comma, from, rvparam, comma, to, rvparam);
143  insertIntoReplace(replace_, loldvparam, from, comma, lvparam, to, comma);
144  insertIntoReplace(replace_, loldvparam, from, rvparam, lvparam, to, rvparam);
145  if (i->second != newID && i->second != ParameterSetID()) {
146  parameterSetIdConverter_.insert(std::make_pair(i->second, newID));
147  }
148  if (i->first.find("@trigger_paths") != std::string::npos) {
149  triggerPaths_.push_back(pset);
150  }
151  }
152  StringWithIDList::iterator icopy = i;
153  ++i;
154  parameterSets_.erase(icopy);
155  --i;
156  doItAgain = true;
157  }
158  }
159  if (!doItAgain && !parameterSets_.empty()) {
160  for (auto const& k : parameterSets_) {
161  std::list<std::string> pieces;
162  split(std::back_inserter(pieces), k.first, '<', ';', '>');
163  for (std::list<std::string>::iterator i = pieces.begin(), e = pieces.end(); i != e; ++i) {
164  std::string removeName = i->substr(i->find('+'));
165  if (removeName.size() >= 4) {
166  if (removeName[1] == 'P') {
167  std::string psetString(removeName.begin() + 3, removeName.end() - 1);
168  parameterSets_.push_back(std::make_pair(psetString, ParameterSetID()));
169  doItAgain = true;
170  } else if (removeName[1] == 'p') {
171  std::string pvec = std::string(removeName.begin() + 3, removeName.end() - 1);
173  split(std::back_inserter(temp), pvec, '{', ',', '}');
174  for (StringList::const_iterator j = temp.begin(), f = temp.end(); j != f; ++j) {
175  parameterSets_.push_back(std::make_pair(*j, ParameterSetID()));
176  }
177  doItAgain = true;
178  }
179  }
180  }
181  }
182  }
183  if (doItAgain) {
185  }
186  }

References StringMap::begin(), findQualityFiles::comma, MillePedeFileConverter_cfg::e, StringMap::end(), f, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, mainParameterSets_, parameterSetIdConverter_, parameterSets_, csv2json::pieces, muonDTDigis_cfi::pset, replace_, edm::split(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, edm::Hash< I >::toString(), and triggerPaths_.

Referenced by ParameterSetConverter().

◆ noConvertParameterSets()

void edm::ParameterSetConverter::noConvertParameterSets ( )
private

Definition at line 96 of file ParameterSetConverter.cc.

96  {
97  for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) {
98  if (i->first.find("@all_sources") != std::string::npos) {
99  mainParameterSets_.push_back(MainParameterSet(i->second, i->first));
100  } else {
101  ParameterSet pset(i->first);
102  pset.setID(i->second);
104  if (i->first.find("@trigger_paths") != std::string::npos) {
105  triggerPaths_.push_back(pset);
106  }
107  }
108  }
109  }

References mps_fire::i, edm::pset::Registry::insertMapped(), edm::pset::Registry::instance(), mainParameterSets_, parameterSets_, muonDTDigis_cfi::pset, and triggerPaths_.

Referenced by ParameterSetConverter().

◆ operator=()

ParameterSetConverter& edm::ParameterSetConverter::operator= ( const ParameterSetConverter )
delete

◆ parameterSetIdConverter()

ParameterSetIdConverter const& edm::ParameterSetConverter::parameterSetIdConverter ( ) const
inline

Definition at line 53 of file ParameterSetConverter.h.

53 { return parameterSetIdConverter_; }

References parameterSetIdConverter_.

Member Data Documentation

◆ mainParameterSets_

std::vector<MainParameterSet> edm::ParameterSetConverter::mainParameterSets_
private

◆ parameterSetIdConverter_

ParameterSetIdConverter& edm::ParameterSetConverter::parameterSetIdConverter_
private

◆ parameterSets_

StringWithIDList edm::ParameterSetConverter::parameterSets_
private

◆ replace_

StringMap edm::ParameterSetConverter::replace_
private

Definition at line 61 of file ParameterSetConverter.h.

Referenced by convertParameterSets(), and ParameterSetConverter().

◆ triggerPaths_

std::vector<TriggerPath> edm::ParameterSetConverter::triggerPaths_
private
edm::ParameterSetID
Hash< ParameterSetType > ParameterSetID
Definition: ParameterSetID.h:21
edm::ParameterSetConverter::mainParameterSets_
std::vector< MainParameterSet > mainParameterSets_
Definition: ParameterSetConverter.h:59
edm::pset::Registry::instance
static Registry * instance()
Definition: Registry.cc:12
mps_fire.i
i
Definition: mps_fire.py:428
edm::ParameterSetConverter::convertParameterSets
void convertParameterSets()
Definition: ParameterSetConverter.cc:111
edm::ParameterSetConverter::triggerPaths_
std::vector< TriggerPath > triggerPaths_
Definition: ParameterSetConverter.h:60
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
edm::ParameterSetConverter::noConvertParameterSets
void noConvertParameterSets()
Definition: ParameterSetConverter.cc:96
findQualityFiles.comma
string comma
Definition: findQualityFiles.py:451
to
StringMap::const_iterator
vector_type::const_iterator const_iterator
Definition: StringMap.h:12
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::ParameterSetConverter::replace_
StringMap replace_
Definition: ParameterSetConverter.h:61
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::ParameterSetConverter::StringList
std::list< std::string > StringList
Definition: ParameterSetConverter.h:42
dqmdumpme.k
k
Definition: dqmdumpme.py:60
csv2json.pieces
pieces
Definition: csv2json.py:32
ParameterSet
Definition: Functions.h:16
edm::Hash::toString
void toString(std::string &result) const
Definition: Hash.h:171
StringMap::end
const_iterator end() const
Definition: StringMap.h:32
edm::ParameterSetConverter::parameterSets_
StringWithIDList parameterSets_
Definition: ParameterSetConverter.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::pset::Registry::insertMapped
bool insertMapped(value_type const &v, bool forceUpdate=false)
Definition: Registry.cc:32
StringMap::begin
const_iterator begin() const
Definition: StringMap.h:31
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::ParameterSetConverter::parameterSetIdConverter_
ParameterSetIdConverter & parameterSetIdConverter_
Definition: ParameterSetConverter.h:62
edm::split
bool split(OutIter result, std::string const &string_to_split, char first, char sep, char last)
Definition: split.h:68
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37