CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Phase2EndcapSingleRing.cc
Go to the documentation of this file.
2 
4 
10 
11 #include "LayerCrossingSide.h"
12 #include "DetGroupMerger.h"
14 
15 #include "TkDetUtil.h"
17 
18 #include "DetGroupElementZLess.h"
19 
20 using namespace std;
21 
23 
24 Phase2EndcapSingleRing::Phase2EndcapSingleRing(vector<const GeomDet*>& allDets)
25  : GeometricSearchDet(true), theDets(allDets.begin(), allDets.end()) {
27 
28  theBinFinder = BinFinderType(theDets.front()->surface().position().phi(), theDets.size());
29 
30 #ifdef EDM_ML_DEBUG
31  LogDebug("TkDetLayers") << "DEBUG INFO for Phase2EndcapSingleRing";
32  for (vector<const GeomDet*>::const_iterator it = theDets.begin(); it != theDets.end(); it++) {
33  LogDebug("TkDetLayers") << "Det detId,phi,z,r: " << (*it)->geographicalId().rawId() << " , "
34  << (*it)->surface().position().phi() << " , " << (*it)->surface().position().z() << " , "
35  << (*it)->surface().position().perp();
36  }
37 
38 #endif
39 }
40 
42 
43 const vector<const GeometricSearchDet*>& Phase2EndcapSingleRing::components() const {
44  throw DetLayerException("Phase2EndcapSingleRing doesn't have GeometricSearchDet components");
45 }
46 
47 pair<bool, TrajectoryStateOnSurface> Phase2EndcapSingleRing::compatible(const TrajectoryStateOnSurface&,
48  const Propagator&,
49  const MeasurementEstimator&) const {
50  edm::LogError("TkDetLayers") << "temporary dummy implementation of Phase2EndcapSingleRing::compatible()!!";
51  return pair<bool, TrajectoryStateOnSurface>();
52 }
53 
55  const Propagator& prop,
56  const MeasurementEstimator& est,
57  std::vector<DetGroup>& result) const {
58  SubLayerCrossing crossing;
59 
60  crossing = computeCrossing(tsos, prop.propagationDirection());
61 
62  if (!crossing.isValid())
63  return;
64 
65  std::vector<DetGroup> closestResult;
66 
67  addClosest(tsos, prop, est, crossing, closestResult);
68  if (closestResult.empty())
69  return;
70 
71  DetGroupElement closestGel(closestResult.front().front());
72 
73  float phiWindow = tkDetUtil::computeWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
74 
75  searchNeighbors(tsos, prop, est, crossing, phiWindow, closestResult, false);
76 
77  DetGroupMerger::addSameLevel(std::move(closestResult), result);
78 }
79 
81  PropagationDirection propDir) const {
82  auto rho = startingState.transverseCurvature();
83 
84  HelixPlaneCrossing::PositionType startPos(startingState.globalPosition());
85  HelixPlaneCrossing::DirectionType startDir(startingState.globalMomentum());
86  HelixForwardPlaneCrossing crossing(startPos, startDir, rho, propDir);
87 
88  pair<bool, double> frontPath = crossing.pathLength(*theDisk);
89  if (!frontPath.first)
90  return SubLayerCrossing();
91 
92  GlobalPoint gFrontPoint(crossing.position(frontPath.second)); //There is only one path
93 
94  int frontIndex = theBinFinder.binIndex(gFrontPoint.barePhi());
95  SubLayerCrossing frontSLC(0, frontIndex, gFrontPoint);
96 
97  return frontSLC;
98 }
99 
101  const Propagator& prop,
102  const MeasurementEstimator& est,
103  const SubLayerCrossing& crossing,
104  vector<DetGroup>& result) const {
105  const vector<const GeomDet*>& sub(subLayer(crossing.subLayerIndex()));
106 
107  const GeomDet* det(sub[crossing.closestDetIndex()]);
108 
109  bool firstgroup = CompatibleDetToGroupAdder::add(*det, tsos, prop, est, result);
110 
111  return firstgroup;
112 }
113 
115  const Propagator& prop,
116  const MeasurementEstimator& est,
117  const SubLayerCrossing& crossing,
118  float window,
119  vector<DetGroup>& result,
120  bool checkClosest) const {
121  const GlobalPoint& gCrossingPos = crossing.position();
122 
123  const vector<const GeomDet*>& sLayer(subLayer(crossing.subLayerIndex()));
124 
125  int closestIndex = crossing.closestDetIndex();
126  int negStartIndex = closestIndex - 1;
127  int posStartIndex = closestIndex + 1;
128 
129  if (checkClosest) { // must decide if the closest is on the neg or pos side
130  if (Geom::phiLess(gCrossingPos.barePhi(), sLayer[closestIndex]->surface().phi())) {
131  posStartIndex = closestIndex;
132  } else {
133  negStartIndex = closestIndex;
134  }
135  }
136 
137  const BinFinderType& binFinder = theBinFinder;
138 
139  typedef CompatibleDetToGroupAdder Adder;
140  int half = sLayer.size() / 2; // to check if dets are called twice....
141  for (int idet = negStartIndex; idet >= negStartIndex - half; idet--) {
142  const GeomDet& neighborDet = *sLayer[binFinder.binIndex(idet)];
143  if (!tkDetUtil::overlapInPhi(gCrossingPos, neighborDet, window))
144  break;
145  if (!Adder::add(neighborDet, tsos, prop, est, result))
146  break;
147  }
148  for (int idet = posStartIndex; idet < posStartIndex + half; idet++) {
149  const GeomDet& neighborDet = *sLayer[binFinder.binIndex(idet)];
150  if (!tkDetUtil::overlapInPhi(gCrossingPos, neighborDet, window))
151  break;
152  if (!Adder::add(neighborDet, tsos, prop, est, result))
153  break;
154  }
155 }
Common base class.
def window
Definition: svgfig.py:643
Phase2EndcapSingleRing(std::vector< const GeomDet * > &allDets)
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
int closestDetIndex() const
PeriodicBinFinderInPhi< float > BinFinderType
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override
GlobalPoint globalPosition() const
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
PropagationDirection
Log< level::Error, false > LogError
bool overlapInPhi(float phi, const GeomDet &det, float phiWindow)
Definition: TkDetUtil.h:32
tuple result
Definition: mps_fire.py:311
const GlobalPoint & position() const
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: TkDetUtil.cc:10
T barePhi() const
Definition: PV3DBase.h:65
const std::vector< const GeometricSearchDet * > & components() const override
Returns basic components, if any.
static void addSameLevel(std::vector< DetGroup > &&gvec, std::vector< DetGroup > &result)
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
int subLayerIndex() const
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const
def move
Definition: eostools.py:511
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const override
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const
SubLayerCrossing computeCrossing(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
std::vector< const GeomDet * > theDets
ReferenceCountingPointer< BoundDisk > theDisk
~Phase2EndcapSingleRing() override
GlobalVector globalMomentum() const
string end
Definition: dataset.py:937
const std::vector< const GeomDet * > & subLayer(int ind) const
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
#define LogDebug(id)