CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TkDetUtil.cc
Go to the documentation of this file.
1 #include "TkDetUtil.h"
3 
9 
10 
11 namespace tkDetUtil {
12 
13  namespace {
14  struct PhiLess {
15  bool operator()(float a, float b) const {
16  return Geom::phiLess(a,b);
17  }
18  };
19  }
20 
21  bool overlapInPhi( const GlobalPoint& crossPoint,const GeomDet & det, float phiWindow)
22  {
23  float phi = crossPoint.barePhi();
24  std::pair<float,float> phiRange(phi-phiWindow, phi+phiWindow);
25  std::pair<float,float> detPhiRange = det.surface().phiSpan();
26  // return rangesIntersect( phiRange, detPhiRange, boost::function<bool(float,float)>(&Geom::phiLess));
27  return rangesIntersect( phiRange, detPhiRange, PhiLess());
28  }
29 
30 
31  float computeWindowSize( const GeomDet* det,
32  const TrajectoryStateOnSurface& tsos,
33  const MeasurementEstimator& est)
34  {
35  const BoundPlane& startPlane = det->surface();
37  est.maximalLocalDisplacement( tsos, startPlane);
38  return calculatePhiWindow( maxDistance, tsos, startPlane);
39  }
40 
41 
42 
43  float
45  const TrajectoryStateOnSurface& ts,
46  const BoundPlane& plane)
47  {
48 
50  float corners[] = { plane.toGlobal(LocalPoint( start.x()+maxDistance.x(), start.y()+maxDistance.y() )).barePhi(),
51  plane.toGlobal(LocalPoint( start.x()-maxDistance.x(), start.y()+maxDistance.y() )).barePhi(),
52  plane.toGlobal(LocalPoint( start.x()-maxDistance.x(), start.y()-maxDistance.y() )).barePhi(),
53  plane.toGlobal(LocalPoint( start.x()+maxDistance.x(), start.y()-maxDistance.y() )).barePhi()
54  };
55 
56  float phimin = corners[0];
57  float phimax = phimin;
58  for ( int i = 1; i<4; i++) {
59  float cPhi = corners[i];
60  if ( Geom::phiLess(cPhi, phimin) ) { phimin = cPhi; }
61  if ( Geom::phiLess( phimax, cPhi) ) { phimax = cPhi; }
62  }
63  float phiWindow = phimax - phimin;
64  if ( phiWindow < 0.) { phiWindow += 2.*Geom::pi();}
65 
66  return phiWindow;
67  }
68 
69 
70 
71 
72 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV2DBase.h:45
std::pair< float, float > const & phiSpan() const
Definition: BoundSurface.h:91
T y() const
Definition: PV3DBase.h:62
float calculatePhiWindow(const MeasurementEstimator::Local2DVector &maxDistance, const TrajectoryStateOnSurface &ts, const BoundPlane &plane)
Definition: TkDetUtil.cc:44
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: TkDetUtil.cc:31
T barePhi() const
Definition: PV3DBase.h:67
bool rangesIntersect(const Range &a, const Range &b)
bool overlapInPhi(const GlobalPoint &crossPoint, const GeomDet &det, float phiWindow)
Definition: TkDetUtil.cc:21
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:57
double b
Definition: hdecay.h:120
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
double pi()
Definition: Pi.h:31
double a
Definition: hdecay.h:121
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
T x() const
Definition: PV2DBase.h:44
T x() const
Definition: PV3DBase.h:61
Definition: DDAxes.h:10