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 }
ReferenceCountingPointer< BoundCylinder > theOuterCylinder
Definition: TBLayer.h:75
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const __attribute__((hot))
Definition: TBLayer.cc:46
int closestIndex() const
static int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
returns 0 if barrel layer crossed from inside, 1 if from outside
std::vector< const GeometricSearchDet * > theComps
Definition: TBLayer.h:69
virtual std::tuple< bool, int, int > computeIndexes(GlobalPoint gInnerPoint, GlobalPoint gOuterPoint) const =0
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
PropagationDirection
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
virtual float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const =0
GlobalPoint globalPosition() const
int closestDetIndex() const
bool isTIB() const
Definition: TBLayer.h:55
const std::vector< const GeometricSearchDet * > & subLayer(int ind) const
Definition: TBLayer.h:51
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() override __attribute__((cold))
Definition: TBLayer.cc:10
T perp() const
Magnitude of transverse component.
const SubLayerCrossing & closest() const
int subLayerIndex() const
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))
const SubLayerCrossing & other() const
GlobalVector globalMomentum() const
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
Definition: TBLayer.cc:15
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
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
ReferenceCountingPointer< BoundCylinder > theInnerCylinder
Definition: TBLayer.h:74
def move(src, dest)
Definition: eostools.py:511