CMS 3D CMS Logo

PixelRod.cc
Go to the documentation of this file.
1 #include "PixelRod.h"
2 
4 
7 
8 using namespace std;
9 
11 
12 PixelRod::PixelRod(vector<const GeomDet*>& theInputDets) : DetRodOneR(theInputDets.begin(), theInputDets.end()) {
13  theBinFinder = BinFinderType(theDets.begin(), theDets.end());
14 
15  //--------- DEBUG INFO --------------
16  LogDebug("TkDetLayers") << "==== DEBUG PixelRod =====";
17  for (vector<const GeomDet*>::const_iterator i = theDets.begin(); i != theDets.end(); i++) {
18  LogDebug("TkDetLayers") << "PixelRod's Det pos z,perp,eta,phi: " << (**i).position().z() << " , "
19  << (**i).position().perp() << " , " << (**i).position().eta() << " , "
20  << (**i).position().phi();
21  }
22  LogDebug("TkDetLayers") << "==== end DEBUG PixelRod =====";
23  //--------------------------------------
24 }
25 
27 
28 const vector<const GeometricSearchDet*>& PixelRod::components() const {
29  throw DetLayerException("PixelRod doesn't have GeometricSearchDet components");
30 }
31 
32 pair<bool, TrajectoryStateOnSurface> PixelRod::compatible(const TrajectoryStateOnSurface& ts,
33  const Propagator&,
34  const MeasurementEstimator&) const {
35  edm::LogError("TkDetLayers") << "temporary dummy implementation of PixelRod::compatible()!!";
36  return pair<bool, TrajectoryStateOnSurface>();
37 }
38 
40  const Propagator& prop,
41  const MeasurementEstimator& est,
42  std::vector<DetWithState>& result) const {
44  TrajectoryStateOnSurface ts = prop.propagate(startingState, specificSurface());
45  if (!ts.isValid())
46  return;
47 
48  GlobalPoint startPos = ts.globalPosition();
49 
50  int closest = theBinFinder.binIndex(startPos.z());
51  pair<bool, TrajectoryStateOnSurface> closestCompat =
52  theCompatibilityChecker.isCompatible(theDets[closest], startingState, prop, est);
53 
54  if (closestCompat.first) {
55  result.push_back(DetWithState(theDets[closest], closestCompat.second));
56  } else {
57  if (!closestCompat.second.isValid())
58  return; // to investigate why this happens
59  }
60 
61  const Plane& closestPlane(theDets[closest]->specificSurface());
62 
63  Local2DVector maxDistance = est.maximalLocalDisplacement(closestCompat.second, closestPlane);
64 
65  float detHalfLen = theDets[closest]->surface().bounds().length() / 2.;
66 
67  // explore neighbours
68  for (size_t idet = closest + 1; idet < theDets.size(); idet++) {
69  LocalPoint nextPos(theDets[idet]->surface().toLocal(closestCompat.second.globalPosition()));
70  if (std::abs(nextPos.y()) < detHalfLen + maxDistance.y()) {
71  if (!add(idet, result, startingState, prop, est))
72  break;
73  } else {
74  break;
75  }
76  }
77 
78  for (int idet = closest - 1; idet >= 0; idet--) {
79  LocalPoint nextPos(theDets[idet]->surface().toLocal(closestCompat.second.globalPosition()));
80  if (std::abs(nextPos.y()) < detHalfLen + maxDistance.y()) {
81  if (!add(idet, result, startingState, prop, est))
82  break;
83  } else {
84  break;
85  }
86  }
87 }
88 
90  const Propagator&,
91  const MeasurementEstimator&,
92  std::vector<DetGroup>&) const {
93  LogDebug("TkDetLayers") << "dummy implementation of PixelRod::groupedCompatibleDets()";
94 }
Common base class.
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
Definition: DetRod.h:19
std::vector< const GeomDet * > theDets
Definition: DetRodOneR.h:37
T z() const
Definition: PV3DBase.h:61
int closest(std::vector< int > const &vec, int value)
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &, std::vector< DetGroup > &) const override
Definition: PixelRod.cc:89
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
BinFinderType theBinFinder
Definition: PixelRod.h:37
Log< level::Error, false > LogError
GeomDetCompatibilityChecker theCompatibilityChecker
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
Definition: Plane.h:16
~PixelRod() override
Definition: PixelRod.cc:26
void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const override __attribute__((hot))
Definition: PixelRod.cc:39
T y() const
Definition: PV3DBase.h:60
PixelRod(std::vector< const GeomDet *> &theDets)
Definition: PixelRod.cc:12
GlobalPoint globalPosition() const
static std::pair< bool, TrajectoryStateOnSurface > isCompatible(const GeomDet *theDet, const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est)
int binIndex(T z) const override
returns an index in the valid range for the bin that contains Z
GeometricSearchDet::DetWithState DetWithState
Definition: PixelRod.cc:10
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PeriodicBinFinderInZ< float > BinFinderType
Definition: PixelRod.h:13
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
bool add(int idet, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Query detector idet for compatible and add the output to result.
Definition: DetRodOneR.cc:32
const std::vector< const GeometricSearchDet * > & components() const override __attribute__((cold))
Returns basic components, if any.
Definition: PixelRod.cc:28
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const override
Definition: PixelRod.cc:32
virtual const Plane & specificSurface() const final
Return the rod surface as a Plane.
Definition: DetRod.h:24
Vector2DBase< float, LocalTag > Local2DVector
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
#define LogDebug(id)