CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GeometricSearchTrackerBuilder.cc
Go to the documentation of this file.
3 
8 #include "TIBLayerBuilder.h"
9 #include "TOBLayerBuilder.h"
10 #include "TIDLayerBuilder.h"
11 #include "TECLayerBuilder.h"
12 
16 
17 using namespace std;
18 
20  const TrackerGeometry *theGeomDetGeometry,
21  const TrackerTopology *tTopo,
22  const bool usePhase2Stacks) {
23  PixelBarrelLayerBuilder aPixelBarrelLayerBuilder;
24  Phase2OTBarrelLayerBuilder aPhase2OTBarrelLayerBuilder;
27  Phase2EndcapLayerBuilder aPhase2EndcapLayerBuilder;
28  TIBLayerBuilder aTIBLayerBuilder;
29  TOBLayerBuilder aTOBLayerBuilder;
30  TIDLayerBuilder aTIDLayerBuilder;
31  TECLayerBuilder aTECLayerBuilder;
32 
33  vector<BarrelDetLayer const *> thePxlBarLayers;
34  vector<BarrelDetLayer const *> theTIBLayers;
35  vector<BarrelDetLayer const *> theTOBLayers;
36  vector<ForwardDetLayer const *> theNegPxlFwdLayers;
37  vector<ForwardDetLayer const *> thePosPxlFwdLayers;
38  vector<ForwardDetLayer const *> theNegTIDLayers;
39  vector<ForwardDetLayer const *> thePosTIDLayers;
40  vector<ForwardDetLayer const *> theNegTECLayers;
41  vector<ForwardDetLayer const *> thePosTECLayers;
42  bool useBrothers = !usePhase2Stacks;
43 
44  auto const &theGeometricDetLayers = theGeometricTracker->components();
45  for (auto const &theGeomDetLayer : theGeometricDetLayers) {
46  if (theGeomDetLayer->type() == GeometricDet::PixelBarrel) {
47  auto const &thePxlBarGeometricDetLayers = theGeomDetLayer->components();
48  for (auto const &thisGeomDet : thePxlBarGeometricDetLayers) {
49  thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
50  }
51  }
52 
53  if (theGeomDetLayer->type() == GeometricDet::PixelPhase1Barrel) {
54  auto const &thePxlBarGeometricDetLayers = theGeomDetLayer->components();
55  for (auto const &thisGeomDet : thePxlBarGeometricDetLayers) {
56  thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
57  }
58  }
59 
60  if (theGeomDetLayer->type() == GeometricDet::PixelPhase2Barrel) {
61  auto const &thePxlBarGeometricDetLayers = theGeomDetLayer->components();
62  for (auto const &thisGeomDet : thePxlBarGeometricDetLayers) {
63  thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
64  }
65  }
66 
67  if (theGeomDetLayer->type() == GeometricDet::TIB) {
68  auto const &theTIBGeometricDetLayers = theGeomDetLayer->components();
69  for (auto const &thisGeomDet : theTIBGeometricDetLayers) {
70  theTIBLayers.push_back(aTIBLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
71  }
72  }
73 
74  if (theGeomDetLayer->type() == GeometricDet::TOB) {
75  auto const &theTOBGeometricDetLayers = theGeomDetLayer->components();
76  for (auto const &thisGeomDet : theTOBGeometricDetLayers) {
77  theTOBLayers.push_back(aTOBLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
78  }
79  }
80 
81  if (theGeomDetLayer->type() == GeometricDet::OTPhase2Barrel) {
82  auto const &theTOBGeometricDetLayers = theGeomDetLayer->components();
83  for (auto const &thisGeomDet : theTOBGeometricDetLayers) {
84  theTOBLayers.push_back(aPhase2OTBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry, useBrothers));
85  }
86  }
87 
88  if (theGeomDetLayer->type() == GeometricDet::PixelEndCap) {
89  auto const &thePxlFwdGeometricDetLayers = theGeomDetLayer->components();
90  for (auto const &thisGeomDet : thePxlFwdGeometricDetLayers) {
91  if (thisGeomDet->positionBounds().z() < 0)
92  theNegPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
93  else
94  thePosPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
95  }
96  }
97 
98  if (theGeomDetLayer->type() == GeometricDet::PixelPhase1EndCap) {
99  auto const &thePxlFwdGeometricDetLayers = theGeomDetLayer->components();
100  for (auto const &thisGeomDet : thePxlFwdGeometricDetLayers) {
101  if (thisGeomDet->positionBounds().z() < 0)
102  theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
103  else
104  thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
105  }
106  }
107 
108  if (theGeomDetLayer->type() == GeometricDet::PixelPhase2EndCap) {
109  auto const &thePxlFwdGeometricDetLayers = theGeomDetLayer->components();
110  for (auto const &thisGeomDet : thePxlFwdGeometricDetLayers) {
111  //FIXME: this is just to keep the compatibility with the PixelPhase1 extension layout
112  //hopefully we can get rid of it soon
113  if (thisGeomDet->positionBounds().z() < 0) {
114  if (thisGeomDet->type() == GeometricDet::PixelPhase2FullDisk ||
115  thisGeomDet->type() == GeometricDet::PixelPhase2ReducedDisk)
116  theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
117  else if (thisGeomDet->type() == GeometricDet::PixelPhase2TDRDisk)
118  theNegPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, false));
119  } else if (thisGeomDet->positionBounds().z() > 0) {
120  if (thisGeomDet->type() == GeometricDet::PixelPhase2FullDisk ||
121  thisGeomDet->type() == GeometricDet::PixelPhase2ReducedDisk)
122  thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
123  else if (thisGeomDet->type() == GeometricDet::PixelPhase2TDRDisk)
124  thePosPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, false));
125  } else {
126  edm::LogError("TkDetLayers") << "In PixelPhase2EndCap the disks are neither PixelPhase2FullDisk nor "
127  "PixelPhase2ReducedDisk nor PixelPhase2TDRDisk...";
128  }
129  }
130  }
131 
132  if (theGeomDetLayer->type() == GeometricDet::TID) {
133  auto const &theTIDGeometricDetLayers = theGeomDetLayer->components();
134  for (auto const &thisGeomDet : theTIDGeometricDetLayers) {
135  if (thisGeomDet->positionBounds().z() < 0)
136  theNegTIDLayers.push_back(aTIDLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
137  else
138  thePosTIDLayers.push_back(aTIDLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
139  }
140  }
141 
142  if (theGeomDetLayer->type() == GeometricDet::OTPhase2EndCap) {
143  auto const &theTIDGeometricDetLayers = theGeomDetLayer->components();
144  for (auto const &thisGeomDet : theTIDGeometricDetLayers) {
145  if (thisGeomDet->positionBounds().z() < 0)
146  theNegTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, useBrothers));
147  else
148  thePosTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, useBrothers));
149  }
150  }
151 
152  if (theGeomDetLayer->type() == GeometricDet::TEC) {
153  auto const &theTECGeometricDetLayers = theGeomDetLayer->components();
154  for (auto const &thisGeomDet : theTECGeometricDetLayers) {
155  if (thisGeomDet->positionBounds().z() < 0)
156  theNegTECLayers.push_back(aTECLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
157  else
158  thePosTECLayers.push_back(aTECLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
159  }
160  }
161  }
162 
163  return new GeometricSearchTracker(thePxlBarLayers,
164  theTIBLayers,
165  theTOBLayers,
166  theNegPxlFwdLayers,
167  theNegTIDLayers,
168  theNegTECLayers,
169  thePosPxlFwdLayers,
170  thePosTIDLayers,
171  thePosTECLayers,
172  tTopo);
173 }
174 
176  const TrackerGeometry *theGeomDetGeometry,
177  const TrackerTopology *tTopo,
178  const MTDGeometry *mtd,
179  const MTDTopology *mTopo,
180  const bool usePhase2Stacks) {
181  //Tracker part
182  GeometricSearchTracker *theSearchTrack = this->build(theGeometricTracker, theGeomDetGeometry, tTopo, usePhase2Stacks);
183 
184  theSearchTrack->addDetLayerGeometry();
185  theSearchTrack->mtdDetLayerGeometry->buildLayers(mtd, mTopo);
186  theSearchTrack->mtdDetLayerGeometry->sortLayers();
187 
188  std::vector<const BarrelDetLayer *> barrel;
189  for (auto &&e : theSearchTrack->mtdDetLayerGeometry->allBarrelLayers()) {
190  auto p = dynamic_cast<const BarrelDetLayer *>(e);
191  if (p) {
192  barrel.push_back(p);
193  }
194  }
195  std::vector<const ForwardDetLayer *> backward;
196  for (auto &&e : theSearchTrack->mtdDetLayerGeometry->allBackwardLayers()) {
197  auto p = dynamic_cast<const ForwardDetLayer *>(e);
198  if (p) {
199  backward.push_back(p);
200  }
201  }
202  std::vector<const ForwardDetLayer *> forward;
203  for (auto &&e : theSearchTrack->mtdDetLayerGeometry->allForwardLayers()) {
204  auto p = dynamic_cast<const ForwardDetLayer *>(e);
205  if (p) {
206  forward.push_back(p);
207  }
208  }
209  //Include the MTD layers in the TrackerSearchGeometry
210  theSearchTrack->addMTDLayers(barrel, backward, forward);
211  return theSearchTrack;
212 }
void addMTDLayers(const std::vector< BarrelDetLayer const * > &btl, const std::vector< ForwardDetLayer const * > &negEtl, const std::vector< ForwardDetLayer const * > &posEtl)
TIBLayer * build(const GeometricDet *aTIBLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
TOBLayer * build(const GeometricDet *aTOBLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
TECLayer * build(const GeometricDet *aTECLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
PixelBarrelLayer * build(const GeometricDet *aPixelBarrelLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
Phase2EndcapLayer * build(const GeometricDet *aPhase2EndcapLayer, const TrackerGeometry *theGeomDetGeometry, const bool useBrothers) __attribute__((cold))
TIDLayer * build(const GeometricDet *aTIDLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
Log< level::Error, false > LogError
const std::vector< const DetLayer * > & allBackwardLayers() const
return all endcap layers
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:150
MTDDetLayerGeometry * mtdDetLayerGeometry
void buildLayers(const MTDGeometry *geo, const MTDTopology *mtopo)
GeometricSearchTracker * build(const GeometricDet *theGeometricTracker, const TrackerGeometry *theGeomDetGeometry, const TrackerTopology *tTopo, const bool usePhase2Stacks=false) __attribute__((cold))
const std::vector< const DetLayer * > & allForwardLayers() const
return all endcap layers
const std::vector< const DetLayer * > & allBarrelLayers() const
return all barrel layers
ForwardDetLayer * build(const GeometricDet *aPixelForwardLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
Phase2OTBarrelLayer * build(const GeometricDet *aPhase2OTBarrelLayer, const TrackerGeometry *theGeomDetGeometry, const bool useBrothers=true) __attribute__((cold))