36 template <
typename component_range_t,
typename projector_t>
38 const projector_t &
proj,
40 double sumOfWeights = 0.0;
42 for (
auto it = cmps.begin();
it != cmps.end(); ++
it) {
46 return std::abs(sumOfWeights - 1.0) < tol;
49 template <
typename component_range_t,
typename projector_t>
51 double sumOfWeights = 0.0;
55 for (
auto it = cmps.begin();
it != cmps.end(); ++
it) {
56 decltype(
auto)
cmp = *
it;
57 assert(std::isfinite(
proj(
cmp)) &&
"weight not finite in normalization");
61 assert(sumOfWeights > 0 &&
"sum of weights is not > 0");
63 for (
auto it = cmps.begin();
it != cmps.end(); ++
it) {
64 decltype(
auto)
cmp = *
it;
73 template <
typename propagator_state_t,
typename stepper_t,
typename navigator_t>
86 auto getVector = [&](
auto idx) {
87 return cmp.pars().template segment<3>(
idx).transpose();
91 <<
", status: " <<
cmp.status()
93 <<
", det(cov): " <<
cmp.cov().determinant());
99 [[maybe_unused]]
const bool allFinite =
100 std::all_of(cmps.begin(), cmps.end(),
101 [](
auto cmp) {
return std::isfinite(
cmp.weight()); });
103 cmps, [](
const auto &
cmp) {
return cmp.weight(); });
104 [[maybe_unused]]
const bool zeroComponents =
108 assert(not zeroComponents &&
"no cmps at the start");
109 assert(allFinite &&
"weights not finite at the start");
110 assert(allNormalized &&
"not normalized at the start");
112 assert(not zeroComponents &&
"no cmps at the end");
113 assert(allFinite &&
"weights not finite at the end");
114 assert(allNormalized &&
"not normalized at the end");
126 m_p_initial(stepper.absoluteMomentum(state.stepping)),
131 <<
state.stepping.steps <<
" at mean position "
133 <<
" with direction "
135 <<
" and momentum " <<
stepper.absoluteMomentum(
state.stepping)
146 ACTS_VERBOSE(
"Delta Momentum = " << std::setprecision(5)
154 const double *fullCalibrated,
const double *fullCalibratedCovariance,
159 unsigned int calibratedSize);
165 template <
typename traj_t>
167 const traj_t &mt,
const std::vector<MultiTrajectoryTraits::IndexType> &tips,
168 std::map<MultiTrajectoryTraits::IndexType, double> &weights) {
174 mt.getTrackState(*std::min_element(tips.begin(), tips.end(),
175 [&](
const auto &
a,
const auto &
b) {
176 return mt.getTrackState(
a).chi2() <
177 mt.getTrackState(
b).chi2();
182 for (
auto tip : tips) {
183 const auto state = mt.getTrackState(tip);
184 const double chi2 =
state.chi2() - minChi2;
189 state.template calibrated<MultiTrajectoryTraits::MeasurementSizeMax>()
192 .template calibratedCovariance<
195 state.predictedCovariance(),
state.projector(),
state.calibratedSize());
197 const auto factor = std::sqrt(1. / detR) * std::exp(-0.5 * chi2);
200 if (std::isfinite(factor)) {
201 weights.at(tip) *= factor;
211 constexpr
static std::array names = {
"predicted",
"filtered",
"smoothed"};
212 os << names[static_cast<int>(
type)];
219 template <StatesType type,
typename traj_t>
222 const std::map<MultiTrajectoryTraits::IndexType, double> &
weights;
225 const auto proxy =
mt.getTrackState(idx);
227 case StatesType::ePredicted:
229 proxy.predictedCovariance());
230 case StatesType::eFiltered:
232 proxy.filteredCovariance());
233 case StatesType::eSmoothed:
235 proxy.smoothedCovariance());