CMS 3D CMS Logo

ForwardMeasurementEstimator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaElectronAlgos
4 // Class: ForwardMeasurementEstimator
5 //
13 //
14 // Original Author: Ursula Berthon, Claude Charlot
15 // Created: Mon Mar 27 13:22:06 CEST 2006
16 //
17 //
25 
26 // zero value indicates incompatible ts - hit pair
28  const TrackingRecHit& hit) const {
29  LocalPoint lp = hit.localPosition();
30  GlobalPoint gp = hit.det()->surface().toGlobal( lp);
31  return estimate(ts,gp);
32 }
33 
34 std::pair<bool,double> ForwardMeasurementEstimator::estimate( const TrajectoryStateOnSurface& ts, const GlobalPoint &gp) const {
35 
36  float tsR = ts.globalParameters().position().perp();
37  float rhR = gp.perp();
38  float rDiff = tsR - rhR;
39  float rMin = theRMin;
40  float rMax = theRMax;
41  float myZ = gp.z();
42  if( (std::abs(myZ)> 70.f) & (std::abs(myZ)<170.f)) {
43  rMin = theRMinI;
44  rMax = theRMaxI;
45  }
46  if( rDiff >= rMax || rDiff <= rMin ) return std::pair<bool,double>(false,0.);
47 
48  float tsPhi = ts.globalParameters().position().barePhi();
49  float rhPhi = gp.barePhi();
50 
51  float myPhimin = thePhiMin;
52  float myPhimax = thePhiMax;
53 
54  float phiDiff = normalizedPhi(tsPhi - rhPhi);
55 
56  if ( (phiDiff < myPhimax) & (phiDiff > myPhimin) ) {
57  return std::pair<bool,double>(true,1.);
58  } else {
59  return std::pair<bool,double>(false,0.);
60  }
61 }
62 
63 std::pair<bool,double> ForwardMeasurementEstimator::estimate
64  ( const GlobalPoint& vprim,
65  const TrajectoryStateOnSurface& absolute_ts,
66  const GlobalPoint & absolute_gp ) const
67  {
68  GlobalVector ts = absolute_ts.globalParameters().position() - vprim ;
69  GlobalVector gp = absolute_gp - vprim ;
70 
71  float rhR = gp.perp();
72  float tsR = ts.perp();
73  float rDiff = rhR - tsR;
74  float rMin = theRMin;
75  float rMax = theRMax;
76  float myZ = gp.z();
77  if( (std::abs(myZ)> 70.f) & (std::abs(myZ)<170.f) ) {
78  rMin = theRMinI;
79  rMax = theRMaxI;
80  }
81 
82  if( (rDiff >= rMax) | (rDiff <= rMin) ) return std::pair<bool,double>(false,0.);
83 
84  float tsPhi = ts.barePhi();
85  float rhPhi = gp.barePhi();
86 
87  float myPhimin = thePhiMin;
88  float myPhimax = thePhiMax;
89 
90  float phiDiff = normalizedPhi(rhPhi - tsPhi) ;
91 
92  if ( phiDiff < myPhimax && phiDiff > myPhimin )
93  { return std::pair<bool,double>(true,1.) ; }
94  else
95  { return std::pair<bool,double>(false,0.) ; }
96 }
97 
100  const BoundPlane & plane ) const
101  {
102  typedef std::pair<float,float> Range ;
103 
104  GlobalPoint trajPos(ts.globalParameters().position());
105 
106  float r1 = 0.;
107  float r2 = 40.;
108 
109  Range trajRRange(trajPos.perp() - r1, trajPos.perp() + r2);
110  Range trajPhiRange(trajPos.phi() - std::abs(thePhiMin), trajPos.phi() + std::abs(thePhiMax));
111 
112  if(rangesIntersect(trajRRange, plane.rSpan()) &&
113  rangesIntersect(trajPhiRange, plane.phiSpan(), [](auto x,auto y){ return Geom::phiLess(x, y);}))
114  { return true ; }
115  else
116  { return false ; }
117 }
118 
122  const BoundPlane & plane) const
123  {
124  float nSigmaCut = 3.;
125  if ( ts.hasError())
126  {
127  LocalError le = ts.localError().positionError();
128  return Local2DVector( std::sqrt(le.xx())*nSigmaCut, std::sqrt(le.yy())*nSigmaCut);
129  }
130  else
131  return Local2DVector(999999,999999) ;
132  }
133 
134 
135 
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
float xx() const
Definition: LocalError.h:24
std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const override
T perp() const
Definition: PV3DBase.h:72
MeasurementEstimator::Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const override
PixelRecoRange< float > Range
constexpr T normalizedPhi(T phi)
Definition: normalizedPhi.h:9
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
LocalError positionError() const
T barePhi() const
Definition: PV3DBase.h:68
float yy() const
Definition: LocalError.h:26
Vector2DBase< float, LocalTag > Local2DVector
const GeomDet * det() const
T sqrt(T t)
Definition: SSEVec.h:18
bool rangesIntersect(const Range &a, const Range &b)
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
const LocalTrajectoryError & localError() const
virtual LocalPoint localPosition() const =0
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:23
const GlobalTrajectoryParameters & globalParameters() const