test
CMS 3D CMS Logo

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