CMS 3D CMS Logo

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