CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackerScenarioBuilder Class Reference

Builds a scenario from configuration and applies it to the alignable tracker. More...

#include <TrackerScenarioBuilder.h>

Inheritance diagram for TrackerScenarioBuilder:
MisalignmentScenarioBuilder

Public Member Functions

void applyScenario (const edm::ParameterSet &scenario) override
 Apply misalignment scenario to the tracker. More...
 
bool isTopLevel_ (const std::string &parameterSetName) const override
 does this still make sense? More...
 
bool possiblyPartOf (const std::string &sub, const std::string &large) const override
 True if hierarchy level 'sub' could be part of hierarchy level 'large'. More...
 
 TrackerScenarioBuilder (AlignableTracker *alignable)
 Constructor. More...
 
 ~TrackerScenarioBuilder () override
 Destructor. More...
 
- Public Member Functions inherited from MisalignmentScenarioBuilder
 MisalignmentScenarioBuilder (AlignableObjectId::Geometry)
 Constructor. More...
 
virtual ~MisalignmentScenarioBuilder ()=default
 Destructor. More...
 

Private Member Functions

std::string stripOffModule (const align::StructureType &type) const
 

Private Attributes

AlignableTrackertheAlignableTracker
 
unsigned int theFirstStripIndex
 index of first strip subdet in 'theSubdets' (pixel<strip) More...
 
std::vector< std::string > theSubdets
 following things are needed in possiblyPartOf: More...
 

Additional Inherited Members

- Protected Member Functions inherited from MisalignmentScenarioBuilder
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...
 
void mergeParameters_ (edm::ParameterSet &localSet, const edm::ParameterSet &globalSet) const
 Merge two sets of parameters into one (the first argument) More...
 
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 inherited from MisalignmentScenarioBuilder
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...
 

Detailed Description

Builds a scenario from configuration and applies it to the alignable tracker.

Date
2007/10/18 09:57:11
Revision
1.2
Author
fronga
Author
Frederic Ronga - CERN-PH-CMG

Builds a scenario from configuration and applies it to the alignable tracker.

Definition at line 24 of file TrackerScenarioBuilder.h.

Constructor & Destructor Documentation

TrackerScenarioBuilder::TrackerScenarioBuilder ( AlignableTracker alignable)
explicit

Constructor.

Definition at line 23 of file TrackerScenarioBuilder.cc.

References Exception, stripOffModule(), align::TECModule, theAlignableTracker, theFirstStripIndex, theSubdets, align::TIBModule, align::TIDModule, align::TOBModule, align::TPBModule, and align::TPEModule.

23  :
25  theAlignableTracker(alignable)
26 {
27 
28  if (!theAlignableTracker) {
29  throw cms::Exception("TypeMismatch") << "Pointer to AlignableTracker is empty.\n";
30  }
31 
32  // Fill what is needed for possiblyPartOf(..):
33  theSubdets.push_back(stripOffModule(align::TPBModule)); // Take care, order matters: 1st pixel, 2nd strip.
40 }
std::string stripOffModule(const align::StructureType &type) const
unsigned int theFirstStripIndex
index of first strip subdet in &#39;theSubdets&#39; (pixel<strip)
MisalignmentScenarioBuilder(AlignableObjectId::Geometry)
Constructor.
std::vector< std::string > theSubdets
following things are needed in possiblyPartOf:
Geometry geometry() const
retrieve the geometry information
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker&#39;s geometry.
AlignableTracker * theAlignableTracker
TrackerScenarioBuilder::~TrackerScenarioBuilder ( )
inlineoverride

Member Function Documentation

void TrackerScenarioBuilder::applyScenario ( const edm::ParameterSet scenario)
overridevirtual

Apply misalignment scenario to the tracker.

Implements MisalignmentScenarioBuilder.

Definition at line 44 of file TrackerScenarioBuilder.cc.

References MisalignmentScenarioBuilder::decodeMovements_(), Exception, edm::ParameterSet::getParameter(), MisalignmentScenarioBuilder::hasParameter_(), AlignableModifier::setSeed(), AlignableTracker::subStructures(), theAlignableTracker, MisalignmentScenarioBuilder::theModifier, and MisalignmentScenarioBuilder::theModifierCounter.

Referenced by SurveyDataConverter::applyCoarseSurveyInfo(), AlignmentProducerBase::applyMisalignment(), and ~TrackerScenarioBuilder().

45 {
46 
47  // Apply the scenario to all main components of tracker.
49 
50  // Seed is set at top-level, and is mandatory
51  if ( this->hasParameter_( "seed", scenario) )
52  theModifier.setSeed( static_cast<long>(scenario.getParameter<int>("seed")) );
53  else
54  throw cms::Exception("BadConfig") << "No generator seed defined!";
55 
56  // misalignment applied recursively ('subStructures("Tracker")' contains only tracker itself)
57  this->decodeMovements_(scenario, theAlignableTracker->subStructures("Tracker"));
58 
59  edm::LogInfo("TrackerScenarioBuilder")
60  << "Applied modifications to " << theModifierCounter << " alignables";
61 
62 }
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.
void setSeed(long seed)
Resets the generator seed according to the argument.
AlignableModifier theModifier
Helper class for random movements.
Alignables & subStructures(const std::string &subStructName)
int theModifierCounter
Counter for applied modification.
bool hasParameter_(const std::string &name, const edm::ParameterSet &pSet) const
Check if given parameter exists in parameter set.
AlignableTracker * theAlignableTracker
bool TrackerScenarioBuilder::isTopLevel_ ( const std::string &  parameterSetName) const
overridevirtual

does this still make sense?

Reimplemented from MisalignmentScenarioBuilder.

Definition at line 66 of file TrackerScenarioBuilder.cc.

References MisalignmentScenarioBuilder::rootName_(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~TrackerScenarioBuilder().

67 {
68  // Get root name (strip last character [s])
69  std::string root = this->rootName_(parameterSetName);
70 
71  if (root == "Tracker") return true;
72 
73  return false;
74 }
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;)
bool TrackerScenarioBuilder::possiblyPartOf ( const std::string &  sub,
const std::string &  large 
) const
overridevirtual

True if hierarchy level 'sub' could be part of hierarchy level 'large'.

Reimplemented from MisalignmentScenarioBuilder.

Definition at line 77 of file TrackerScenarioBuilder.cc.

References theFirstStripIndex, and theSubdets.

Referenced by ~TrackerScenarioBuilder().

78 {
79  // string::find(s) != nPos => 's' is contained in string!
80  const std::string::size_type nPos = std::string::npos;
81 
82  // First check whether anything from pixel in strip.
83  if (largeStr.find("Strip") != nPos) {
84  if (subStruct.find("Pixel") != nPos) return false;
85  for (unsigned int iPix = 0; iPix < theFirstStripIndex; ++iPix) {
86  if (subStruct.find(theSubdets[iPix]) != nPos) return false;
87  }
88  }
89 
90  // Now check whether anything from strip in pixel.
91  if (largeStr.find("Pixel") != nPos) {
92  if (subStruct.find("Strip") != nPos) return false;
93  for (unsigned int iStrip = theFirstStripIndex; iStrip < theSubdets.size(); ++iStrip) {
94  if (subStruct.find(theSubdets[iStrip]) != nPos) return false;
95  }
96  }
97 
98  // Finally check for any different detector parts, e.g. TIDEndcap/TIBString gives false.
99  for (unsigned int iSub = 0; iSub < theSubdets.size(); ++iSub) {
100  for (unsigned int iLarge = 0; iLarge < theSubdets.size(); ++iLarge) {
101  if (iLarge == iSub) continue;
102  if (largeStr.find(theSubdets[iLarge]) != nPos && subStruct.find(theSubdets[iSub]) != nPos) {
103  return false;
104  }
105  }
106  }
107 
108  // It seems like a possible combination:
109  return true;
110 }
uint16_t size_type
unsigned int theFirstStripIndex
index of first strip subdet in &#39;theSubdets&#39; (pixel<strip)
std::vector< std::string > theSubdets
following things are needed in possiblyPartOf:
std::string TrackerScenarioBuilder::stripOffModule ( const align::StructureType type) const
private

Definition at line 113 of file TrackerScenarioBuilder.cc.

References Exception, dataset::name, AlignableTracker::objectIdProvider(), AlCaHLTBitMon_QueryRunRegistry::string, theAlignableTracker, and AlignableObjectId::typeToName().

Referenced by TrackerScenarioBuilder(), and ~TrackerScenarioBuilder().

113  {
114  const std::string module{"Module"};
116  auto start = name.find(module);
117  if (start == std::string::npos) {
118  throw cms::Exception("LogicError")
119  << "[TrackerScenarioBuilder] '" << name << "' is not a module type";
120  }
121  name.replace(start, module.length(), "");
122  return name;
123 }
Definition: start.py:1
type
Definition: HCALResponse.h:21
std::string typeToName(align::StructureType type) const
Convert type to name.
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker&#39;s geometry.
AlignableTracker * theAlignableTracker
Definition: vlib.h:208

Member Data Documentation

AlignableTracker* TrackerScenarioBuilder::theAlignableTracker
private

Pointer to mother alignable object

Definition at line 47 of file TrackerScenarioBuilder.h.

Referenced by applyScenario(), stripOffModule(), and TrackerScenarioBuilder().

unsigned int TrackerScenarioBuilder::theFirstStripIndex
private

index of first strip subdet in 'theSubdets' (pixel<strip)

Definition at line 50 of file TrackerScenarioBuilder.h.

Referenced by possiblyPartOf(), and TrackerScenarioBuilder().

std::vector<std::string> TrackerScenarioBuilder::theSubdets
private

following things are needed in possiblyPartOf:

sub-detector acronyms appearing in StructureType.h (TPE)

Definition at line 49 of file TrackerScenarioBuilder.h.

Referenced by possiblyPartOf(), and TrackerScenarioBuilder().