CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public 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)
 Apply misalignment scenario to the tracker. More...
 
virtual bool isTopLevel_ (const std::string &parameterSetName) const
 does this still make sense? More...
 
virtual bool possiblyPartOf (const std::string &sub, const std::string &large) const
 True if hierarchy level 'sub' could be part of hierarchy level 'large'. More...
 
 TrackerScenarioBuilder (AlignableTracker *alignable)
 Constructor. More...
 
 ~TrackerScenarioBuilder ()
 Destructor. More...
 
- Public Member Functions inherited from MisalignmentScenarioBuilder
 MisalignmentScenarioBuilder ()
 Default constructor. More...
 
virtual ~MisalignmentScenarioBuilder ()
 Destructor. More...
 

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 &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...
 
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...
 
AlignableObjectId theAlignableObjectId
 Type to name converter. 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

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

Date:
2009/03/15 17:39:58
Revision:
1.3
Author:
flucke
Author
Frederic Ronga - CERN-PH-CMG

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

Definition at line 23 of file TrackerScenarioBuilder.h.

Constructor & Destructor Documentation

TrackerScenarioBuilder::TrackerScenarioBuilder ( AlignableTracker alignable)
explicit

Constructor.

Definition at line 24 of file TrackerScenarioBuilder.cc.

References edm::hlt::Exception, theAlignableTracker, theFirstStripIndex, and theSubdets.

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("TPB"); // Take care, order matters: 1st pixel, 2nd strip.
34  theSubdets.push_back("TPE");
36  theSubdets.push_back("TIB");
37  theSubdets.push_back("TID");
38  theSubdets.push_back("TOB");
39  theSubdets.push_back("TEC");
40 }
unsigned int theFirstStripIndex
index of first strip subdet in &#39;theSubdets&#39; (pixel&lt;strip)
std::vector< std::string > theSubdets
following things are needed in possiblyPartOf:
AlignableTracker * theAlignableTracker
TrackerScenarioBuilder::~TrackerScenarioBuilder ( )
inline

Destructor.

Definition at line 32 of file TrackerScenarioBuilder.h.

32 {};

Member Function Documentation

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

Apply misalignment scenario to the tracker.

Implements MisalignmentScenarioBuilder.

Definition at line 44 of file TrackerScenarioBuilder.cc.

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

Referenced by SurveyDataConverter::applyCoarseSurveyInfo(), AlignmentProducer::beginOfJob(), and MisalignedTrackerESProducer::produce().

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 setSeed(long seed)
Resets the generator seed according to the argument.
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.
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
virtual

does this still make sense?

Reimplemented from MisalignmentScenarioBuilder.

Definition at line 66 of file TrackerScenarioBuilder.cc.

References dbtoconf::root, and MisalignmentScenarioBuilder::rootName_().

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;)
string root
initialization
Definition: dbtoconf.py:70
bool TrackerScenarioBuilder::possiblyPartOf ( const std::string &  sub,
const std::string &  large 
) const
virtual

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.

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&lt;strip)
std::vector< std::string > theSubdets
following things are needed in possiblyPartOf:

Member Data Documentation

AlignableTracker* TrackerScenarioBuilder::theAlignableTracker
private

Pointer to mother alignable object

Definition at line 43 of file TrackerScenarioBuilder.h.

Referenced by applyScenario(), and TrackerScenarioBuilder().

unsigned int TrackerScenarioBuilder::theFirstStripIndex
private

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

Definition at line 46 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 45 of file TrackerScenarioBuilder.h.

Referenced by possiblyPartOf(), and TrackerScenarioBuilder().