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