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::TrackerScenarioBuilder ( AlignableTracker alignable)
explicit

Constructor.

Definition at line 22 of file TrackerScenarioBuilder.cc.

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

24  if (!theAlignableTracker) {
25  throw cms::Exception("TypeMismatch") << "Pointer to AlignableTracker is empty.\n";
26  }
27 
28  // Fill what is needed for possiblyPartOf(..):
29  theSubdets.push_back(stripOffModule(align::TPBModule)); // Take care, order matters: 1st pixel, 2nd strip.
36 }
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::~TrackerScenarioBuilder ( )
inlineoverride

Destructor.

Definition at line 30 of file TrackerScenarioBuilder.h.

30 {};

Member Function Documentation

◆ applyScenario()

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

Apply misalignment scenario to the tracker.

Implements MisalignmentScenarioBuilder.

Definition at line 39 of file TrackerScenarioBuilder.cc.

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

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

39  {
40  // Apply the scenario to all main components of tracker.
42 
43  // Seed is set at top-level, and is mandatory
44  if (this->hasParameter_("seed", scenario))
45  theModifier.setSeed(static_cast<long>(scenario.getParameter<int>("seed")));
46  else
47  throw cms::Exception("BadConfig") << "No generator seed defined!";
48 
49  // misalignment applied recursively ('subStructures("Tracker")' contains only tracker itself)
50  this->decodeMovements_(scenario, theAlignableTracker->subStructures("Tracker"));
51 
52  edm::LogInfo("TrackerScenarioBuilder") << "Applied modifications to " << theModifierCounter << " alignables";
53 }
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.
bool hasParameter_(const std::string &name, const edm::ParameterSet &pSet) const
Check if given parameter exists in parameter set.
scenario
Definition: constants.h:173
Log< level::Info, false > LogInfo
AlignableModifier theModifier
Helper class for random movements.
Alignables & subStructures(const std::string &subStructName)
int theModifierCounter
Counter for applied modification.
AlignableTracker * theAlignableTracker

◆ isTopLevel_()

bool TrackerScenarioBuilder::isTopLevel_ ( const std::string &  parameterSetName) const
overridevirtual

does this still make sense?

Reimplemented from MisalignmentScenarioBuilder.

Definition at line 56 of file TrackerScenarioBuilder.cc.

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

56  {
57  // Get root name (strip last character [s])
58  std::string root = this->rootName_(parameterSetName);
59 
60  if (root == "Tracker")
61  return true;
62 
63  return false;
64 }
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;)

◆ possiblyPartOf()

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 67 of file TrackerScenarioBuilder.cc.

References theFirstStripIndex, and theSubdets.

67  {
68  // string::find(s) != nPos => 's' is contained in string!
69  const std::string::size_type nPos = std::string::npos;
70 
71  // First check whether anything from pixel in strip.
72  if (largeStr.find("Strip") != nPos) {
73  if (subStruct.find("Pixel") != nPos)
74  return false;
75  for (unsigned int iPix = 0; iPix < theFirstStripIndex; ++iPix) {
76  if (subStruct.find(theSubdets[iPix]) != nPos)
77  return false;
78  }
79  }
80 
81  // Now check whether anything from strip in pixel.
82  if (largeStr.find("Pixel") != nPos) {
83  if (subStruct.find("Strip") != nPos)
84  return false;
85  for (unsigned int iStrip = theFirstStripIndex; iStrip < theSubdets.size(); ++iStrip) {
86  if (subStruct.find(theSubdets[iStrip]) != nPos)
87  return false;
88  }
89  }
90 
91  // Finally check for any different detector parts, e.g. TIDEndcap/TIBString gives false.
92  for (unsigned int iSub = 0; iSub < theSubdets.size(); ++iSub) {
93  for (unsigned int iLarge = 0; iLarge < theSubdets.size(); ++iLarge) {
94  if (iLarge == iSub)
95  continue;
96  if (largeStr.find(theSubdets[iLarge]) != nPos && subStruct.find(theSubdets[iSub]) != nPos) {
97  return false;
98  }
99  }
100  }
101 
102  // It seems like a possible combination:
103  return true;
104 }
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:

◆ stripOffModule()

std::string TrackerScenarioBuilder::stripOffModule ( const align::StructureType type) const
private

Definition at line 107 of file TrackerScenarioBuilder.cc.

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

Referenced by TrackerScenarioBuilder().

107  {
108  const std::string module{"Module"};
110  auto start = name.find(module);
111  if (start == std::string::npos) {
112  throw cms::Exception("LogicError") << "[TrackerScenarioBuilder] '" << name << "' is not a module type";
113  }
114  name.replace(start, module.length(), "");
115  return name;
116 }
Definition: start.py:1
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

Member Data Documentation

◆ theAlignableTracker

AlignableTracker* TrackerScenarioBuilder::theAlignableTracker
private

Pointer to mother alignable object

Definition at line 44 of file TrackerScenarioBuilder.h.

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

◆ theFirstStripIndex

unsigned int TrackerScenarioBuilder::theFirstStripIndex
private

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

Definition at line 47 of file TrackerScenarioBuilder.h.

Referenced by possiblyPartOf(), and TrackerScenarioBuilder().

◆ theSubdets

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

following things are needed in possiblyPartOf:

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

Definition at line 46 of file TrackerScenarioBuilder.h.

Referenced by possiblyPartOf(), and TrackerScenarioBuilder().