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 (ParameterSetMap const &psetMap, ParameterSetIdConverter &idConverter, bool alreadyByReference)
 
 ParameterSetConverter (const ParameterSetConverter &)=delete
 
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.

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

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  }
ParameterSetIdConverter & parameterSetIdConverter_
std::vector< MainParameterSet > mainParameterSets_
std::vector< TriggerPath > triggerPaths_
Hash< ParameterSetType > ParameterSetID

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

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

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  }
ParameterSetIdConverter & parameterSetIdConverter_
uint16_t size_type
std::vector< MainParameterSet > mainParameterSets_
std::vector< TriggerPath > triggerPaths_
vector_type::const_iterator const_iterator
Definition: StringMap.h:12
double f[11][100]
bool split(OutIter result, std::string const &string_to_split, char first, char sep, char last)
Definition: split.h:68
Hash< ParameterSetType > ParameterSetID
void toString(std::string &result) const
Definition: Hash.h:171
const_iterator end() const
Definition: StringMap.h:32
const_iterator begin() const
Definition: StringMap.h:31
std::list< std::string > StringList

◆ noConvertParameterSets()

void edm::ParameterSetConverter::noConvertParameterSets ( )
private

Definition at line 96 of file ParameterSetConverter.cc.

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

Referenced by ParameterSetConverter().

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  }
std::vector< MainParameterSet > mainParameterSets_
std::vector< TriggerPath > triggerPaths_
bool insertMapped(value_type const &v, bool forceUpdate=false)
Definition: Registry.cc:32
static Registry * instance()
Definition: Registry.cc:12

◆ operator=()

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

◆ parameterSetIdConverter()

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

Definition at line 53 of file ParameterSetConverter.h.

References parameterSetIdConverter_.

53 { return parameterSetIdConverter_; }
ParameterSetIdConverter & 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