CMS 3D CMS Logo

TBLayer.cc
Go to the documentation of this file.
1 #include "TBLayer.h"
2 
3 #include "LayerCrossingSide.h"
4 #include "DetGroupMerger.h"
6 
9 
11  for (auto i : theComps)
12  delete i;
13 }
14 
16  const Propagator& prop,
17  const MeasurementEstimator& est,
18  std::vector<DetGroup>& result) const {
19  SubLayerCrossings crossings;
20  crossings = computeCrossings(tsos, prop.propagationDirection());
21  if (!crossings.isValid())
22  return;
23 
24  std::vector<DetGroup> closestResult;
25  addClosest(tsos, prop, est, crossings.closest(), closestResult);
26  // for TIB this differs from compatibleDets logic, which checks next in such cases!!!
27  if (closestResult.empty()) {
28  if (!isTIB())
29  addClosest(tsos, prop, est, crossings.other(), result);
30  return;
31  }
32 
33  DetGroupElement closestGel(closestResult.front().front());
34  float window = computeWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
35 
36  searchNeighbors(tsos, prop, est, crossings.closest(), window, closestResult, false);
37 
38  std::vector<DetGroup> nextResult;
39  searchNeighbors(tsos, prop, est, crossings.other(), window, nextResult, true);
40 
41  int crossingSide = LayerCrossingSide().barrelSide(closestGel.trajectoryState(), prop);
43  std::move(closestResult), std::move(nextResult), result, crossings.closestIndex(), crossingSide);
44 }
45 
47  PropagationDirection propDir) const {
48  GlobalPoint startPos(startingState.globalPosition());
49  GlobalVector startDir(startingState.globalMomentum());
50  double rho(startingState.transverseCurvature());
51 
52  bool inBetween = ((theOuterCylinder->position() - startPos).perp() < theOuterCylinder->radius()) &&
53  ((theInnerCylinder->position() - startPos).perp() > theInnerCylinder->radius());
54 
55  HelixBarrelCylinderCrossing innerCrossing(
56  startPos, startDir, rho, propDir, *theInnerCylinder, HelixBarrelCylinderCrossing::onlyPos);
57  if (!inBetween && !innerCrossing.hasSolution())
58  return SubLayerCrossings();
59 
60  HelixBarrelCylinderCrossing outerCrossing(
61  startPos, startDir, rho, propDir, *theOuterCylinder, HelixBarrelCylinderCrossing::onlyPos);
62 
63  if (!innerCrossing.hasSolution() && outerCrossing.hasSolution()) {
64  innerCrossing = outerCrossing;
65  } else if (!outerCrossing.hasSolution() && innerCrossing.hasSolution()) {
66  outerCrossing = innerCrossing;
67  }
68 
69  GlobalPoint gInnerPoint(innerCrossing.position());
70  GlobalPoint gOuterPoint(outerCrossing.position());
71 
72  int innerIndex, outerIndex;
73  bool inLess;
74  std::tie(inLess, innerIndex, outerIndex) = computeIndexes(gInnerPoint, gOuterPoint);
75 
76  SubLayerCrossing innerSLC(0, innerIndex, gInnerPoint);
77  SubLayerCrossing outerSLC(1, outerIndex, gOuterPoint);
78 
79  if (inLess) {
80  return SubLayerCrossings(innerSLC, outerSLC, 0);
81  } else {
82  return SubLayerCrossings(outerSLC, innerSLC, 1);
83  }
84 }
85 
87  const Propagator& prop,
88  const MeasurementEstimator& est,
89  const SubLayerCrossing& crossing,
90  std::vector<DetGroup>& result) const {
91  auto const& sub = subLayer(crossing.subLayerIndex());
92  auto det = sub[crossing.closestDetIndex()];
93  return CompatibleDetToGroupAdder().add(*det, tsos, prop, est, result);
94 }
Vector3DBase
Definition: Vector3DBase.h:8
MeasurementEstimator
Definition: MeasurementEstimator.h:19
SubLayerCrossings::isValid
bool isValid()
Definition: SubLayerCrossings.h:28
HelixBarrelCylinderCrossing.h
mps_fire.i
i
Definition: mps_fire.py:428
HelixBarrelCylinderCrossing::onlyPos
Definition: HelixBarrelCylinderCrossing.h:18
LayerCrossingSide
Definition: LayerCrossingSide.h:15
LayerCrossingSide.h
SubLayerCrossings::closestIndex
int closestIndex() const
Definition: SubLayerCrossings.h:31
HelixBarrelCylinderCrossing::hasSolution
bool hasSolution() const
Definition: HelixBarrelCylinderCrossing.h:34
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
svgfig.window
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:643
TBLayer::~TBLayer
~TBLayer() override __attribute__((cold))
Definition: TBLayer.cc:10
TrajectoryStateOnSurface::transverseCurvature
double transverseCurvature() const
Definition: TrajectoryStateOnSurface.h:70
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
TBLayer::theInnerCylinder
ReferenceCountingPointer< BoundCylinder > theInnerCylinder
Definition: TBLayer.h:74
TBLayer::groupedCompatibleDetsV
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
Definition: TBLayer.cc:15
TBLayer::searchNeighbors
virtual void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const =0
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TBLayer::computeIndexes
virtual std::tuple< bool, int, int > computeIndexes(GlobalPoint gInnerPoint, GlobalPoint gOuterPoint) const =0
MeasurementEstimator.h
Propagator::propagationDirection
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
DetGroupMerger.h
Point3DBase< float, GlobalTag >
DDAxes::rho
DetGroupMerger::orderAndMergeTwoLevels
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
Definition: DetGroupMerger.cc:6
TBLayer::theComps
std::vector< const GeometricSearchDet * > theComps
Definition: TBLayer.h:69
CompatibleDetToGroupAdder::add
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))
Definition: CompatibleDetToGroupAdder.cc:7
SubLayerCrossings::closest
const SubLayerCrossing & closest() const
Definition: SubLayerCrossings.h:29
TBLayer::addClosest
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const __attribute__((hot))
Definition: TBLayer.cc:86
HelixBarrelCylinderCrossing::position
PositionType position() const
Definition: HelixBarrelCylinderCrossing.h:48
SubLayerCrossing::closestDetIndex
int closestDetIndex() const
Definition: SubLayerCrossings.h:13
DetGroupElement
Definition: DetGroup.h:10
TBLayer::subLayer
const std::vector< const GeometricSearchDet * > & subLayer(int ind) const
Definition: TBLayer.h:51
TBLayer::theOuterCylinder
ReferenceCountingPointer< BoundCylinder > theOuterCylinder
Definition: TBLayer.h:75
CompatibleDetToGroupAdder.h
TBLayer::computeWindowSize
virtual float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const =0
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
eostools.move
def move(src, dest)
Definition: eostools.py:511
TBLayer.h
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
CompatibleDetToGroupAdder
Definition: CompatibleDetToGroupAdder.h:13
LayerCrossingSide::barrelSide
static int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
returns 0 if barrel layer crossed from inside, 1 if from outside
Definition: LayerCrossingSide.h:18
SubLayerCrossings::other
const SubLayerCrossing & other() const
Definition: SubLayerCrossings.h:30
SubLayerCrossing
Definition: SubLayerCrossings.h:7
SubLayerCrossing::subLayerIndex
int subLayerIndex() const
Definition: SubLayerCrossings.h:12
HelixBarrelCylinderCrossing
Definition: HelixBarrelCylinderCrossing.h:16
mps_fire.result
result
Definition: mps_fire.py:311
TBLayer::computeCrossings
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const __attribute__((hot))
Definition: TBLayer.cc:46
TBLayer::isTIB
bool isTIB() const
Definition: TBLayer.h:55
SubLayerCrossings
Definition: SubLayerCrossings.h:22