Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MultiTrajectory.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 constexpr bool ActsTrk::MutableMultiTrajectory::hasColumn_impl(
7  Acts::HashedString key) const {
8  using namespace Acts::HashedStringLiteral;
9  INSPECTCALL(key);
10 
11  switch (key) {
12  case "previous"_hash:
13  case "chi2"_hash:
14  case "pathLength"_hash:
15  case "typeFlags"_hash:
16  case "predicted"_hash:
17  case "filtered"_hash:
18  case "smoothed"_hash:
19  case "jacobian"_hash:
20  case "projector"_hash:
21  case "uncalibratedSourceLink"_hash:
22  case "calibrated"_hash:
23  case "calibratedCov"_hash:
24  case "measdim"_hash:
25  case "referenceSurface"_hash:
26  return true;
27  default:
28  for (auto& d : m_decorations) {
29  if (d.hash == key) {
30  return true;
31  }
32  }
33  return false;
34  }
35 }
36 
37 template <typename T>
38 void ActsTrk::MutableMultiTrajectory::addColumn_impl(std::string_view name) {
39  // It is actually not clear if we would allow decorating RO MTJ, maybe we do
40  if constexpr (ActsTrk::detail::accepted_decoration_types<T>::value) {
41  m_decorations.emplace_back( ActsTrk::detail::decoration<T>(
42  name,
43  ActsTrk::detail::constDecorationGetter<T>,
44  ActsTrk::detail::decorationCopier<T>,
45  ActsTrk::detail::decorationSetter<T>
46  )
47  );
48  // it would be useful to force presence of decoration already here
49  } else {
50  throw std::runtime_error("Can't add decoration of this type to MutableMultiTrajectory");
51  }
52 }
53 
54 template <typename val_t, typename cov_t>
55 void ActsTrk::MutableMultiTrajectory::allocateCalibrated_impl(IndexType istate,
56  const Eigen::DenseBase<val_t>& val,
57  const Eigen::DenseBase<cov_t>& cov)
58 
59  requires(Eigen::PlainObjectBase<val_t>::RowsAtCompileTime > 0 &&
60  Eigen::PlainObjectBase<val_t>::RowsAtCompileTime <= Acts::eBoundSize &&
61  Eigen::PlainObjectBase<val_t>::RowsAtCompileTime ==
62  Eigen::PlainObjectBase<cov_t>::RowsAtCompileTime &&
63  Eigen::PlainObjectBase<cov_t>::RowsAtCompileTime ==
64  Eigen::PlainObjectBase<cov_t>::ColsAtCompileTime)
65 {
66  constexpr std::size_t measdim = val_t::RowsAtCompileTime;
67 
68  if(m_trackStatesAux->measDim.at(istate) != kInvalid
69  && m_trackStatesAux->measDim.at(istate) != measdim) {
70  throw std::invalid_argument{
71  "Measurement dimension does not match the allocated dimension"};
72  }
73 
74  m_trackStatesAux->measDim.at(istate) = measdim;
75  auto idx = m_trackStatesAux->calibrated.at(istate);
76  m_trackMeasurementsAux->meas.at(idx).resize(measdim);
77  m_trackMeasurementsAux->covMatrix.at(idx).resize(measdim*measdim);
78 
79  double* measPtr = m_trackMeasurementsAux->meas[idx].data();
80  Eigen::Map<Acts::ActsVector<measdim>> valMap(measPtr);
81  valMap = val;
82 
83  double* covPtr = m_trackMeasurementsAux->covMatrix[idx].data();
84  Eigen::Map<Acts::ActsSquareMatrix<measdim>> covMap(covPtr);
85  covMap = cov;
86 }
87