Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 76 additions & 109 deletions RecoTracker/TkDetLayers/src/GeometricSearchTrackerBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@
#include "TIDLayerBuilder.h"
#include "TECLayerBuilder.h"

#include "Geometry/TrackerGeometryBuilder/interface/trackerHierarchy.h"

#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h"

#include "DataFormats/Common/interface/Trie.h"

using namespace std;

GeometricSearchTracker *GeometricSearchTrackerBuilder::build(const GeometricDet *theGeometricTracker,
Expand Down Expand Up @@ -45,150 +41,121 @@ GeometricSearchTracker *GeometricSearchTrackerBuilder::build(const GeometricDet
vector<ForwardDetLayer const *> thePosTECLayers;
bool useBrothers = !usePhase2Stacks;

vector<const GeometricDet *> theGeometricDetLayers = theGeometricTracker->components();
for (vector<const GeometricDet *>::const_iterator it = theGeometricDetLayers.begin();
it != theGeometricDetLayers.end();
it++) {
if ((*it)->type() == GeometricDet::PixelBarrel) {
vector<const GeometricDet *> thePxlBarGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = thePxlBarGeometricDetLayers.begin();
it2 != thePxlBarGeometricDetLayers.end();
it2++) {
thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(*it2, theGeomDetGeometry));
auto const &theGeometricDetLayers = theGeometricTracker->components();
for (auto const &theGeomDetLayer : theGeometricDetLayers) {
if (theGeomDetLayer->type() == GeometricDet::PixelBarrel) {
auto const &thePxlBarGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : thePxlBarGeometricDetLayers) {
thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
}
}

if ((*it)->type() == GeometricDet::PixelPhase1Barrel) {
vector<const GeometricDet *> thePxlBarGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = thePxlBarGeometricDetLayers.begin();
it2 != thePxlBarGeometricDetLayers.end();
it2++) {
thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(*it2, theGeomDetGeometry));
if (theGeomDetLayer->type() == GeometricDet::PixelPhase1Barrel) {
auto const &thePxlBarGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : thePxlBarGeometricDetLayers) {
thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
}
}

if ((*it)->type() == GeometricDet::PixelPhase2Barrel) {
vector<const GeometricDet *> thePxlBarGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = thePxlBarGeometricDetLayers.begin();
it2 != thePxlBarGeometricDetLayers.end();
it2++) {
thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(*it2, theGeomDetGeometry));
if (theGeomDetLayer->type() == GeometricDet::PixelPhase2Barrel) {
auto const &thePxlBarGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : thePxlBarGeometricDetLayers) {
thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
}
}

if ((*it)->type() == GeometricDet::TIB) {
vector<const GeometricDet *> theTIBGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = theTIBGeometricDetLayers.begin();
it2 != theTIBGeometricDetLayers.end();
it2++) {
theTIBLayers.push_back(aTIBLayerBuilder.build(*it2, theGeomDetGeometry));
if (theGeomDetLayer->type() == GeometricDet::TIB) {
auto const &theTIBGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : theTIBGeometricDetLayers) {
theTIBLayers.push_back(aTIBLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
}
}

if ((*it)->type() == GeometricDet::TOB) {
vector<const GeometricDet *> theTOBGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = theTOBGeometricDetLayers.begin();
it2 != theTOBGeometricDetLayers.end();
it2++) {
theTOBLayers.push_back(aTOBLayerBuilder.build(*it2, theGeomDetGeometry));
if (theGeomDetLayer->type() == GeometricDet::TOB) {
auto const &theTOBGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : theTOBGeometricDetLayers) {
theTOBLayers.push_back(aTOBLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
}
}

if ((*it)->type() == GeometricDet::OTPhase2Barrel) {
vector<const GeometricDet *> theTOBGeometricDetLayers = (*it)->components();

for (vector<const GeometricDet *>::const_iterator it2 = theTOBGeometricDetLayers.begin();
it2 != theTOBGeometricDetLayers.end();
it2++) {
theTOBLayers.push_back(aPhase2OTBarrelLayerBuilder.build(*it2, theGeomDetGeometry, useBrothers));
if (theGeomDetLayer->type() == GeometricDet::OTPhase2Barrel) {
auto const &theTOBGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : theTOBGeometricDetLayers) {
theTOBLayers.push_back(aPhase2OTBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry, useBrothers));
}
}

if ((*it)->type() == GeometricDet::PixelEndCap) {
vector<const GeometricDet *> thePxlFwdGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = thePxlFwdGeometricDetLayers.begin();
it2 != thePxlFwdGeometricDetLayers.end();
it2++) {
if ((*it2)->positionBounds().z() < 0)
theNegPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(*it2, theGeomDetGeometry));
if ((*it2)->positionBounds().z() > 0)
thePosPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(*it2, theGeomDetGeometry));
if (theGeomDetLayer->type() == GeometricDet::PixelEndCap) {
auto const &thePxlFwdGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : thePxlFwdGeometricDetLayers) {
if (thisGeomDet->positionBounds().z() < 0)
theNegPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
else
thePosPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
}
}

if ((*it)->type() == GeometricDet::PixelPhase1EndCap) {
vector<const GeometricDet *> thePxlFwdGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = thePxlFwdGeometricDetLayers.begin();
it2 != thePxlFwdGeometricDetLayers.end();
it2++) {
if ((*it2)->positionBounds().z() < 0)
theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(*it2, theGeomDetGeometry));
if ((*it2)->positionBounds().z() > 0)
thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(*it2, theGeomDetGeometry));
if (theGeomDetLayer->type() == GeometricDet::PixelPhase1EndCap) {
auto const &thePxlFwdGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : thePxlFwdGeometricDetLayers) {
if (thisGeomDet->positionBounds().z() < 0)
theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
else
thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
}
}

if ((*it)->type() == GeometricDet::PixelPhase2EndCap) {
vector<const GeometricDet *> thePxlFwdGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = thePxlFwdGeometricDetLayers.begin();
it2 != thePxlFwdGeometricDetLayers.end();
it2++) {
if (theGeomDetLayer->type() == GeometricDet::PixelPhase2EndCap) {
auto const &thePxlFwdGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : thePxlFwdGeometricDetLayers) {
//FIXME: this is just to keep the compatibility with the PixelPhase1 extension layout
//hopefully we can get rid of it soon
if ((*it2)->positionBounds().z() < 0) {
if ((*it2)->type() == GeometricDet::PixelPhase2FullDisk ||
(*it2)->type() == GeometricDet::PixelPhase2ReducedDisk)
theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(*it2, theGeomDetGeometry));
else if ((*it2)->type() == GeometricDet::PixelPhase2TDRDisk)
theNegPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(*it2, theGeomDetGeometry, false));
} else if ((*it2)->positionBounds().z() > 0) {
if ((*it2)->type() == GeometricDet::PixelPhase2FullDisk ||
(*it2)->type() == GeometricDet::PixelPhase2ReducedDisk)
thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(*it2, theGeomDetGeometry));
else if ((*it2)->type() == GeometricDet::PixelPhase2TDRDisk)
thePosPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(*it2, theGeomDetGeometry, false));
if (thisGeomDet->positionBounds().z() < 0) {
if (thisGeomDet->type() == GeometricDet::PixelPhase2FullDisk ||
thisGeomDet->type() == GeometricDet::PixelPhase2ReducedDisk)
theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
else if (thisGeomDet->type() == GeometricDet::PixelPhase2TDRDisk)
theNegPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, false));
} else if (thisGeomDet->positionBounds().z() > 0) {
if (thisGeomDet->type() == GeometricDet::PixelPhase2FullDisk ||
thisGeomDet->type() == GeometricDet::PixelPhase2ReducedDisk)
thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
else if (thisGeomDet->type() == GeometricDet::PixelPhase2TDRDisk)
thePosPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, false));
} else {
edm::LogError("TkDetLayers") << "In PixelPhase2EndCap the disks are neither PixelPhase2FullDisk nor "
"PixelPhase2ReducedDisk nor PixelPhase2TDRDisk...";
}
}
}

if ((*it)->type() == GeometricDet::TID) {
vector<const GeometricDet *> theTIDGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = theTIDGeometricDetLayers.begin();
it2 != theTIDGeometricDetLayers.end();
it2++) {
if ((*it2)->positionBounds().z() < 0)
theNegTIDLayers.push_back(aTIDLayerBuilder.build(*it2, theGeomDetGeometry));
if ((*it2)->positionBounds().z() > 0)
thePosTIDLayers.push_back(aTIDLayerBuilder.build(*it2, theGeomDetGeometry));
if (theGeomDetLayer->type() == GeometricDet::TID) {
auto const &theTIDGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : theTIDGeometricDetLayers) {
if (thisGeomDet->positionBounds().z() < 0)
theNegTIDLayers.push_back(aTIDLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
else
thePosTIDLayers.push_back(aTIDLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
}
}

if ((*it)->type() == GeometricDet::OTPhase2EndCap) {
vector<const GeometricDet *> theTIDGeometricDetLayers = (*it)->components();

bool useBrothers = !usePhase2Stacks;
for (vector<const GeometricDet *>::const_iterator it2 = theTIDGeometricDetLayers.begin();
it2 != theTIDGeometricDetLayers.end();
it2++) {
if ((*it2)->positionBounds().z() < 0)
theNegTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(*it2, theGeomDetGeometry, useBrothers));
if ((*it2)->positionBounds().z() > 0)
thePosTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(*it2, theGeomDetGeometry, useBrothers));
if (theGeomDetLayer->type() == GeometricDet::OTPhase2EndCap) {
auto const &theTIDGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : theTIDGeometricDetLayers) {
if (thisGeomDet->positionBounds().z() < 0)
theNegTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, useBrothers));
else
thePosTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, useBrothers));
}
}

if ((*it)->type() == GeometricDet::TEC) {
vector<const GeometricDet *> theTECGeometricDetLayers = (*it)->components();
for (vector<const GeometricDet *>::const_iterator it2 = theTECGeometricDetLayers.begin();
it2 != theTECGeometricDetLayers.end();
it2++) {
if ((*it2)->positionBounds().z() < 0)
theNegTECLayers.push_back(aTECLayerBuilder.build(*it2, theGeomDetGeometry));
if ((*it2)->positionBounds().z() > 0)
thePosTECLayers.push_back(aTECLayerBuilder.build(*it2, theGeomDetGeometry));
if (theGeomDetLayer->type() == GeometricDet::TEC) {
auto const &theTECGeometricDetLayers = theGeomDetLayer->components();
for (auto const &thisGeomDet : theTECGeometricDetLayers) {
if (thisGeomDet->positionBounds().z() < 0)
theNegTECLayers.push_back(aTECLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
else
thePosTECLayers.push_back(aTECLayerBuilder.build(thisGeomDet, theGeomDetGeometry));
}
}
}
Expand Down