File indexing completed on 2024-04-06 12:24:57
0001 #include "CLHEP/Units/GlobalPhysicalConstants.h"
0002 #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionBarrelEstimator.h"
0003 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0004 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
0005 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0006 #include "TrackingTools/DetLayers/interface/rangesIntersect.h"
0007 #include "DataFormats/GeometryVector/interface/VectorUtil.h"
0008
0009
0010 std::pair<bool, double> ConversionBarrelEstimator::estimate(const TrajectoryStateOnSurface& ts,
0011 const TrackingRecHit& hit) const {
0012 std::pair<bool, double> result;
0013
0014
0015
0016 float tsPhi = ts.globalParameters().position().phi();
0017 GlobalPoint gp = hit.globalPosition();
0018 float rhPhi = gp.phi();
0019
0020
0021 float dz = 2. * sqrt(hit.localPositionError().yy());
0022 float zDiff = ts.globalParameters().position().z() - gp.z();
0023 float phiDiff = tsPhi - rhPhi;
0024 if (phiDiff > pi)
0025 phiDiff -= twopi;
0026 if (phiDiff < -pi)
0027 phiDiff += twopi;
0028
0029
0030 float zrange = sqrt(theZRangeMax * theZRangeMax + dz * dz);
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 if (phiDiff < thePhiRangeMax && phiDiff > thePhiRangeMin && zDiff < zrange && zDiff > -zrange) {
0041
0042
0043
0044
0045
0046 result.first = true;
0047 result.second = phiDiff;
0048 } else {
0049
0050
0051
0052 result.first = false;
0053 result.second = 0;
0054 }
0055
0056 return result;
0057 }
0058
0059 bool ConversionBarrelEstimator::estimate(const TrajectoryStateOnSurface& ts, const BoundPlane& plane) const {
0060 typedef std::pair<float, float> Range;
0061
0062
0063 GlobalPoint trajPos(ts.globalParameters().position());
0064 Range trajZRange(trajPos.z() - 2. * theZRangeMax, trajPos.z() + 2. * theZRangeMax);
0065 Range trajPhiRange(trajPos.phi() + thePhiRangeMin, trajPos.phi() + thePhiRangeMax);
0066
0067 if (rangesIntersect(trajZRange, plane.zSpan()) &&
0068 rangesIntersect(trajPhiRange, plane.phiSpan(), [](auto x, auto y) { return Geom::phiLess(x, y); })) {
0069
0070 return true;
0071
0072 } else {
0073
0074 return false;
0075 }
0076 }
0077
0078 MeasurementEstimator::Local2DVector ConversionBarrelEstimator::maximalLocalDisplacement(
0079 const TrajectoryStateOnSurface& ts, const BoundPlane& plane) const {
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 return Local2DVector(9999, 9999);
0090 }