21 #include <type_traits>
28 : apply(apply_),
alpha(alpha_), beta(beta_) {}
33 Acts::FreeToBoundCorrection::operator bool()
const {
42 m_cosIncidentAngleMinCutoff(cosIncidentAngleMinCutoff),
43 m_cosIncidentAngleMaxCutoff(cosIncidentAngleMaxCutoff) {}
47 m_alpha = freeToBoundCorrection.
alpha;
48 m_beta = freeToBoundCorrection.
beta;
53 std::optional<std::tuple<Acts::BoundVector, Acts::BoundSquareMatrix>>
62 ActsScalar absCosIncidenceAng = std::abs(dir.dot(normal));
66 if (absCosIncidenceAng < m_cosIncidentAngleMinCutoff or
67 absCosIncidenceAng > m_cosIncidentAngleMaxCutoff) {
68 ACTS_VERBOSE(
"Incident angle: " << std::acos(absCosIncidenceAng)
69 <<
" is out of range for correction");
77 std::vector<std::tuple<FreeVector, ActsScalar, ActsScalar>> sampledFreeParams;
78 sampledFreeParams.reserve(sampleSize);
83 Eigen::JacobiSVD<FreeSquareMatrix> svd(
84 freeCovariance, Eigen::ComputeFullU | Eigen::ComputeFullV);
85 auto S = svd.singularValues();
91 D(
i,
i) = std::sqrt(
S(
i));
106 sampledFreeParams.push_back(
107 {freeParams, lambda / kappa,
108 lambda / kappa + (1.0 - m_alpha * m_alpha + m_beta)});
111 sampledFreeParams.push_back(
112 {freeParams + covSqrt.col(
i) * gamma, 0.5 / kappa, 0.5 / kappa});
113 sampledFreeParams.push_back(
114 {freeParams - covSqrt.col(
i) * gamma, 0.5 / kappa, 0.5 / kappa});
124 std::vector<std::pair<BoundVector, ActsScalar>> transformedBoundParams;
129 const auto& [paramsNom, mweightNom, cweightNom] = sampledFreeParams[0];
134 if (not nominalRes.ok()) {
136 "Free to bound transformation for nominal free parameters failed.");
139 auto nominalBound = nominalRes.value();
140 transformedBoundParams.push_back({nominalBound, cweightNom});
141 bpMean = bpMean + mweightNom * nominalBound;
145 for (
unsigned i = 1;
i < sampledFreeParams.size(); ++
i) {
146 const auto& [params, mweight, cweight] = sampledFreeParams[
i];
153 navDir * params.segment<3>(
eFreeDir0),
false)
159 surface, geoContext);
161 if (not result.ok()) {
163 "Free to bound transformation for sampled free parameters: \n"
164 << correctedFreeParams <<
" failed.");
168 auto bp = result.value();
169 transformedBoundParams.push_back({bp, cweight});
170 bpMean = bpMean + mweight * bp;
174 for (
unsigned isample = 0; isample < sampleSize; ++isample) {
175 BoundVector bSigma = transformedBoundParams[isample].first - bpMean;
178 transformedBoundParams[isample].second * bSigma * bSigma.transpose();