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 &levelName, int iComponent, const edm::ParameterSet &pSet) const
 
edm::ParameterSet getParameterSet_ (const std::string &name, 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.

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 }

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

◆ ~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.

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 }

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

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

◆ 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.

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 }

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

◆ 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.

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 }

References theFirstStripIndex, and theSubdets.

◆ stripOffModule()

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

Definition at line 107 of file TrackerScenarioBuilder.cc.

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 }

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

Referenced by TrackerScenarioBuilder().

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().

AlignableObjectId::typeToName
std::string typeToName(align::StructureType type) const
Convert type to name.
Definition: AlignableObjectId.cc:270
start
Definition: start.py:1
MisalignmentScenarioBuilder::hasParameter_
bool hasParameter_(const std::string &name, const edm::ParameterSet &pSet) const
Check if given parameter exists in parameter set.
Definition: MisalignmentScenarioBuilder.cc:271
align::TOBModule
Definition: StructureType.h:54
align::TIBModule
Definition: StructureType.h:38
AlignableTracker::objectIdProvider
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker's geometry.
Definition: AlignableTracker.h:110
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
TrackerScenarioBuilder::theAlignableTracker
AlignableTracker * theAlignableTracker
Definition: TrackerScenarioBuilder.h:44
AlignableTracker::subStructures
Alignables & subStructures(const std::string &subStructName)
Definition: AlignableTracker.h:27
MisalignmentScenarioBuilder::theModifierCounter
int theModifierCounter
Counter for applied modification.
Definition: MisalignmentScenarioBuilder.h:80
cmsdt::scenario
scenario
Definition: constants.h:173
MisalignmentScenarioBuilder::theModifier
AlignableModifier theModifier
Helper class for random movements.
Definition: MisalignmentScenarioBuilder.h:78
TrackerScenarioBuilder::theFirstStripIndex
unsigned int theFirstStripIndex
index of first strip subdet in 'theSubdets' (pixel<strip)
Definition: TrackerScenarioBuilder.h:47
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
TrackerScenarioBuilder::theSubdets
std::vector< std::string > theSubdets
following things are needed in possiblyPartOf:
Definition: TrackerScenarioBuilder.h:46
root
Definition: RooFitFunction.h:10
TrackerScenarioBuilder::stripOffModule
std::string stripOffModule(const align::StructureType &type) const
Definition: TrackerScenarioBuilder.cc:107
align::TIDModule
Definition: StructureType.h:47
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
callgraph.module
module
Definition: callgraph.py:61
align::TPEModule
Definition: StructureType.h:30
MisalignmentScenarioBuilder::MisalignmentScenarioBuilder
MisalignmentScenarioBuilder(AlignableObjectId::Geometry)
Constructor.
Definition: MisalignmentScenarioBuilder.cc:23
Exception
Definition: hltDiff.cc:245
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MisalignmentScenarioBuilder::decodeMovements_
void decodeMovements_(const edm::ParameterSet &, const align::Alignables &)
Decode movements defined in given parameter set for given set of alignables.
Definition: MisalignmentScenarioBuilder.cc:28
MisalignmentScenarioBuilder::rootName_
const std::string rootName_(const std::string &parameterSetName) const
Get root name of a parameter set (e.g. 'Rod' in 'Rods' or 'Rod1')
Definition: MisalignmentScenarioBuilder.cc:336
AlignableObjectId::geometry
Geometry geometry() const
retrieve the geometry information
Definition: AlignableObjectId.h:27
AlignableModifier::setSeed
void setSeed(long seed)
Resets the generator seed according to the argument.
Definition: AlignableModifier.cc:277
align::TECModule
Definition: StructureType.h:61
align::TPBModule
Definition: StructureType.h:23