CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
int i
Definition: DBlmapReader.cc:9
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const
Definition: PixelRod.cc:45
T y() const
Definition: PV2DBase.h:46
std::vector< const GeomDet * > theDets
Definition: DetRodOneR.h:40
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
virtual const Plane & specificSurface() const
Return the rod surface as a Plane.
Definition: DetRod.h:27
Definition: Plane.h:17
virtual int binIndex(T z) const
returns an index in the valid range for the bin that contains Z
static std::pair< bool, TrajectoryStateOnSurface > isCompatible(const GeomDet *theDet, const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est)
~PixelRod()
Definition: PixelRod.cc:34
virtual const std::vector< const GeometricSearchDet * > & components() const __attribute__((cold))
Returns basic components, if any.
Definition: PixelRod.cc:39
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PeriodicBinFinderInZ< float > BinFinderType
Definition: PixelRod.h:14
#define end
Definition: vmac.h:37
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
Definition: DetRod.h:21
#define begin
Definition: vmac.h:30
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const __attribute__((hot))
Definition: PixelRod.cc:52
PixelRod(std::vector< const GeomDet * > &theDets)
Definition: PixelRod.cc:13
virtual void groupedCompatibleDetsV(const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &, std::vector< DetGroup > &) const
Definition: PixelRod.cc:102