CMS 3D CMS Logo

ConversionBarrelEstimator.cc
Go to the documentation of this file.
1 #include "CLHEP/Units/GlobalPhysicalConstants.h"
8 
9 // zero value indicates incompatible ts - hit pair
11  const TrackingRecHit& hit) const {
12  std::pair<bool, double> result;
13 
14  //std::cout << " ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const TransientTrackingRecHit& hit) " << std::endl;
15 
16  float tsPhi = ts.globalParameters().position().phi();
17  GlobalPoint gp = hit.globalPosition();
18  float rhPhi = gp.phi();
19 
20  // allow a z fudge of 2 sigma
21  float dz = 2. * sqrt(hit.localPositionError().yy());
22  float zDiff = ts.globalParameters().position().z() - gp.z();
23  float phiDiff = tsPhi - rhPhi;
24  if (phiDiff > pi)
25  phiDiff -= twopi;
26  if (phiDiff < -pi)
27  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  if (phiDiff < thePhiRangeMax && phiDiff > thePhiRangeMin && zDiff < zrange && zDiff > -zrange) {
41  // std::cout << " estimator returns 1 with phiDiff " << thePhiRangeMin << " < " << phiDiff << " < "
42  // << thePhiRangeMax << " and zDiff " << zDiff << " < " << zrange << std::endl;
43  // std::cout << " YES " << phiDiff << " " << zDiff << std::endl;
44  // std::cout << " => RECHIT ACCEPTED " << std::endl;
45 
46  result.first = true;
47  result.second = phiDiff;
48  } else {
49  // std::cout << " estimator returns NOT ACCEPTED with phiDiff " << thePhiRangeMin << " < " << phiDiff << " < "
50  //<< thePhiRangeMax << " and zDiff " << zDiff << " < " << theZRangeMax+dz << std::endl;
51 
52  result.first = false;
53  result.second = 0;
54  }
55 
56  return result;
57 }
58 
60  typedef std::pair<float, float> Range;
61  // std::cout << " ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane) " << std::endl;
62 
63  GlobalPoint trajPos(ts.globalParameters().position());
64  Range trajZRange(trajPos.z() - 2. * theZRangeMax, trajPos.z() + 2. * theZRangeMax);
65  Range trajPhiRange(trajPos.phi() + thePhiRangeMin, trajPos.phi() + thePhiRangeMax);
66 
67  if (rangesIntersect(trajZRange, plane.zSpan()) &&
68  rangesIntersect(trajPhiRange, plane.phiSpan(), [](auto x, auto y) { return Geom::phiLess(x, y); })) {
69  // std::cout << " ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane) IN RANGE " << std::endl;
70  return true;
71 
72  } else {
73  // std::cout << " ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane) NOT IN RANGE " << std::endl;
74  return false;
75  }
76 }
77 
79  const TrajectoryStateOnSurface& ts, const BoundPlane& plane) const {
80  /*
81  if ( ts.hasError() ) {
82  LocalError le = ts.localError().positionError();
83  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;
84  return Local2DVector( sqrt(le.xx())*nSigmaCut(), sqrt(le.yy())*nSigmaCut());
85  }
86 
87  else return Local2DVector(9999,9999);
88  */
89  return Local2DVector(9999, 9999);
90 }
DDAxes::y
TrajectoryStateOnSurface.h
GlobalTrajectoryParameters.h
TkClusParameters_cff.zrange
zrange
Definition: TkClusParameters_cff.py:7
Range
PixelRecoRange< float > Range
Definition: PixelTripletHLTGenerator.cc:31
GlobalTrajectoryParameters::position
GlobalPoint position() const
Definition: GlobalTrajectoryParameters.h:60
VectorUtil.h
ConversionBarrelEstimator::thePhiRangeMin
float thePhiRangeMin
Definition: ConversionBarrelEstimator.h:40
TransientTrackingRecHit.h
DDAxes::x
MeasurementEstimator::Local2DVector
Vector2DBase< float, LocalTag > Local2DVector
Definition: MeasurementEstimator.h:26
ConversionBarrelEstimator::theZRangeMax
float theZRangeMax
Definition: ConversionBarrelEstimator.h:43
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Vector2DBase
Definition: Vector2DBase.h:8
Point3DBase< float, GlobalTag >
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
Geom::phiLess
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
ConversionBarrelEstimator::estimate
std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const override
Definition: ConversionBarrelEstimator.cc:10
ConversionBarrelEstimator::maximalLocalDisplacement
Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const override
Definition: ConversionBarrelEstimator.cc:78
ConversionBarrelEstimator.h
TrackingRecHit
Definition: TrackingRecHit.h:21
PVValHelper::dz
Definition: PVValidationHelpers.h:50
BoundPlane
rangesIntersect
bool rangesIntersect(const Range &a, const Range &b)
Definition: rangesIntersect.h:14
ConversionBarrelEstimator::thePhiRangeMax
float thePhiRangeMax
Definition: ConversionBarrelEstimator.h:41
mps_fire.result
result
Definition: mps_fire.py:311
pi
const Double_t pi
Definition: trackSplitPlot.h:36
TrajectoryStateOnSurface::globalParameters
const GlobalTrajectoryParameters & globalParameters() const
Definition: TrajectoryStateOnSurface.h:64
rangesIntersect.h
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
hit
Definition: SiStripHitEffFromCalibTree.cc:88