EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrkrClusterOutlierFittingAlgorithm.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrkrClusterOutlierFittingAlgorithm.hpp
1 #pragma once
2 
3 #include <iostream>
4 #include <map>
5 #include <random>
6 #include <stdexcept>
7 #include <boost/program_options.hpp>
8 
23 
29 
31  std::vector<std::pair<long unsigned int, double>> chi2Cuts;
32  int verbosity = 0;
33 
34  template <typename track_state_t>
35  bool operator()(const track_state_t& state) const {
36 
38  if(not state.hasCalibrated() or not state.hasPredicted())
39  return false;
40 
42  // residuals = state.calibrated() - state.projector() * state.predicted();
43  auto distance = (state.calibrated() - state.projector() * state.predicted()).norm();
44 
46  const auto& projector = state.projector();
47  const auto& predictedCov = state.predictedCovariance();
48  const auto& stateCov = state.effectiveCalibratedCovariance();
49 
52  double chi2 = ((state.calibrated() - state.projector() * state.predicted()).transpose() *
53  (( stateCov + projector * predictedCov * projector.transpose())).inverse() * (state.calibrated() - state.projector() * state.predicted()))
54  .eval()(0,0);
55 
56  if(verbosity > 2)
57  {
58  std::cout << "geoid : " << state.referenceSurface().geometryId() << std::endl;
59  std::cout << "Distance between prediction and measurement is: " << distance << std::endl;
60  std::cout << "chi2 " << chi2 << std::endl;
61  }
62 
63  auto volID = state.referenceSurface().geometryId().volume();
64 
65  for(auto& pair : chi2Cuts)
66  {
67  if(verbosity > 2)
68  {
69  std::cout << "VolID : " << volID << " checking against " << pair.first
70  << ", chicut " << pair.second << " with chi2 " << chi2 << std::endl;
71  }
72 
73  if(volID == pair.first)
74  {
75  return chi2 >= pair.second;
76  }
77  }
78 
80  return false;
81  }
82 };
83 
84 
85 namespace ActsExamples {
86 
92 {
93  public:
95  using FitterResult
97  using FitterFunction
98  = std::function<FitterResult(
99  const std::vector<ActsExamples::TrkrClusterSourceLink>&,
100  const TrackParameters&,
102 
104  = std::function<FitterResult(
105  const std::vector<ActsExamples::TrkrClusterSourceLink>&,
106  const TrackParameters&,
108  const std::vector<const Acts::Surface*>&)>;
109 
110 
113  std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry,
115 
118 
119  struct Config
120  {
123  };
124 
127 
128 
129 private:
131 };
132 
133 }