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 
10  switch (key) {
11  case "previous"_hash:
12  case "chi2"_hash:
13  case "pathLength"_hash:
14  case "typeFlags"_hash:
15  case "predicted"_hash:
16  case "filtered"_hash:
17  case "smoothed"_hash:
18  case "jacobian"_hash:
19  case "projector"_hash:
20  case "uncalibratedSourceLink"_hash:
21  case "calibrated"_hash:
22  case "calibratedCov"_hash:
23  case "measdim"_hash:
24  case "referenceSurface"_hash:
25  return true;
26  default:
27  for (auto& d : m_decorations) {
28  if (d.hash == key) {
29  return true;
30  }
31  }
32  return false;
33  }
34 }
35 
36 template <typename T>
37 void ActsTrk::MutableMultiTrajectory::addColumn_impl(std::string_view name) {
38  // It is actually not clear if we would allow decorating RO MTJ, maybe we do
39  if constexpr (ActsTrk::detail::accepted_decoration_types<T>::value) {
40  m_decorations.emplace_back( ActsTrk::detail::decoration<T>(
41  name,
42  ActsTrk::detail::constDecorationGetter<T>,
43  ActsTrk::detail::decorationCopier<T>,
44  ActsTrk::detail::decorationSetter<T>
45  )
46  );
47  INSPECTCALL("added dynamic decoration " << name << " n decorations now " << m_decorations.size());
48 
49  // it would be useful to force presence of decoration already here
50  } else {
51  throw std::runtime_error("Can't add decoration of this type to MutableMultiTrajectory");
52  }
53 }
54 
55 template <typename val_t, typename cov_t>
56 void ActsTrk::MutableMultiTrajectory::allocateCalibrated_impl(IndexType istate,
57  const Eigen::DenseBase<val_t>& val,
58  const Eigen::DenseBase<cov_t>& cov)
59 
60  requires(Eigen::PlainObjectBase<val_t>::RowsAtCompileTime > 0 &&
61  Eigen::PlainObjectBase<val_t>::RowsAtCompileTime <= Acts::eBoundSize &&
62  Eigen::PlainObjectBase<val_t>::RowsAtCompileTime ==
63  Eigen::PlainObjectBase<cov_t>::RowsAtCompileTime &&
64  Eigen::PlainObjectBase<cov_t>::RowsAtCompileTime ==
65  Eigen::PlainObjectBase<cov_t>::ColsAtCompileTime)
66 {
67  constexpr std::size_t measdim = val_t::RowsAtCompileTime;
68 
69  if(m_trackStatesAux->measDim.at(istate) != kInvalid
70  && m_trackStatesAux->measDim.at(istate) != measdim) {
71  throw std::invalid_argument{
72  "Measurement dimension does not match the allocated dimension"};
73  }
74 
75  m_trackStatesAux->measDim.at(istate) = measdim;
76  auto idx = m_trackStatesAux->calibrated.at(istate);
77  m_trackMeasurementsAux->meas.at(idx).resize(measdim);
78  m_trackMeasurementsAux->covMatrix.at(idx).resize(measdim*measdim);
79 
80  double* measPtr = m_trackMeasurementsAux->meas[idx].data();
81  Eigen::Map<Acts::ActsVector<measdim>> valMap(measPtr);
82  valMap = val;
83 
84  double* covPtr = m_trackMeasurementsAux->covMatrix[idx].data();
85  Eigen::Map<Acts::ActsSquareMatrix<measdim>> covMap(covPtr);
86  covMap = cov;
87 }
88