CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected 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 ()
 Default constructor. More...
 
virtual ~MisalignmentScenarioBuilder ()
 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 &pSet, const std::vector< Alignable * > &alignables)
 Decode movements defined in given parameter set for given set of alignables. More...
 
void decodeMovements_ (const edm::ParameterSet &pSet, const std::vector< Alignable * > &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
 Counter for applied modification. More...
 
edm::ParameterSet theScenario
 Misalignment scenario to apply (from config file) More...
 

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 21 of file MisalignmentScenarioBuilder.h.

Constructor & Destructor Documentation

MisalignmentScenarioBuilder::MisalignmentScenarioBuilder ( )
inline

Default constructor.

Definition at line 27 of file MisalignmentScenarioBuilder.h.

27  :
28  theModifierCounter(0) {};
int theModifierCounter
Counter for applied modification.
virtual MisalignmentScenarioBuilder::~MisalignmentScenarioBuilder ( )
inlinevirtual

Destructor.

Definition at line 31 of file MisalignmentScenarioBuilder.h.

31 {};

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 std::vector< Alignable * > &  alignables 
)
protected

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

Definition at line 24 of file MisalignmentScenarioBuilder.cc.

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

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

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

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

57 {
58 
59  indent_ += " "; // For indented output!
60 
61  // Retrieve parameters for all components at this level
62  std::ostringstream name;
63  name << levelName << "s";
64  edm::ParameterSet globalParameters = this->getParameterSet_( name.str(), pSet );
65  if ( !globalParameters.empty() ) {
66  LogDebug("PrintParameters") << indent_ << " *** " << levelName << ": found "
67  << globalParameters.getParameterNames().size()
68  << " global parameters" << std::endl;
69  }
70 
71  // Propagate down parameters from upper level
72  this->propagateParameters_( pSet, name.str(), globalParameters );
73  LogDebug("PrintParameters") << indent_ << " global parameter is now:" << std::endl;
74  this->printParameters_( globalParameters, true );
75 
76  // Loop on alignables
77  int iComponent = 0; // physical numbering starts at 1...
78  for (std::vector<Alignable*>::const_iterator iter = alignables.begin();
79  iter != alignables.end(); ++iter) {
80  iComponent++;
81 
82  // Check for special parameters -> merge with global
83  name.str("");
84  name << levelName << iComponent;
85 
86  edm::ParameterSet localParameters = this->getParameterSet_( levelName, iComponent, pSet );
87  LogDebug("PrintParameters") << indent_ << " ** " << name.str() << ": found "
88  << localParameters.getParameterNames().size()
89  << " local parameters" << std::endl;
90  this->mergeParameters_( localParameters, globalParameters );
91 
92  // Retrieve and apply parameters
93  LogDebug("PrintParameters") << indent_ << " parameters to apply:" << std::endl;
94  this->printParameters_( localParameters, true );
95  if ( theModifier.modify( (*iter), localParameters ) ) {
97  LogDebug("PrintParameters") << indent_ << "Movements applied to " << name.str();
98  }
99 
100  // Apply movements to components
101  std::vector<std::string> parameterSetNames;
102  localParameters.getParameterSetNames( parameterSetNames, true );
103  if ( (*iter)->size() > 0 && parameterSetNames.size() > 0 )
104  // Has components and remaining parameter sets
105  this->decodeMovements_( localParameters, (*iter)->components() );
106  }
107 
108  indent_ = indent_.substr( 0, indent_.length()-1 );
109 
110 }
#define LogDebug(id)
bool empty() const
Definition: ParameterSet.h:216
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
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)
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 215 of file MisalignmentScenarioBuilder.cc.

References edm::ParameterSet::getParameter(), hasParameter_(), mergeVDriftHistosByStation::name, and query::result.

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

217 {
218 
220 
221  // Get list of parameter set names and retrieve requested one
222  std::vector<std::string> parameterSetNames;
223  if ( this->hasParameter_( name, pSet ) ) {
224  result = pSet.getParameter<edm::ParameterSet>( name );
225  }
226 
227  return result;
228 }
T getParameter(std::string const &) const
tuple result
Definition: query.py:137
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 233 of file MisalignmentScenarioBuilder.cc.

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

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

References spr::find(), edm::ParameterSet::getParameterNames(), mergeVDriftHistosByStation::name, and cscdqm::h::names.

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

292 {
293 
294  // Get list of parameter set names and look for requested one
295  std::vector<std::string> names = pSet.getParameterNames();
296 
297  return ( std::find( names.begin(), names.end(), name ) != names.end() );
298 
299 }
static const HistoName names[]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
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 343 of file MisalignmentScenarioBuilder.cc.

References dbtoconf::root, rootName_(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by propagateParameters_().

344 {
345  // Get root name (strip last character[s])
346  std::string root = this->rootName_( parameterSetName );
347 
348  // tracker stuff treated in overwriting TrackerScenarioBuilder::isTopLevel_(..)
349  if ( root == "DTSector" ) return true;
350  else if ( root == "CSCSector" ) return true;
351  else if ( root == "Muon" ) return true;
352 
353  return false;
354 
355 }
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;)
string root
initialization
Definition: dbtoconf.py:70
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 117 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_().

119 {
120 
121  indent_ += " ";
122 
123  // Loop on globalSet. Add to localSet all non-existing parameters
124  std::vector<std::string> globalParameterNames = globalSet.getParameterNames();
125  for ( std::vector<std::string>::iterator iter = globalParameterNames.begin();
126  iter != globalParameterNames.end(); iter ++ ) {
127 
128  if (globalSet.existsAs<edm::ParameterSet>(*iter)) {
129  // This is a parameter set: check it
130  edm::ParameterSet subLocalSet = this->getParameterSet_( (*iter), localSet );
131  if ( subLocalSet.empty() ) {
132  // No local subset exists: just insert it
133  localSet.copyFrom(globalSet, (*iter));
134  } else {
135  // Merge with local subset and replace
136  this->mergeParameters_( subLocalSet, globalSet.getParameter<edm::ParameterSet>(*iter) );
137  localSet.addParameter<edm::ParameterSet>( (*iter), subLocalSet );
138  }
139  } else {
140  // If (*iter) exists, (silently...) not replaced:
141  localSet.copyFrom(globalSet, (*iter));
142  }
143  }
144 
145  indent_ = indent_.substr( 0, indent_.length()-1 );
146 
147 }
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:216
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
void copyFrom(ParameterSet const &from, std::string const &name)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:142
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 358 of file MisalignmentScenarioBuilder.cc.

Referenced by propagateParameters_().

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

Print all parameters and values for given set.

Definition at line 304 of file MisalignmentScenarioBuilder.cc.

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

Referenced by decodeMovements_().

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

References edm::ParameterSet::addParameter(), edm::ParameterSet::copyFrom(), edm::hlt::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_().

156 {
157  indent_ += " "; // For indented output!
158 
159  // Propagate some given parameters
160  std::vector<std::string> parameterNames = pSet.getParameterNames();
161  for ( std::vector<std::string>::iterator iter = parameterNames.begin();
162  iter != parameterNames.end(); iter++ ) {
163  if ( theModifier.isPropagated( *iter ) ) { // like 'distribution', 'scale', etc.
164  LogDebug("PropagateParameters") << indent_ << " - adding parameter " << (*iter) << std::endl;
165  subSet.copyFrom(pSet, (*iter)); // If existing, is not replaced.
166  }
167  }
168 
169  // Propagate all tracked parameter sets
170  std::vector<std::string> pSetNames;
171  if ( pSet.getParameterSetNames( pSetNames, true ) > 0 ) {
172  for ( std::vector<std::string>::const_iterator it = pSetNames.begin();
173  it != pSetNames.end(); it++ ) {
174  const std::string rootName = this->rootName_(*it);
175  const std::string globalRoot(this->rootName_(globalName));
176  if (rootName.compare(0, rootName.length(), globalRoot) == 0) {
177  // Parameter for this level: skip
178  LogDebug("PropagateParameters") << indent_ << " - skipping PSet " << (*it) << " from global "
179  << globalName << std::endl;
180  } else if ( this->isTopLevel_(*it) ) {
181  // Top-level parameters should not be propagated
182  LogDebug("PropagateParameters") << indent_
183  << " - skipping top-level PSet " << (*it)
184  << " global " << globalName << std::endl;
185 
186  } else if (!this->possiblyPartOf(*it, globalRoot)) {
187  // (*it) is a part of the detector that does not fit to globalName
188  LogDebug("PropagateParameters") << indent_
189  << " - skipping PSet " << (*it)
190  << " not fitting into global " << globalName << std::endl;
191 
192  } else if ( AlignableObjectId::stringToId( rootName ) == align::invalid ) {
193  // Parameter is not known!
194  throw cms::Exception("BadConfig") << "Unknown parameter set name " << rootName;
195  } else {
196  // Pass down any other: in order to merge PSets, create dummy PSet
197  // only containing this PSet and merge it recursively.
198  LogDebug("PropagateParameters") << indent_ << " - adding PSet " << (*it)
199  << " global " << globalName << std::endl;
200  edm::ParameterSet m_subSet;
201  m_subSet.addParameter<edm::ParameterSet>( (*it),
202  pSet.getParameter<edm::ParameterSet>(*it) );
203  this->mergeParameters_( subSet, m_subSet );
204  }
205  }
206  }
207 
208  indent_ = indent_.substr( 0, indent_.length()-1 );
209 }
#define LogDebug(id)
T getParameter(std::string const &) 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;)
static align::StructureType stringToId(const char *)
void copyFrom(ParameterSet const &from, std::string const &name)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:142
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 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 367 of file MisalignmentScenarioBuilder.cc.

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

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

368 {
369 
370  std::string result = parameterSetName; // Initialise to full string
371 
372  // Check if string ends with 's'
373  const int lastChar = parameterSetName.length()-1;
374  if ( parameterSetName[lastChar] == 's' ) {
375  result = parameterSetName.substr( 0, lastChar );
376  } else {
377  // Otherwise, look for numbers (assumes names have no numbers inside...)
378  for ( unsigned int ichar = 0; ichar<parameterSetName.length(); ichar++ ) {
379  if ( isdigit(parameterSetName[ichar]) ) {
380  result = parameterSetName.substr( 0, ichar );
381  break; // Stop at first digit
382  }
383  }
384  }
385 
386  LogDebug("PrintParameters") << "Name was " << parameterSetName << ", root is " << result;
387 
388  return result;
389 
390 }
#define LogDebug(id)
tuple result
Definition: query.py:137

Member Data Documentation

std::string MisalignmentScenarioBuilder::indent_
mutableprotected
AlignableModifier MisalignmentScenarioBuilder::theModifier
protected
int MisalignmentScenarioBuilder::theModifierCounter
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().