ATLAS Offline Software
MeasurementSelector.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
4 #pragma once
5 
6 // Alternative measurement selector
7 //
8 // This measurement selector is assuming the following
9 // - the number of selected measurements is small (~<10)
10 // - the number of measurement candidates is typically >> the
11 // number of selected measuremebts
12 // - the total number of candidate measurements can be large
13 // - there is a simple one-to-one relation between bound state
14 // parameters and measurement coordinates.
15 
16 #include "Acts/Utilities/Result.hpp"
17 #include "Acts/Utilities/Delegate.hpp"
18 #include "Acts/EventData/SourceLink.hpp"
19 #include "Acts/TrackFinding/CombinatorialKalmanFilterError.hpp"
20 #include "Acts/Definitions/Algebra.hpp"
21 #include "Acts/Surfaces/Surface.hpp"
22 #include "Acts/Geometry/GeometryHierarchyMap.hpp"
23 #include "Acts/EventData/Types.hpp"
24 #include "Acts/EventData/TrackStatePropMask.hpp"
25 #include "boost/container/small_vector.hpp"
26 
27 // for BaseTypes
28 #include "Acts/EventData/TrackStateProxy.hpp"
29 #include "Acts/Utilities/CalibrationContext.hpp"
30 #include "Acts/EventData/TrackParameters.hpp"
31 
32 // for MeasurementSizeMax
33 #include "Acts/EventData/MultiTrajectory.hpp"
34 
35 #include <utility>
36 #include <type_traits>
37 
38 // Types to be used during measurement selection for the prediction and the
39 // measurement for calibrated measurements after selection if the actual calibration is
40 // executed after the calibration, and the trajectory, track state, bound parameter
41 // types.
42 template <typename derived_t>
44 {
45  // the measurement type after the selection e.g. a Matrix<N,1>
46  template <std::size_t N>
47  using CalibratedMeasurement = typename Acts::detail_lt::FixedSizeTypes<N>::Coefficients;
48 
49  // the measurement covariance type after the selection e.g. a Matrix<N,N>
50  template <std::size_t N>
52 
53  // the measurement type before the selection e.g. an Eigen::Map< Matrix<N,1> > if
54  // the calibration is performed after the selection
55  template <std::size_t N>
56  using PreSelectionMeasurement = typename Acts::detail_lt::FixedSizeTypes<N>::Coefficients;
57 
58  // the measurement covariance type before the selection e.g. an Eigen::Map<Matrix<N,N> > if
59  // the calibration is performed after the selection
60  template <std::size_t N>
62 
63  // e.g. the same as CalibratedMeasurement
64  template <std::size_t N>
65  using Predicted = typename Acts::detail_lt::FixedSizeTypes<N>::Coefficients;
66 
67  // e.g. the same as CalibratedMeasurementCovariance
68  template <std::size_t N>
70 
71  // e.g. helper template to get the value_type from the container type
72  template <typename T_Container>
74  using value_type = typename T_Container::value_type;
75  };
76 
77  // the trajectory type to which states for selected measurements are to be added
78  using trajectory_t = typename derived_t::traj_t;
79  // the track state type for new track states
80  using TrackStateProxy = trajectory_t::TrackStateProxy;
81 
82  // the value type usd for matrices
84  using BoundTrackParameters = Acts::BoundTrackParameters;
85  using BoundMatrix = Acts::BoundMatrix;
86 
87  using BoundState = std::tuple<BoundTrackParameters, BoundMatrix, double>;
88 
89  // maximum dimension of measurements
90  static const std::size_t s_dimMax = 3;
91 
92  // must be the same as what is used for the CKF
93  // @TODO how to get rid of this ?
94  static constexpr std::size_t s_maxBranchesPerSurface = 10;
95 };
96 
97 //
101  template <class T_Matrix>
102  static constexpr std::size_t matrixColumns() { return T_Matrix::ColsAtCompileTime;}
103  template <class T_Matrix>
104  static constexpr std::size_t matrixRows() { return T_Matrix::RowsAtCompileTime;}
105 
106  template <typename T_Float, class T_Matrix>
107  static auto matrixTypeCast(const T_Matrix &matrix) { return matrix.template cast<T_Float>(); }
108 
109  template <class T_Matrix>
110  static auto transpose(const T_Matrix &matrix) { return matrix.transpose(); }
111 
112  template <class T_Matrix>
113  static auto invert(const T_Matrix &matrix) { return matrix.inverse(); }
114 };
115 
116 
117 // Map from the measurement to bound state domain
118 // it is assumed that there is a simple unambiguous association
119 // between coordinates of the measurement domain and the bound state domain
120 // e.g. measurement coordinate 1 maps to loc0 of the bound state.
121 // @TODO use FixedSizeSubspace ? currently does not provide methods to directly
122 // create the a sub-space covariance matrix from a full covariance matrix,
123 // and to create the projector bitset, which is stored in the TrackState.
125 
126  template <std::size_t N>
127  using type = std::array<unsigned char, N>;
128 
129  template <std::size_t N>
130  static constexpr type<N> identity() {
131  type<N> ret;
132  for(int i=0; i<N; ++i) {
133  ret[i]=i;
134  }
135  return ret;
136  }
137 };
138 
139 // utility to "project" a bound state parameter vector or covariance matrix onto the 1,2, ... N dimensional measurement domain
140 // @TODO allow to influence resulting matrix type ?
141 template <std::size_t N,class T_ResultType,class T_Matrix>
142 T_ResultType project(ParameterMapping::type<N> parameter_map, const T_Matrix &matrix)
143 {
144  using MatrixIndexMapType = unsigned char; // "char" to reduce the size of the map, and if not wide enough this entire
145  // concept is likely inefficient.
146  using MatrixIndexType = unsigned int; // @TODO or std::size_t ? does not matter
147 
148  // ensure that index types are wide enough
149  static_assert( MeasurementSelectorMatrixTraits::matrixRows<T_Matrix>() < std::numeric_limits<MatrixIndexMapType>::max());
150  static_assert( N*MeasurementSelectorMatrixTraits::matrixRows<T_Matrix>() < std::numeric_limits<MatrixIndexType>::max());
151 
152  T_ResultType ret;
153  if constexpr(MeasurementSelectorMatrixTraits::matrixColumns<T_Matrix>() == 1) {
154  // handle projection of paramteter vector
155  for (MatrixIndexType meas_i=0; meas_i<N; ++meas_i) {
156  assert( meas_i < parameter_map.size() );
157  ret(meas_i,0) = matrix( parameter_map[meas_i], 0);
158  }
159  }
160  else {
161  // handle projection of covariance matrix
162  // "project" matrix
163  for (MatrixIndexType meas_i=0; meas_i<N; ++meas_i) {
164  assert( meas_i < parameter_map.size());
165  MatrixIndexType param_i = parameter_map[meas_i];
166  for (MatrixIndexType meas_j=0; meas_j<N; ++meas_j) {
167  assert( meas_j < parameter_map.size());
168  ret(meas_i,meas_j) = matrix(param_i, parameter_map[meas_j]);
169  }
170  }
171  }
172  return ret;
173 }
174 
175 
176 
177 
178 // helper method to compute a chi2 for the difference of two "measurement" and covariance pairs
179 template <typename measurement_vector_t, typename measurement_cov_matrix_t,
180  typename predicted_vector_t, typename predicted_cov_matrix_t>
181 double computeChi2(const measurement_vector_t &a,
182  const measurement_cov_matrix_t &a_cov,
183  const predicted_vector_t &b,
184  const predicted_cov_matrix_t &b_cov) {
185 
186  // just sum sanity checks that a and b have the correct dimensions and that
187  // the chi2 can actually be computed.
188  static_assert( MeasurementSelectorMatrixTraits::matrixColumns<measurement_vector_t>() == 1); // a is vector
189  static_assert( MeasurementSelectorMatrixTraits::matrixColumns<predicted_vector_t>() == 1); // b is vector
190  static_assert( MeasurementSelectorMatrixTraits::matrixRows<measurement_cov_matrix_t>()
191  == MeasurementSelectorMatrixTraits::matrixColumns<measurement_cov_matrix_t>() ); // a is square matrix
192  static_assert( MeasurementSelectorMatrixTraits::matrixRows<predicted_cov_matrix_t>()
193  == MeasurementSelectorMatrixTraits::matrixColumns<predicted_cov_matrix_t>() ); // b is square matrix
194  static_assert( MeasurementSelectorMatrixTraits::matrixRows<measurement_cov_matrix_t>()
195  == MeasurementSelectorMatrixTraits::matrixRows<measurement_vector_t>() ); // a vector matches matrix
196  static_assert( MeasurementSelectorMatrixTraits::matrixRows<predicted_cov_matrix_t>()
197  == MeasurementSelectorMatrixTraits::matrixRows<predicted_vector_t>() ); // b vector matches matrix
198  static_assert( MeasurementSelectorMatrixTraits::matrixRows<measurement_cov_matrix_t>()
199  == MeasurementSelectorMatrixTraits::matrixRows<predicted_cov_matrix_t>() ); // a and b match
200 
201  // @TODO remove abstraction i.e. assume matrix has the interface of an eigen matrix
202  auto inv_ab_cov( MeasurementSelectorMatrixTraits::invert(a_cov+b_cov) );
203  auto diff( a-b);
204  return (MeasurementSelectorMatrixTraits::transpose(diff) * inv_ab_cov * diff)(0,0);
205 }
206 
207 // Collection to hold the n-"best" candidates
208 // The objects of type PayloadType must support assignment operation, and must
209 // be default constructible. Moreover it must be possible to provide a
210 // "comparison" operator to order the payload objects.
211 template <std::size_t N, class PayloadType >
213  using IndexType = unsigned short; // @TODO or char ? If N>>10 this concept is likely
214  // inefficient
215  // using PayloadType = Payload<DIM>;
216  TopCollection(std::size_t max_n) {
217  init(max_n);
218  }
219 
220  // @param max_n the maximum number of top-candidates is fixed by the template parameter
221  // N but can be reduced further to this number
222  void init(std::size_t max_n) {
223  assert( max_n < N);
224  m_nextSlot=0;
225  m_maxSlots=max_n;
226  m_order[0]=0;
227  }
228  // @param get a slot to hold a new candidate which is not necessarily accepted in the list
229  // of the n-top candidates
230  PayloadType &slot() {
231  return m_slots[m_order[m_nextSlot] ];
232  }
233  // @param idx get the specified filled slot (read only) indicated by the index, where the index does not
234  // indicate the order in the top-candidate list
235  const PayloadType &getSlot(IndexType idx) const {
236  return m_slots[idx];
237  }
238  // @param idx get the specified filled slot indicated by the index, where the index does not
239  // indicate the order in the top-candidate list
240  PayloadType &getSlot(IndexType idx) {
241  return m_slots[idx];
242  }
243  // @param test whether the given index points to one of the accepted top candidates
244  bool isValid(IndexType idx) const {
245  return idx < m_nextSlot;
246  }
247  // Accept the element of the latest slot provided there is still a free slot or it is better than
248  // the worst element.
249  // @param comparison operator to compute e.g. a<b where "smaller" means "better"
250  void acceptAndSort(std::function<bool(const PayloadType &a, const PayloadType &b)> comparison) {
251  // bubble best element to top
252  for (unsigned int slot_i = m_nextSlot;
253  slot_i-- > 0
254  && !comparison(m_slots[ m_order[slot_i] ],m_slots[ m_order[slot_i+1] ]);) {
255  std::swap(m_order[slot_i],m_order[slot_i+1]);
256  }
257  // if there are still free slot increase the number of used slots
258  if (m_nextSlot < m_maxSlots) {
259  ++m_nextSlot;
261  }
262  }
263 
264  bool empty() const {
265  return m_nextSlot==0;
266  }
267 
268  IndexType size() const { return m_nextSlot; }
269 
270  // helper to iterate over the slot indices in sorting order from best to worst
271  typename std::array<IndexType, N+1>::const_iterator begin() { return m_order.begin(); }
272  typename std::array<IndexType, N+1>::const_iterator end() { return m_order.begin()+m_nextSlot; }
273 
274  std::array<PayloadType, N+1> m_slots; // storage for the slots
275  std::array<IndexType, N+1> m_order; // order of the filled slots
276  IndexType m_nextSlot = 0; // the index of the next free slot
277  IndexType m_maxSlots = 0; // maximum number of top-slots
278 };
279 
280 
281 
284  std::vector<float> etaBins{};
286  std::vector<std::pair<float, float> > chi2CutOff{ {15,25} };
288  std::vector<std::size_t> numMeasurementsCutOff{1};
289 };
290 
291 // Measurement type specific measirement selector
292 // Assumptions:
293 // - begin and end source_link_iterator point to a contiguous range of measurements in a single container
294 // - all measurements in this range have the same dimensionality.
295 // - the mapping of the bound parameters to the measurement domain for each measurement in this range
296 // is identical
297 template <std::size_t NMeasMax,
298  std::size_t DIMMAX,
299  typename derived_t >
301 
302  using Config = Acts::GeometryHierarchyMap<AtlasMeasurementSelectorCuts>;
304 
306 
307 protected:
312 
313  const derived_t &derived() const { return *static_cast<const derived_t *>(this); }
314 
315  // helper to create a projector bitset from a map from bound parameters to coordinates
317  template <std::size_t N>
318  static
319  Acts::ProjectorBitset create(const ParameterMapping::type<N> &parameter_map) {
320  constexpr std::size_t nrows = Acts::MultiTrajectoryTraits::MeasurementSizeMax;
321  constexpr std::size_t ncols = Acts::eBoundSize;
322 
323  std::bitset<nrows * ncols> proj_bitset {};
324 
325  for (unsigned int col_i=0; col_i<N; ++col_i) {
326  unsigned int row_i = parameter_map[col_i];
327  unsigned int idx = col_i *nrows + row_i; // @TODO handle row major and column major correctly
328  proj_bitset[ (nrows * ncols - 1) - idx ] = 1;
329  }
330  return proj_bitset.to_ullong();
331  }
332  };
333 
334  // helper to create states without the calibrated measurement, covariance, and sourcelink
335  // if more than one state is created the states after the first will share
336  // the jacobi and the prediction, if outlier_states is true no storage is created
337  // for filtered.
338  // @TODO should there be the possibility to have multiple states which mix outlier and non-outlier states ?
339  static void createStates(std::size_t n_new_states,
340  const T_BoundState& boundState,
341  std::size_t prevTip,
342  trajectory_t& trajectory,
343  const Acts::BoundSubspaceIndices& subspaceIndices,
344  boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> &track_states,
345  const Acts::Logger& logger,
346  bool outlier_states) {
347  // create track states for all compatible measurement candidates
348  const auto &boundParams = derived_t::boundParams(boundState);
349  const auto &pathLength = derived_t::pathLength(boundState);
350 
351  using PM = Acts::TrackStatePropMask;
352 
353  track_states.reserve( n_new_states );
354  std::optional<TrackStateProxy> firstTrackState{
355  std::nullopt};
356  for (unsigned int state_i=0; state_i<n_new_states; ++state_i) {
357  PM mask = PM::Predicted | PM::Filtered | PM::Jacobian | PM::Calibrated;
358 
359  if (firstTrackState.has_value()) {
360  // subsequent track states don't need storage for these as they will
361  // be shared
362  mask &= ~PM::Predicted & ~PM::Jacobian;
363  }
364 
365  if (outlier_states) {
366  // outlier won't have separate filtered parameters
367  mask &= ~PM::Filtered;
368  }
369 
370  TrackStateProxy trackState = trajectory.makeTrackState(mask, prevTip);
371  ACTS_VERBOSE("Create SourceLink output track state #"
372  << trackState.index() << " with mask: " << mask);
373 
374  if (firstTrackState.has_value()) {
375  trackState.shareFrom(*firstTrackState, PM::Predicted);
376  trackState.shareFrom(*firstTrackState, PM::Jacobian);
377  }
378  else {
379  // only set these for first
380  trackState.predicted() = boundParams.parameters();
381  if (boundParams.covariance()) {
382  trackState.predictedCovariance() = *boundParams.covariance();
383  }
384  trackState.jacobian() = derived_t::boundJacobiMatrix(boundState);
385  firstTrackState = trackState;
386  }
387  trackState.pathLength() = pathLength;
388 
389  trackState.setReferenceSurface(boundParams.referenceSurface().getSharedPtr());
390 
391  trackState.setProjectorSubspaceIndices(subspaceIndices);
392 
393  Acts::TrackStateType typeFlags = trackState.typeFlags();
394  if (trackState.referenceSurface().surfaceMaterial() != nullptr) {
395  typeFlags.set(Acts::TrackStateFlag::MaterialFlag);
396  }
397  typeFlags.set(Acts::TrackStateFlag::ParameterFlag);
398 
399  // @TODO these track states still need some additional processing. Should there be a special
400  // flag for this ?
401  track_states.push_back( trackState.index());
402  }
403  }
404 
405 
406  // utility struct to temporarily store data about the best measurements
407  template <std::size_t DIM, typename T_SourceLink>
410  typename MeasurementSelectorTraits<derived_t>::template PreSelectionMeasurementCovariance<DIM> >;
412  std::optional<T_SourceLink> m_sourceLink;
413  float m_chi2;
415  };
416 
417  // simple adapter to support a range-based for loop
418  // the adapter creates iterators to directly iterate over the measurement range
419  // where the measurement range is extracted from the specific source link iterators
420  // which provide the start and end index of the measurements which define the contiguous
421  // measuremnt range.
422  // @TODO pass such an object instead of sourceLinkBegin, sourceLinkEnd
423  // in selectMeasurementsCreateTrackStates ?
424  template <typename T>
426  private:
427  const T *m_container{};
428  using const_iterator = typename T::const_iterator;
431  public:
432  template <typename Iterator>
433  MeasurementRange( const T &container, const Iterator &begin_iter, const Iterator &end_iter)
434  : m_begin( container.begin() + begin_iter.m_iterator.index()),
435  m_end( container.begin() + end_iter.m_iterator.index())
436  {
437  }
438  const_iterator begin() const { return m_begin; }
439  const_iterator end() const { return m_end; }
440  };
441 
442  // type and dimension specific function to select measurements from the range defined by the source link iterators.
443  // will iterate over the contiguous measurement range defined by the source link iterators where the measurements
444  // are contained in the given container. The selection lopp will get the measurement and covariance with the
445  // help of a preCalibrator. select measurements based on smallest chi2 wrt. the prediction, then optionally
446  // apply a full calibrator after the selection and finally create track states.
447  template <std::size_t DIM, typename source_link_iterator_t, typename T_Container>
448  Acts::Result<boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> >
449  selectMeasurementsCreateTrackStates(const Acts::GeometryContext& geometryContext,
450  const Acts::CalibrationContext& calibrationContext,
451  const Acts::Surface& surface,
452  const T_BoundState& boundState,
453  const source_link_iterator_t& sourceLinkBegin,
454  const source_link_iterator_t& sourceLinkEnd,
455  std::size_t prevTip,
456  trajectory_t& trajectory,
457  const Acts::Logger& logger,
458  const std::size_t numMeasurementsCut,
459  const std::pair<float,float>& maxChi2Cut,
460  const T_Container &container) const {
461  Acts::Result<boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> >
462  result = boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface>{};
463  using container_value_t = typename MeasurementSelectorTraits<derived_t>::template MeasurementContainerTraits<T_Container>::value_type;
464  using BaseElementType = std::remove_cv_t<std::remove_pointer_t< container_value_t > >;
465  // get calibrator
466  using TheMatchingMeasurement = MatchingMeasurement<DIM, container_value_t >;
467  using MeasCovPair = TheMatchingMeasurement::MeasCovPair;
468 
469  using Predicted = typename MeasurementSelectorTraits<derived_t>::template Predicted<DIM>;
470  using PredictedCovariance = typename MeasurementSelectorTraits<derived_t>::template PredictedCovariance<DIM>;
471 
472 
473 
474  // get prediction in the measurement domain
475  Acts::SubspaceIndices<DIM> parameter_map = derived().template parameterMap<DIM>(geometryContext,
476  calibrationContext,
477  surface);
478  auto predicted
479  = std::make_pair( project<DIM, Predicted>(parameter_map,
480  derived().boundParams(boundState).parameters()),
481  project<DIM, PredictedCovariance>(parameter_map,
482  derived().boundParams(boundState).covariance().value()));
483 
484  // select n measurents with the smallest chi2.
485  auto preCalibrator = derived().template preCalibrator<DIM, BaseElementType>();
486  TopCollection<NMeasMax, TheMatchingMeasurement > selected_measurements(numMeasurementsCut);
487  {
488  for ( const auto &measurement : MeasurementRange<T_Container>(container, sourceLinkBegin, sourceLinkEnd) ) {
489  TheMatchingMeasurement &matching_measurement=selected_measurements.slot();
490  matching_measurement.m_measurement = preCalibrator(geometryContext,
491  calibrationContext,
492  derived().template forwardToCalibrator(measurement),
493  derived().boundParams(boundState));
494  matching_measurement.m_chi2 = computeChi2(matching_measurement.m_measurement.first,
495  matching_measurement.m_measurement.second,
496  predicted.first,
497  predicted.second);
498  // only consider measurements which pass the outlier chi2 cut
499  if (matching_measurement.m_chi2<maxChi2Cut.second) {
500  matching_measurement.m_sourceLink=measurement;
501  selected_measurements.acceptAndSort([](const TheMatchingMeasurement &a,
502  const TheMatchingMeasurement &b) {
503  return a.m_chi2 < b.m_chi2;
504  });
505  }
506  }
507  }
508 
509  // apply final calibration to n-best measurements
510  auto postCalibrator = derived().template postCalibrator<DIM, BaseElementType>();
511  using post_calib_meas_cov_pair_t
513  typename MeasurementSelectorTraits<derived_t>::template CalibratedMeasurementCovariance<DIM> >;
514 
515  // need extra temporary buffer if the types to store "measurements" during measurement selection
516  // and calibrated measurements after the measurement selection are not identical
517  static constexpr bool pre_and_post_calib_types_agree
519  typename MeasurementSelectorTraits<derived_t>::template PreSelectionMeasurement<DIM> >::value
520  && std::is_same< typename MeasurementSelectorTraits<derived_t>::template CalibratedMeasurementCovariance<DIM>,
521  typename MeasurementSelectorTraits<derived_t>::template PreSelectionMeasurementCovariance<DIM> >::value;
522 
523  using Empty = struct {};
524  typename std::conditional< !pre_and_post_calib_types_agree,
525  std::array< post_calib_meas_cov_pair_t, NMeasMax>, // @TODO could use boost static_vector instead
526  Empty>::type calibrated;
527  if (postCalibrator) {
529 
530  // apply final calibration, recompute chi2
532  idx: selected_measurements) {
533  TheMatchingMeasurement &a_selected_measurement = selected_measurements.getSlot(idx);
534 
535  // helper to select the destination storage which is the extra temporary buffer
536  // if the measurement storage types during and after selection are different.
537  post_calib_meas_cov_pair_t &calibrated_measurement
538  = [&calibrated, &a_selected_measurement, calibrated_meas_cov_i]() -> post_calib_meas_cov_pair_t & {
539  if constexpr(pre_and_post_calib_types_agree) {
540  (void) calibrated;
541  (void) calibrated_meas_cov_i;
542  return a_selected_measurement.m_measurement;
543  }
544  else {
545  (void) a_selected_measurement;
546  assert(calibrated_meas_cov_i < calibrated.size());
547  return calibrated[calibrated_meas_cov_i];
548  }
549  }();
550 
551  // apply the calibration
552  calibrated_measurement = postCalibrator(geometryContext,
553  calibrationContext,
554  derived().template forwardToCalibrator(a_selected_measurement.m_sourceLink.value()),
555  derived().boundParams(boundState));
556  // update chi2 using calibrated measurement
557  a_selected_measurement.m_chi2 = computeChi2(calibrated_measurement.first,
558  calibrated_measurement.second,
559  predicted.first,
560  predicted.second);
561  // ... and set outlier flag
562  a_selected_measurement.m_isOutLier = (a_selected_measurement.m_chi2 >= maxChi2Cut.first);
563  if constexpr(!pre_and_post_calib_types_agree) {
564  ++calibrated_meas_cov_i;
565  }
566  }
567  }
568  else {
569  // if no final calibration is performed only the outlier flag still needs to be set
571  idx: selected_measurements) {
572  TheMatchingMeasurement &a_selected_measurement = selected_measurements.getSlot(idx);
573  a_selected_measurement.m_isOutLier = (a_selected_measurement.m_chi2 >= maxChi2Cut.first);
574  }
575  }
576 
577  // First Create states without setting information about the calibrated measurement for the selected measurements
578  // @TODO first create state then copy measurements, or crete state by state and set measurements ?
579  // the lastter has the "advantage" that the outlier flag can be set individually
580  // the former has the advantage that part of the state creation code is independent of the
581  // the measurement.
582 
583  Acts::BoundSubspaceIndices boundSubspaceIndices;
584  std::copy(parameter_map.begin(), parameter_map.end(), boundSubspaceIndices.begin());
585  createStates( selected_measurements.size(),
586  boundState,
587  prevTip,
588  trajectory,
589  boundSubspaceIndices,
590  *result,
591  logger,
592  (!selected_measurements.empty()
593  ? selected_measurements.getSlot( *(selected_measurements.begin())).m_isOutLier
594  : false) );
595  assert( result->size() == selected_measurements.size() );
596 
597  // helper to determine whether calibrated storeage is to be used
598  auto use_calibrated_storage = [&postCalibrator]() -> bool {
599  if constexpr(pre_and_post_calib_types_agree) {
600  (void) postCalibrator;
601  return false;
602  }
603  else {
604  // this is only known during runtime
605  // but it should not be tested if the types agree.
606  return postCalibrator;
607  }
608  };
609 
610  // copy selected measurements to pre-created states
611  unsigned int state_i=0;
613  idx: selected_measurements) {
614  assert( state_i < result->size());
615  TrackStateProxy trackState( trajectory.getTrackState( (*result)[state_i] ) );
616  TheMatchingMeasurement &a_selected_measurement = selected_measurements.getSlot(idx);
617  trackState.setUncalibratedSourceLink(derived().makeSourceLink(std::move(a_selected_measurement.m_sourceLink.value())));
618  // flag outliers accordingly, so that they are handled correctly by the post processing
619  trackState.typeFlags().set( a_selected_measurement.m_isOutLier
620  ? Acts::TrackStateFlag::OutlierFlag
621  : Acts::TrackStateFlag::MeasurementFlag );
622  trackState.allocateCalibrated(DIM);
623  if (use_calibrated_storage()) {
624  // if the final clibration is performed after the selection then
625  // copy these measurements and covariances to the track states
626  assert( use_calibrated_storage() == !pre_and_post_calib_types_agree);
627  if constexpr(!pre_and_post_calib_types_agree) {
628  assert( state_i < calibrated.size());
629  trackState.template calibrated<DIM>()
630  = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(calibrated[state_i].first);
631  trackState.template calibratedCovariance<DIM>()
632  = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(calibrated[state_i].second);
633  trackState.chi2() = a_selected_measurement.m_chi2;
634  }
635  }
636  else {
637  trackState.template calibrated<DIM>()
638  = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(a_selected_measurement.m_measurement.first);
639  trackState.template calibratedCovariance<DIM>()
640  = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(a_selected_measurement.m_measurement.second);
641  trackState.chi2() = a_selected_measurement.m_chi2;
642  }
643  ++state_i;
644  }
645  return result;
646  }
647 
648  template <typename parameters_t>
649  static std::size_t getEtaBin(const parameters_t& boundParameters,
650  const std::vector<float> &etaBins) {
651  if (etaBins.empty()) {
652  return 0u; // shortcut if no etaBins
653  }
654  const float eta = std::abs(std::atanh(std::cos(boundParameters.parameters()[Acts::eBoundTheta])));
655  std::size_t bin = 0;
656  for (auto etaBin : etaBins) {
657  if (etaBin >= eta) {
658  break;
659  }
660  bin++;
661  }
662  return bin;
663  }
664 
665 public:
666  // get numMeasurement and maxChi2 cuts for the given surface
667  // @TODO should the cuts just depend on the surface or really on the bound parameters (i.e. bound eta)
668  std::tuple< std::size_t, std::pair<float,float> > getCuts(const Acts::Surface& surface,
669  const T_BoundState& boundState,
670  const Acts::Logger& logger) const {
671  std::tuple< std::size_t, std::pair<float,float> > result;
672  std::size_t &numMeasurementsCut = std::get<0>(result);
673  std::pair<float,float> &maxChi2Cut = std::get<1>(result);
674  // Get geoID of this surface
675  auto geoID = surface.geometryId();
676  // Find the appropriate cuts
677  auto cuts = m_config.find(geoID);
678  if (cuts == m_config.end()) {
679  // indicats failure
680  numMeasurementsCut = 0;
681  }
682  else {
683  // num measurement Cut
684  // getchi2 cut
685  std::size_t eta_bin = getEtaBin(derived().boundParams(boundState), cuts->etaBins);
686  numMeasurementsCut = (!cuts->numMeasurementsCutOff.empty()
687  ? cuts->numMeasurementsCutOff[ std::min(cuts->numMeasurementsCutOff.size()-1, eta_bin) ]
688  : NMeasMax);
689  maxChi2Cut = ! cuts->chi2CutOff.empty()
690  ? cuts->chi2CutOff[ std::min(cuts->chi2CutOff.size()-1, eta_bin) ]
691  : std::make_pair<float,float>(std::numeric_limits<float>::max(),
693  ACTS_VERBOSE("Get cut for eta-bin="
694  << (eta_bin < cuts->etaBins.size() ? cuts->etaBins[eta_bin] : std::numeric_limits<float>::max())
695  << ": chi2 (max,max-outlier) " << maxChi2Cut.first << ", " << maxChi2Cut.second
696  << " max.meas." << numMeasurementsCut);
697  }
698  return result;
699  }
700 };
701 
702 // Measurement selector which calls a type specific selection method
703 // the measurement selector expects a list of measurement containers to be provided
704 // by the source link iterators as well as the index of the container to be used for the
705 // given measurement range, which is defined by the source link iterators.
706 // the measurement range must refer to a contiguous range of measurements contained
707 // within a single measurement container.
708 // The "container" itself is a variant of particular measurement containers with associated
709 // dimension i.e. number of coordinates per measurement. A member funcion specific to one of
710 // the alternatives of the variant will be called to perform the selection and track state
711 // creation.
712 template <std::size_t NMeasMax,
713  typename derived_t,
714  typename measurement_container_variant_t >
715 struct MeasurementSelectorWithDispatch : public MeasurementSelectorBase< NMeasMax, MeasurementSelectorTraits<derived_t>::s_dimMax, derived_t> {
716 
722 
723  // helper to get the maximum number of measurement diemsions.
724  static constexpr std::size_t dimMax() {
726  }
727 
728  template <typename source_link_iterator_t>
729  Acts::Result<boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> >
730  createSourceLinkTrackStates(const Acts::GeometryContext& geometryContext,
731  const Acts::CalibrationContext& calibrationContext,
732  const Acts::Surface& surface,
733  const T_BoundState& boundState,
734  source_link_iterator_t sourceLinkBegin,
735  source_link_iterator_t sourceLinkEnd,
736  typename TrackStateProxy::IndexType prevTip,
737  [[maybe_unused]] trajectory_t& trajectory_buffer,
738  [[maybe_unused]] std::vector<TrackStateProxy> &trackStateCandidates,
739  trajectory_t& trajectory,
740  const Acts::Logger& logger) const {
741  Acts::Result<boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> >
742  result = Acts::CombinatorialKalmanFilterError::MeasurementSelectionFailed;
743  if (sourceLinkBegin != sourceLinkEnd) {
744  auto [numMeasurementsCut, maxChi2Cut] = this->getCuts(surface,boundState, logger);
745  // numMeasurementsCut is == 0 in case getCuts failed
746  // anyway cannot select anything if numMeasurementsCut==0;
747  if (numMeasurementsCut>0) {
748  const std::vector<measurement_container_variant_t> &
749  measurementContainer = sourceLinkBegin.m_iterator.measurementContainerList();
750 
751  assert( sourceLinkBegin.m_iterator.containerIndex() == sourceLinkEnd.m_iterator.containerIndex() );
752  const measurement_container_variant_t &a_measurement_container_variant = measurementContainer.at(sourceLinkBegin.m_iterator.containerIndex());
753  result = std::visit( [this,
754  &geometryContext,
755  &calibrationContext,
756  &surface,
757  &boundState,
758  &sourceLinkBegin,
759  &sourceLinkEnd,
760  prevTip,
761  &trajectory,
762  &logger,
763  numMeasurementsCut,
764  &maxChi2Cut] (const auto &measurement_container_with_dimension) {
765  using ArgType = std::remove_cv_t<std::remove_reference_t< decltype(measurement_container_with_dimension) > >;
766  constexpr std::size_t DIM = ArgType::dimension();
767  return this->template selectMeasurementsCreateTrackStates<DIM>(geometryContext,
768  calibrationContext,
769  surface,
770  boundState,
771  sourceLinkBegin,
772  sourceLinkEnd,
773  prevTip,
774  trajectory,
775  logger,
776  numMeasurementsCut,
777  maxChi2Cut,
778  measurement_container_with_dimension.container());
779  },
780  a_measurement_container_variant);
781  }
782  }
783  return result;
784  }
785 };
786 
787 template <std::size_t NMeasMax,
788  typename derived_t,
789  typename measurement_container_variant_t>
790 struct MeasurementSelectorBaseImpl : public MeasurementSelectorWithDispatch<NMeasMax, derived_t, measurement_container_variant_t> {
792 
793  // get the bound parameters and covariance of the bound state
795  return std::get<0>(boundState);
796  }
797 
798  // get the jacobi matrix of the bound state
800  return std::get<1>(boundState);
801  }
802  // get the accumulated path length of the bound state
803  static double pathLength(const T_BoundState &boundState) {
804  return std::get<2>(boundState);
805  }
806 
807  // create a source link from the measurement
808  template <typename T_Value>
809  static Acts::SourceLink makeSourceLink(T_Value &&value) {
810  return Acts::SourceLink{value};
811  }
812 
813  // perform simple transformation to cerate the type
814  // that is passed to the calibrator.
815  // by default pass the measurement by reference not pointer
816  template <typename T>
817  static const auto &forwardToCalibrator(const T &a) {
818  if constexpr( std::is_same<T, std::remove_pointer_t<T> >::value ) {
819  return a;
820  }
821  else {
822  return *a;
823  }
824  }
825 
826  // get mapping between bound state parameters and coordinates in the measurement domain
827  // in most cases this is just the identity operation e.g. loc0 -> coord0 and loc1 -> coord1
828  // i.e. map[0]=0; map[1]=1;
829  // @TODO should this be measurement type specific, or is dimension and the surface good enough ?
830  template <std::size_t DIM>
832  parameterMap(const Acts::GeometryContext&,
833  const Acts::CalibrationContext&,
834  const Acts::Surface&) {
835  return ParameterMapping::identity<DIM>();
836  }
837 
838  // By default the methods postCalibrator and preCalibrator return delegates:
839  template <std::size_t DIM, typename measurement_t>
840  using PreCalibrator = Acts::Delegate<
842  typename MeasurementSelectorTraits<derived_t>::template PreSelectionMeasurementCovariance<DIM> >
843  (const Acts::GeometryContext&,
844  const Acts::CalibrationContext&,
845  const measurement_t &,
847 
848  // Since the measurement types used during measurement selection and after measurement selection
849  // might be different so are the types of the calibrator delegates
850  template <std::size_t DIM, typename measurement_t>
851  using PostCalibrator = Acts::Delegate<
853  typename MeasurementSelectorTraits<derived_t>::template CalibratedMeasurementCovariance<DIM> >
854  (const Acts::GeometryContext&,
855  const Acts::CalibrationContext&,
856  const measurement_t &,
858 
862  template <std::size_t DIM, typename measurement_t>
864  postCalibrator() const; // not implemented
865 
866  // the "calibrator" which is used during the measuremnt selection
868  // this delegate must be connected or be a valid functor. If not this likely will lead to an
869  // exception or seg fault.
870  template <std::size_t DIM, typename measurement_t>
872  preCalibrator() const; // not implemented
873 
874 };
MeasurementSelectorBase::ProjectorBitSetMaker
Definition: MeasurementSelector.h:316
TopCollection::m_slots
std::array< PayloadType, N+1 > m_slots
Definition: MeasurementSelector.h:274
MeasurementSelectorBase::MeasurementRange::MeasurementRange
MeasurementRange(const T &container, const Iterator &begin_iter, const Iterator &end_iter)
Definition: MeasurementSelector.h:433
MeasurementSelectorBase< NMeasMax, MeasurementSelectorTraits< derived_t >::s_dimMax, derived_t >::TrackStateProxy
typename MeasurementSelectorTraits< derived_t >::TrackStateProxy TrackStateProxy
Definition: MeasurementSelector.h:310
ParameterMapping::type
std::array< unsigned char, N > type
Definition: MeasurementSelector.h:127
MeasurementSelectorBase::MeasurementRange::begin
const_iterator begin() const
Definition: MeasurementSelector.h:438
MeasurementSelectorTraits::BoundState
std::tuple< BoundTrackParameters, BoundMatrix, double > BoundState
Definition: MeasurementSelector.h:87
MeasurementSelectorBase::MeasurementRange::m_container
const T * m_container
Definition: MeasurementSelector.h:427
xAOD::short
short
Definition: Vertex_v1.cxx:165
MeasurementSelectorBase::selectMeasurementsCreateTrackStates
Acts::Result< boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface > > selectMeasurementsCreateTrackStates(const Acts::GeometryContext &geometryContext, const Acts::CalibrationContext &calibrationContext, const Acts::Surface &surface, const T_BoundState &boundState, const source_link_iterator_t &sourceLinkBegin, const source_link_iterator_t &sourceLinkEnd, std::size_t prevTip, trajectory_t &trajectory, const Acts::Logger &logger, const std::size_t numMeasurementsCut, const std::pair< float, float > &maxChi2Cut, const T_Container &container) const
Definition: MeasurementSelector.h:449
get_generator_info.result
result
Definition: get_generator_info.py:21
MeasurementSelectorTraits::s_dimMax
static const std::size_t s_dimMax
Definition: MeasurementSelector.h:90
MeasurementSelectorBaseImpl::parameterMap
ParameterMapping::type< DIM > parameterMap(const Acts::GeometryContext &, const Acts::CalibrationContext &, const Acts::Surface &)
Definition: MeasurementSelector.h:832
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
MeasurementSelectorTraits::MeasurementContainerTraits
Definition: MeasurementSelector.h:73
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
index
Definition: index.py:1
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MeasurementSelectorWithDispatch::trajectory_t
typename Base::trajectory_t trajectory_t
Definition: MeasurementSelector.h:719
MeasurementSelectorTraits::MatrixFloatType
double MatrixFloatType
Definition: MeasurementSelector.h:83
MeasurementSelectorBase::MatchingMeasurement
Definition: MeasurementSelector.h:408
MeasurementSelectorBaseImpl::PreCalibrator
Acts::Delegate< std::pair< typename MeasurementSelectorTraits< derived_t >::template PreSelectionMeasurement< DIM >, typename MeasurementSelectorTraits< derived_t >::template PreSelectionMeasurementCovariance< DIM > >(const Acts::GeometryContext &, const Acts::CalibrationContext &, const measurement_t &, const typename MeasurementSelectorTraits< derived_t >::BoundTrackParameters &)> PreCalibrator
Definition: MeasurementSelector.h:846
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
MeasurementSelectorBaseImpl::boundJacobiMatrix
static const MeasurementSelectorTraits< derived_t >::BoundMatrix & boundJacobiMatrix(const T_BoundState &boundState)
Definition: MeasurementSelector.h:799
ConvertOldUJHistosToNewHistos.etaBins
list etaBins
Definition: ConvertOldUJHistosToNewHistos.py:145
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
MeasurementSelectorBase::s_maxBranchesPerSurface
static constexpr std::size_t s_maxBranchesPerSurface
Definition: MeasurementSelector.h:311
taskman.template
dictionary template
Definition: taskman.py:317
bin
Definition: BinsDiffFromStripMedian.h:43
MeasurementSelectorBase::getCuts
std::tuple< std::size_t, std::pair< float, float > > getCuts(const Acts::Surface &surface, const T_BoundState &boundState, const Acts::Logger &logger) const
Definition: MeasurementSelector.h:668
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
athena.value
value
Definition: athena.py:124
MeasurementSelectorTraits::CalibratedMeasurementCovariance
typename Acts::detail_lt::FixedSizeTypes< N >::Covariance CalibratedMeasurementCovariance
Definition: MeasurementSelector.h:51
TopCollection::slot
PayloadType & slot()
Definition: MeasurementSelector.h:230
MeasurementSelectorWithDispatch::T_BoundState
typename Base::T_BoundState T_BoundState
Definition: MeasurementSelector.h:718
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
TopCollection::IndexType
unsigned short IndexType
Definition: MeasurementSelector.h:213
MeasurementSelectorTraits::BoundMatrix
Acts::BoundMatrix BoundMatrix
Definition: MeasurementSelector.h:85
MeasurementSelectorTraits::PreSelectionMeasurement
typename Acts::detail_lt::FixedSizeTypes< N >::Coefficients PreSelectionMeasurement
Definition: MeasurementSelector.h:56
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
TopCollection::m_order
std::array< IndexType, N+1 > m_order
Definition: MeasurementSelector.h:275
MeasurementSelectorMatrixTraits
Definition: MeasurementSelector.h:98
MeasurementSelectorWithDispatch
Definition: MeasurementSelector.h:715
MeasurementSelectorBaseImpl::PostCalibrator
Acts::Delegate< std::pair< typename MeasurementSelectorTraits< derived_t >::template CalibratedMeasurement< DIM >, typename MeasurementSelectorTraits< derived_t >::template CalibratedMeasurementCovariance< DIM > >(const Acts::GeometryContext &, const Acts::CalibrationContext &, const measurement_t &, const typename MeasurementSelectorTraits< derived_t >::BoundTrackParameters &)> PostCalibrator
Definition: MeasurementSelector.h:857
MeasurementSelectorBaseImpl::postCalibrator
const PostCalibrator< DIM, measurement_t > & postCalibrator() const
the calibrator used after the measurement selection which does not have to be "connected"
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
MeasurementSelectorWithDispatch::TrackStateProxy
typename Base::TrackStateProxy TrackStateProxy
Definition: MeasurementSelector.h:720
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
MeasurementSelectorWithDispatch::s_maxBranchesPerSurface
static constexpr std::size_t s_maxBranchesPerSurface
Definition: MeasurementSelector.h:721
MeasurementSelectorBase::MatchingMeasurement::m_chi2
float m_chi2
Definition: MeasurementSelector.h:413
MeasurementSelectorMatrixTraits::invert
static auto invert(const T_Matrix &matrix)
Definition: MeasurementSelector.h:113
MeasurementSelectorBase::derived
const derived_t & derived() const
Definition: MeasurementSelector.h:313
ParameterMapping
Definition: MeasurementSelector.h:124
TopCollection::m_maxSlots
IndexType m_maxSlots
Definition: MeasurementSelector.h:277
MeasurementSelectorBase
Definition: MeasurementSelector.h:300
MeasurementSelectorWithDispatch::dimMax
static constexpr std::size_t dimMax()
Definition: MeasurementSelector.h:724
MeasurementSelectorBase< NMeasMax, MeasurementSelectorTraits< derived_t >::s_dimMax, derived_t >::T_BoundState
typename MeasurementSelectorTraits< derived_t >::BoundState T_BoundState
Definition: MeasurementSelector.h:308
MeasurementSelectorTraits::trajectory_t
typename derived_t::traj_t trajectory_t
Definition: MeasurementSelector.h:78
MeasurementSelectorTraits::PreSelectionMeasurementCovariance
typename Acts::detail_lt::FixedSizeTypes< N >::Covariance PreSelectionMeasurementCovariance
Definition: MeasurementSelector.h:61
MeasurementSelectorMatrixTraits::matrixTypeCast
static auto matrixTypeCast(const T_Matrix &matrix)
Definition: MeasurementSelector.h:107
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
MeasurementSelectorBase::MeasurementRange
Definition: MeasurementSelector.h:425
TopCollection::getSlot
PayloadType & getSlot(IndexType idx)
Definition: MeasurementSelector.h:240
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
ActsTrk::IndexType
std::uint32_t IndexType
Definition: Decoration.h:14
TopCollection::m_nextSlot
IndexType m_nextSlot
Definition: MeasurementSelector.h:276
MeasurementSelectorTraits::CalibratedMeasurement
typename Acts::detail_lt::FixedSizeTypes< N >::Coefficients CalibratedMeasurement
Definition: MeasurementSelector.h:47
MeasurementSelectorTraits::BoundTrackParameters
Acts::BoundTrackParameters BoundTrackParameters
Definition: MeasurementSelector.h:84
MeasurementSelectorBase::MatchingMeasurement::m_sourceLink
std::optional< T_SourceLink > m_sourceLink
Definition: MeasurementSelector.h:412
MeasurementSelectorBaseImpl::forwardToCalibrator
static const auto & forwardToCalibrator(const T &a)
Definition: MeasurementSelector.h:817
MeasurementSelectorBase::createStates
static void createStates(std::size_t n_new_states, const T_BoundState &boundState, std::size_t prevTip, trajectory_t &trajectory, const Acts::BoundSubspaceIndices &subspaceIndices, boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface > &track_states, const Acts::Logger &logger, bool outlier_states)
Definition: MeasurementSelector.h:339
lumiFormat.i
int i
Definition: lumiFormat.py:85
TopCollection::acceptAndSort
void acceptAndSort(std::function< bool(const PayloadType &a, const PayloadType &b)> comparison)
Definition: MeasurementSelector.h:250
MeasurementSelectorBase::ProjectorBitSetMaker::create
static Acts::ProjectorBitset create(const ParameterMapping::type< N > &parameter_map)
Definition: MeasurementSelector.h:319
MeasurementSelectorBaseImpl::pathLength
static double pathLength(const T_BoundState &boundState)
Definition: MeasurementSelector.h:803
AtlasMeasurementSelectorCuts
Definition: MeasurementSelector.h:282
MeasurementSelectorMatrixTraits::transpose
static auto transpose(const T_Matrix &matrix)
Definition: MeasurementSelector.h:110
MeasurementSelectorMatrixTraits::matrixRows
static constexpr std::size_t matrixRows()
Definition: MeasurementSelector.h:104
TopCollection::end
std::array< IndexType, N+1 >::const_iterator end()
Definition: MeasurementSelector.h:272
MeasurementSelectorTraits::Predicted
typename Acts::detail_lt::FixedSizeTypes< N >::Coefficients Predicted
Definition: MeasurementSelector.h:65
MeasurementSelectorBase< NMeasMax, MeasurementSelectorTraits< derived_t >::s_dimMax, derived_t >::trajectory_t
typename MeasurementSelectorTraits< derived_t >::trajectory_t trajectory_t
Definition: MeasurementSelector.h:309
MeasurementSelectorTraits::s_maxBranchesPerSurface
static constexpr std::size_t s_maxBranchesPerSurface
Definition: MeasurementSelector.h:94
plotBeamSpotVert.cuts
string cuts
Definition: plotBeamSpotVert.py:93
TopCollection::begin
std::array< IndexType, N+1 >::const_iterator begin()
Definition: MeasurementSelector.h:271
AtlasMeasurementSelectorCuts::chi2CutOff
std::vector< std::pair< float, float > > chi2CutOff
Maximum local chi2 contribution.
Definition: MeasurementSelector.h:286
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
TopCollection::getSlot
const PayloadType & getSlot(IndexType idx) const
Definition: MeasurementSelector.h:235
AtlasMeasurementSelectorCuts::numMeasurementsCutOff
std::vector< std::size_t > numMeasurementsCutOff
Maximum number of associated measurements on a single surface.
Definition: MeasurementSelector.h:288
MeasurementSelectorBaseImpl::makeSourceLink
static Acts::SourceLink makeSourceLink(T_Value &&value)
Definition: MeasurementSelector.h:809
MeasurementSelectorBase::MatchingMeasurement::m_isOutLier
bool m_isOutLier
Definition: MeasurementSelector.h:414
Config
Definition: dumpNPs.cxx:47
doL1CaloHVCorrections.eta_bin
eta_bin
Definition: doL1CaloHVCorrections.py:368
TopCollection::size
IndexType size() const
Definition: MeasurementSelector.h:268
TopCollection::TopCollection
TopCollection(std::size_t max_n)
Definition: MeasurementSelector.h:216
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
MeasurementSelectorBase::MeasurementRange::m_end
const_iterator m_end
Definition: MeasurementSelector.h:430
MeasurementSelectorBaseImpl::preCalibrator
const PreCalibrator< DIM, measurement_t > & preCalibrator() const
ParameterMapping::identity
static constexpr type< N > identity()
Definition: MeasurementSelector.h:130
MeasurementSelectorBase::getEtaBin
static std::size_t getEtaBin(const parameters_t &boundParameters, const std::vector< float > &etaBins)
Definition: MeasurementSelector.h:649
project
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
Definition: MeasurementSelector.h:142
MeasurementSelectorBaseImpl::boundParams
static const MeasurementSelectorTraits< derived_t >::BoundTrackParameters & boundParams(const T_BoundState &boundState)
Definition: MeasurementSelector.h:794
MeasurementSelectorTraits
Definition: MeasurementSelector.h:44
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
MuonR4::SegmentFit::Covariance
AmgSymMatrix(toInt(ParamDefs::nPars)) Covariance
Definition: MuonHoughDefs.h:49
MeasurementSelectorTraits::TrackStateProxy
trajectory_t::TrackStateProxy TrackStateProxy
Definition: MeasurementSelector.h:80
a
TList * a
Definition: liststreamerinfos.cxx:10
MeasurementSelectorWithDispatch::createSourceLinkTrackStates
Acts::Result< boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface > > createSourceLinkTrackStates(const Acts::GeometryContext &geometryContext, const Acts::CalibrationContext &calibrationContext, const Acts::Surface &surface, const T_BoundState &boundState, source_link_iterator_t sourceLinkBegin, source_link_iterator_t sourceLinkEnd, typename TrackStateProxy::IndexType prevTip, [[maybe_unused]] trajectory_t &trajectory_buffer, [[maybe_unused]] std::vector< TrackStateProxy > &trackStateCandidates, trajectory_t &trajectory, const Acts::Logger &logger) const
Definition: MeasurementSelector.h:730
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MeasurementSelectorBase::MatchingMeasurement::m_measurement
MeasCovPair m_measurement
Definition: MeasurementSelector.h:411
MeasurementSelectorBaseImpl
Definition: MeasurementSelector.h:790
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
MeasurementSelectorBase::MatchingMeasurement::MeasCovPair
std::pair< typename MeasurementSelectorTraits< derived_t >::template PreSelectionMeasurement< DIM >, typename MeasurementSelectorTraits< derived_t >::template PreSelectionMeasurementCovariance< DIM > > MeasCovPair
Definition: MeasurementSelector.h:410
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
calibdata.copy
bool copy
Definition: calibdata.py:27
computeChi2
double computeChi2(const measurement_vector_t &a, const measurement_cov_matrix_t &a_cov, const predicted_vector_t &b, const predicted_cov_matrix_t &b_cov)
Definition: MeasurementSelector.h:181
TopCollection::init
void init(std::size_t max_n)
Definition: MeasurementSelector.h:222
MeasurementSelectorTraits::PredictedCovariance
typename Acts::detail_lt::FixedSizeTypes< N >::Covariance PredictedCovariance
Definition: MeasurementSelector.h:69
TopCollection
Definition: MeasurementSelector.h:212
MeasurementSelectorMatrixTraits::matrixColumns
static constexpr std::size_t matrixColumns()
matrix adapter for Eigen additionally need +,- and *
Definition: MeasurementSelector.h:102
value_type
Definition: EDM_MasterSearch.h:11
AtlasMeasurementSelectorCuts::etaBins
std::vector< float > etaBins
bins in |eta| to specify variable selections
Definition: MeasurementSelector.h:284
MeasurementSelectorBase::MeasurementRange::m_begin
const_iterator m_begin
Definition: MeasurementSelector.h:429
Trk::TrackState::TrackStateType
TrackStateType
enum describing the role of track states during cleaning and outlier removal.
Definition: TrackStateDefs.h:51
MeasurementSelectorBase::MeasurementRange::const_iterator
typename T::const_iterator const_iterator
Definition: MeasurementSelector.h:428
MeasurementSelectorBase::m_config
Config m_config
Definition: MeasurementSelector.h:305
MeasurementSelectorBase::MeasurementRange::end
const_iterator end() const
Definition: MeasurementSelector.h:439
python.iconfTool.gui.pad.logger
logger
Definition: pad.py:14
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
TopCollection::empty
bool empty() const
Definition: MeasurementSelector.h:264
TopCollection::isValid
bool isValid(IndexType idx) const
Definition: MeasurementSelector.h:244