File indexing completed on 2025-01-18 09:11:19
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/EventData/TrackParameterHelpers.hpp"
0010
0011 #include "Acts/Utilities/AngleHelpers.hpp"
0012 #include "Acts/Utilities/VectorHelpers.hpp"
0013
0014 #include <numbers>
0015
0016 bool Acts::isBoundVectorValid(const BoundVector& v, bool validateAngleRange,
0017 double epsilon, double maxAbsEta) {
0018 constexpr auto pi = std::numbers::pi_v<double>;
0019
0020 bool loc0Valid = std::isfinite(v[eBoundLoc0]);
0021 bool loc1Valid = std::isfinite(v[eBoundLoc1]);
0022 bool phiValid = std::isfinite(v[eBoundPhi]);
0023 bool thetaValid = std::isfinite(v[eBoundTheta]);
0024 bool qOverPValid = std::isfinite(v[eBoundQOverP]);
0025 bool timeValid = std::isfinite(v[eBoundTime]);
0026
0027 if (validateAngleRange) {
0028 phiValid = phiValid && (v[eBoundPhi] + epsilon >= -pi) &&
0029 (v[eBoundPhi] - epsilon < pi);
0030 thetaValid = thetaValid && (v[eBoundTheta] + epsilon >= 0) &&
0031 (v[eBoundTheta] - epsilon <= pi);
0032 }
0033
0034 bool etaValid = true;
0035 if (std::isfinite(maxAbsEta)) {
0036 double eta = AngleHelpers::etaFromTheta(v[eBoundTheta]);
0037 etaValid = std::isfinite(eta) && (std::abs(eta) - epsilon <= maxAbsEta);
0038 }
0039
0040 return loc0Valid && loc1Valid && phiValid && thetaValid && qOverPValid &&
0041 timeValid && etaValid;
0042 }
0043
0044 bool Acts::isFreeVectorValid(const FreeVector& v, double epsilon,
0045 double maxAbsEta) {
0046 bool pos0Valid = std::isfinite(v[eFreePos0]);
0047 bool pos1Valid = std::isfinite(v[eFreePos1]);
0048 bool pos2Valid = std::isfinite(v[eFreePos2]);
0049 bool dir0Valid = std::isfinite(v[eFreeDir0]);
0050 bool dir1Valid = std::isfinite(v[eFreeDir1]);
0051 bool dir2Valid = std::isfinite(v[eFreeDir2]);
0052 bool dirValid = (std::abs(v.segment<3>(eFreeDir0).norm() - 1) - epsilon <= 0);
0053 bool qOverPValid = std::isfinite(v[eFreeQOverP]);
0054 bool timeValid = std::isfinite(v[eFreeTime]);
0055
0056 bool etaValid = true;
0057 if (std::isfinite(maxAbsEta)) {
0058 double eta = VectorHelpers::eta(v.segment<3>(eFreeDir0));
0059 etaValid = std::isfinite(eta) && (std::abs(eta) - epsilon <= maxAbsEta);
0060 }
0061
0062 return pos0Valid && pos1Valid && pos2Valid && dir0Valid && dir1Valid &&
0063 dir2Valid && dirValid && qOverPValid && timeValid && etaValid;
0064 }