CMS 3D CMS Logo

BarrelMeasurementEstimator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaElectronAlgos
4 // Class: BarrelMeasurementEstimator
5 //
13 //
14 // Original Author: Ursula Berthon, Claude Charlot
15 // Created: Mon Mar 27 13:22:06 CEST 2006
16 //
17 //
18 
24 
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 this->estimate(ts,gp);
32 }
33 
34 //usable in case we have no TransientTrackingRecHit
36  const GlobalPoint &gp) const {
37 
38  float myZ = gp.z();
39  float myR = gp.perp();
40  float zDiff = ts.globalParameters().position().z() - myZ;
41 
42  float myZmax = theZMax;
43  float myZmin = theZMin;
44 
45  if(std::abs(myZ)<30. && myR>8.) {
46  myZmax = 0.09;
47  myZmin = -0.09;
48  }
49 
50  if( zDiff >= myZmax || zDiff <= myZmin ) return std::pair<bool,double>(false,0.);
51 
52  float tsPhi = ts.globalParameters().position().phi();
53 
54  float rhPhi = gp.phi();
55 
56  float phiDiff = tsPhi - rhPhi;
57  if (phiDiff > pi) phiDiff -= twopi;
58  if (phiDiff < -pi) phiDiff += twopi;
59 
60  if ( phiDiff < thePhiMax && phiDiff > thePhiMin ) {
61 
62  return std::pair<bool,double>(true,1.);
63  } else {
64 
65  return std::pair<bool,double>(false,0.);
66  }
67 }
68 
69 
70 std::pair<bool,double> BarrelMeasurementEstimator::estimate
71  ( const GlobalPoint & vprim,
72  const TrajectoryStateOnSurface & absolute_ts,
73  const GlobalPoint& absolute_gp ) const
74  {
75  GlobalVector ts = absolute_ts.globalParameters().position() - vprim ;
76  GlobalVector gp = absolute_gp - vprim ;
77 
78  float myR = gp.perp();
79  float myZ = gp.z();
80  float zDiff = myZ -ts.z() ;
81  float myZmax = theZMax;
82  float myZmin = theZMin;
83  if( (std::abs(myZ)<30.f) & (myR>8.f) )
84  {
85  myZmax = 0.09f;
86  myZmin = -0.09f;
87  }
88 
89 
90  if( zDiff >= myZmax || zDiff <= myZmin ) return std::pair<bool,double>(false,0.);
91 
92  float rhPhi = gp.barePhi() ;
93  float tsPhi = ts.barePhi();
94  float phiDiff = normalized_phi(rhPhi-tsPhi) ;
95 
96  if ( (phiDiff < thePhiMax) & (phiDiff > thePhiMin) )
97  { return std::pair<bool,double>(true,1.) ; }
98  else
99  { return std::pair<bool,double>(false,0.) ; }
100  }
101 
104  const BoundPlane& plane) const
105  {
106  typedef std::pair<float,float> Range;
107 
108 
109  GlobalPoint trajPos(ts.globalParameters().position());
110 
111  Range trajZRange(trajPos.z() - std::abs(theZMin), trajPos.z() + std::abs(theZMax));
112  Range trajPhiRange(trajPos.phi() - std::abs(thePhiMin), trajPos.phi() + std::abs(thePhiMax));
113 
114  if(rangesIntersect(trajZRange, plane.zSpan()) &&
115  rangesIntersect(trajPhiRange, plane.phiSpan(), PhiLess()))
116  {
117  return true;
118  }
119  else
120  {
121  // cout <<cout<<" barrel boundpl est returns false!!"<<endl;
122  // cout<<"BarrelMeasurementEstimator(estimate) :thePhiMin,thePhiMax, theZMin,theZMax "<<thePhiMin<<" "<<thePhiMax<<" "<< theZMin<<" "<<theZMax<<endl;
123  // cout<<" trajZRange "<<trajZRange.first<<" "<<trajZRange.second<<endl;
124  // cout<<" trajPhiRange "<<trajPhiRange.first<<" "<<trajPhiRange.second<<endl;
125  // cout<<" detZRange "<<detRange.zRange().first<<" "<<detRange.zRange().second<<endl;
126  // cout<<" detPhiRange "<<detRange.phiRange().first<<" "<<detRange.phiRange().second<<endl;
127  // cout<<" intersect z: "<<rangesIntersect(trajZRange, detRange.zRange())<<endl;
128  // cout<<" intersect phi: "<<rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess())<<endl;
129  return false ;
130  }
131 
132  }
133 
137  const BoundPlane & plane) const
138  {
139  float nSigmaCut = 3. ;
140  if ( ts.hasError())
141  {
142  LocalError le = ts.localError().positionError() ;
143  return Local2DVector( std::sqrt(le.xx())*nSigmaCut, std::sqrt(le.yy())*nSigmaCut) ;
144  }
145  else return Local2DVector(99999,99999) ;
146  }
147 
148 
149 
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
float xx() const
Definition: LocalError.h:24
T perp() const
Definition: PV3DBase.h:72
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
LocalError positionError() const
const Double_t pi
T barePhi() const
Definition: PV3DBase.h:68
PixelRecoRange< float > Range
float yy() const
Definition: LocalError.h:26
Vector2DBase< float, LocalTag > Local2DVector
const GeomDet * det() const
RealType normalized_phi(RealType phi)
T sqrt(T t)
Definition: SSEVec.h:18
bool rangesIntersect(const Range &a, const Range &b)
MeasurementEstimator::Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const override
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
const GlobalTrajectoryParameters & globalParameters() const
std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const override