25 const std::vector<Alignable*> &alignables)
29 typedef std::map<std::string, std::vector<Alignable*> > AlignablesMap;
30 AlignablesMap alisMap;
31 for (std::vector<Alignable*>::const_iterator iA = alignables.begin(); iA != alignables.end(); ++iA) {
43 const AlignablesMap::iterator itTec = alisMap.find(
"TECEndcap");
44 for (AlignablesMap::iterator it = alisMap.begin(); it != alisMap.end(); ++it) {
45 if (it == itTec)
continue;
48 if (itTec != alisMap.end()) this->
decodeMovements_(pSet, itTec->second, itTec->first);
55 const std::vector<Alignable*> &alignables,
62 std::ostringstream
name;
63 name << levelName <<
"s";
65 if ( !globalParameters.
empty() ) {
66 LogDebug(
"PrintParameters") <<
indent_ <<
" *** " << levelName <<
": found "
68 <<
" global parameters" << std::endl;
73 LogDebug(
"PrintParameters") <<
indent_ <<
" global parameter is now:" << std::endl;
78 for (std::vector<Alignable*>::const_iterator
iter = alignables.begin();
84 name << levelName << iComponent;
87 LogDebug(
"PrintParameters") <<
indent_ <<
" ** " << name.str() <<
": found "
89 <<
" local parameters" << std::endl;
93 LogDebug(
"PrintParameters") <<
indent_ <<
" parameters to apply:" << std::endl;
97 LogDebug(
"PrintParameters") <<
indent_ <<
"Movements applied to " << name.str();
101 std::vector<std::string> parameterSetNames;
103 if ( (*iter)->size() > 0 && parameterSetNames.size() > 0 )
125 for ( std::vector<std::string>::iterator
iter = globalParameterNames.begin();
126 iter != globalParameterNames.end();
iter ++ ) {
131 if ( subLocalSet.
empty() ) {
161 for ( std::vector<std::string>::iterator
iter = parameterNames.begin();
162 iter != parameterNames.end();
iter++ ) {
164 LogDebug(
"PropagateParameters") <<
indent_ <<
" - adding parameter " << (*iter) << std::endl;
170 std::vector<std::string> pSetNames;
172 for ( std::vector<std::string>::const_iterator it = pSetNames.begin();
173 it != pSetNames.end(); it++ ) {
176 if (rootName.compare(0, rootName.length(), globalRoot) == 0) {
178 LogDebug(
"PropagateParameters") <<
indent_ <<
" - skipping PSet " << (*it) <<
" from global "
179 << globalName << std::endl;
183 <<
" - skipping top-level PSet " << (*it)
184 <<
" global " << globalName << std::endl;
189 <<
" - skipping PSet " << (*it)
190 <<
" not fitting into global " << globalName << std::endl;
194 throw cms::Exception(
"BadConfig") <<
"Unknown parameter set name " << rootName;
198 LogDebug(
"PropagateParameters") <<
indent_ <<
" - adding PSet " << (*it)
199 <<
" global " << globalName << std::endl;
222 std::vector<std::string> parameterSetNames;
237 unsigned int nFittingPsets = 0;
241 for (std::vector<std::string>::iterator
iter = pNames.begin();
iter != pNames.end(); ++
iter) {
242 if (
iter->find(levelName) != 0)
continue;
246 if (numberString.empty()) {
251 size_t pos = numberString.find_first_of(
'_', lastPos);
252 while (std::string::npos != pos || std::string::npos != lastPos) {
253 const std::string digit(numberString.substr(lastPos, pos - lastPos));
255 bool isDigit = !digit.empty();
256 for (std::string::const_iterator dIt = digit.begin(); dIt != digit.end(); ++dIt) {
257 if (!isdigit(*dIt)) isDigit =
false;
261 throw cms::Exception(
"BadConfig") <<
"[MisalignmentScenarioBuilder::getParameterSet_] "
262 <<
"Expect only numbers, separated by '_' after "
263 << levelName <<
" in " << *
iter << std::endl;
268 if (atoi(digit.c_str()) == iComponent) {
271 << levelName << iComponent;
275 lastPos = numberString.find_first_not_of(
'_', pos);
276 pos = numberString.find_first_of(
'_', lastPos);
280 if (nFittingPsets > 1) {
281 throw cms::Exception(
"BadConfig") <<
"[MisalignmentScenarioBuilder::getParameterSet_] "
282 <<
"Found " << nFittingPsets <<
" PSet for "
283 << levelName <<
" " << iComponent <<
"." << std::endl;
297 return (
std::find( names.begin(), names.end(),
name ) != names.end() );
305 const bool showPsets )
const
309 for ( std::vector<std::string>::iterator
iter = parameterNames.begin();
310 iter != parameterNames.end();
iter++ ) {
349 if ( root ==
"DTSector" )
return true;
350 else if ( root ==
"CSCSector" )
return true;
351 else if ( root ==
"Muon" )
return true;
373 const int lastChar = parameterSetName.length()-1;
374 if ( parameterSetName[lastChar] ==
's' ) {
375 result = parameterSetName.substr( 0, lastChar );
378 for (
unsigned int ichar = 0; ichar<parameterSetName.length(); ichar++ ) {
379 if ( isdigit(parameterSetName[ichar]) ) {
380 result = parameterSetName.substr( 0, ichar );
386 LogDebug(
"PrintParameters") <<
"Name was " << parameterSetName <<
", root is " <<
result;
T getParameter(std::string const &) const
virtual bool possiblyPartOf(const std::string &subStruct, const std::string &largeStruct) const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
static const HistoName names[]
void printParameters_(const edm::ParameterSet &pSet, const bool showPsets=false) const
Print all parameters and values for given set.
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')
static align::StructureType stringToId(const char *)
void copyFrom(ParameterSet const &from, std::string const &name)
void addParameter(std::string const &name, T const &value)
void propagateParameters_(const edm::ParameterSet &pSet, const std::string &globalName, edm::ParameterSet &subSet) const
Propagate global parameters to sub-parameters.
std::vector< std::string > getParameterNames() const
virtual bool isTopLevel_(const std::string ¶meterSetName) const
Check if given parameter is for a top-level structure.
const char * levelName(LogLevel)
void decodeMovements_(const edm::ParameterSet &pSet, const std::vector< Alignable * > &alignables)
Decode movements defined in given parameter set for given set of alignables.
AlignableModifier theModifier
Helper class for random movements.
std::string indent_
Depth in hierarchy.
bool modify(Alignable *alignable, const edm::ParameterSet &pSet)
Modify given set of alignables according to parameters.
void mergeParameters_(edm::ParameterSet &localSet, const edm::ParameterSet &globalSet) const
Merge two sets of parameters into one (the first argument)
bool isPropagated(const std::string ¶meterName) const
Check if given parameter should be propagated.
int theModifierCounter
Counter for applied modification.
static const char * idToString(align::StructureType type)
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
bool hasParameter_(const std::string &name, const edm::ParameterSet &pSet) const
Check if given parameter exists in parameter set.
edm::ParameterSet getParameterSet_(const std::string &name, const edm::ParameterSet &pSet) const
string root
initialization