test
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 Member Functions | Private Attributes
AlignableCompositeBuilder Class Reference

#include <AlignableCompositeBuilder.h>

Public Member Functions

void addAlignmentLevel (std::unique_ptr< AlignmentLevel > level)
 
 AlignableCompositeBuilder (const TrackerTopology *, AlignableIndexer &)
 
unsigned int buildAll (AlignableMap &)
 
void clearAlignmentLevels ()
 Resets the alignment-levels. More...
 
virtual ~AlignableCompositeBuilder ()
 

Private Member Functions

unsigned int buildLevel (unsigned int parentLevel, AlignableMap &, std::ostringstream &)
 Builds the components for a given level in the hierarchy. More...
 
unsigned int getIndexOfStructure (align::ID, unsigned int level) const
 
unsigned int maxNumComponents (unsigned int startLevel) const
 

Private Attributes

AlignableIndexer alignableIndexer_
 
align::AlignmentLevels alignmentLevels_
 
const TrackerTopologytrackerTopology_
 

Detailed Description

Definition at line 16 of file AlignableCompositeBuilder.h.

Constructor & Destructor Documentation

AlignableCompositeBuilder::AlignableCompositeBuilder ( const TrackerTopology trackerTopology,
AlignableIndexer alignableIndexer 
)

Definition at line 20 of file AlignableCompositeBuilder.cc.

21  :
22  trackerTopology_(trackerTopology),
23  alignableIndexer_(alignableIndexer)
24 {
25 }
const TrackerTopology * trackerTopology_
virtual AlignableCompositeBuilder::~AlignableCompositeBuilder ( )
inlinevirtual

Definition at line 22 of file AlignableCompositeBuilder.h.

22 {};

Member Function Documentation

void AlignableCompositeBuilder::addAlignmentLevel ( std::unique_ptr< AlignmentLevel level)

Add all desired AlignmentLevels for a sub-detector to the builder before calling buildAll(), the order matters! Example for PixelBarrel-RunI geometry: -> PXBModule, PXBLadder, TPBLayer, TPBHalfBarrel, TPBBarrel

Definition at line 29 of file AlignableCompositeBuilder.cc.

References eostools::move().

Referenced by AlignableTrackerBuilder::buildAlignableComposites().

29  {
30  alignmentLevels_.push_back(std::move(level));
31 }
align::AlignmentLevels alignmentLevels_
def move
Definition: eostools.py:510
tuple level
Definition: testEve_cfg.py:34
unsigned int AlignableCompositeBuilder::buildAll ( AlignableMap alignableMap)

Builds all composite Alignables according to the levels added before via addAlignmentLevel(). The Alignables were built from bottom- to the top- hierarchy, e.g. for PixelBarrel-RunI geometry:

  • PXBLadder (with PXBModule as children)
  • TPBLayer (with PXBLadder as children)
  • TPBHalfBarrel (with TPBLayer as children)
  • TPBBarrel (with TPBHalfBarrel as children) Returns the number of composite Alignables which were built.

Definition at line 41 of file AlignableCompositeBuilder.cc.

References AlignableObjectId::idToString(), testEve_cfg::level, and contentValuesCheck::ss.

Referenced by AlignableTrackerBuilder::buildAlignableComposites().

42 {
43  auto highestLevel = alignmentLevels_.back()->levelType;
44 
45  std::ostringstream ss;
46  ss << "building CompositeAlignables for "
47  << AlignableObjectId::idToString(highestLevel) << "\n";
48 
49  unsigned int numCompositeAlignables = 0;
50  for (unsigned int level = 1; level < alignmentLevels_.size(); ++level) {
51  numCompositeAlignables += buildLevel(level, alignableMap, ss);
52  }
53 
54  ss << "built " << numCompositeAlignables << " CompositeAlignables for "
55  << AlignableObjectId::idToString(highestLevel);
56  edm::LogInfo("AlignableBuildProcess")
57  << "@SUB=AlignableCompositeBuilder::buildAll" << ss.str();
58 
59  return numCompositeAlignables;
60 }
unsigned int buildLevel(unsigned int parentLevel, AlignableMap &, std::ostringstream &)
Builds the components for a given level in the hierarchy.
align::AlignmentLevels alignmentLevels_
tuple level
Definition: testEve_cfg.py:34
static const char * idToString(align::StructureType type)
unsigned int AlignableCompositeBuilder::buildLevel ( unsigned int  parentLevel,
AlignableMap alignableMap,
std::ostringstream &  ss 
)
private

Builds the components for a given level in the hierarchy.

Definition at line 70 of file AlignableCompositeBuilder.cc.

References AlignableMap::find(), AlignableMap::get(), AlignableObjectId::idToString(), cmsHarvester::index, SpecificationBuilder_cfi::parent(), and parents.

73 {
74  unsigned int childLevel = parentLevel - 1;
75  unsigned int maxNumParents = maxNumComponents(parentLevel);
76 
77  auto childType = alignmentLevels_[childLevel] ->levelType;
78  auto parentType = alignmentLevels_[parentLevel]->levelType;
79 
80  auto& children = alignableMap.find(AlignableObjectId::idToString(childType));
81  auto& parents = alignableMap.get (AlignableObjectId::idToString(parentType));
82  parents.reserve(maxNumParents);
83 
84  // This vector is used indicate if a parent already exists. It is initialized
85  // with 'naked' Alignables-pointers; if the pointer is not naked (!= nullptr)
86  // for one of the child-IDs, its parent was already built before.
87  Alignables tmpParents(maxNumParents, nullptr);
88 
89  for (auto* child: children) {
90  // get the number of the child-Alignable ...
91  const auto index = getIndexOfStructure(child->id(), parentLevel);
92  // ... and use it as index to get the parent of this child
93  auto& parent = tmpParents[index];
94 
95  // if parent was not built yet ...
96  if (!parent) {
97  // ... build new composite Alignable with ID of child (obviously its the
98  // first child of the Alignable)
99  if (alignmentLevels_[parentLevel]->isFlat) {
100  parent = new AlignableComposite(child->id(), parentType,
101  child->globalRotation());
102  } else {
103  parent = new AlignableComposite(child->id(), parentType,
105  }
106  parents.push_back(parent);
107  }
108 
109  // in all cases add the child to the parent Alignable
110  parent->addComponent(child);
111  }
112 
113  ss << " built " << parents.size() << " "
114  << AlignableObjectId::idToString(alignmentLevels_[parentLevel]->levelType)
115  << "(s) (theoretical maximum: " << maxNumParents
116  << ") consisting of " << children.size() << " "
117  << AlignableObjectId::idToString(alignmentLevels_[childLevel]->levelType)
118  << "(s)\n";
119 
120  return parents.size();
121 }
TkRotation< Scalar > RotationType
Definition: Definitions.h:29
TPRegexp parents
Definition: eve_filter.cc:21
std::vector< Alignable * > Alignables
Definition: Alignable.h:251
unsigned int getIndexOfStructure(align::ID, unsigned int level) const
align::AlignmentLevels alignmentLevels_
Alignables & get(const std::string &name="")
Definition: AlignableMap.cc:9
Alignables & find(const std::string &name="")
Definition: AlignableMap.cc:15
unsigned int maxNumComponents(unsigned int startLevel) const
static const char * idToString(align::StructureType type)
void AlignableCompositeBuilder::clearAlignmentLevels ( )

Resets the alignment-levels.

Definition at line 35 of file AlignableCompositeBuilder.cc.

Referenced by AlignableTrackerBuilder::buildAlignableComposites().

35  {
36  alignmentLevels_.clear();
37 }
align::AlignmentLevels alignmentLevels_
unsigned int AlignableCompositeBuilder::getIndexOfStructure ( align::ID  id,
unsigned int  level 
) const
private

Calculates the index of an Alignable within the hierarchy; unique for each component of a given structure-type.

Definition at line 140 of file AlignableCompositeBuilder.cc.

References testEve_cfg::level.

141 {
142  // indexer returns a function pointer for the structure-type
143  auto indexOf = alignableIndexer_.get(alignmentLevels_[level]->levelType);
144 
145  if (alignmentLevels_.size() - 1 > level) {
146  return getIndexOfStructure(id, level + 1)
147  * alignmentLevels_[level]->maxNumComponents
148  + indexOf(id, trackerTopology_) - 1;
149  }
150 
151  return indexOf(id, trackerTopology_) - 1;
152 }
unsigned int getIndexOfStructure(align::ID, unsigned int level) const
align::AlignmentLevels alignmentLevels_
virtual align::Counter get(align::StructureType) const
Get a counter based on its structure type.
const TrackerTopology * trackerTopology_
tuple level
Definition: testEve_cfg.py:34
unsigned int AlignableCompositeBuilder::maxNumComponents ( unsigned int  startLevel) const
private

Calculates the theoretical max. number of components for a given level in the hierarchy.

Definition at line 125 of file AlignableCompositeBuilder.cc.

References makeMuonMisalignmentScenario::components, and testEve_cfg::level.

126 {
127  unsigned int components = 1;
128 
129  for (unsigned int level = startLevel;
130  level < alignmentLevels_.size();
131  ++level) {
132  components *= alignmentLevels_[level]->maxNumComponents;
133  }
134 
135  return components;
136 }
align::AlignmentLevels alignmentLevels_
tuple level
Definition: testEve_cfg.py:34

Member Data Documentation

AlignableIndexer AlignableCompositeBuilder::alignableIndexer_
private

Definition at line 68 of file AlignableCompositeBuilder.h.

align::AlignmentLevels AlignableCompositeBuilder::alignmentLevels_
private

Definition at line 70 of file AlignableCompositeBuilder.h.

const TrackerTopology* AlignableCompositeBuilder::trackerTopology_
private

Definition at line 66 of file AlignableCompositeBuilder.h.