CMS 3D CMS Logo

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