CMS 3D CMS Logo

Phase2OTBarrelLayerBuilder.cc
Go to the documentation of this file.
5 
6 using namespace std;
7 using namespace edm;
8 
10  const TrackerGeometry* theGeomDetGeometry,
11  const bool useBrothers) {
12  // This builder is very similar to TOBLayer one. Most of the code should be put in a
13  // common place.
14 
15  LogTrace("TkDetLayers") << "Phase2OTBarrelLayerBuilder::build";
16  vector<const GeometricDet*> theGeometricDets = aPhase2OTBarrelLayer->components();
17  LogDebug("TkDetLayers") << "Phase2OTBarrelLayerBuilder with #Components: " << theGeometricDets.size() << std::endl;
18  vector<const GeometricDet*> theGeometricDetRods;
19  vector<const GeometricDet*> theGeometricDetRings;
20 
21  for (vector<const GeometricDet*>::const_iterator it = theGeometricDets.begin(); it != theGeometricDets.end(); it++) {
22  if ((*it)->type() == GeometricDet::ladder) {
23  theGeometricDetRods.push_back(*it);
24  } else if ((*it)->type() == GeometricDet::panel) {
25  theGeometricDetRings.push_back(*it);
26  } else {
27  LogDebug("TkDetLayers") << "Phase2OTBarrelLayerBuilder with no Rods and no Rings! ";
28  }
29  }
30 
31  LogDebug("TkDetLayers") << "Phase2OTBarrelLayerBuilder with #Rods: " << theGeometricDetRods.size() << std::endl;
32 
33  Phase2OTBarrelRodBuilder myPhase2OTBarrelRodBuilder;
34 
35  vector<const Phase2OTBarrelRod*> theInnerRods;
36  vector<const Phase2OTBarrelRod*> theOuterRods;
37 
38  // properly calculate the meanR value to separate rod in inner/outer.
39 
40  double meanR = 0;
41  for (unsigned int index = 0; index != theGeometricDetRods.size(); index++)
42  meanR += theGeometricDetRods[index]->positionBounds().perp();
43  if (!theGeometricDetRods.empty())
44 
45  meanR /= (double)theGeometricDetRods.size();
46 
47  for (unsigned int index = 0; index != theGeometricDetRods.size(); index++) {
48  if (theGeometricDetRods[index]->positionBounds().perp() < meanR)
49  theInnerRods.push_back(
50  myPhase2OTBarrelRodBuilder.build(theGeometricDetRods[index], theGeomDetGeometry, useBrothers));
51 
52  if (theGeometricDetRods[index]->positionBounds().perp() > meanR)
53  theOuterRods.push_back(
54  myPhase2OTBarrelRodBuilder.build(theGeometricDetRods[index], theGeomDetGeometry, useBrothers));
55  }
56 
57  if (theGeometricDetRings.empty())
58  return new Phase2OTBarrelLayer(theInnerRods, theOuterRods);
59 
60  LogDebug("TkDetLayers") << "Phase2OTBarrelLayerBuilder with #Rings: " << theGeometricDetRings.size() << std::endl;
61 
62  Phase2EndcapRingBuilder myPhase2EndcapRingBuilder;
63 
64  vector<const Phase2EndcapRing*> theNegativeRings;
65  vector<const Phase2EndcapRing*> thePositiveRings;
66 
67  // properly calculate the meanR value to separate rod in inner/outer.
68  double centralZ = 0.0;
69 
70  for (vector<const GeometricDet*>::const_iterator it = theGeometricDetRings.begin(); it != theGeometricDetRings.end();
71  it++) {
72  if ((*it)->positionBounds().z() < centralZ)
73  theNegativeRings.push_back(myPhase2EndcapRingBuilder.build(*it, theGeomDetGeometry, useBrothers));
74  if ((*it)->positionBounds().z() > centralZ)
75  thePositiveRings.push_back(myPhase2EndcapRingBuilder.build(*it, theGeomDetGeometry, useBrothers));
76  }
77 
78  return new Phase2OTtiltedBarrelLayer(theInnerRods, theOuterRods, theNegativeRings, thePositiveRings);
79 }
TBPLayer Phase2OTBarrelLayer
#define LogTrace(id)
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:154
Phase2EndcapRing * build(const GeometricDet *aPhase2EndcapRing, const TrackerGeometry *theGeomDetGeometry, const bool useBrothers=true) __attribute__((cold))
Phase2OTBarrelRod * build(const GeometricDet *thePhase2OTBarrelRod, const TrackerGeometry *theGeomDetGeometry, const bool useBrothers=true) __attribute__((cold))
HLT enums.
Phase2OTBarrelLayer * build(const GeometricDet *aPhase2OTBarrelLayer, const TrackerGeometry *theGeomDetGeometry, const bool useBrothers=true) __attribute__((cold))
#define LogDebug(id)