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