CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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,
ParameterSetID
ParameterSetIdConverter
 
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 62 of file ParameterSetConverter.cc.

References convertParameterSets(), i, edm::ParameterSet::id(), j, mainParameterSets_, noConvertParameterSets(), parameterSetIdConverter_, parameterSets_, edm::ParameterSet::registerIt(), replace_, and triggerPaths_.

64  :
67  triggerPaths_(),
68  replace_(),
69  parameterSetIdConverter_(idConverter)
70  {
71  for (ParameterSetMap::const_iterator i = psetMap.begin(), iEnd = psetMap.end(); i != iEnd; ++i) {
72  parameterSets_.push_back(std::make_pair(i->second.pset(), i->first));
73  }
74  if (alreadyByReference) {
76  } else {
77  replace_.insert(std::make_pair(std::string("=+p({})"), std::string("=+q({})")));
79  }
80  for (std::vector<MainParameterSet>::iterator j = mainParameterSets_.begin(), jEnd = mainParameterSets_.end(); j != jEnd; ++j) {
81  for (std::vector<TriggerPath>::iterator i = triggerPaths_.begin(), iEnd = triggerPaths_.end(); i != iEnd; ++i) {
82  if (i->triggerPaths_ == j->triggerPaths_) {
83  j->parameterSet_.addParameter("@trigger_paths", i->parameterSet_);
84  break;
85  }
86  }
87  }
88  for (std::vector<MainParameterSet>::iterator i = mainParameterSets_.begin(), iEnd = mainParameterSets_.end(); i != iEnd; ++i) {
89  ParameterSet& pset = i->parameterSet_;
90  pset.registerIt();
91  ParameterSetID newID(pset.id());
92  if (i->oldID_ != newID && i->oldID_ != ParameterSetID()) {
93  parameterSetIdConverter_.insert(std::make_pair(i->oldID_, newID));
94  }
95  }
96  }
int i
Definition: DBlmapReader.cc:9
ParameterSetIdConverter & parameterSetIdConverter_
std::vector< MainParameterSet > mainParameterSets_
std::vector< TriggerPath > triggerPaths_
int j
Definition: DBlmapReader.cc:9
Hash< ParameterSetType > ParameterSetID
edm::ParameterSetConverter::~ParameterSetConverter ( )

Definition at line 98 of file ParameterSetConverter.cc.

98 {}

Member Function Documentation

void edm::ParameterSetConverter::convertParameterSets ( )
private

Definition at line 117 of file ParameterSetConverter.cc.

References StringMap::begin(), findQualityFiles::comma, alignCSCRings::e, StringMap::end(), f, i, edm::ParameterSet::id(), j, mainParameterSets_, parameterSetIdConverter_, parameterSets_, csv2json::pieces, edm::ParameterSet::registerIt(), replace_, edm::split(), groupFilesInBlocks::temp, edm::Hash< I >::toString(), and triggerPaths_.

Referenced by ParameterSetConverter().

117  {
118  std::string const comma(",");
119  std::string const rparam(")");
120  std::string const rvparam("})");
121  std::string const loldparam("=+P(");
122  std::string const loldvparam("=+p({");
123  std::string const lparam("=+Q(");
124  std::string const lvparam("=+q({");
125  bool doItAgain = false;
126  for (StringMap::const_iterator j = replace_.begin(), jEnd = replace_.end(); j != jEnd; ++j) {
127  for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) {
128  for (std::string::size_type it = i->first.find(j->first); it != std::string::npos; it = i->first.find(j->first)) {
129  i->first.replace(it, j->first.size(), j->second);
130  doItAgain = true;
131  }
132  }
133  }
134  for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) {
135  if (i->first.find("+P") == std::string::npos && i->first.find("+p") == std::string::npos) {
136  if (i->first.find("@all_sources") != std::string::npos) {
137  mainParameterSets_.push_back(MainParameterSet(i->second, i->first));
138  } else {
139  ParameterSet pset(i->first);
140  pset.registerIt();
141  std::string& from = i->first;
142  std::string to;
143  ParameterSetID newID(pset.id());
144  newID.toString(to);
145  insertIntoReplace(replace_, loldparam, from, rparam, lparam, to, rparam);
146  insertIntoReplace(replace_, comma, from, comma, comma, to, comma);
147  insertIntoReplace(replace_, comma, from, rvparam, comma, to, rvparam);
148  insertIntoReplace(replace_, loldvparam, from, comma, lvparam, to, comma);
149  insertIntoReplace(replace_, loldvparam, from, rvparam, lvparam, to, rvparam);
150  if (i->second != newID && i->second != ParameterSetID()) {
151  parameterSetIdConverter_.insert(std::make_pair(i->second, newID));
152  }
153  if (i->first.find("@trigger_paths") != std::string::npos) {
154  triggerPaths_.push_back(pset);
155  }
156  }
157  StringWithIDList::iterator icopy = i;
158  ++i;
159  parameterSets_.erase(icopy);
160  --i;
161  doItAgain = true;
162  }
163  }
164  if (!doItAgain && !parameterSets_.empty()) {
165  for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) {
166  std::list<std::string> pieces;
167  split(std::back_inserter(pieces), i->first, '<', ';', '>');
168  for (std::list<std::string>::iterator i= pieces.begin(), e = pieces.end(); i != e; ++i) {
169  std::string removeName = i->substr(i->find('+'));
170  if (removeName.size() >= 4) {
171  if (removeName[1] == 'P') {
172  std::string psetString(removeName.begin()+3, removeName.end()-1);
173  parameterSets_.push_back(std::make_pair(psetString, ParameterSetID()));
174  doItAgain = true;
175  } else if (removeName[1] == 'p') {
176  std::string pvec = std::string(removeName.begin()+3, removeName.end()-1);
178  split(std::back_inserter(temp), pvec, '{', ',', '}');
179  for (StringList::const_iterator j = temp.begin(), f = temp.end(); j != f; ++j) {
180  parameterSets_.push_back(std::make_pair(*j, ParameterSetID()));
181  }
182  doItAgain = true;
183  }
184  }
185  }
186  }
187  }
188  if (doItAgain) {
190  }
191  }
int i
Definition: DBlmapReader.cc:9
const_iterator end() const
Definition: StringMap.h:32
tuple pieces
Definition: csv2json.py:31
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
int j
Definition: DBlmapReader.cc:9
double f[11][100]
bool split(OutIter result, std::string const &string_to_split, char first, char sep, char last)
Definition: split.h:88
Hash< ParameterSetType > ParameterSetID
static std::string from(" from ")
void toString(std::string &result) const
Definition: Hash.h:188
std::list< std::string > StringList
void edm::ParameterSetConverter::noConvertParameterSets ( )
private

Definition at line 101 of file ParameterSetConverter.cc.

References i, edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), mainParameterSets_, parameterSets_, edm::ParameterSet::setID(), and triggerPaths_.

Referenced by ParameterSetConverter().

101  {
102  for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) {
103  if (i->first.find("@all_sources") != std::string::npos) {
104  mainParameterSets_.push_back(MainParameterSet(i->second, i->first));
105  } else {
106  ParameterSet pset(i->first);
107  pset.setID(i->second);
109  if (i->first.find("@trigger_paths") != std::string::npos) {
110  triggerPaths_.push_back(pset);
111  }
112  }
113  }
114  }
int i
Definition: DBlmapReader.cc:9
static ThreadSafeRegistry * instance()
std::vector< MainParameterSet > mainParameterSets_
std::vector< TriggerPath > triggerPaths_
bool insertMapped(value_type const &v)
ParameterSetIdConverter const& edm::ParameterSetConverter::parameterSetIdConverter ( ) const
inline

Definition at line 49 of file ParameterSetConverter.h.

References parameterSetIdConverter_.

ParameterSetIdConverter & parameterSetIdConverter_

Member Data Documentation

std::vector<MainParameterSet> edm::ParameterSetConverter::mainParameterSets_
private
ParameterSetIdConverter& edm::ParameterSetConverter::parameterSetIdConverter_
private
StringWithIDList edm::ParameterSetConverter::parameterSets_
private
StringMap edm::ParameterSetConverter::replace_
private

Definition at line 56 of file ParameterSetConverter.h.

Referenced by convertParameterSets(), and ParameterSetConverter().

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