CMS 3D CMS Logo

BarrelUtil.h
Go to the documentation of this file.
1 #ifndef TkDetLayers_BarrelUtil_h
2 #define TkDetLayers_BarrelUtil_h
3 
4 
6 
12 
13 #pragma GCC visibility push(hidden)
14 namespace barrelUtil {
15 
16  inline
17  float calculatePhiWindow( float Xmax, const GeomDet& det,
18  const TrajectoryStateOnSurface& state) {
19 
20  LocalPoint startPoint = state.localPosition();
21  LocalVector shift( Xmax , 0. , 0.);
22  LocalPoint shift1 = startPoint + shift;
23  LocalPoint shift2 = startPoint + (-shift);
24  //LocalPoint shift2( startPoint); //original code;
25  //shift2 -= shift;
26 
27  auto phi1 = det.surface().toGlobal(shift1).barePhi();
28  auto phi2 = det.surface().toGlobal(shift2).barePhi();
29  auto phiStart = state.globalPosition().barePhi();
30  auto phiWin = std::min(std::abs(phiStart-phi1),std::abs(phiStart-phi2));
31 
32  return phiWin;
33  }
34 
35  inline
36  float computeWindowSize( const GeomDet* det,
37  const TrajectoryStateOnSurface& tsos,
38  const MeasurementEstimator& est) {
39  auto xmax =
40  est.maximalLocalDisplacement(tsos, det->surface()).x();
41  return calculatePhiWindow( xmax, *det, tsos);
42  }
43 
44 
45 
46  inline
47  bool overlap(float phi, const GeometricSearchDet& gsdet, float phiWin) {
48  // introduce offset (extrapolated point and true propagated point differ by 0.0003 - 0.00033,
49  // due to thickness of Rod of 1 cm)
50  constexpr float phiOffset = 0.00034; //...TOBE CHECKED LATER...
51  phiWin += phiOffset;
52 
53  // detector phi range
54  std::pair<float,float> phiRange(phi-phiWin, phi+phiWin);
55 
56  return rangesIntersect(phiRange, gsdet.surface().phiSpan(),
57  [](auto x, auto y){ return Geom::phiLess(x,y); });
58  }
59 
60 
61 }
62 
63 
64 #pragma GCC visibility pop
65 #endif
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
std::pair< float, float > const & phiSpan() const
Definition: Surface.h:123
GlobalPoint globalPosition() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
#define constexpr
T barePhi() const
Definition: PV3DBase.h:68
bool rangesIntersect(const Range &a, const Range &b)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
float calculatePhiWindow(float Xmax, const GeomDet &det, const TrajectoryStateOnSurface &state)
Definition: BarrelUtil.h:17
T min(T a, T b)
Definition: MathUtil.h:58
bool overlap(float phi, const GeometricSearchDet &gsdet, float phiWin)
Definition: BarrelUtil.h:47
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: BarrelUtil.h:36
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:23
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
static unsigned int const shift