CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
MisalignmentScenarioBuilder Class Referenceabstract

Base class to build a scenario from configuration and apply to either tracker or muon. More...

#include <MisalignmentScenarioBuilder.h>

Inheritance diagram for MisalignmentScenarioBuilder:
MuonScenarioBuilder TrackerScenarioBuilder

Public Member Functions

virtual void applyScenario (const edm::ParameterSet &scenario)=0
 Apply misalignment scenario to the tracker (sub-system specific) More...
 
 MisalignmentScenarioBuilder (AlignableObjectId::Geometry)
 Constructor. More...
 
virtual ~MisalignmentScenarioBuilder ()=default
 Destructor. More...
 

Protected Member Functions

void applyMovements_ (Alignable *alignable, const edm::ParameterSet &pSet)
 Apply movements given by parameter set to given alignable. More...
 
void decodeMovements_ (const edm::ParameterSet &, const align::Alignables &)
 Decode movements defined in given parameter set for given set of alignables. More...
 
void decodeMovements_ (const edm::ParameterSet &, const align::Alignables &, const std::string &levelName)
 Decode movements defined in given parameter set for given set of alignables tagged by given name. More...
 
edm::ParameterSet getParameterSet_ (const std::string &name, const edm::ParameterSet &pSet) const
 
edm::ParameterSet getParameterSet_ (const std::string &levelName, int iComponent, const edm::ParameterSet &pSet) const
 
bool hasParameter_ (const std::string &name, const edm::ParameterSet &pSet) const
 Check if given parameter exists in parameter set. More...
 
virtual bool isTopLevel_ (const std::string &parameterSetName) const
 Check if given parameter is for a top-level structure. More...
 
void mergeParameters_ (edm::ParameterSet &localSet, const edm::ParameterSet &globalSet) const
 Merge two sets of parameters into one (the first argument) More...
 
virtual bool possiblyPartOf (const std::string &subStruct, const std::string &largeStruct) const
 
void printParameters_ (const edm::ParameterSet &pSet, const bool showPsets=false) const
 Print all parameters and values for given set. More...
 
void propagateParameters_ (const edm::ParameterSet &pSet, const std::string &globalName, edm::ParameterSet &subSet) const
 Propagate global parameters to sub-parameters. More...
 
const std::string rootName_ (const std::string &parameterSetName) const
 Get root name of a parameter set (e.g. 'Rod' in 'Rods' or 'Rod1') More...
 

Protected Attributes

std::string indent_
 Depth in hierarchy. More...
 
AlignableModifier theModifier
 Helper class for random movements. More...
 
int theModifierCounter {0}
 Counter for applied modification. More...
 
edm::ParameterSet theScenario
 Misalignment scenario to apply (from config file) More...
 

Private Attributes

const AlignableObjectId alignableObjectId_
 

Detailed Description

Base class to build a scenario from configuration and apply to either tracker or muon.

Date
2011/09/19 11:44:50
Revision
1.10
Author
mussgill
Author
Frederic Ronga - CERN-PH-CMG

Definition at line 22 of file MisalignmentScenarioBuilder.h.

Constructor & Destructor Documentation

MisalignmentScenarioBuilder::MisalignmentScenarioBuilder ( AlignableObjectId::Geometry  geometry)

Constructor.

Definition at line 24 of file MisalignmentScenarioBuilder.cc.

24  :
26 {
27 }
const AlignableObjectId alignableObjectId_
virtual MisalignmentScenarioBuilder::~MisalignmentScenarioBuilder ( )
virtualdefault

Destructor.

Member Function Documentation

void MisalignmentScenarioBuilder::applyMovements_ ( Alignable alignable,
const edm::ParameterSet pSet 
)
protected

Apply movements given by parameter set to given alignable.

virtual void MisalignmentScenarioBuilder::applyScenario ( const edm::ParameterSet scenario)
pure virtual

Apply misalignment scenario to the tracker (sub-system specific)

Implemented in TrackerScenarioBuilder, and MuonScenarioBuilder.

void MisalignmentScenarioBuilder::decodeMovements_ ( const edm::ParameterSet pSet,
const align::Alignables alignables 
)
protected

Decode movements defined in given parameter set for given set of alignables.

Definition at line 32 of file MisalignmentScenarioBuilder.cc.

References alignableObjectId_, AlignableObjectId::idToString(), fwlog::levelName(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MuonScenarioBuilder::applyScenario(), TrackerScenarioBuilder::applyScenario(), and decodeMovements_().

34 {
35 
36  // first create a map with one align::Alignables per type (=levelName)
37  using AlignablesMap = std::map<std::string, align::Alignables>;
38  AlignablesMap alisMap;
39  for (align::Alignables::const_iterator iA = alignables.begin(); iA != alignables.end(); ++iA) {
40  const std::string &levelName = alignableObjectId_.idToString((*iA)->alignableObjectId());
41  alisMap[levelName].push_back(*iA); // either first entry of new level or add to an old one
42  }
43 
44  // Now call the more general version for each entry in the map.
45  //
46  // There is a hack to ensure that strip components are called in the same order
47  // as in old version of TrackerScenarioBuilder (TIB,TID,TOB,TEC) while
48  // std::map seems to order alphabetically (TECEndcap,TIBHalfBarrel,TIDEndcap,TOBHalfBarrel).
49  // Order matters due to random sequence. If scenarios are allowed to change
50  // 'numerically', remove this comment and the lines marked with 'HACK'.
51  const AlignablesMap::iterator itTec = alisMap.find("TECEndcap"); // HACK
52  for (AlignablesMap::iterator it = alisMap.begin(); it != alisMap.end(); ++it) {
53  if (it == itTec) continue; // HACK
54  this->decodeMovements_(pSet, it->second, it->first);
55  }
56  if (itTec != alisMap.end()) this->decodeMovements_(pSet, itTec->second, itTec->first); // HACK
57 }
void decodeMovements_(const edm::ParameterSet &, const align::Alignables &)
Decode movements defined in given parameter set for given set of alignables.
const char * levelName(LogLevel)
Definition: fwLog.cc:34
const char * idToString(align::StructureType type) const
const AlignableObjectId alignableObjectId_
void MisalignmentScenarioBuilder::decodeMovements_ ( const edm::ParameterSet pSet,
const align::Alignables alignables,
const std::string &  levelName 
)
protected

Decode movements defined in given parameter set for given set of alignables tagged by given name.

Definition at line 62 of file MisalignmentScenarioBuilder.cc.

References decodeMovements_(), edm::ParameterSet::empty(), edm::ParameterSet::getParameterNames(), getParameterSet_(), edm::ParameterSet::getParameterSetNames(), indent_, LogDebug, mergeParameters_(), AlignableModifier::modify(), dataset::name, printParameters_(), propagateParameters_(), theModifier, and theModifierCounter.

65 {
66 
67  indent_ += " "; // For indented output!
68 
69  // Retrieve parameters for all components at this level
70  std::ostringstream name;
71  name << levelName << "s";
72  edm::ParameterSet globalParameters = this->getParameterSet_( name.str(), pSet );
73  if ( !globalParameters.empty() ) {
74  LogDebug("PrintParameters") << indent_ << " *** " << levelName << ": found "
75  << globalParameters.getParameterNames().size()
76  << " global parameters" << std::endl;
77  }
78 
79  // Propagate down parameters from upper level
80  this->propagateParameters_( pSet, name.str(), globalParameters );
81  LogDebug("PrintParameters") << indent_ << " global parameter is now:" << std::endl;
82  this->printParameters_( globalParameters, true );
83 
84  // Loop on alignables
85  int iComponent = 0; // physical numbering starts at 1...
86  for (align::Alignables::const_iterator iter = alignables.begin();
87  iter != alignables.end(); ++iter) {
88  iComponent++;
89 
90  // Check for special parameters -> merge with global
91  name.str("");
92  name << levelName << iComponent;
93 
94  edm::ParameterSet localParameters = this->getParameterSet_( levelName, iComponent, pSet );
95  LogDebug("PrintParameters") << indent_ << " ** " << name.str() << ": found "
96  << localParameters.getParameterNames().size()
97  << " local parameters" << std::endl;
98  this->mergeParameters_( localParameters, globalParameters );
99 
100  // Retrieve and apply parameters
101  LogDebug("PrintParameters") << indent_ << " parameters to apply:" << std::endl;
102  this->printParameters_( localParameters, true );
103  if ( theModifier.modify( (*iter), localParameters ) ) {
105  LogDebug("PrintParameters") << indent_ << "Movements applied to " << name.str();
106  }
107 
108  // Apply movements to components
109  std::vector<std::string> parameterSetNames;
110  localParameters.getParameterSetNames( parameterSetNames, true );
111  if ( (*iter)->size() > 0 && !parameterSetNames.empty() )
112  // Has components and remaining parameter sets
113  this->decodeMovements_( localParameters, (*iter)->components() );
114  }
115 
116  indent_ = indent_.substr( 0, indent_.length()-1 );
117 
118 }
#define LogDebug(id)
bool empty() const
Definition: ParameterSet.h:218
void decodeMovements_(const edm::ParameterSet &, const align::Alignables &)
Decode movements defined in given parameter set for given set of alignables.
void printParameters_(const edm::ParameterSet &pSet, const bool showPsets=false) const
Print all parameters and values for given set.
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
const char * levelName(LogLevel)
Definition: fwLog.cc:34
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)
int theModifierCounter
Counter for applied modification.
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
edm::ParameterSet getParameterSet_(const std::string &name, const edm::ParameterSet &pSet) const
edm::ParameterSet MisalignmentScenarioBuilder::getParameterSet_ ( const std::string &  name,
const edm::ParameterSet pSet 
) const
protected

Get parameter set corresponding to given name from pSet returns empty parameter set if does not exist)

Definition at line 223 of file MisalignmentScenarioBuilder.cc.

References edm::ParameterSet::getParameter(), hasParameter_(), dataset::name, and mps_fire::result.

Referenced by decodeMovements_(), MuonScenarioBuilder::extractParameters(), and mergeParameters_().

225 {
226 
228 
229  // Get list of parameter set names and retrieve requested one
230  std::vector<std::string> parameterSetNames;
231  if ( this->hasParameter_( name, pSet ) ) {
232  result = pSet.getParameter<edm::ParameterSet>( name );
233  }
234 
235  return result;
236 }
T getParameter(std::string const &) const
bool hasParameter_(const std::string &name, const edm::ParameterSet &pSet) const
Check if given parameter exists in parameter set.
edm::ParameterSet MisalignmentScenarioBuilder::getParameterSet_ ( const std::string &  levelName,
int  iComponent,
const edm::ParameterSet pSet 
) const
protected

Get parameter set corresponding to given levelName and iComponent from pSet, any parameter set name like <levelName><m>, <levelName><m>_<n>, <levelName><m>_<n>_<o> etc. is accepted for iComponent == m, n or o. (returns empty parameter set if does not exist).

Definition at line 241 of file MisalignmentScenarioBuilder.cc.

References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), indent_, LogDebug, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

243 {
245  unsigned int nFittingPsets = 0;
246 
247  // Get list of parameter set names and look for requested one
248  std::vector<std::string> pNames = pSet.getParameterNames();
249  for (std::vector<std::string>::iterator iter = pNames.begin(); iter != pNames.end(); ++iter) {
250  if (iter->find(levelName) != 0) continue; // parameter not starting with levelName
251 
252  const std::string numberString(*iter, levelName.size());
253  // if (numberString.empty() || numberString == "s") { // "s" only left means we have e.g. 'TOBs'
254  if (numberString.empty()) { // check on "s" not needed, see below
255  continue; // nothing left in levelName to be iComponent...
256  }
257  // now look for numbers (separated by '_', tolerating '__' or ending with '_')
258  size_t lastPos = 0;
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));
262 
263  bool isDigit = !digit.empty();
264  for (std::string::const_iterator dIt = digit.begin(); dIt != digit.end(); ++dIt) {
265  if (!isdigit(*dIt)) isDigit = false; // check all 'letters' to be a digit
266  }
267  if (!isDigit) {
268  if (lastPos != 0) { // do not throw if e.g. after 'TOB' ('Det') you find only 's' (Unit<n>)
269  throw cms::Exception("BadConfig") << "[MisalignmentScenarioBuilder::getParameterSet_] "
270  << "Expect only numbers, separated by '_' after "
271  << levelName << " in " << *iter << std::endl;
272  }
273  break;
274  }
275 
276  if (atoi(digit.c_str()) == iComponent) {
277  ++nFittingPsets;
278  LogDebug("getParameterSet_") << indent_ << "found " << *iter << " matching "
279  << levelName << iComponent;
280  result = pSet.getParameter<edm::ParameterSet>(*iter);
281  break;
282  }
283  lastPos = numberString.find_first_not_of('_', pos);
284  pos = numberString.find_first_of('_', lastPos);
285  }
286  } // end loop on names of parameters in pSet
287 
288  if (nFittingPsets > 1) {
289  throw cms::Exception("BadConfig") << "[MisalignmentScenarioBuilder::getParameterSet_] "
290  << "Found " << nFittingPsets << " PSet for "
291  << levelName << " " << iComponent << "." << std::endl;
292  }
293 
294  return result;
295 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::vector< std::string > getParameterNames() const
const char * levelName(LogLevel)
Definition: fwLog.cc:34
std::string indent_
Depth in hierarchy.
bool MisalignmentScenarioBuilder::hasParameter_ ( const std::string &  name,
const edm::ParameterSet pSet 
) const
protected

Check if given parameter exists in parameter set.

Definition at line 298 of file MisalignmentScenarioBuilder.cc.

References spr::find(), edm::ParameterSet::getParameterNames(), dataset::name, and names.

Referenced by MuonScenarioBuilder::applyScenario(), TrackerScenarioBuilder::applyScenario(), and getParameterSet_().

300 {
301 
302  // Get list of parameter set names and look for requested one
303  std::vector<std::string> names = pSet.getParameterNames();
304 
305  return ( std::find( names.begin(), names.end(), name ) != names.end() );
306 
307 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const std::string names[nVars_]
std::vector< std::string > getParameterNames() const
bool MisalignmentScenarioBuilder::isTopLevel_ ( const std::string &  parameterSetName) const
protectedvirtual

Check if given parameter is for a top-level structure.

Reimplemented in TrackerScenarioBuilder.

Definition at line 351 of file MisalignmentScenarioBuilder.cc.

References rootName_(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by propagateParameters_().

352 {
353  // Get root name (strip last character[s])
354  std::string root = this->rootName_( parameterSetName );
355 
356  // tracker stuff treated in overwriting TrackerScenarioBuilder::isTopLevel_(..)
357  if ( root == "DTSector" ) return true;
358  else if ( root == "CSCSector" ) return true;
359  else if ( root == "Muon" ) return true;
360 
361  return false;
362 
363 }
const std::string rootName_(const std::string &parameterSetName) const
Get root name of a parameter set (e.g. &#39;Rod&#39; in &#39;Rods&#39; or &#39;Rod1&#39;)
void MisalignmentScenarioBuilder::mergeParameters_ ( edm::ParameterSet localSet,
const edm::ParameterSet globalSet 
) const
protected

Merge two sets of parameters into one (the first argument)

Definition at line 125 of file MisalignmentScenarioBuilder.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::copyFrom(), edm::ParameterSet::empty(), edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), getParameterSet_(), and indent_.

Referenced by decodeMovements_(), and propagateParameters_().

127 {
128 
129  indent_ += " ";
130 
131  // Loop on globalSet. Add to localSet all non-existing parameters
132  std::vector<std::string> globalParameterNames = globalSet.getParameterNames();
133  for ( std::vector<std::string>::iterator iter = globalParameterNames.begin();
134  iter != globalParameterNames.end(); iter ++ ) {
135 
136  if (globalSet.existsAs<edm::ParameterSet>(*iter)) {
137  // This is a parameter set: check it
138  edm::ParameterSet subLocalSet = this->getParameterSet_( (*iter), localSet );
139  if ( subLocalSet.empty() ) {
140  // No local subset exists: just insert it
141  localSet.copyFrom(globalSet, (*iter));
142  } else {
143  // Merge with local subset and replace
144  this->mergeParameters_( subLocalSet, globalSet.getParameter<edm::ParameterSet>(*iter) );
145  localSet.addParameter<edm::ParameterSet>( (*iter), subLocalSet );
146  }
147  } else {
148  // If (*iter) exists, (silently...) not replaced:
149  localSet.copyFrom(globalSet, (*iter));
150  }
151  }
152 
153  indent_ = indent_.substr( 0, indent_.length()-1 );
154 
155 }
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:218
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
void copyFrom(ParameterSet const &from, std::string const &name)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
std::vector< std::string > getParameterNames() const
std::string indent_
Depth in hierarchy.
void mergeParameters_(edm::ParameterSet &localSet, const edm::ParameterSet &globalSet) const
Merge two sets of parameters into one (the first argument)
edm::ParameterSet getParameterSet_(const std::string &name, const edm::ParameterSet &pSet) const
bool MisalignmentScenarioBuilder::possiblyPartOf ( const std::string &  subStruct,
const std::string &  largeStruct 
) const
protectedvirtual

Check whether structure 'subStruct' could be part of 'largeStruct', defaults to true, but can be overwritten in derived classes to speed up recursive merging.

Reimplemented in TrackerScenarioBuilder.

Definition at line 366 of file MisalignmentScenarioBuilder.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by propagateParameters_().

367 {
368  return true; // possibly overwrite in specific class
369 }
void MisalignmentScenarioBuilder::printParameters_ ( const edm::ParameterSet pSet,
const bool  showPsets = false 
) const
protected

Print all parameters and values for given set.

Definition at line 312 of file MisalignmentScenarioBuilder.cc.

References edm::ParameterSet::existsAs(), and edm::ParameterSet::getParameterNames().

Referenced by decodeMovements_().

314 {
315 
316  std::vector<std::string> parameterNames = pSet.getParameterNames();
317  for ( std::vector<std::string>::iterator iter = parameterNames.begin();
318  iter != parameterNames.end(); ++iter ) {
319  if (showPsets || !pSet.existsAs<edm::ParameterSet>(*iter)) {
320 // LogTrace("PrintParameters") << indent_ << " " << (*iter) << " = "
321 // << pSet.retrieve( *iter ).toString() << std::endl;
322 // From Bill Tannenbaum:
323 // You can use
324 // pset.getParameterAsString(aString).
325 // This function was added with the new tag.
326 // However, there is a possible complication if the parameter in question is
327 // itself a ParameterSet or a vector of ParameterSets. In the new format, a
328 // ParameterSet cannot be converted to a string until its ID is calculated,
329 // which happens when it is registered. So, if you get error messages about
330 // not being able to convert an unregistered ParameterSet to a string, you can
331 // do one of two things:
332 // A) You can use ParameterSet::dump() to print the parameter set, instead of
333 // getParameterAsString(). This does not require registering. I'm not sure of
334 // the exact format of the dump output (Rick wrote this, I think).
335 // OR
336 // B) You can use ParameterSet::registerIt() to register the parameter set
337 // before calling getParameterAsString().
338 //
339 // In either case, you can use existsAs to determine which parameters are
340 // themselves parameter sets or vectors of parameter sets.
341 //
342 // Note that in the new parameter set format, ParameterSet::toString() does not
343 // write out nested parameter sets by value. It writes them out by
344 // "reference", i.e it writes the ID.
345  }
346  }
347 }
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
std::vector< std::string > getParameterNames() const
void MisalignmentScenarioBuilder::propagateParameters_ ( const edm::ParameterSet pSet,
const std::string &  globalName,
edm::ParameterSet subSet 
) const
protected

Propagate global parameters to sub-parameters.

Definition at line 161 of file MisalignmentScenarioBuilder.cc.

References edm::ParameterSet::addParameter(), alignableObjectId_, edm::ParameterSet::copyFrom(), Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), edm::ParameterSet::getParameterSetNames(), indent_, align::invalid, AlignableModifier::isPropagated(), isTopLevel_(), LogDebug, mergeParameters_(), possiblyPartOf(), rootName_(), AlCaHLTBitMon_QueryRunRegistry::string, AlignableObjectId::stringToId(), and theModifier.

Referenced by decodeMovements_().

164 {
165  indent_ += " "; // For indented output!
166 
167  // Propagate some given parameters
168  std::vector<std::string> parameterNames = pSet.getParameterNames();
169  for ( std::vector<std::string>::iterator iter = parameterNames.begin();
170  iter != parameterNames.end(); ++iter ) {
171  if ( theModifier.isPropagated( *iter ) ) { // like 'distribution', 'scale', etc.
172  LogDebug("PropagateParameters") << indent_ << " - adding parameter " << (*iter) << std::endl;
173  subSet.copyFrom(pSet, (*iter)); // If existing, is not replaced.
174  }
175  }
176 
177  // Propagate all tracked parameter sets
178  std::vector<std::string> pSetNames;
179  if ( pSet.getParameterSetNames( pSetNames, true ) > 0 ) {
180  for ( std::vector<std::string>::const_iterator it = pSetNames.begin();
181  it != pSetNames.end(); ++it ) {
182  const std::string rootName = this->rootName_(*it);
183  const std::string globalRoot(this->rootName_(globalName));
184  if (rootName.compare(0, rootName.length(), globalRoot) == 0) {
185  // Parameter for this level: skip
186  LogDebug("PropagateParameters") << indent_ << " - skipping PSet " << (*it) << " from global "
187  << globalName << std::endl;
188  } else if ( this->isTopLevel_(*it) ) {
189  // Top-level parameters should not be propagated
190  LogDebug("PropagateParameters") << indent_
191  << " - skipping top-level PSet " << (*it)
192  << " global " << globalName << std::endl;
193 
194  } else if (!this->possiblyPartOf(*it, globalRoot)) {
195  // (*it) is a part of the detector that does not fit to globalName
196  LogDebug("PropagateParameters") << indent_
197  << " - skipping PSet " << (*it)
198  << " not fitting into global " << globalName << std::endl;
199 
200  } else if (alignableObjectId_.stringToId(rootName) == align::invalid) {
201  // Parameter is not known!
202  throw cms::Exception("BadConfig") << "Unknown parameter set name " << rootName;
203  } else {
204  // Pass down any other: in order to merge PSets, create dummy PSet
205  // only containing this PSet and merge it recursively.
206  LogDebug("PropagateParameters") << indent_ << " - adding PSet " << (*it)
207  << " global " << globalName << std::endl;
208  edm::ParameterSet m_subSet;
209  m_subSet.addParameter<edm::ParameterSet>( (*it),
210  pSet.getParameter<edm::ParameterSet>(*it) );
211  this->mergeParameters_( subSet, m_subSet );
212  }
213  }
214  }
215 
216  indent_ = indent_.substr( 0, indent_.length()-1 );
217 }
#define LogDebug(id)
T getParameter(std::string const &) const
align::StructureType stringToId(const char *) const
virtual bool possiblyPartOf(const std::string &subStruct, const std::string &largeStruct) const
const std::string rootName_(const std::string &parameterSetName) const
Get root name of a parameter set (e.g. &#39;Rod&#39; in &#39;Rods&#39; or &#39;Rod1&#39;)
void copyFrom(ParameterSet const &from, std::string const &name)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
std::vector< std::string > getParameterNames() const
virtual bool isTopLevel_(const std::string &parameterSetName) const
Check if given parameter is for a top-level structure.
AlignableModifier theModifier
Helper class for random movements.
std::string indent_
Depth in hierarchy.
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 &parameterName) const
Check if given parameter should be propagated.
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
const AlignableObjectId alignableObjectId_
const std::string MisalignmentScenarioBuilder::rootName_ ( const std::string &  parameterSetName) const
protected

Get root name of a parameter set (e.g. 'Rod' in 'Rods' or 'Rod1')

Definition at line 375 of file MisalignmentScenarioBuilder.cc.

References LogDebug, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by TrackerScenarioBuilder::isTopLevel_(), isTopLevel_(), and propagateParameters_().

376 {
377  std::string result{parameterSetName}; // Initialise to full string
378 
379  // Check if string ends with 's'
380  const auto lastChar = parameterSetName.length()-1;
381  if ( parameterSetName[lastChar] == 's' ) {
382  result = parameterSetName.substr( 0, lastChar );
383  } else {
384  // Otherwise, look for numbers at the end
385  // (assumes that numbers at the end are not part of the name)
386  for (auto ichar = lastChar; ichar != 0; --ichar) {
387  if (!isdigit(parameterSetName[ichar])) {
388  result = parameterSetName.substr(0, ichar + 1);
389  break; // Stop at first non-digit
390  }
391  }
392  }
393 
394  LogDebug("PrintParameters") << "Name was " << parameterSetName << ", root is " << result;
395 
396  return result;
397 }
#define LogDebug(id)

Member Data Documentation

const AlignableObjectId MisalignmentScenarioBuilder::alignableObjectId_
private

Definition at line 93 of file MisalignmentScenarioBuilder.h.

Referenced by decodeMovements_(), and propagateParameters_().

std::string MisalignmentScenarioBuilder::indent_
mutableprotected
AlignableModifier MisalignmentScenarioBuilder::theModifier
protected
int MisalignmentScenarioBuilder::theModifierCounter {0}
protected

Counter for applied modification.

Definition at line 88 of file MisalignmentScenarioBuilder.h.

Referenced by MuonScenarioBuilder::applyScenario(), TrackerScenarioBuilder::applyScenario(), and decodeMovements_().

edm::ParameterSet MisalignmentScenarioBuilder::theScenario
protected

Misalignment scenario to apply (from config file)

Definition at line 85 of file MisalignmentScenarioBuilder.h.

Referenced by MuonScenarioBuilder::applyScenario().