CMS 3D CMS Logo

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

#include <TIBLayerBuilder.h>

Public Member Functions

TIBLayer * build (const GeometricDet *aTIBLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
 
void constructRings (std::vector< const GeometricDet * > &theGeometricRods, std::vector< std::vector< const GeometricDet * > > &innerGeometricDetRings, std::vector< std::vector< const GeometricDet * > > &outerGeometricDetRings)
 
 TIBLayerBuilder ()
 

Detailed Description

A concrete builder for TIBLayer

Definition at line 15 of file TIBLayerBuilder.h.

Constructor & Destructor Documentation

TIBLayerBuilder::TIBLayerBuilder ( )
inline

Definition at line 17 of file TIBLayerBuilder.h.

17 {};

Member Function Documentation

TIBLayer * TIBLayerBuilder::build ( const GeometricDet aTIBLayer,
const TrackerGeometry theGeomDetGeometry 
)

Definition at line 10 of file TIBLayerBuilder.cc.

References TIBRingBuilder::build(), GeometricDet::components(), i, and align::TIBLayer.

Referenced by GeometricSearchTrackerBuilder::build().

12 {
13  vector<const GeometricDet*> theGeometricRods = aTIBLayer->components();
14 
15  vector<vector<const GeometricDet*> > innerGeometricDetRings;
16  vector<vector<const GeometricDet*> > outerGeometricDetRings;
17 
18  constructRings(theGeometricRods,innerGeometricDetRings,outerGeometricDetRings);
19 
20  TIBRingBuilder myRingBuilder;
21 
22  vector<const TIBRing*> innerRings;
23  vector<const TIBRing*> outerRings;
24 
25  for(unsigned int i=0; i<innerGeometricDetRings.size(); i++){
26  innerRings.push_back(myRingBuilder.build(innerGeometricDetRings[i],theGeomDetGeometry));
27  outerRings.push_back(myRingBuilder.build(outerGeometricDetRings[i],theGeomDetGeometry));
28  }
29 
30  return new TIBLayer(innerRings,outerRings);
31 }
int i
Definition: DBlmapReader.cc:9
void constructRings(std::vector< const GeometricDet * > &theGeometricRods, std::vector< std::vector< const GeometricDet * > > &innerGeometricDetRings, std::vector< std::vector< const GeometricDet * > > &outerGeometricDetRings)
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:169
TIBRing * build(const std::vector< const GeometricDet * > &detsInRing, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
void TIBLayerBuilder::constructRings ( std::vector< const GeometricDet * > &  theGeometricRods,
std::vector< std::vector< const GeometricDet * > > &  innerGeometricDetRings,
std::vector< std::vector< const GeometricDet * > > &  outerGeometricDetRings 
)

Definition at line 37 of file TIBLayerBuilder.cc.

References i, LogDebug, and edm::max().

40 {
41  double meanPerp=0;
42  for(vector<const GeometricDet*>::const_iterator it=theGeometricRods.begin();
43  it!= theGeometricRods.end();it++){
44  meanPerp = meanPerp + (*it)->positionBounds().perp();
45  }
46  meanPerp = meanPerp/theGeometricRods.size();
47 
48  vector<const GeometricDet*> theInnerGeometricRods;
49  vector<const GeometricDet*> theOuterGeometricRods;
50 
51  for(vector<const GeometricDet*>::const_iterator it=theGeometricRods.begin();
52  it!= theGeometricRods.end();it++){
53  if( (*it)->positionBounds().perp() < meanPerp) theInnerGeometricRods.push_back(*it);
54  if( (*it)->positionBounds().perp() > meanPerp) theOuterGeometricRods.push_back(*it);
55  }
56 
57  size_t innerLeftRodMaxSize = 0;
58  size_t innerRightRodMaxSize = 0;
59  size_t outerLeftRodMaxSize = 0;
60  size_t outerRightRodMaxSize = 0;
61 
62  for(vector<const GeometricDet*>::const_iterator it=theInnerGeometricRods.begin();
63  it!= theInnerGeometricRods.end();it++){
64  if( (*it)->positionBounds().z() < 0)
65  innerLeftRodMaxSize = max(innerLeftRodMaxSize, (**it).components().size());
66  if( (*it)->positionBounds().z() > 0)
67  innerRightRodMaxSize = max(innerRightRodMaxSize, (**it).components().size());
68  }
69 
70  for(vector<const GeometricDet*>::const_iterator it=theOuterGeometricRods.begin();
71  it!= theOuterGeometricRods.end();it++){
72  if( (*it)->positionBounds().z() < 0)
73  outerLeftRodMaxSize = max(outerLeftRodMaxSize, (**it).components().size());
74  if( (*it)->positionBounds().z() > 0)
75  outerRightRodMaxSize = max(outerRightRodMaxSize, (**it).components().size());
76  }
77 
78  LogDebug("TkDetLayers") << "innerLeftRodMaxSize: " << innerLeftRodMaxSize ;
79  LogDebug("TkDetLayers") << "innerRightRodMaxSize: " << innerRightRodMaxSize ;
80 
81  LogDebug("TkDetLayers") << "outerLeftRodMaxSize: " << outerLeftRodMaxSize ;
82  LogDebug("TkDetLayers") << "outerRightRodMaxSize: " << outerRightRodMaxSize ;
83 
84  for(unsigned int i=0;i< (innerLeftRodMaxSize+innerRightRodMaxSize);i++){
85  innerGeometricDetRings.push_back(vector<const GeometricDet*>());
86  }
87 
88  for(unsigned int i=0;i< (outerLeftRodMaxSize+outerRightRodMaxSize);i++){
89  outerGeometricDetRings.push_back(vector<const GeometricDet*>());
90  }
91 
92  for(unsigned int ringN = 0; ringN < innerLeftRodMaxSize; ringN++){
93  for(vector<const GeometricDet*>::const_iterator it=theInnerGeometricRods.begin();
94  it!= theInnerGeometricRods.end();it++){
95  if( (*it)->positionBounds().z() < 0){
96  if( (**it).components().size()>ringN)
97  innerGeometricDetRings[ringN].push_back( (**it).components()[ringN] );
98  }
99  }
100  }
101 
102  for(unsigned int ringN = 0; ringN < innerRightRodMaxSize; ringN++){
103  for(vector<const GeometricDet*>::const_iterator it=theInnerGeometricRods.begin();
104  it!= theInnerGeometricRods.end();it++){
105  if( (*it)->positionBounds().z() > 0){
106  if( (**it).components().size()>ringN)
107  innerGeometricDetRings[innerLeftRodMaxSize+ringN].push_back( (**it).components()[ringN] );
108  }
109  }
110  }
111 
112 
113  for(unsigned int ringN = 0; ringN < outerLeftRodMaxSize; ringN++){
114  for(vector<const GeometricDet*>::const_iterator it=theOuterGeometricRods.begin();
115  it!= theOuterGeometricRods.end();it++){
116  if( (*it)->positionBounds().z() < 0){
117  if( (**it).components().size()>ringN)
118  outerGeometricDetRings[ringN].push_back( (**it).components()[ringN] );
119  }
120  }
121  }
122 
123  for(unsigned int ringN = 0; ringN < outerRightRodMaxSize; ringN++){
124  for(vector<const GeometricDet*>::const_iterator it=theOuterGeometricRods.begin();
125  it!= theOuterGeometricRods.end();it++){
126  if( (*it)->positionBounds().z() > 0){
127  if( (**it).components().size()>ringN)
128  outerGeometricDetRings[outerLeftRodMaxSize+ringN].push_back( (**it).components()[ringN] );
129  }
130  }
131  }
132 
133 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const T & max(const T &a, const T &b)