Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AdaptiveGridDensityVertexFinder.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AdaptiveGridDensityVertexFinder.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 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 
18 
19 #include <unordered_map>
20 
21 namespace Acts {
22 
36 template <int trkGridSize = 15, typename vfitter_t = DummyVertexFitter<>>
38  // Assert odd trkGridSize
39  static_assert(trkGridSize % 2);
40 
41  using InputTrack_t = typename vfitter_t::InputTrack_t;
43 
44  public:
46 
48  struct Config {
50  Config(float binSize = 0.1)
51  : gridDensity(typename GridDensity::Config(binSize)) {}
53  Config(const GridDensity& gDensity) : gridDensity(gDensity) {}
54 
55  // The grid density object
57 
58  // Cache the main grid and the density contributions (trackGrid and z-bin)
59  // for every single track.
60  // This option enables the possibility to calculate the entire main grid
61  // only once in the first iteration. If tracks are removed from the track
62  // collection, the individual track density contributions to the main grid
63  // can just be removed without calculating the entire grid from scratch.
65 
66  // Maximum d0 impact parameter significance to use a track
67  double maxD0TrackSignificance = 3.5;
68  // Maximum z0 impact parameter significance to use a track
69  double maxZ0TrackSignificance = 12.;
70  // The actual corresponding cut values in the algorithm
73  bool estimateSeedWidth = false;
74  };
75 
79  struct State {
80  // Map from the z bin values to the corresponding track density
82 
83  // Map from input track to corresponding track density map
84  std::unordered_map<const InputTrack_t*, DensityMap> trackDensities;
85 
86  // Map to store bool if track has passed track selection or not
87  std::unordered_map<const InputTrack_t*, bool> trackSelectionMap;
88 
89  // Store tracks that have been removed from track collection. These
90  // tracks will be removed from the main grid
91  std::vector<const InputTrack_t*> tracksToRemove;
92 
93  bool isInitialized = false;
94  };
95 
107  const std::vector<const InputTrack_t*>& trackVector,
108  const VertexingOptions<InputTrack_t>& vertexingOptions,
109  State& state) const;
110 
114  template <
115  typename T = InputTrack_t,
118  : m_cfg(cfg), m_extractParameters([](T params) { return params; }) {}
119 
122  template <
123  typename T = InputTrack_t,
126  : m_extractParameters([](T params) { return params; }) {}
127 
135  const Config& cfg,
136  const std::function<BoundTrackParameters(InputTrack_t)>& func)
137  : m_cfg(cfg), m_extractParameters(func) {}
138 
145  const std::function<BoundTrackParameters(InputTrack_t)>& func)
146  : m_extractParameters(func) {}
147 
148  private:
154  bool doesPassTrackSelection(const BoundTrackParameters& trk) const;
155 
156  // The configuration object
157  const Config m_cfg;
158 
162  std::function<BoundTrackParameters(InputTrack_t)> m_extractParameters;
163 };
164 
165 } // namespace Acts
166