23 trackerTopology_(trackerTopology),
25 alignableIndexer_(alignableIndexer)
32 alignmentLevels_.push_back(
std::move(level));
38 alignmentLevels_.clear();
45 auto highestLevel = alignmentLevels_.back()->levelType;
47 std::ostringstream
ss;
48 ss <<
"building CompositeAlignables for "
49 << alignableObjectId_.idToString(highestLevel) <<
"\n";
51 unsigned int numCompositeAlignables = 0;
52 for (
unsigned int level = 1;
level < alignmentLevels_.size(); ++
level) {
53 numCompositeAlignables += buildLevel(
level, alignableMap, ss);
56 ss <<
"built " << numCompositeAlignables <<
" CompositeAlignables for "
57 << alignableObjectId_.idToString(highestLevel);
59 <<
"@SUB=AlignableCompositeBuilder::buildAll" << ss.str();
61 return numCompositeAlignables;
74 std::ostringstream&
ss)
76 unsigned int childLevel = parentLevel - 1;
77 unsigned int maxNumParents = maxNumComponents(parentLevel);
79 auto childType = alignmentLevels_[childLevel] ->levelType;
80 auto parentType = alignmentLevels_[parentLevel]->levelType;
82 auto& children = alignableMap.
find(alignableObjectId_.idToString(childType));
83 auto&
parents = alignableMap.
get (alignableObjectId_.idToString(parentType));
91 for (
auto*
child: children) {
93 const auto index = getIndexOfStructure(
child->id(), parentLevel);
101 if (alignmentLevels_[parentLevel]->isFlat) {
103 child->globalRotation());
112 parent->addComponent(
child);
115 ss <<
" built " <<
parents.size() <<
" "
116 << alignableObjectId_.idToString(alignmentLevels_[parentLevel]->levelType)
117 <<
"(s) (theoretical maximum: " << maxNumParents
118 <<
") consisting of " << children.size() <<
" "
119 << alignableObjectId_.idToString(alignmentLevels_[childLevel]->levelType)
131 for (
unsigned int level = startLevel;
132 level < alignmentLevels_.size();
134 components *= alignmentLevels_[
level]->maxNumComponents;
145 auto indexOf = alignableIndexer_.get(alignmentLevels_[level]->levelType,
148 if (alignmentLevels_.size() - 1 >
level) {
149 return getIndexOfStructure(
id, level + 1)
150 * alignmentLevels_[
level]->maxNumComponents
154 return indexOf(
id) - 1;
TkRotation< Scalar > RotationType
unsigned int buildLevel(unsigned int parentLevel, AlignableMap &, std::ostringstream &)
Builds the components for a given level in the hierarchy.
std::vector< Alignable * > Alignables
AlignableCompositeBuilder(const TrackerTopology *, const TrackerGeometry *, const AlignableIndexer &)
unsigned int getIndexOfStructure(align::ID, unsigned int level) const
unsigned int buildAll(AlignableMap &)
Alignables & get(const std::string &name="")
Alignables & find(const std::string &name="")
void clearAlignmentLevels()
Resets the alignment-levels.
unsigned int maxNumComponents(unsigned int startLevel) const
void addAlignmentLevel(std::unique_ptr< AlignmentLevel > level)