CMS 3D CMS Logo

List of all members | Public Member Functions
TIBLayerBuilder Class Reference

#include <TIBLayerBuilder.h>

Public Member Functions

TIBLayerbuild (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 14 of file TIBLayerBuilder.h.

Constructor & Destructor Documentation

TIBLayerBuilder::TIBLayerBuilder ( )
inline

Definition at line 16 of file TIBLayerBuilder.h.

References build(), and constructRings().

16 {};

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(), mps_fire::i, and align::TIBLayer.

Referenced by GeometricSearchTrackerBuilder::build(), and TIBLayerBuilder().

10  {
11  vector<const GeometricDet*> theGeometricRods = aTIBLayer->components();
12 
13  vector<vector<const GeometricDet*> > innerGeometricDetRings;
14  vector<vector<const GeometricDet*> > outerGeometricDetRings;
15 
16  constructRings(theGeometricRods, innerGeometricDetRings, outerGeometricDetRings);
17 
18  TIBRingBuilder myRingBuilder;
19 
20  vector<const TIBRing*> innerRings;
21  vector<const TIBRing*> outerRings;
22 
23  for (unsigned int i = 0; i < innerGeometricDetRings.size(); i++) {
24  innerRings.push_back(myRingBuilder.build(innerGeometricDetRings[i], theGeomDetGeometry));
25  outerRings.push_back(myRingBuilder.build(outerGeometricDetRings[i], theGeomDetGeometry));
26  }
27 
28  return new TIBLayer(innerRings, outerRings);
29 }
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:139
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 31 of file TIBLayerBuilder.cc.

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

Referenced by TIBLayerBuilder().

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