File indexing completed on 2024-04-06 12:04:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "DataFormats/CTPPSReco/interface/CTPPSTimingLocalTrack.h"
0012 #include <cmath>
0013
0014
0015
0016
0017
0018 CTPPSTimingLocalTrack::CTPPSTimingLocalTrack() : num_hits_(0), num_planes_(0), valid_(true), t_(0.), t_sigma_(0.) {}
0019
0020 CTPPSTimingLocalTrack::CTPPSTimingLocalTrack(const math::XYZPoint& pos0,
0021 const math::XYZPoint& pos0_sigma,
0022 float t,
0023 float t_sigma)
0024 : pos0_(pos0), pos0_sigma_(pos0_sigma), num_hits_(0), num_planes_(0), valid_(false), t_(t), t_sigma_(t_sigma) {}
0025
0026
0027
0028 bool CTPPSTimingLocalTrack::containsHit(const CTPPSTimingRecHit& recHit, float tolerance, CheckDimension check) const {
0029 float xTolerance = pos0_sigma_.x() + (0.5 * recHit.xWidth()) + tolerance;
0030 float yTolerance = pos0_sigma_.y() + (0.5 * recHit.yWidth()) + tolerance;
0031 float zTolerance = pos0_sigma_.z() + (0.5 * recHit.zWidth()) + tolerance;
0032
0033 float xDiff = std::abs(pos0_.x() - recHit.x());
0034 float yDiff = std::abs(pos0_.y() - recHit.y());
0035 float zDiff = std::abs(pos0_.z() - recHit.z());
0036
0037 switch (check) {
0038 case CheckDimension::x:
0039 return xDiff < xTolerance;
0040 case CheckDimension::y:
0041 return yDiff < yTolerance;
0042 case CheckDimension::all:
0043 return xDiff < xTolerance && yDiff < yTolerance && zDiff < zTolerance;
0044 }
0045 return false;
0046 }
0047
0048
0049
0050
0051
0052 bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs) {
0053
0054 if (lhs.time() < rhs.time())
0055 return true;
0056 if (lhs.time() > rhs.time())
0057 return false;
0058
0059 if (lhs.x0() < rhs.x0())
0060 return true;
0061 if (lhs.x0() > rhs.x0())
0062 return false;
0063
0064 if (lhs.y0() < rhs.y0())
0065 return true;
0066 if (lhs.y0() > rhs.y0())
0067 return false;
0068
0069 return (lhs.z0() < rhs.z0());
0070 }