25 alignableObjectId_(geometry)
33 const std::vector<Alignable*> &alignables)
37 typedef std::map<std::string, std::vector<Alignable*> > AlignablesMap;
38 AlignablesMap alisMap;
39 for (std::vector<Alignable*>::const_iterator iA = alignables.begin(); iA != alignables.end(); ++iA) {
51 const AlignablesMap::iterator itTec = alisMap.find(
"TECEndcap");
52 for (AlignablesMap::iterator it = alisMap.begin(); it != alisMap.end(); ++it) {
53 if (it == itTec)
continue;
56 if (itTec != alisMap.end()) this->
decodeMovements_(pSet, itTec->second, itTec->first);
63 const std::vector<Alignable*> &alignables,
70 std::ostringstream
name;
71 name << levelName <<
"s";
73 if ( !globalParameters.
empty() ) {
74 LogDebug(
"PrintParameters") <<
indent_ <<
" *** " << levelName <<
": found "
76 <<
" global parameters" << std::endl;
81 LogDebug(
"PrintParameters") <<
indent_ <<
" global parameter is now:" << std::endl;
86 for (std::vector<Alignable*>::const_iterator iter = alignables.begin();
87 iter != alignables.end(); ++iter) {
92 name << levelName << iComponent;
95 LogDebug(
"PrintParameters") <<
indent_ <<
" ** " << name.str() <<
": found "
97 <<
" local parameters" << std::endl;
101 LogDebug(
"PrintParameters") <<
indent_ <<
" parameters to apply:" << std::endl;
105 LogDebug(
"PrintParameters") <<
indent_ <<
"Movements applied to " << name.str();
109 std::vector<std::string> parameterSetNames;
111 if ( (*iter)->size() > 0 && parameterSetNames.size() > 0 )
133 for ( std::vector<std::string>::iterator iter = globalParameterNames.begin();
134 iter != globalParameterNames.end(); iter ++ ) {
139 if ( subLocalSet.
empty() ) {
141 localSet.
copyFrom(globalSet, (*iter));
149 localSet.
copyFrom(globalSet, (*iter));
169 for ( std::vector<std::string>::iterator iter = parameterNames.begin();
170 iter != parameterNames.end(); ++iter ) {
172 LogDebug(
"PropagateParameters") <<
indent_ <<
" - adding parameter " << (*iter) << std::endl;
178 std::vector<std::string> pSetNames;
180 for ( std::vector<std::string>::const_iterator it = pSetNames.begin();
181 it != pSetNames.end(); ++it ) {
184 if (rootName.compare(0, rootName.length(), globalRoot) == 0) {
186 LogDebug(
"PropagateParameters") <<
indent_ <<
" - skipping PSet " << (*it) <<
" from global "
187 << globalName << std::endl;
191 <<
" - skipping top-level PSet " << (*it)
192 <<
" global " << globalName << std::endl;
197 <<
" - skipping PSet " << (*it)
198 <<
" not fitting into global " << globalName << std::endl;
202 throw cms::Exception(
"BadConfig") <<
"Unknown parameter set name " << rootName;
206 LogDebug(
"PropagateParameters") <<
indent_ <<
" - adding PSet " << (*it)
207 <<
" global " << globalName << std::endl;
230 std::vector<std::string> parameterSetNames;
245 unsigned int nFittingPsets = 0;
249 for (std::vector<std::string>::iterator iter = pNames.begin(); iter != pNames.end(); ++iter) {
250 if (iter->find(levelName) != 0)
continue;
252 const std::string numberString(*iter, levelName.size());
254 if (numberString.empty()) {
259 size_t pos = numberString.find_first_of(
'_', lastPos);
260 while (std::string::npos != pos || std::string::npos != lastPos) {
261 const std::string digit(numberString.substr(lastPos, pos - lastPos));
263 bool isDigit = !digit.empty();
264 for (std::string::const_iterator dIt = digit.begin(); dIt != digit.end(); ++dIt) {
265 if (!isdigit(*dIt)) isDigit =
false;
269 throw cms::Exception(
"BadConfig") <<
"[MisalignmentScenarioBuilder::getParameterSet_] "
270 <<
"Expect only numbers, separated by '_' after "
271 << levelName <<
" in " << *iter << std::endl;
276 if (atoi(digit.c_str()) == iComponent) {
278 LogDebug(
"getParameterSet_") <<
indent_ <<
"found " << *iter <<
" matching "
279 << levelName << iComponent;
283 lastPos = numberString.find_first_not_of(
'_', pos);
284 pos = numberString.find_first_of(
'_', lastPos);
288 if (nFittingPsets > 1) {
289 throw cms::Exception(
"BadConfig") <<
"[MisalignmentScenarioBuilder::getParameterSet_] "
290 <<
"Found " << nFittingPsets <<
" PSet for "
291 << levelName <<
" " << iComponent <<
"." << std::endl;
305 return (
std::find( names.begin(), names.end(),
name ) != names.end() );
313 const bool showPsets )
const
317 for ( std::vector<std::string>::iterator iter = parameterNames.begin();
318 iter != parameterNames.end(); ++iter ) {
357 if ( root ==
"DTSector" )
return true;
358 else if ( root ==
"CSCSector" )
return true;
359 else if ( root ==
"Muon" )
return true;
380 const auto lastChar = parameterSetName.length()-1;
381 if ( parameterSetName[lastChar] ==
's' ) {
382 result = parameterSetName.substr( 0, lastChar );
386 for (
auto ichar = lastChar; ichar != 0; --ichar) {
387 if (!isdigit(parameterSetName[ichar])) {
388 result = parameterSetName.substr(0, ichar + 1);
394 LogDebug(
"PrintParameters") <<
"Name was " << parameterSetName <<
", root is " <<
result;
T getParameter(std::string const &) const
align::StructureType stringToId(const char *) 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')
MisalignmentScenarioBuilder(AlignableObjectId::Geometry)
Constructor.
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.
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.
ESHandle< TrackerGeometry > geometry
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.
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
const AlignableObjectId alignableObjectId_
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