CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
25 
26 
27 // zero value indicates incompatible ts - hit pair
29  const TransientTrackingRecHit& hit) const {
30  LocalPoint lp = hit.localPosition();
31  GlobalPoint gp = hit.det()->surface().toGlobal( lp);
32  return this->estimate(ts,gp);
33 }
34 
35 //usable in case we have no TransientTrackingRecHit
37  GlobalPoint &gp) const {
38  float tsPhi = ts.globalParameters().position().phi();
39  float myR = gp.perp();
40  float myZ = gp.z();
41 
42  float myZmax = theZMax;
43  float myZmin = theZMin;
44 
45  if(std::abs(myZ)<30. && myR>8.)
46  {
47  myZmax = 0.09;
48  myZmin = -0.09;
49  }
50 
51  float rhPhi = gp.phi();
52 
53  float zDiff = ts.globalParameters().position().z() - gp.z();
54  float phiDiff = tsPhi - rhPhi;
55  if (phiDiff > pi) phiDiff -= twopi;
56  if (phiDiff < -pi) phiDiff += twopi;
57 
58 
59 
60 
61  if ( phiDiff < thePhiMax && phiDiff > thePhiMin &&
62  zDiff < myZmax && zDiff > myZmin) {
63 
64  return std::pair<bool,double>(true,1.);
65  } else {
66 
67  return std::pair<bool,double>(false,0.);
68  }
69 }
70 
71 
72 std::pair<bool,double> BarrelMeasurementEstimator::estimate
73  ( const GlobalPoint & vprim,
74  const TrajectoryStateOnSurface & absolute_ts,
75  GlobalPoint& absolute_gp ) const
76  {
77  GlobalVector ts = absolute_ts.globalParameters().position() - vprim ;
78  GlobalVector gp = absolute_gp - vprim ;
79 
80  float tsPhi = ts.phi();
81  float myR = gp.perp();
82  float myZ = gp.z();
83 
84  float myZmax = theZMax;
85  float myZmin = theZMin;
86 
87  if(std::abs(myZ)<30. && myR>8.)
88  {
89  myZmax = 0.09;
90  myZmin = -0.09;
91  }
92 
93  float rhPhi = gp.phi() ;
94  float zDiff = gp.z()-ts.z() ;
95  float phiDiff = normalized_phi(rhPhi-tsPhi) ;
96 
97  if ( phiDiff < thePhiMax && phiDiff > thePhiMin && zDiff < myZmax && zDiff > myZmin)
98  { return std::pair<bool,double>(true,1.) ; }
99  else
100  { return std::pair<bool,double>(false,0.) ; }
101  }
102 
105  const BoundPlane& plane) const
106  {
107  typedef std::pair<float,float> Range;
108 
109 
110  GlobalPoint trajPos(ts.globalParameters().position());
111  GlobalDetRangeZPhi detRange(plane);
112 
113  Range trajZRange(trajPos.z() - std::abs(theZMin), trajPos.z() + std::abs(theZMax));
114  Range trajPhiRange(trajPos.phi() - std::abs(thePhiMin), trajPos.phi() + std::abs(thePhiMax));
115 
116  if(rangesIntersect(trajZRange, detRange.zRange()) &&
117  rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess()))
118  {
119  return true;
120  }
121  else
122  {
123  // cout <<cout<<" barrel boundpl est returns false!!"<<endl;
124  // cout<<"BarrelMeasurementEstimator(estimate) :thePhiMin,thePhiMax, theZMin,theZMax "<<thePhiMin<<" "<<thePhiMax<<" "<< theZMin<<" "<<theZMax<<endl;
125  // cout<<" trajZRange "<<trajZRange.first<<" "<<trajZRange.second<<endl;
126  // cout<<" trajPhiRange "<<trajPhiRange.first<<" "<<trajPhiRange.second<<endl;
127  // cout<<" detZRange "<<detRange.zRange().first<<" "<<detRange.zRange().second<<endl;
128  // cout<<" detPhiRange "<<detRange.phiRange().first<<" "<<detRange.phiRange().second<<endl;
129  // cout<<" intersect z: "<<rangesIntersect(trajZRange, detRange.zRange())<<endl;
130  // cout<<" intersect phi: "<<rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess())<<endl;
131  return false ;
132  }
133 
134  }
135 
139  const BoundPlane & plane) const
140  {
141  float nSigmaCut = 3. ;
142  if ( ts.hasError())
143  {
145  return Local2DVector( sqrt(le.xx())*nSigmaCut, sqrt(le.yy())*nSigmaCut) ;
146  }
147  else return Local2DVector(99999,99999) ;
148  }
149 
150 
151 
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
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
const Double_t pi
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
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TransientTrackingRecHit &hit) const
const LocalTrajectoryError & localError() const
PixelRecoRange< float > Range
const GlobalTrajectoryParameters & globalParameters() const
volatile std::atomic< bool > shutdown_flag false
virtual LocalPoint localPosition() const =0
MeasurementEstimator::Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const