CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
T y() const
Definition: PV2DBase.h:44
std::vector< const GeomDet * > theDets
Definition: DetRodOneR.h:37
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
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
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
BinFinderType theBinFinder
Definition: PixelRod.h:37
Log< level::Error, false > LogError
GeomDetCompatibilityChecker theCompatibilityChecker
Definition: Plane.h:16
~PixelRod() override
Definition: PixelRod.cc:26
tuple result
Definition: mps_fire.py:311
void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const override __attribute__((hot))
Definition: PixelRod.cc:39
static std::pair< bool, TrajectoryStateOnSurface > isCompatible(const GeomDet *theDet, const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est)
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
int binIndex(T z) const override
returns an index in the valid range for the bin that contains Z
T z() const
Definition: PV3DBase.h:61
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)
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
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
string end
Definition: dataset.py:937
Vector2DBase< float, LocalTag > Local2DVector
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
PixelRod(std::vector< const GeomDet * > &theDets)
Definition: PixelRod.cc:12
#define LogDebug(id)