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::Types<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::Types<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::Types<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
83  using MatrixFloatType = Acts::ActsScalar;
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::ProjectorBitset &projector_bitset,
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  trackState.setProjectorBitset(projector_bitset);
391 
392  Acts::TrackStateType typeFlags = trackState.typeFlags();
393  if (trackState.referenceSurface().surfaceMaterial() != nullptr) {
394  typeFlags.set(Acts::TrackStateFlag::MaterialFlag);
395  }
396  typeFlags.set(Acts::TrackStateFlag::ParameterFlag);
397 
398  // @TODO these track states still need some additional processing. Should there be a special
399  // flag for this ?
400  track_states.push_back( trackState.index());
401  }
402  }
403 
404 
405  // utility struct to temporarily store data about the best measurements
406  template <std::size_t DIM, typename T_SourceLink>
409  typename MeasurementSelectorTraits<derived_t>::template PreSelectionMeasurementCovariance<DIM> >;
411  std::optional<T_SourceLink> m_sourceLink;
412  float m_chi2;
414  };
415 
416  // simple adapter to support a range-based for loop
417  // the adapter creates iterators to directly iterate over the measurement range
418  // where the measurement range is extracted from the specific source link iterators
419  // which provide the start and end index of the measurements which define the contiguous
420  // measuremnt range.
421  // @TODO pass such an object instead of sourceLinkBegin, sourceLinkEnd
422  // in selectMeasurementsCreateTrackStates ?
423  template <typename T>
425  private:
426  const T *m_container;
427  using const_iterator = typename T::const_iterator;
430  public:
431  template <typename Iterator>
432  MeasurementRange( const T &container, const Iterator &begin_iter, const Iterator &end_iter)
433  : m_begin( container.begin() + begin_iter.m_iterator.index()),
434  m_end( container.begin() + end_iter.m_iterator.index())
435  {
436  }
437  const_iterator begin() const { return m_begin; }
438  const_iterator end() const { return m_end; }
439  };
440 
441  // type and dimension specific function to select measurements from the range defined by the source link iterators.
442  // will iterate over the contiguous measurement range defined by the source link iterators where the measurements
443  // are contained in the given container. The selection lopp will get the measurement and covariance with the
444  // help of a preCalibrator. select measurements based on smallest chi2 wrt. the prediction, then optionally
445  // apply a full calibrator after the selection and finally create track states.
446  template <std::size_t DIM, typename source_link_iterator_t, typename T_Container>
447  Acts::Result<boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> >
448  selectMeasurementsCreateTrackStates(const Acts::GeometryContext& geometryContext,
449  const Acts::CalibrationContext& calibrationContext,
450  const Acts::Surface& surface,
451  const T_BoundState& boundState,
452  const source_link_iterator_t& sourceLinkBegin,
453  const source_link_iterator_t& sourceLinkEnd,
454  std::size_t prevTip,
455  trajectory_t& trajectory,
456  const Acts::Logger& logger,
457  const std::size_t numMeasurementsCut,
458  const std::pair<float,float>& maxChi2Cut,
459  const T_Container &container) const {
460  Acts::Result<boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> >
461  result = boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface>{};
462  using container_value_t = typename MeasurementSelectorTraits<derived_t>::template MeasurementContainerTraits<T_Container>::value_type;
463  using BaseElementType = std::remove_cv_t<std::remove_pointer_t< container_value_t > >;
464  // get calibrator
465  using TheMatchingMeasurement = MatchingMeasurement<DIM, container_value_t >;
466  using MeasCovPair = TheMatchingMeasurement::MeasCovPair;
467 
468  using Predicted = typename MeasurementSelectorTraits<derived_t>::template Predicted<DIM>;
469  using PredictedCovariance = typename MeasurementSelectorTraits<derived_t>::template PredictedCovariance<DIM>;
470 
471 
472 
473  // get prediction in the measurement domain
474  ParameterMapping::type<DIM> parameter_map = derived().template parameterMap<DIM>(geometryContext,
475  calibrationContext,
476  surface);
477  auto predicted
478  = std::make_pair( project<DIM, Predicted>(parameter_map,
479  derived().boundParams(boundState).parameters()),
480  project<DIM, PredictedCovariance>(parameter_map,
481  derived().boundParams(boundState).covariance().value()));
482 
483  // select n measurents with the smallest chi2.
484  auto preCalibrator = derived().template preCalibrator<DIM, BaseElementType>();
485  TopCollection<NMeasMax, TheMatchingMeasurement > selected_measurements(numMeasurementsCut);
486  {
487  for ( const auto &measurement : MeasurementRange<T_Container>(container, sourceLinkBegin, sourceLinkEnd) ) {
488  TheMatchingMeasurement &matching_measurement=selected_measurements.slot();
489  matching_measurement.m_measurement = preCalibrator(geometryContext,
490  calibrationContext,
491  derived().template forwardToCalibrator(measurement),
492  derived().boundParams(boundState));
493  matching_measurement.m_chi2 = computeChi2(matching_measurement.m_measurement.first,
494  matching_measurement.m_measurement.second,
495  predicted.first,
496  predicted.second);
497  // only consider measurements which pass the outlier chi2 cut
498  if (matching_measurement.m_chi2<maxChi2Cut.second) {
499  matching_measurement.m_sourceLink=measurement;
500  selected_measurements.acceptAndSort([](const TheMatchingMeasurement &a,
501  const TheMatchingMeasurement &b) {
502  return a.m_chi2 < b.m_chi2;
503  });
504  }
505  }
506  }
507 
508  // apply final calibration to n-best measurements
509  auto postCalibrator = derived().template postCalibrator<DIM, BaseElementType>();
510  using post_calib_meas_cov_pair_t
512  typename MeasurementSelectorTraits<derived_t>::template CalibratedMeasurementCovariance<DIM> >;
513 
514  // need extra temporary buffer if the types to store "measurements" during measurement selection
515  // and calibrated measurements after the measurement selection are not identical
516  static constexpr bool pre_and_post_calib_types_agree
518  typename MeasurementSelectorTraits<derived_t>::template PreSelectionMeasurement<DIM> >::value
519  && std::is_same< typename MeasurementSelectorTraits<derived_t>::template CalibratedMeasurementCovariance<DIM>,
520  typename MeasurementSelectorTraits<derived_t>::template PreSelectionMeasurementCovariance<DIM> >::value;
521 
522  using Empty = struct {};
523  typename std::conditional< !pre_and_post_calib_types_agree,
524  std::array< post_calib_meas_cov_pair_t, NMeasMax>, // @TODO could use boost static_vector instead
525  Empty>::type calibrated;
526  if (postCalibrator) {
528 
529  // apply final calibration, recompute chi2
531  idx: selected_measurements) {
532  TheMatchingMeasurement &a_selected_measurement = selected_measurements.getSlot(idx);
533 
534  // helper to select the destination storage which is the extra temporary buffer
535  // if the measurement storage types during and after selection are different.
536  post_calib_meas_cov_pair_t &calibrated_measurement
537  = [&calibrated, &a_selected_measurement, calibrated_meas_cov_i]() -> post_calib_meas_cov_pair_t & {
538  if constexpr(pre_and_post_calib_types_agree) {
539  (void) calibrated;
540  (void) calibrated_meas_cov_i;
541  return a_selected_measurement.m_measurement;
542  }
543  else {
544  (void) a_selected_measurement;
545  assert(calibrated_meas_cov_i < calibrated.size());
546  return calibrated[calibrated_meas_cov_i];
547  }
548  }();
549 
550  // apply the calibration
551  calibrated_measurement = postCalibrator(geometryContext,
552  calibrationContext,
553  derived().template forwardToCalibrator(a_selected_measurement.m_sourceLink.value()),
554  derived().boundParams(boundState));
555  // update chi2 using calibrated measurement
556  a_selected_measurement.m_chi2 = computeChi2(calibrated_measurement.first,
557  calibrated_measurement.second,
558  predicted.first,
559  predicted.second);
560  // ... and set outlier flag
561  a_selected_measurement.m_isOutLier = (a_selected_measurement.m_chi2 >= maxChi2Cut.first);
562  if constexpr(!pre_and_post_calib_types_agree) {
563  ++calibrated_meas_cov_i;
564  }
565  }
566  }
567  else {
568  // if no final calibration is performed only the outlier flag still needs to be set
570  idx: selected_measurements) {
571  TheMatchingMeasurement &a_selected_measurement = selected_measurements.getSlot(idx);
572  a_selected_measurement.m_isOutLier = (a_selected_measurement.m_chi2 >= maxChi2Cut.first);
573  }
574  }
575 
576  // First Create states without setting information about the calibrated measurement for the selected measurements
577  // @TODO first create state then copy measurements, or crete state by state and set measurements ?
578  // the lastter has the "advantage" that the outlier flag can be set individually
579  // the former has the advantage that part of the state creation code is independent of the
580  // the measuerement.
581  createStates( selected_measurements.size(),
582  boundState,
583  prevTip,
584  trajectory,
585  ProjectorBitSetMaker::create(parameter_map),
586  *result,
587  logger,
588  (!selected_measurements.empty()
589  ? selected_measurements.getSlot( *(selected_measurements.begin())).m_isOutLier
590  : false) );
591  assert( result->size() == selected_measurements.size() );
592 
593  // helper to determine whether calibrated storeage is to be used
594  auto use_calibrated_storage = [&postCalibrator]() -> bool {
595  if constexpr(pre_and_post_calib_types_agree) {
596  (void) postCalibrator;
597  return false;
598  }
599  else {
600  // this is only known during runtime
601  // but it should not be tested if the types agree.
602  return postCalibrator;
603  }
604  };
605 
606  // copy selected measurements to pre-created states
607  unsigned int state_i=0;
609  idx: selected_measurements) {
610  assert( state_i < result->size());
611  TrackStateProxy trackState( trajectory.getTrackState( (*result)[state_i] ) );
612  TheMatchingMeasurement &a_selected_measurement = selected_measurements.getSlot(idx);
613  trackState.setUncalibratedSourceLink(derived().makeSourceLink(std::move(a_selected_measurement.m_sourceLink.value())));
614  // flag outliers accordingly, so that they are handled correctly by the post processing
615  trackState.typeFlags().set( a_selected_measurement.m_isOutLier
616  ? Acts::TrackStateFlag::OutlierFlag
617  : Acts::TrackStateFlag::MeasurementFlag );
618  trackState.allocateCalibrated(DIM);
619  if (use_calibrated_storage()) {
620  // if the final clibration is performed after the selection then
621  // copy these measurements and covariances to the track states
622  assert( use_calibrated_storage() == !pre_and_post_calib_types_agree);
623  if constexpr(!pre_and_post_calib_types_agree) {
624  assert( state_i < calibrated.size());
625  trackState.template calibrated<DIM>()
626  = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(calibrated[state_i].first);
627  trackState.template calibratedCovariance<DIM>()
628  = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(calibrated[state_i].second);
629  trackState.chi2() = a_selected_measurement.m_chi2;
630  }
631  }
632  else {
633  trackState.template calibrated<DIM>()
634  = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(a_selected_measurement.m_measurement.first);
635  trackState.template calibratedCovariance<DIM>()
636  = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(a_selected_measurement.m_measurement.second);
637  trackState.chi2() = a_selected_measurement.m_chi2;
638  }
639  ++state_i;
640  }
641  return result;
642  }
643 
644  template <typename parameters_t>
645  static std::size_t getEtaBin(const parameters_t& boundParameters,
646  const std::vector<float> &etaBins) {
647  if (etaBins.empty()) {
648  return 0u; // shortcut if no etaBins
649  }
650  const float eta = std::abs(std::atanh(std::cos(boundParameters.parameters()[Acts::eBoundTheta])));
651  std::size_t bin = 0;
652  for (auto etaBin : etaBins) {
653  if (etaBin >= eta) {
654  break;
655  }
656  bin++;
657  }
658  return bin;
659  }
660 
661 public:
662  // get numMeasurement and maxChi2 cuts for the given surface
663  // @TODO should the cuts just depend on the surface or really on the bound parameters (i.e. bound eta)
664  std::tuple< std::size_t, std::pair<float,float> > getCuts(const Acts::Surface& surface,
665  const T_BoundState& boundState,
666  const Acts::Logger& logger) const {
667  std::tuple< std::size_t, std::pair<float,float> > result;
668  std::size_t &numMeasurementsCut = std::get<0>(result);
669  std::pair<float,float> &maxChi2Cut = std::get<1>(result);
670  // Get geoID of this surface
671  auto geoID = surface.geometryId();
672  // Find the appropriate cuts
673  auto cuts = m_config.find(geoID);
674  if (cuts == m_config.end()) {
675  // indicats failure
676  numMeasurementsCut = 0;
677  }
678  else {
679  // num measurement Cut
680  // getchi2 cut
681  std::size_t eta_bin = getEtaBin(derived().boundParams(boundState), cuts->etaBins);
682  numMeasurementsCut = (!cuts->numMeasurementsCutOff.empty()
683  ? cuts->numMeasurementsCutOff[ std::min(cuts->numMeasurementsCutOff.size()-1, eta_bin) ]
684  : NMeasMax);
685  maxChi2Cut = ! cuts->chi2CutOff.empty()
686  ? cuts->chi2CutOff[ std::min(cuts->chi2CutOff.size()-1, eta_bin) ]
687  : std::make_pair<float,float>(std::numeric_limits<float>::max(),
689  ACTS_VERBOSE("Get cut for eta-bin="
690  << (eta_bin < cuts->etaBins.size() ? cuts->etaBins[eta_bin] : std::numeric_limits<float>::max())
691  << ": chi2 (max,max-outlier) " << maxChi2Cut.first << ", " << maxChi2Cut.second
692  << " max.meas." << numMeasurementsCut);
693  }
694  return result;
695  }
696 };
697 
698 // Measurement selector which calls a type specific selection method
699 // the measurement selector expects a list of measurement containers to be provided
700 // by the source link iterators as well as the index of the container to be used for the
701 // given measurement range, which is defined by the source link iterators.
702 // the measurement range must refer to a contiguous range of measurements contained
703 // within a single measurement container.
704 // The "container" itself is a variant of particular measurement containers with associated
705 // dimension i.e. number of coordinates per measurement. A member funcion specific to one of
706 // the alternatives of the variant will be called to perform the selection and track state
707 // creation.
708 template <std::size_t NMeasMax,
709  typename derived_t,
710  typename measurement_container_variant_t >
711 struct MeasurementSelectorWithDispatch : public MeasurementSelectorBase< NMeasMax, MeasurementSelectorTraits<derived_t>::s_dimMax, derived_t> {
712 
718 
719  // helper to get the maximum number of measurement diemsions.
720  static constexpr std::size_t dimMax() {
722  }
723 
724  template <typename source_link_iterator_t>
725  Acts::Result<boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> >
726  createSourceLinkTrackStates(const Acts::GeometryContext& geometryContext,
727  const Acts::CalibrationContext& calibrationContext,
728  const Acts::Surface& surface,
729  const T_BoundState& boundState,
730  source_link_iterator_t sourceLinkBegin,
731  source_link_iterator_t sourceLinkEnd,
732  std::size_t prevTip,
733  [[maybe_unused]] trajectory_t& trajectory_buffer,
734  [[maybe_unused]] std::vector<TrackStateProxy> &trackStateCandidates,
735  trajectory_t& trajectory,
736  const Acts::Logger& logger) const {
737  Acts::Result<boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> >
738  result = Acts::CombinatorialKalmanFilterError::MeasurementSelectionFailed;
739  if (sourceLinkBegin != sourceLinkEnd) {
740  auto [numMeasurementsCut, maxChi2Cut] = this->getCuts(surface,boundState, logger);
741  // numMeasurementsCut is == 0 in case getCuts failed
742  // anyway cannot select anything if numMeasurementsCut==0;
743  if (numMeasurementsCut>0) {
744  const std::vector<measurement_container_variant_t> &
745  measurementContainer = sourceLinkBegin.m_iterator.measurementContainerList();
746 
747  assert( sourceLinkBegin.m_iterator.containerIndex() == sourceLinkEnd.m_iterator.containerIndex() );
748  const measurement_container_variant_t &a_measurement_container_variant = measurementContainer.at(sourceLinkBegin.m_iterator.containerIndex());
749  result = std::visit( [this,
750  &geometryContext,
751  &calibrationContext,
752  &surface,
753  &boundState,
754  &sourceLinkBegin,
755  &sourceLinkEnd,
756  prevTip,
757  &trajectory,
758  &logger,
759  numMeasurementsCut,
760  &maxChi2Cut] (const auto &measurement_container_with_dimension) {
761  using ArgType = std::remove_cv_t<std::remove_reference_t< decltype(measurement_container_with_dimension) > >;
762  constexpr std::size_t DIM = ArgType::dimension();
763  return this->template selectMeasurementsCreateTrackStates<DIM>(geometryContext,
764  calibrationContext,
765  surface,
766  boundState,
767  sourceLinkBegin,
768  sourceLinkEnd,
769  prevTip,
770  trajectory,
771  logger,
772  numMeasurementsCut,
773  maxChi2Cut,
774  measurement_container_with_dimension.container());
775  },
776  a_measurement_container_variant);
777  }
778  }
779  return result;
780  }
781 };
782 
783 template <std::size_t NMeasMax,
784  typename derived_t,
785  typename measurement_container_variant_t>
786 struct MeasurementSelectorBaseImpl : public MeasurementSelectorWithDispatch<NMeasMax, derived_t, measurement_container_variant_t> {
788 
789  // get the bound parameters and covariance of the bound state
791  return std::get<0>(boundState);
792  }
793 
794  // get the jacobi matrix of the bound state
796  return std::get<1>(boundState);
797  }
798  // get the accumulated path length of the bound state
799  static double pathLength(const T_BoundState &boundState) {
800  return std::get<2>(boundState);
801  }
802 
803  // create a source link from the measurement
804  template <typename T_Value>
805  static Acts::SourceLink makeSourceLink(T_Value &&value) {
806  return Acts::SourceLink{value};
807  }
808 
809  // perform simple transformation to cerate the type
810  // that is passed to the calibrator.
811  // by default pass the measurement by reference not pointer
812  template <typename T>
813  static const auto &forwardToCalibrator(const T &a) {
814  if constexpr( std::is_same<T, std::remove_pointer_t<T> >::value ) {
815  return a;
816  }
817  else {
818  return *a;
819  }
820  }
821 
822  // get mapping between bound state parameters and coordinates in the measurement domain
823  // in most cases this is just the identity operation e.g. loc0 -> coord0 and loc1 -> coord1
824  // i.e. map[0]=0; map[1]=1;
825  // @TODO should this be measurement type specific, or is dimension and the surface good enough ?
826  template <std::size_t DIM>
828  parameterMap(const Acts::GeometryContext&,
829  const Acts::CalibrationContext&,
830  const Acts::Surface&) {
831  return ParameterMapping::identity<DIM>();
832  }
833 
834  // By default the methods postCalibrator and preCalibrator return delegates:
835  template <std::size_t DIM, typename measurement_t>
836  using PreCalibrator = Acts::Delegate<
838  typename MeasurementSelectorTraits<derived_t>::template PreSelectionMeasurementCovariance<DIM> >
839  (const Acts::GeometryContext&,
840  const Acts::CalibrationContext&,
841  const measurement_t &,
843 
844  // Since the measurement types used during measurement selection and after measurement selection
845  // might be different so are the types of the calibrator delegates
846  template <std::size_t DIM, typename measurement_t>
847  using PostCalibrator = Acts::Delegate<
849  typename MeasurementSelectorTraits<derived_t>::template CalibratedMeasurementCovariance<DIM> >
850  (const Acts::GeometryContext&,
851  const Acts::CalibrationContext&,
852  const measurement_t &,
854 
858  template <std::size_t DIM, typename measurement_t>
860  postCalibrator() const; // not implemented
861 
862  // the "calibrator" which is used during the measuremnt selection
864  // this delegate must be connected or be a valid functor. If not this likely will lead to an
865  // exception or seg fault.
866  template <std::size_t DIM, typename measurement_t>
868  preCalibrator() const; // not implemented
869 
870 };
MeasurementSelectorTraits::Predicted
typename Acts::detail_lt::Types< N >::Coefficients Predicted
Definition: MeasurementSelector.h:65
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:432
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:437
MeasurementSelectorTraits::BoundState
std::tuple< BoundTrackParameters, BoundMatrix, double > BoundState
Definition: MeasurementSelector.h:87
MeasurementSelectorBase::MeasurementRange::m_container
const T * m_container
Definition: MeasurementSelector.h:426
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:448
get_generator_info.result
result
Definition: get_generator_info.py:21
max
#define max(a, b)
Definition: cfImp.cxx:41
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:828
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
MeasurementSelectorTraits::MeasurementContainerTraits
Definition: MeasurementSelector.h:73
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
index
Definition: index.py:1
MeasurementSelectorWithDispatch::trajectory_t
typename Base::trajectory_t trajectory_t
Definition: MeasurementSelector.h:715
MeasurementSelectorBase::MatchingMeasurement
Definition: MeasurementSelector.h:407
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:842
MeasurementSelectorBaseImpl::boundJacobiMatrix
static const MeasurementSelectorTraits< derived_t >::BoundMatrix & boundJacobiMatrix(const T_BoundState &boundState)
Definition: MeasurementSelector.h:795
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:664
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
athena.value
value
Definition: athena.py:122
TopCollection::slot
PayloadType & slot()
Definition: MeasurementSelector.h:230
MeasurementSelectorWithDispatch::T_BoundState
typename Base::T_BoundState T_BoundState
Definition: MeasurementSelector.h:714
MeasurementSelectorTraits::PreSelectionMeasurement
typename Acts::detail_lt::Types< N >::Coefficients PreSelectionMeasurement
Definition: MeasurementSelector.h:56
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
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:711
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:853
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:83
MeasurementSelectorWithDispatch::TrackStateProxy
typename Base::TrackStateProxy TrackStateProxy
Definition: MeasurementSelector.h:716
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
MeasurementSelectorWithDispatch::s_maxBranchesPerSurface
static constexpr std::size_t s_maxBranchesPerSurface
Definition: MeasurementSelector.h:717
MeasurementSelectorBase::MatchingMeasurement::m_chi2
float m_chi2
Definition: MeasurementSelector.h:412
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:720
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
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:424
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
TopCollection::m_nextSlot
IndexType m_nextSlot
Definition: MeasurementSelector.h:276
MeasurementSelectorTraits::BoundTrackParameters
Acts::BoundTrackParameters BoundTrackParameters
Definition: MeasurementSelector.h:84
MeasurementSelectorTraits::MatrixFloatType
Acts::ActsScalar MatrixFloatType
Definition: MeasurementSelector.h:83
MeasurementSelectorBase::MatchingMeasurement::m_sourceLink
std::optional< T_SourceLink > m_sourceLink
Definition: MeasurementSelector.h:411
MeasurementSelectorBaseImpl::forwardToCalibrator
static const auto & forwardToCalibrator(const T &a)
Definition: MeasurementSelector.h:813
MeasurementSelectorTraits::PreSelectionMeasurementCovariance
typename Acts::detail_lt::Types< N >::Covariance PreSelectionMeasurementCovariance
Definition: MeasurementSelector.h:61
lumiFormat.i
int i
Definition: lumiFormat.py:92
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:799
AtlasMeasurementSelectorCuts
Definition: MeasurementSelector.h:282
ret
T ret(T t)
Definition: rootspy.cxx:260
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
ActsTrk::Covariance
Acts::TrackStateTraits< 3, false >::Covariance Covariance
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:52
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
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:805
MeasurementSelectorBase::MatchingMeasurement::m_isOutLier
bool m_isOutLier
Definition: MeasurementSelector.h:413
Config
Definition: dumpNPs.cxx:47
min
#define min(a, b)
Definition: cfImp.cxx:40
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:429
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:645
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, std::size_t prevTip, [[maybe_unused]] trajectory_t &trajectory_buffer, [[maybe_unused]] std::vector< TrackStateProxy > &trackStateCandidates, trajectory_t &trajectory, const Acts::Logger &logger) const
Definition: MeasurementSelector.h:726
MeasurementSelectorTraits::CalibratedMeasurementCovariance
typename Acts::detail_lt::Types< N >::Covariance CalibratedMeasurementCovariance
Definition: MeasurementSelector.h:51
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:790
MeasurementSelectorTraits
Definition: MeasurementSelector.h:44
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
MeasurementSelectorTraits::PredictedCovariance
typename Acts::detail_lt::Types< N >::Covariance PredictedCovariance
Definition: MeasurementSelector.h:69
MeasurementSelectorTraits::TrackStateProxy
trajectory_t::TrackStateProxy TrackStateProxy
Definition: MeasurementSelector.h:80
a
TList * a
Definition: liststreamerinfos.cxx:10
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MeasurementSelectorBase::createStates
static void createStates(std::size_t n_new_states, const T_BoundState &boundState, std::size_t prevTip, trajectory_t &trajectory, const Acts::ProjectorBitset &projector_bitset, boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface > &track_states, const Acts::Logger &logger, bool outlier_states)
Definition: MeasurementSelector.h:339
MeasurementSelectorBase::MatchingMeasurement::m_measurement
MeasCovPair m_measurement
Definition: MeasurementSelector.h:410
MeasurementSelectorBaseImpl
Definition: MeasurementSelector.h:786
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:409
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
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
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:428
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:427
MeasurementSelectorBase::m_config
Config m_config
Definition: MeasurementSelector.h:305
MeasurementSelectorBase::MeasurementRange::end
const_iterator end() const
Definition: MeasurementSelector.h:438
python.iconfTool.gui.pad.logger
logger
Definition: pad.py:14
MeasurementSelectorTraits::CalibratedMeasurement
typename Acts::detail_lt::Types< N >::Coefficients CalibratedMeasurement
Definition: MeasurementSelector.h:47
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