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 
34 PixelRod::~PixelRod(){
35 
36 }
37 
38 const vector<const GeometricSearchDet*>&
39 PixelRod::components() const{
40  throw DetLayerException("PixelRod doesn't have GeometricSearchDet components");
41 }
42 
43 
44 pair<bool, TrajectoryStateOnSurface>
45 PixelRod::compatible( const TrajectoryStateOnSurface& ts, const Propagator&,
46  const MeasurementEstimator&) const{
47  edm::LogError("TkDetLayers") << "temporary dummy implementation of PixelRod::compatible()!!" ;
48  return pair<bool,TrajectoryStateOnSurface>();
49 }
50 
51 void
52 PixelRod::compatibleDetsV( const TrajectoryStateOnSurface& startingState,
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 (fabs(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 (fabs(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
102 PixelRod::groupedCompatibleDetsV( const TrajectoryStateOnSurface&,
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.
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV2DBase.h:46
GlobalPoint globalPosition() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
Vector2DBase< float, LocalTag > Local2DVector
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
Definition: Plane.h:17
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
#define end
Definition: vmac.h:37
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
#define begin
Definition: vmac.h:30
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState