30 using AlignablesMap = std::map<std::string, align::Alignables>;
31 AlignablesMap alisMap;
32 for (align::Alignables::const_iterator iA = alignables.begin(); iA != alignables.end(); ++iA) {
44 const AlignablesMap::iterator itTec = alisMap.find(
"TECEndcap");
45 for (AlignablesMap::iterator it = alisMap.begin(); it != alisMap.end(); ++it) {
50 if (itTec != alisMap.end())
62 std::ostringstream
name;
65 if (!globalParameters.
empty()) {
67 << globalParameters.
getParameterNames().size() <<
" global parameters" << std::endl;
72 LogDebug(
"PrintParameters") <<
indent_ <<
" global parameter is now:" << std::endl;
77 for (align::Alignables::const_iterator iter = alignables.begin(); iter != alignables.end(); ++iter) {
86 << localParameters.
getParameterNames().size() <<
" local parameters" << std::endl;
90 LogDebug(
"PrintParameters") <<
indent_ <<
" parameters to apply:" << std::endl;
98 std::vector<std::string> parameterSetNames;
100 if ((*iter)->size() > 0 && !parameterSetNames.empty())
117 for (std::vector<std::string>::iterator iter = globalParameterNames.begin(); iter != globalParameterNames.end();
122 if (subLocalSet.
empty()) {
124 localSet.
copyFrom(globalSet, (*iter));
132 localSet.
copyFrom(globalSet, (*iter));
149 for (std::vector<std::string>::iterator iter = parameterNames.begin(); iter != parameterNames.end(); ++iter) {
151 LogDebug(
"PropagateParameters") <<
indent_ <<
" - adding parameter " << (*iter) << std::endl;
157 std::vector<std::string> pSetNames;
159 for (std::vector<std::string>::const_iterator it = pSetNames.begin(); it != pSetNames.end(); ++it) {
162 if (rootName.compare(0, rootName.length(), globalRoot) == 0) {
164 LogDebug(
"PropagateParameters") <<
indent_ <<
" - skipping PSet " << (*it) <<
" from global " << globalName
168 LogDebug(
"PropagateParameters") <<
indent_ <<
" - skipping top-level PSet " << (*it) <<
" global " << globalName
173 LogDebug(
"PropagateParameters") <<
indent_ <<
" - skipping PSet " << (*it) <<
" not fitting into global " 174 << globalName << std::endl;
178 throw cms::Exception(
"BadConfig") <<
"Unknown parameter set name " << rootName;
182 LogDebug(
"PropagateParameters") <<
indent_ <<
" - adding PSet " << (*it) <<
" global " << globalName
202 std::vector<std::string> parameterSetNames;
217 unsigned int nFittingPsets = 0;
221 for (std::vector<std::string>::iterator iter = pNames.begin(); iter != pNames.end(); ++iter) {
227 if (numberString.empty()) {
232 size_t pos = numberString.find_first_of(
'_', lastPos);
233 while (std::string::npos !=
pos || std::string::npos != lastPos) {
234 const std::string digit(numberString.substr(lastPos,
pos - lastPos));
236 bool isDigit = !digit.empty();
237 for (std::string::const_iterator dIt = digit.begin(); dIt != digit.end(); ++dIt) {
244 <<
"[MisalignmentScenarioBuilder::getParameterSet_] " 245 <<
"Expect only numbers, separated by '_' after " <<
levelName <<
" in " << *iter << std::endl;
250 if (atoi(digit.c_str()) == iComponent) {
256 lastPos = numberString.find_first_not_of(
'_',
pos);
257 pos = numberString.find_first_of(
'_', lastPos);
261 if (nFittingPsets > 1) {
262 throw cms::Exception(
"BadConfig") <<
"[MisalignmentScenarioBuilder::getParameterSet_] " 263 <<
"Found " << nFittingPsets <<
" PSet for " <<
levelName <<
" " << iComponent
282 for (std::vector<std::string>::iterator iter = parameterNames.begin(); iter != parameterNames.end(); ++iter) {
319 if (
root ==
"DTSector")
321 else if (
root ==
"CSCSector")
323 else if (
root ==
"Muon")
340 const auto lastChar = parameterSetName.length() - 1;
341 if (parameterSetName[lastChar] ==
's') {
342 result = parameterSetName.substr(0, lastChar);
346 for (
auto ichar = lastChar; ichar != 0; --ichar) {
347 if (!isdigit(parameterSetName[ichar])) {
348 result = parameterSetName.substr(0, ichar + 1);
354 LogDebug(
"PrintParameters") <<
"Name was " << parameterSetName <<
", root is " <<
result;
T getParameter(std::string const &) const
void decodeMovements_(const edm::ParameterSet &, const align::Alignables &)
Decode movements defined in given parameter set for given set of alignables.
bool hasParameter_(const std::string &name, const edm::ParameterSet &pSet) const
Check if given parameter exists in parameter set.
void propagateParameters_(const edm::ParameterSet &pSet, const std::string &globalName, edm::ParameterSet &subSet) const
Propagate global parameters to sub-parameters.
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const std::string rootName_(const std::string ¶meterSetName) const
Get root name of a parameter set (e.g. 'Rod' in 'Rods' or 'Rod1')
const std::string names[nVars_]
bool isPropagated(const std::string ¶meterName) const
Check if given parameter should be propagated.
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
MisalignmentScenarioBuilder(AlignableObjectId::Geometry)
Constructor.
edm::ParameterSet getParameterSet_(const std::string &name, const edm::ParameterSet &pSet) const
void copyFrom(ParameterSet const &from, std::string const &name)
void addParameter(std::string const &name, T const &value)
const char * levelName(LogLevel)
void printParameters_(const edm::ParameterSet &pSet, const bool showPsets=false) const
Print all parameters and values for given set.
AlignableModifier theModifier
Helper class for random movements.
const char * idToString(align::StructureType type) const
std::string indent_
Depth in hierarchy.
bool modify(Alignable *alignable, const edm::ParameterSet &pSet)
Modify given set of alignables according to parameters.
std::vector< Alignable * > Alignables
align::StructureType stringToId(const char *) const
void mergeParameters_(edm::ParameterSet &localSet, const edm::ParameterSet &globalSet) const
Merge two sets of parameters into one (the first argument)
virtual bool possiblyPartOf(const std::string &subStruct, const std::string &largeStruct) const
int theModifierCounter
Counter for applied modification.
const AlignableObjectId alignableObjectId_
std::vector< std::string > getParameterNames() const
virtual bool isTopLevel_(const std::string ¶meterSetName) const
Check if given parameter is for a top-level structure.