#include <AlignableBuilder.h>
Classes | |
struct | LevelInfo |
Public Member Functions | |
void | addLevelInfo (align::StructureType, bool flat, unsigned int maxComponent) |
Add info required to build a level to the list. | |
AlignableBuilder (align::StructureType moduleType, Counters &counter, const TrackerTopology *tTopo) | |
Init the module type. | |
void | buildAll (AlignSetup< align::Alignables > &setup) const |
Build the components for all levels given by user. | |
Private Member Functions | |
void | build (unsigned int level, align::StructureType dauType, AlignSetup< align::Alignables > &setup) const |
Build the components for a given level in the hierarchy. | |
unsigned int | index (unsigned int level, align::ID, const TrackerTopology *tTopo) const |
unsigned int | maxComponent (unsigned int level) const |
Find max number of components for a given level in the hierarchy. | |
Private Attributes | |
Counters | theCounters |
std::vector< LevelInfo > | theLevelInfos |
align::StructureType | theModuleType |
const TrackerTopology * | theTopology |
A class to build alignable composites.
Definition at line 21 of file AlignableBuilder.h.
AlignableBuilder::AlignableBuilder | ( | align::StructureType | moduleType, |
Counters & | counter, | ||
const TrackerTopology * | tTopo | ||
) |
Init the module type.
Definition at line 18 of file AlignableBuilder.cc.
: theModuleType(moduleType), theCounters(counters), theTopology(tTopo) { }
void AlignableBuilder::addLevelInfo | ( | align::StructureType | type, |
bool | flat, | ||
unsigned int | maxComponent | ||
) |
Add info required to build a level to the list.
Definition at line 26 of file AlignableBuilder.cc.
References theLevelInfos.
Referenced by AlignableTracker::buildTEC(), AlignableTracker::buildTIB(), AlignableTracker::buildTID(), AlignableTracker::buildTOB(), AlignableTracker::buildTPB(), and AlignableTracker::buildTPE().
{ theLevelInfos.push_back( LevelInfo(type, flat, maxComponent) ); }
void AlignableBuilder::build | ( | unsigned int | level, |
align::StructureType | dauType, | ||
AlignSetup< align::Alignables > & | setup | ||
) | const [private] |
Build the components for a given level in the hierarchy.
Definition at line 70 of file AlignableBuilder.cc.
References Alignable::addComponent(), AlignSetup< Type >::find(), AlignableBuilder::LevelInfo::flat_, AlignSetup< Type >::get(), Alignable::globalRotation(), i, Alignable::id(), AlignableObjectId::idToString(), index(), testEve_cfg::level, maxComponent(), theLevelInfos, theTopology, and AlignableBuilder::LevelInfo::type_.
Referenced by buildAll().
{ const LevelInfo& momInfo = theLevelInfos[level]; align::StructureType momType = momInfo.type_; const align::Alignables& daus = setup.find( AlignableObjectId::idToString(dauType) ); unsigned int nDau = daus.size(); align::Alignables& moms = setup.get( AlignableObjectId::idToString(momType) ); moms.reserve(nDau); // In order not to depend on the order of the daughter list, // we define flags to indicate the existence of a mother; // 0 if it hasn't been created. // We use vector instead of map for speed. align::Alignables tempMoms(maxComponent(level), 0); // init all to 0 for (unsigned int i = 0; i < nDau; ++i) { Alignable* dau = daus[i]; Alignable*& mom = tempMoms[index( level, dau->id(), theTopology )]; if (0 == mom) { // create new mom with id and rot of 1st dau if ( momInfo.flat_ ) mom = new AlignableComposite( dau->id(), momType, dau->globalRotation() ); else mom = new AlignableComposite( dau->id(), momType, align::RotationType() ); moms.push_back(mom); } mom->addComponent(dau); } }
void AlignableBuilder::buildAll | ( | AlignSetup< align::Alignables > & | setup | ) | const |
Build the components for all levels given by user.
Definition at line 34 of file AlignableBuilder.cc.
References build(), prof2calltree::l, theLevelInfos, and theModuleType.
Referenced by AlignableTracker::buildTEC(), AlignableTracker::buildTIB(), AlignableTracker::buildTID(), AlignableTracker::buildTOB(), AlignableTracker::buildTPB(), and AlignableTracker::buildTPE().
{ build(0, theModuleType, setup); // build the first level above the modules for (unsigned int l = 1; l < theLevelInfos.size(); ++l) build(l, theLevelInfos[l - 1].type_, setup); }
unsigned int AlignableBuilder::index | ( | unsigned int | level, |
align::ID | id, | ||
const TrackerTopology * | tTopo | ||
) | const [private] |
A way to index a component of a certain level in the hierarchy. Unique for each component of a given structure type. It starts from 0 and doesn't have to be continuous.
Definition at line 56 of file AlignableBuilder.cc.
References Counters::get(), info, testEve_cfg::level, AlignableBuilder::LevelInfo::maxComponent_, theCounters, theLevelInfos, and AlignableBuilder::LevelInfo::type_.
Referenced by build().
{ const LevelInfo& info = theLevelInfos[level]; if (theLevelInfos.size() - 1 > level) { return index(level + 1, id, tTopo) * info.maxComponent_ + theCounters.get(info.type_)(id, tTopo) - 1; } return theCounters.get(info.type_)(id, tTopo) - 1; }
unsigned int AlignableBuilder::maxComponent | ( | unsigned int | level | ) | const [private] |
Find max number of components for a given level in the hierarchy.
Definition at line 43 of file AlignableBuilder.cc.
References prof2calltree::l, max(), and theLevelInfos.
Referenced by build().
{ unsigned int max = 1; for (unsigned int l = level; l < theLevelInfos.size(); ++l) { max *= theLevelInfos[l].maxComponent_; } return max; }
Counters AlignableBuilder::theCounters [private] |
Definition at line 66 of file AlignableBuilder.h.
Referenced by index().
std::vector<LevelInfo> AlignableBuilder::theLevelInfos [private] |
Definition at line 64 of file AlignableBuilder.h.
Referenced by addLevelInfo(), build(), buildAll(), index(), and maxComponent().
Definition at line 62 of file AlignableBuilder.h.
Referenced by buildAll().
const TrackerTopology* AlignableBuilder::theTopology [private] |
Definition at line 68 of file AlignableBuilder.h.
Referenced by build().