Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeasurementSelector.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MeasurementSelector.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2021 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
13 
14 #include <algorithm>
15 
16 namespace Acts {
17 
19  double* fullCalibrated, double* fullCalibratedCovariance,
21  false>::Parameters predicted,
23  false>::Covariance predictedCovariance,
25  false>::Projector projector,
26  unsigned int calibratedSize) const {
27  return visit_measurement(calibratedSize, [&](auto N) -> double {
28  constexpr size_t kMeasurementSize = decltype(N)::value;
29 
31  fullCalibrated};
32 
34  calibratedCovariance{fullCalibratedCovariance};
35 
36  using ParametersVector = ActsVector<kMeasurementSize>;
37 
38  // Take the projector (measurement mapping function)
39  const auto H =
40  projector.template topLeftCorner<kMeasurementSize, eBoundSize>().eval();
41 
42  // Get the residuals
43  ParametersVector res;
44  res = calibrated - H * predicted;
45 
46  // Get the chi2
47  return (res.transpose() *
48  ((calibratedCovariance + H * predictedCovariance * H.transpose()))
49  .inverse() *
50  res)
51  .eval()(0, 0);
52  });
53 }
54 
55 } // namespace Acts