CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
AlignableBuilder Class Reference

#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. More...
 
 AlignableBuilder (align::StructureType moduleType, Counters &counter, const TrackerTopology *tTopo)
 Init the module type. More...
 
void buildAll (AlignSetup< align::Alignables > &setup) const
 Build the components for all levels given by user. More...
 

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

Private Attributes

Counters theCounters
 
std::vector< LevelInfotheLevelInfos
 
align::StructureType theModuleType
 
const TrackerTopologytheTopology
 

Detailed Description

A class to build alignable composites.

Date:
2007/10/18 09:41:07
Revision:
1.2
Author
Chung Khim Lae

Definition at line 21 of file AlignableBuilder.h.

Constructor & Destructor Documentation

AlignableBuilder::AlignableBuilder ( align::StructureType  moduleType,
Counters counter,
const TrackerTopology tTopo 
)

Init the module type.

Definition at line 18 of file AlignableBuilder.cc.

18  :
19  theModuleType(moduleType),
20  theCounters(counters),
21  theTopology(tTopo)
22 {
23 }
align::StructureType theModuleType
const TrackerTopology * theTopology

Member Function Documentation

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

29 {
30  theLevelInfos.push_back( LevelInfo(type, flat, maxComponent) );
31 }
type
Definition: HCALResponse.h:21
std::vector< LevelInfo > theLevelInfos
unsigned int maxComponent(unsigned int level) const
Find max number of components for a given level in the hierarchy.
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(), and psClasses.BuildThread::run().

72 {
73  const LevelInfo& momInfo = theLevelInfos[level];
74 
75  align::StructureType momType = momInfo.type_;
76 
77  const align::Alignables& daus = setup.find( AlignableObjectId::idToString(dauType) );
78 
79  unsigned int nDau = daus.size();
80 
81  align::Alignables& moms = setup.get( AlignableObjectId::idToString(momType) );
82 
83  moms.reserve(nDau);
84 
85  // In order not to depend on the order of the daughter list,
86  // we define flags to indicate the existence of a mother;
87  // 0 if it hasn't been created.
88  // We use vector instead of map for speed.
89  align::Alignables tempMoms(maxComponent(level), 0); // init all to 0
90 
91  for (unsigned int i = 0; i < nDau; ++i)
92  {
93  Alignable* dau = daus[i];
94 
95  Alignable*& mom = tempMoms[index( level, dau->id(), theTopology )];
96 
97  if (0 == mom)
98  {
99  // create new mom with id and rot of 1st dau
100  if ( momInfo.flat_ )
101  mom = new AlignableComposite( dau->id(), momType, dau->globalRotation() );
102  else
103  mom = new AlignableComposite( dau->id(), momType, align::RotationType() );
104 
105  moms.push_back(mom);
106  }
107 
108  mom->addComponent(dau);
109  }
110 }
TkRotation< Scalar > RotationType
Definition: Definitions.h:29
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
int i
Definition: DBlmapReader.cc:9
Type & find(const std::string &name="")
Definition: AlignSetup.h:58
std::vector< LevelInfo > theLevelInfos
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:132
Type & get(const std::string &name="")
Definition: AlignSetup.h:52
unsigned int index(unsigned int level, align::ID, const TrackerTopology *tTopo) const
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
unsigned int maxComponent(unsigned int level) const
Find max number of components for a given level in the hierarchy.
tuple level
Definition: testEve_cfg.py:34
static const char * idToString(align::StructureType type)
const TrackerTopology * theTopology
virtual void addComponent(Alignable *component)
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(), ConfigFiles::l, theLevelInfos, and theModuleType.

Referenced by AlignableTracker::buildTEC(), AlignableTracker::buildTIB(), AlignableTracker::buildTID(), AlignableTracker::buildTOB(), AlignableTracker::buildTPB(), and AlignableTracker::buildTPE().

35 {
36  build(0, theModuleType, setup); // build the first level above the modules
37 
38  for (unsigned int l = 1; l < theLevelInfos.size(); ++l)
39  build(l, theLevelInfos[l - 1].type_, setup);
40 }
void build(unsigned int level, align::StructureType dauType, AlignSetup< align::Alignables > &setup) const
Build the components for a given level in the hierarchy.
std::vector< LevelInfo > theLevelInfos
align::StructureType theModuleType
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 BeautifulSoup.PageElement::_invert(), and build().

57 {
58  const LevelInfo& info = theLevelInfos[level];
59 
60  if (theLevelInfos.size() - 1 > level)
61  {
62  return index(level + 1, id, tTopo) * info.maxComponent_ + theCounters.get(info.type_)(id, tTopo) - 1;
63  }
64 
65  return theCounters.get(info.type_)(id, tTopo) - 1;
66 }
static const TGPicture * info(bool iBackgroundIsBlack)
std::vector< LevelInfo > theLevelInfos
virtual align::Counter get(align::StructureType) const
Get a counter based on its structure type.
Definition: Counters.cc:8
unsigned int index(unsigned int level, align::ID, const TrackerTopology *tTopo) const
tuple level
Definition: testEve_cfg.py:34
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 ConfigFiles::l, bookConverter::max, and theLevelInfos.

Referenced by build().

44 {
45  unsigned int max = 1;
46 
47  for (unsigned int l = level; l < theLevelInfos.size(); ++l)
48  {
49  max *= theLevelInfos[l].maxComponent_;
50  }
51 
52  return max;
53 }
std::vector< LevelInfo > theLevelInfos
tuple level
Definition: testEve_cfg.py:34

Member Data Documentation

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

align::StructureType AlignableBuilder::theModuleType
private

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