CMS 3D CMS Logo

TIBLayerBuilder.cc
Go to the documentation of this file.
1 #include "TIBLayerBuilder.h"
2 
4 
5 #include "TIBRingBuilder.h"
6 
7 using namespace edm;
8 using namespace std;
9 
10 TIBLayer* TIBLayerBuilder::build(const GeometricDet* aTIBLayer, const TrackerGeometry* theGeomDetGeometry) {
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 }
30 
31 void TIBLayerBuilder::constructRings(vector<const GeometricDet*>& theGeometricRods,
32  vector<vector<const GeometricDet*> >& innerGeometricDetRings,
33  vector<vector<const GeometricDet*> >& outerGeometricDetRings) {
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 }
mps_fire.i
i
Definition: mps_fire.py:428
TIBLayerBuilder::build
TIBLayer * build(const GeometricDet *aTIBLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
Definition: TIBLayerBuilder.cc:10
MessageLogger.h
TIBLayerBuilder::constructRings
void constructRings(std::vector< const GeometricDet * > &theGeometricRods, std::vector< std::vector< const GeometricDet * > > &innerGeometricDetRings, std::vector< std::vector< const GeometricDet * > > &outerGeometricDetRings)
Definition: TIBLayerBuilder.cc:31
edm
HLT enums.
Definition: AlignableModifier.h:19
GeometricDet::components
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:149
edm::max
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:118
TIBRingBuilder
Definition: TIBRingBuilder.h:14
TIBLayerBuilder.h
GeometricDet
Definition: GeometricDet.h:31
align::TIBLayer
Definition: StructureType.h:42
TIBRingBuilder.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
TIBLayer
Definition: TIBLayer.h:13
std
Definition: JetResolutionObject.h:76
TIBRingBuilder::build
TIBRing * build(const std::vector< const GeometricDet * > &detsInRing, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
Definition: TIBRingBuilder.cc:6
TrackerGeometry
Definition: TrackerGeometry.h:14