#include <ParameterSetConverter.h>
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< MainParameterSet > | mainParameterSets_ |
ParameterSetIdConverter & | parameterSetIdConverter_ |
StringWithIDList | parameterSets_ |
StringMap | replace_ |
std::vector< TriggerPath > | triggerPaths_ |
Definition at line 41 of file ParameterSetConverter.h.
typedef std::map<ParameterSetID, ParameterSetID> edm::ParameterSetConverter::ParameterSetIdConverter |
Definition at line 46 of file ParameterSetConverter.h.
typedef std::list<std::string> edm::ParameterSetConverter::StringList |
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.
typedef std::list<std::pair<std::string, ParameterSetID> > edm::ParameterSetConverter::StringWithIDList |
Definition at line 45 of file ParameterSetConverter.h.
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_.
: parameterSets_(), mainParameterSets_(), triggerPaths_(), replace_(), parameterSetIdConverter_(idConverter) { for (ParameterSetMap::const_iterator i = psetMap.begin(), iEnd = psetMap.end(); i != iEnd; ++i) { parameterSets_.push_back(std::make_pair(i->second.pset(), i->first)); } if (alreadyByReference) { noConvertParameterSets(); } else { replace_.insert(std::make_pair(std::string("=+p({})"), std::string("=+q({})"))); convertParameterSets(); } for (std::vector<MainParameterSet>::iterator j = mainParameterSets_.begin(), jEnd = mainParameterSets_.end(); j != jEnd; ++j) { for (std::vector<TriggerPath>::iterator i = triggerPaths_.begin(), iEnd = triggerPaths_.end(); i != iEnd; ++i) { if (i->triggerPaths_ == j->triggerPaths_) { j->parameterSet_.addParameter("@trigger_paths", i->parameterSet_); break; } } } for (std::vector<MainParameterSet>::iterator i = mainParameterSets_.begin(), iEnd = mainParameterSets_.end(); i != iEnd; ++i) { ParameterSet& pset = i->parameterSet_; pset.registerIt(); ParameterSetID newID(pset.id()); if (i->oldID_ != newID && i->oldID_ != ParameterSetID()) { parameterSetIdConverter_.insert(std::make_pair(i->oldID_, newID)); } } }
edm::ParameterSetConverter::~ParameterSetConverter | ( | ) |
Definition at line 98 of file ParameterSetConverter.cc.
{}
void edm::ParameterSetConverter::convertParameterSets | ( | ) | [private] |
Definition at line 117 of file ParameterSetConverter.cc.
References findQualityFiles::comma, f, i, edm::ParameterSet::id(), j, mainParameterSets_, parameterSetIdConverter_, parameterSets_, csv2json::pieces, edm::ParameterSet::registerIt(), replace_, edm::split(), cond::rpcobtemp::temp, edm::Hash< I >::toString(), and triggerPaths_.
Referenced by ParameterSetConverter().
{ std::string const comma(","); std::string const rparam(")"); std::string const rvparam("})"); std::string const loldparam("=+P("); std::string const loldvparam("=+p({"); std::string const lparam("=+Q("); std::string const lvparam("=+q({"); bool doItAgain = false; for (StringMap::const_iterator j = replace_.begin(), jEnd = replace_.end(); j != jEnd; ++j) { for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) { for (std::string::size_type it = i->first.find(j->first); it != std::string::npos; it = i->first.find(j->first)) { i->first.replace(it, j->first.size(), j->second); doItAgain = true; } } } for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) { if (i->first.find("+P") == std::string::npos && i->first.find("+p") == std::string::npos) { if (i->first.find("@all_sources") != std::string::npos) { mainParameterSets_.push_back(MainParameterSet(i->second, i->first)); } else { ParameterSet pset(i->first); pset.registerIt(); std::string& from = i->first; std::string to; ParameterSetID newID(pset.id()); newID.toString(to); insertIntoReplace(replace_, loldparam, from, rparam, lparam, to, rparam); insertIntoReplace(replace_, comma, from, comma, comma, to, comma); insertIntoReplace(replace_, comma, from, rvparam, comma, to, rvparam); insertIntoReplace(replace_, loldvparam, from, comma, lvparam, to, comma); insertIntoReplace(replace_, loldvparam, from, rvparam, lvparam, to, rvparam); if (i->second != newID && i->second != ParameterSetID()) { parameterSetIdConverter_.insert(std::make_pair(i->second, newID)); } if (i->first.find("@trigger_paths") != std::string::npos) { triggerPaths_.push_back(pset); } } StringWithIDList::iterator icopy = i; ++i; parameterSets_.erase(icopy); --i; doItAgain = true; } } if (!doItAgain && !parameterSets_.empty()) { for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) { std::list<std::string> pieces; split(std::back_inserter(pieces), i->first, '<', ';', '>'); for (std::list<std::string>::iterator i= pieces.begin(), e = pieces.end(); i != e; ++i) { std::string removeName = i->substr(i->find('+')); if (removeName.size() >= 4) { if (removeName[1] == 'P') { std::string psetString(removeName.begin()+3, removeName.end()-1); parameterSets_.push_back(std::make_pair(psetString, ParameterSetID())); doItAgain = true; } else if (removeName[1] == 'p') { std::string pvec = std::string(removeName.begin()+3, removeName.end()-1); StringList temp; split(std::back_inserter(temp), pvec, '{', ',', '}'); for (StringList::const_iterator j = temp.begin(), f = temp.end(); j != f; ++j) { parameterSets_.push_back(std::make_pair(*j, ParameterSetID())); } doItAgain = true; } } } } } if (doItAgain) { convertParameterSets(); } }
void edm::ParameterSetConverter::noConvertParameterSets | ( | ) | [private] |
Definition at line 101 of file ParameterSetConverter.cc.
References i, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), mainParameterSets_, parameterSets_, edm::ParameterSet::setID(), and triggerPaths_.
Referenced by ParameterSetConverter().
{ for (StringWithIDList::iterator i = parameterSets_.begin(), iEnd = parameterSets_.end(); i != iEnd; ++i) { if (i->first.find("@all_sources") != std::string::npos) { mainParameterSets_.push_back(MainParameterSet(i->second, i->first)); } else { ParameterSet pset(i->first); pset.setID(i->second); pset::Registry::instance()->insertMapped(pset); if (i->first.find("@trigger_paths") != std::string::npos) { triggerPaths_.push_back(pset); } } } }
ParameterSetIdConverter const& edm::ParameterSetConverter::parameterSetIdConverter | ( | ) | const [inline] |
Definition at line 49 of file ParameterSetConverter.h.
References parameterSetIdConverter_.
{return parameterSetIdConverter_;}
std::vector<MainParameterSet> edm::ParameterSetConverter::mainParameterSets_ [private] |
Definition at line 54 of file ParameterSetConverter.h.
Referenced by convertParameterSets(), noConvertParameterSets(), and ParameterSetConverter().
Definition at line 57 of file ParameterSetConverter.h.
Referenced by convertParameterSets(), ParameterSetConverter(), and parameterSetIdConverter().
Definition at line 53 of file ParameterSetConverter.h.
Referenced by convertParameterSets(), noConvertParameterSets(), and ParameterSetConverter().
Definition at line 56 of file ParameterSetConverter.h.
Referenced by convertParameterSets(), and ParameterSetConverter().
std::vector<TriggerPath> edm::ParameterSetConverter::triggerPaths_ [private] |
Definition at line 55 of file ParameterSetConverter.h.
Referenced by convertParameterSets(), noConvertParameterSets(), and ParameterSetConverter().