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>

Inheritance diagram for edm::ParameterSetConverter:

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

 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 41 of file ParameterSetConverter.h.

Member Typedef Documentation

Definition at line 46 of file ParameterSetConverter.h.

Definition at line 43 of file ParameterSetConverter.h.

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

Definition at line 44 of file ParameterSetConverter.h.

Definition at line 45 of file ParameterSetConverter.h.

Constructor & Destructor Documentation

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

Definition at line 59 of file ParameterSetConverter.cc.

References convertParameterSets(), mps_fire::i, edm::ParameterSet::id(), mainParameterSets_, noConvertParameterSets(), parameterSetIdConverter_, parameterSets_, muonDTDigis_cfi::pset, edm::ParameterSet::registerIt(), 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
edm::ParameterSetConverter::~ParameterSetConverter ( )

Definition at line 94 of file ParameterSetConverter.cc.

94 {}

Member Function Documentation

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, edm::ParameterSet::id(), mainParameterSets_, parameterSetIdConverter_, parameterSets_, csvLumiCalc::pieces, muonDTDigis_cfi::pset, edm::ParameterSet::registerIt(), 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 (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) {
161  std::list<std::string> pieces;
162  split(std::back_inserter(pieces), i->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  }
const_iterator end() const
Definition: StringMap.h:32
const_iterator begin() const
Definition: StringMap.h:31
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:196
std::list< std::string > StringList
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, edm::ParameterSet::setID(), 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
ParameterSetIdConverter const& edm::ParameterSetConverter::parameterSetIdConverter ( ) const
inline

Definition at line 51 of file ParameterSetConverter.h.

51 { return parameterSetIdConverter_; }
ParameterSetIdConverter & parameterSetIdConverter_

Member Data Documentation

std::vector<MainParameterSet> edm::ParameterSetConverter::mainParameterSets_
private
ParameterSetIdConverter& edm::ParameterSetConverter::parameterSetIdConverter_
private

Definition at line 60 of file ParameterSetConverter.h.

Referenced by convertParameterSets(), and ParameterSetConverter().

StringWithIDList edm::ParameterSetConverter::parameterSets_
private
StringMap edm::ParameterSetConverter::replace_
private

Definition at line 59 of file ParameterSetConverter.h.

Referenced by convertParameterSets(), and ParameterSetConverter().

std::vector<TriggerPath> edm::ParameterSetConverter::triggerPaths_
private