30 #include <type_traits>
31 #include <unordered_map>
35 #include <boost/histogram.hpp>
42 namespace detail_vmt {
51 using axis_t = boost::histogram::axis::variant<
52 boost::histogram::axis::category<std::string>,
53 boost::histogram::axis::category<>>;
56 using hist_t = boost::histogram::histogram<axes_t>;
66 using cat = axis::category<std::string>;
69 axes.emplace_back(cat({
87 axes.emplace_back(axis::category<>({0, 1}));
89 auto h = make_histogram(axes);
92 auto ts = instance.getTrackState(
i);
100 using scalar =
typename decltype(ts.predicted())::
Scalar;
101 size_t par_size =
eBoundSize *
sizeof(scalar);
105 if (ts.hasPredicted() &&
107 h(
"parPred", isMeas, weight(par_size));
108 h(
"covPred", isMeas, weight(cov_size));
110 if (ts.hasFiltered() &&
112 h(
"parFilt", isMeas, weight(par_size));
113 h(
"covFilt", isMeas, weight(cov_size));
115 if (ts.hasSmoothed() &&
117 h(
"parSmth", isMeas, weight(par_size));
118 h(
"covSmth", isMeas, weight(cov_size));
120 h(
"sourceLinks", isMeas, weight(
sizeof(
SourceLink)));
121 h(
"measOffset", isMeas,
123 h(
"measCovOffset", isMeas,
125 if (ts.hasCalibrated() &&
126 ACTS_CHECK_BIT(index.allocMask, TrackStatePropMask::Calibrated)) {
127 size_t meas_size = ts.calibratedSize() *
sizeof(scalar);
128 size_t meas_cov_size =
129 ts.calibratedSize() * ts.calibratedSize() *
sizeof(scalar);
131 h(
"meas", isMeas, weight(meas_size));
132 h(
"measCov", isMeas, weight(meas_cov_size));
133 h(
"sourceLinks", isMeas, weight(
sizeof(
const SourceLink)));
137 if (ts.hasJacobian() &&
139 h(
"jac", isMeas, weight(cov_size));
181 for (
const auto& [key,
value] : other.m_dynamic) {
189 template <
typename T>
192 using namespace Acts::HashedStringLiteral;
194 case "predicted"_hash:
195 return instance.m_index[istate].ipredicted !=
kInvalid;
196 case "filtered"_hash:
197 return instance.m_index[istate].ifiltered !=
kInvalid;
198 case "smoothed"_hash:
199 return instance.m_index[istate].ismoothed !=
kInvalid;
200 case "calibrated"_hash:
201 return instance.m_measOffset[istate] !=
kInvalid;
202 case "calibratedCov"_hash:
203 return instance.m_measCovOffset[istate] !=
kInvalid;
204 case "jacobian"_hash:
205 return instance.m_index[istate].ijacobian !=
kInvalid;
206 case "projector"_hash:
207 return instance.m_index[istate].iprojector !=
kInvalid;
208 case "uncalibratedSourceLink"_hash:
209 return instance.m_sourceLinks[instance.m_index[istate].iuncalibrated]
211 case "previous"_hash:
213 case "referenceSurface"_hash:
216 case "pathLength"_hash:
217 case "typeFlags"_hash:
220 return instance.m_dynamic.find(key) != instance.m_dynamic.end();
224 template <
bool EnsureConst,
typename T>
227 if constexpr (EnsureConst) {
228 static_assert(std::is_const_v<std::remove_reference_t<T>>,
231 using namespace Acts::HashedStringLiteral;
233 case "previous"_hash:
234 return &instance.m_previous[istate];
236 return &instance.m_next[istate];
237 case "predicted"_hash:
238 return &instance.m_index[istate].ipredicted;
239 case "filtered"_hash:
240 return &instance.m_index[istate].ifiltered;
241 case "smoothed"_hash:
242 return &instance.m_index[istate].ismoothed;
243 case "projector"_hash:
244 return &instance.m_projectors[instance.m_index[istate].iprojector];
246 return &instance.m_index[istate].measdim;
248 return &instance.m_index[istate].chi2;
249 case "pathLength"_hash:
250 return &instance.m_index[istate].pathLength;
251 case "typeFlags"_hash:
252 return &instance.m_index[istate].typeFlags;
254 auto it = instance.m_dynamic.find(key);
255 if (
it == instance.m_dynamic.end()) {
256 throw std::runtime_error(
"Unable to handle this component");
259 detail::DynamicColumnBase*>
260 col =
it->second.get();
261 assert(col &&
"Dynamic column is null");
262 return col->get(istate);
266 template <
typename T>
268 using namespace Acts::HashedStringLiteral;
270 case "predicted"_hash:
271 case "filtered"_hash:
272 case "smoothed"_hash:
273 case "calibrated"_hash:
274 case "calibratedCov"_hash:
275 case "jacobian"_hash:
276 case "projector"_hash:
277 case "previous"_hash:
279 case "uncalibratedSourceLink"_hash:
280 case "referenceSurface"_hash:
283 case "pathLength"_hash:
284 case "typeFlags"_hash:
287 return instance.m_dynamic.find(key) != instance.m_dynamic.end();
295 return m_index[istate].measdim;
311 std::vector<typename detail_lt::Types<eBoundSize>::Coefficients>
m_params;
330 std::unordered_map<HashedString, std::unique_ptr<detail::DynamicColumnBase>>
353 VectorMultiTrajectory(VectorMultiTrajectory&& other)
361 TrackStateProxy::Parameters parameters_impl(
IndexType parIdx) {
362 return TrackStateProxy::Parameters{
m_params[parIdx].data()};
365 ConstTrackStateProxy::Parameters parameters_impl(
IndexType parIdx)
const {
366 return ConstTrackStateProxy::Parameters{
m_params[parIdx].data()};
387 template <
size_t measdim>
388 TrackStateProxy::Measurement<measdim> measurement_impl(
IndexType istate) {
390 return TrackStateProxy::Measurement<measdim>{&
m_meas[
offset]};
393 template <
size_t measdim>
394 ConstTrackStateProxy::Measurement<measdim> measurement_impl(
397 return ConstTrackStateProxy::Measurement<measdim>{&
m_meas[
offset]};
400 template <
size_t measdim>
401 TrackStateProxy::MeasurementCovariance<measdim> measurementCovariance_impl(
404 return TrackStateProxy::MeasurementCovariance<measdim>{&
m_measCov[
offset]};
407 template <
size_t measdim>
408 ConstTrackStateProxy::MeasurementCovariance<measdim>
409 measurementCovariance_impl(
IndexType istate)
const {
411 return ConstTrackStateProxy::MeasurementCovariance<measdim>{
419 void reserve(std::size_t
n);
438 return detail_vmt::VectorMultiTrajectoryBase::component_impl<false>(
443 return detail_vmt::VectorMultiTrajectoryBase::component_impl<true>(
447 template <
typename T>
450 {
hashString(key), std::make_unique<detail::DynamicColumn<T>>()});
459 "Invalid measurement dimension detected");
463 m_index[istate].measdim == measdim) {
467 m_index[istate].measdim = measdim;
481 std::shared_ptr<const Surface>
surface) {
490 class ConstVectorMultiTrajectory;
509 ConstVectorMultiTrajectory(
const VectorMultiTrajectory& other)
512 ConstVectorMultiTrajectory(VectorMultiTrajectory&& other)
515 ConstVectorMultiTrajectory(ConstVectorMultiTrajectory&&) =
default;
536 template <
size_t measdim>
543 template <
size_t measdim>
544 ConstTrackStateProxy::MeasurementCovariance<measdim>
560 return detail_vmt::VectorMultiTrajectoryBase::component_impl<true>(
572 ConstVectorMultiTrajectory);