test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // zero value indicates incompatible ts - hit pair
27  const TrackingRecHit& hit) const {
28  LocalPoint lp = hit.localPosition();
29  GlobalPoint gp = hit.det()->surface().toGlobal( lp);
30  return estimate(ts,gp);
31 }
32 
33 std::pair<bool,double> ForwardMeasurementEstimator::estimate( const TrajectoryStateOnSurface& ts, const GlobalPoint &gp) const {
34 
35  float tsR = ts.globalParameters().position().perp();
36  float rhR = gp.perp();
37  float rDiff = tsR - rhR;
38  float rMin = theRMin;
39  float rMax = theRMax;
40  float myZ = gp.z();
41  if(std::abs(myZ)> 70. && std::abs(myZ)<170.) {
42  rMin = theRMinI;
43  rMax = theRMaxI;
44  }
45  if( rDiff >= rMax || rDiff <= rMin ) return std::pair<bool,double>(false,0.);
46 
47  float tsPhi = ts.globalParameters().position().phi();
48  float rhPhi = gp.phi();
49 
50  float myPhimin = thePhiMin;
51  float myPhimax = thePhiMax;
52 
53  float phiDiff = tsPhi - rhPhi;
54  if (phiDiff > pi) phiDiff -= twopi;
55  if (phiDiff < -pi) phiDiff += twopi;
56 
57  if ( phiDiff < myPhimax && phiDiff > myPhimin ) {
58  return std::pair<bool,double>(true,1.);
59  } else {
60  return std::pair<bool,double>(false,0.);
61  }
62 }
63 
64 std::pair<bool,double> ForwardMeasurementEstimator::estimate
65  ( const GlobalPoint& vprim,
66  const TrajectoryStateOnSurface& absolute_ts,
67  const GlobalPoint & absolute_gp ) const
68  {
69  GlobalVector ts = absolute_ts.globalParameters().position() - vprim ;
70  GlobalVector gp = absolute_gp - vprim ;
71 
72  float rhR = gp.perp();
73  float tsR = ts.perp();
74  float rDiff = rhR - tsR;
75  float rMin = theRMin;
76  float rMax = theRMax;
77  float myZ = gp.z();
78  if(std::abs(myZ)> 70. && std::abs(myZ)<170.) {
79  rMin = theRMinI;
80  rMax = theRMaxI;
81  }
82 
83  if( rDiff >= rMax || rDiff <= rMin ) return std::pair<bool,double>(false,0.);
84 
85  float tsPhi = ts.phi();
86  float rhPhi = gp.phi();
87 
88  float myPhimin = thePhiMin;
89  float myPhimax = thePhiMax;
90 
91  float phiDiff = normalized_phi(rhPhi - tsPhi) ;
92 
93  if ( phiDiff < myPhimax && phiDiff > myPhimin )
94  { return std::pair<bool,double>(true,1.) ; }
95  else
96  { return std::pair<bool,double>(false,0.) ; }
97 }
98 
101  const BoundPlane & plane ) const
102  {
103  typedef std::pair<float,float> Range ;
104 
105  GlobalPoint trajPos(ts.globalParameters().position());
106  GlobalDetRangeRPhi detRange(plane);
107 
108  float r1 = 0.;
109  float r2 = 40.;
110 
111  Range trajRRange(trajPos.perp() - r1, trajPos.perp() + r2);
112  Range trajPhiRange(trajPos.phi() - std::abs(thePhiMin), trajPos.phi() + std::abs(thePhiMax));
113 
114  if(rangesIntersect(trajRRange, detRange.rRange()) &&
115  rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess()))
116  { return true ; }
117  else
118  { return false ; }
119 }
120 
124  const BoundPlane & plane) const
125  {
126  float nSigmaCut = 3.;
127  if ( ts.hasError())
128  {
130  return Local2DVector( sqrt(le.xx())*nSigmaCut, sqrt(le.yy())*nSigmaCut);
131  }
132  else
133  return Local2DVector(999999,999999) ;
134  }
135 
136 
137 
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
float xx() const
Definition: LocalError.h:24
T perp() const
Definition: PV3DBase.h:72
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Vector2DBase< float, LocalTag > Local2DVector
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
LocalError positionError() const
const Double_t pi
float yy() const
Definition: LocalError.h:26
const GeomDet * det() const
RealType normalized_phi(RealType phi)
T sqrt(T t)
Definition: SSEVec.h:48
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
const LocalTrajectoryError & localError() const
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const
MeasurementEstimator::Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
PixelRecoRange< float > Range
const GlobalTrajectoryParameters & globalParameters() const
volatile std::atomic< bool > shutdown_flag false
virtual LocalPoint localPosition() const =0