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