Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IterativeVertexFinder.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file IterativeVertexFinder.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 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 
9 #pragma once
10 
23 
24 namespace Acts {
25 
59 template <typename vfitter_t, typename sfinder_t>
61  static_assert(VertexFitterConcept<vfitter_t>,
62  "Vertex fitter does not fulfill vertex fitter concept.");
63  using Propagator_t = typename vfitter_t::Propagator_t;
65 
66  public:
67  using InputTrack_t = typename vfitter_t::InputTrack_t;
69 
71  struct Config {
78  Config(const vfitter_t& fitter, Linearizer_t lin, sfinder_t sfinder,
79  const IPEstimator& est)
80  : vertexFitter(fitter),
81  linearizer(std::move(lin)),
82  seedFinder(std::move(sfinder)),
83  ipEst(est) {}
84 
86  vfitter_t vertexFitter;
87 
90 
92  sfinder_t seedFinder;
93 
96 
105  int maxVertices = 50;
106 
109  bool createSplitVertices = false;
115  bool doMaxTracksCut = false;
116  int maxTracks = 5000;
117  double cutOffTrackWeight = 0.01;
121  };
122 
124  struct State {
126  const Acts::MagneticFieldContext& magContext)
127  : ipState(field.makeCache(magContext)),
128  linearizerState(field.makeCache(magContext)),
129  fitterState(field.makeCache(magContext)) {}
131  typename IPEstimator::State ipState;
133  typename Linearizer_t::State linearizerState;
135  typename vfitter_t::State fitterState;
136  };
137 
142  template <
143  typename T = InputTrack_t,
146  std::unique_ptr<const Logger> logger = getDefaultLogger(
147  "IterativeVertexFinder", Logging::INFO))
148  : m_cfg(std::move(cfg)),
149  m_extractParameters([](T params) { return params; }),
151 
160  std::function<BoundTrackParameters(InputTrack_t)> func,
161  std::unique_ptr<const Logger> logger = getDefaultLogger(
162  "IterativeVertexFinder", Logging::INFO))
163  : m_cfg(std::move(cfg)),
164  m_extractParameters(func),
165  m_logger(std::move(logger)) {}
166 
175  const std::vector<const InputTrack_t*>& trackVector,
176  const VertexingOptions<InputTrack_t>& vertexingOptions,
177  State& state) const;
178 
179  private:
181  const Config m_cfg;
182 
186  std::function<BoundTrackParameters(InputTrack_t)> m_extractParameters;
187 
189  std::unique_ptr<const Logger> m_logger;
190 
192  const Logger& logger() const { return *m_logger; }
193 
199  const std::vector<const InputTrack_t*>& seedTracks,
200  const VertexingOptions<InputTrack_t>& vertexingOptions) const;
201 
206  void removeTracks(const std::vector<const InputTrack_t*>& tracksToRemove,
207  std::vector<const InputTrack_t*>& seedTracks) const;
208 
218  const BoundTrackParameters& params, const Vertex<InputTrack_t>& vertex,
219  const Surface& perigeeSurface,
220  const VertexingOptions<InputTrack_t>& vertexingOptions,
221  State& state) const;
222 
234  std::vector<const InputTrack_t*>& tracksToFit,
235  std::vector<const InputTrack_t*>& seedTracks,
236  const VertexingOptions<InputTrack_t>& vertexingOptions,
237  State& state) const;
238 
248  const std::vector<const InputTrack_t*>& seedTracks,
249  const Vertex<InputTrack_t>& seedVertex,
250  std::vector<const InputTrack_t*>& tracksToFitOut,
251  std::vector<const InputTrack_t*>& tracksToFitSplitVertexOut,
252  const VertexingOptions<InputTrack_t>& vertexingOptions,
253  State& state) const;
254 
268  std::vector<Vertex<InputTrack_t>>& vertexCollection,
269  Vertex<InputTrack_t>& currentVertex,
270  std::vector<const InputTrack_t*>& tracksToFit,
271  std::vector<const InputTrack_t*>& seedTracks,
272  const std::vector<const InputTrack_t*>& origTracks,
273  const VertexingOptions<InputTrack_t>& vertexingOptions,
274  State& state) const;
275 
281  int countSignificantTracks(const Vertex<InputTrack_t>& vtx) const;
282 };
283 
284 } // namespace Acts
285 
286 #include "IterativeVertexFinder.ipp"