test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ConversionBarrelEstimator.cc
Go to the documentation of this file.
1 #include "CLHEP/Units/GlobalPhysicalConstants.h"
8 
9 
10  // zero value indicates incompatible ts - hit pair
12  const TrackingRecHit& hit) const {
13  std::pair<bool,double> result;
14 
15  //std::cout << " ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const TransientTrackingRecHit& hit) " << std::endl;
16 
17  float tsPhi = ts.globalParameters().position().phi();
18  GlobalPoint gp = hit.globalPosition();
19  float rhPhi = gp.phi();
20 
21  // allow a z fudge of 2 sigma
22  float dz = 2. * sqrt(hit.localPositionError().yy()) ;
23  float zDiff = ts.globalParameters().position().z() - gp.z();
24  float phiDiff = tsPhi - rhPhi;
25  if (phiDiff > pi) phiDiff -= twopi;
26  if (phiDiff < -pi) phiDiff += twopi;
27 
28  // add the errors on the window and the point in quadrature
29  float zrange = sqrt(theZRangeMax*theZRangeMax + dz*dz);
30 
31  /*
32  std::cout << " BarrelEstimator ts local error " <<ts.localError().positionError() << " hit local error " << hit.localPositionError() << std::endl;
33  std::cout << " BarrelEstimator: RecHit at " << gp << " phi " << rhPhi << " eta " << gp.eta() << std::endl;
34  std::cout << " BarrelEstimator: ts at " << ts.globalParameters().position() << " phi " <<ts.globalParameters().position().phi() << " eta " << ts.globalParameters().position().eta()<< std::endl;
35  std::cout << " zrange = +/-" << zrange << ", zDiff = " << zDiff << std::endl;
36  std::cout << " thePhiRangeMin = " << thePhiRangeMin << ", thePhiRangeMax = " << thePhiRangeMax << ", phiDiff = " << phiDiff << std::endl;
37  */
38 
39 
40 
41  if ( phiDiff < thePhiRangeMax && phiDiff > thePhiRangeMin &&
42  zDiff < zrange && zDiff > -zrange) {
43 
44  // std::cout << " estimator returns 1 with phiDiff " << thePhiRangeMin << " < " << phiDiff << " < "
45  // << thePhiRangeMax << " and zDiff " << zDiff << " < " << zrange << std::endl;
46  // std::cout << " YES " << phiDiff << " " << zDiff << std::endl;
47  // std::cout << " => RECHIT ACCEPTED " << std::endl;
48 
49  result.first=true;
50  result.second=phiDiff;
51  } else {
52 
53  // std::cout << " estimator returns NOT ACCEPTED with phiDiff " << thePhiRangeMin << " < " << phiDiff << " < "
54  //<< thePhiRangeMax << " and zDiff " << zDiff << " < " << theZRangeMax+dz << std::endl;
55 
56  result.first=false;
57  result.second=0;
58 
59  }
60 
61  return result;
62 
63 }
64 
65 
66 
68  const BoundPlane& plane) const {
69 
70  typedef std::pair<float,float> Range;
71  // std::cout << " ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane) " << std::endl;
72 
73  GlobalPoint trajPos(ts.globalParameters().position());
74  Range trajZRange(trajPos.z() - 2.*theZRangeMax, trajPos.z() + 2.*theZRangeMax);
75  Range trajPhiRange(trajPos.phi() + thePhiRangeMin, trajPos.phi() + thePhiRangeMax);
76 
77 
78  if(rangesIntersect(trajZRange, plane.zSpan()) &&
79  rangesIntersect(trajPhiRange, plane.phiSpan(), PhiLess())) {
80  // std::cout << " ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane) IN RANGE " << std::endl;
81  return true;
82 
83 
84 
85  } else {
86 
87  // std::cout << " ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane) NOT IN RANGE " << std::endl;
88  return false;
89 
90  }
91 
92 
93 }
94 
95 
98  const BoundPlane& plane) const
99 {
100 
101 
102 
103  /*
104  if ( ts.hasError() ) {
105  LocalError le = ts.localError().positionError();
106  std::cout << " ConversionBarrelEstimator::maximalLocalDisplacent local error " << sqrt(le.xx()) << " " << sqrt(le.yy()) << " nSigma " << nSigmaCut() << " sqrt(le.xx())*nSigmaCut() " << sqrt(le.xx())*nSigmaCut() << " sqrt(le.yy())*nSigmaCut() " << sqrt(le.yy())*nSigmaCut() << std::endl;
107  return Local2DVector( sqrt(le.xx())*nSigmaCut(), sqrt(le.yy())*nSigmaCut());
108  }
109 
110  else return Local2DVector(9999,9999);
111  */
112 return Local2DVector(9999,9999);
113 
114 }
115 
116 
PixelRecoRange< float > Range
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
virtual GlobalPoint globalPosition() const
tuple result
Definition: mps_fire.py:83
const Double_t pi
float yy() const
Definition: LocalError.h:26
Vector2DBase< float, LocalTag > Local2DVector
T sqrt(T t)
Definition: SSEVec.h:18
bool rangesIntersect(const Range &a, const Range &b)
T z() const
Definition: PV3DBase.h:64
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
const GlobalTrajectoryParameters & globalParameters() const
virtual LocalError localPositionError() const =0
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const