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 TransientTrackingRecHit& 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, GlobalPoint &gp) const {
34 
35  float tsR = ts.globalParameters().position().perp();
36  float tsPhi = ts.globalParameters().position().phi();
37 
38  float rhPhi = gp.phi();
39  float rhR = gp.perp();
40 
41  float myZ = gp.z();
42 
43  float rMin = theRMin;
44  float rMax = theRMax;
45  float myPhimin = thePhiMin;
46  float myPhimax = thePhiMax;
47 
48  if(std::abs(myZ)> 70. && std::abs(myZ)<170.)
49  {
50  rMin = theRMinI;
51  rMax = theRMaxI;
52  }
53 
54  float phiDiff = tsPhi - rhPhi;
55  if (phiDiff > pi) phiDiff -= twopi;
56  if (phiDiff < -pi) phiDiff += twopi;
57 
58  float rDiff = tsR - rhR;
59 
60  if ( phiDiff < myPhimax && phiDiff > myPhimin &&
61  rDiff < rMax && rDiff > rMin) {
62  return std::pair<bool,double>(true,1.);
63  } else {
64  return std::pair<bool,double>(false,0.);
65  }
66 }
67 
68 std::pair<bool,double> ForwardMeasurementEstimator::estimate
69  ( const GlobalPoint& vprim,
70  const TrajectoryStateOnSurface& absolute_ts,
71  GlobalPoint & absolute_gp ) const
72  {
73  GlobalVector ts = absolute_ts.globalParameters().position() - vprim ;
74  GlobalVector gp = absolute_gp - vprim ;
75 
76  float tsR = ts.perp();
77  float tsPhi = ts.phi();
78 
79  float rhPhi = gp.phi();
80  float rhR = gp.perp();
81 
82  float myZ = gp.z();
83 
84  float rMin = theRMin;
85  float rMax = theRMax;
86  float myPhimin = thePhiMin;
87  float myPhimax = thePhiMax;
88 
89  if(std::abs(myZ)> 70. && std::abs(myZ)<170.)
90  {
91  rMin = theRMinI;
92  rMax = theRMaxI;
93  }
94 
95  float phiDiff = normalized_phi(rhPhi - tsPhi) ;
96  float rDiff = rhR - tsR;
97 
98  if ( phiDiff < myPhimax && phiDiff > myPhimin && rDiff < rMax && rDiff > rMin)
99  { return std::pair<bool,double>(true,1.) ; }
100  else
101  { return std::pair<bool,double>(false,0.) ; }
102 }
103 
106  const BoundPlane & plane ) const
107  {
108  typedef std::pair<float,float> Range ;
109 
110  GlobalPoint trajPos(ts.globalParameters().position());
111  GlobalDetRangeRPhi detRange(plane);
112 
113  float r1 = 0.;
114  float r2 = 40.;
115 
116  Range trajRRange(trajPos.perp() - r1, trajPos.perp() + r2);
117  Range trajPhiRange(trajPos.phi() - std::abs(thePhiMin), trajPos.phi() + std::abs(thePhiMax));
118 
119  if(rangesIntersect(trajRRange, detRange.rRange()) &&
120  rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess()))
121  { return true ; }
122  else
123  { return false ; }
124 }
125 
129  const BoundPlane & plane) const
130  {
131  float nSigmaCut = 3.;
132  if ( ts.hasError())
133  {
135  return Local2DVector( sqrt(le.xx())*nSigmaCut, sqrt(le.yy())*nSigmaCut);
136  }
137  else
138  return Local2DVector(999999,999999) ;
139  }
140 
141 
142 
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
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TransientTrackingRecHit &hit) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Vector2DBase< float, LocalTag > Local2DVector
virtual const GeomDet * det() const =0
The GomeDet* can be zero for InvalidTransientRecHits and for TConstraintRecHit2Ds.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
LocalError positionError() const
float yy() const
Definition: LocalError.h:26
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
MeasurementEstimator::Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
PixelRecoRange< float > Range
const GlobalTrajectoryParameters & globalParameters() const
volatile std::atomic< bool > shutdown_flag false
double pi
virtual LocalPoint localPosition() const =0