Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GridDensityVertexFinder.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GridDensityVertexFinder.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 <map>
20 
21 namespace Acts {
22 
34 template <int mainGridSize = 2000, int trkGridSize = 15,
35  typename vfitter_t = DummyVertexFitter<>>
37  // Assert odd trkGridSize
38  static_assert(trkGridSize % 2);
39  // Assert bigger main grid than track grid
40  static_assert(mainGridSize > trkGridSize);
41 
42  using InputTrack_t = typename vfitter_t::InputTrack_t;
44 
45  public:
48 
50  struct Config {
52  Config(float zMinMax = 100)
53  : gridDensity(typename GridDensity::Config(zMinMax)) {}
55  Config(const GridDensity& gDensity) : gridDensity(gDensity) {}
56 
57  // The grid density object
59 
60  // Cache the main grid and the density contributions (trackGrid and z-bin)
61  // for every single track.
62  // This option enables the possibility to calculate the entire main grid
63  // only once in the first iteration. If tracks are removed from the track
64  // collection, the individual track density contributions to the main grid
65  // can just be removed without calculating the entire grid from scratch.
67 
68  // Maximum d0 impact parameter significance to use a track
69  double maxD0TrackSignificance = 3.5;
70  // Maximum z0 impact parameter significance to use a track
71  double maxZ0TrackSignificance = 12.;
72  // The actual corresponding cut values in the algorithm
75  bool estimateSeedWidth = false;
76  };
77 
81  struct State {
82  // The main density grid
83  MainGridVector mainGrid = MainGridVector::Zero();
84  // Map to store z-bin and track grid (i.e. the density contribution of
85  // a single track to the main grid) for every single track
86  std::map<const InputTrack_t*, std::pair<int, TrackGridVector>>
88 
89  // Map to store bool if track has passed track selection or not
90  std::map<const InputTrack_t*, bool> trackSelectionMap;
91 
92  // Store tracks that have been removed from track collection. These
93  // track will be removed from the main grid
94  std::vector<const InputTrack_t*> tracksToRemove;
95 
96  bool isInitialized = false;
97  };
98 
110  const std::vector<const InputTrack_t*>& trackVector,
111  const VertexingOptions<InputTrack_t>& vertexingOptions,
112  State& state) const;
113 
117  template <
118  typename T = InputTrack_t,
121  : m_cfg(cfg), m_extractParameters([](T params) { return params; }) {}
122 
125  template <
126  typename T = InputTrack_t,
129  : m_extractParameters([](T params) { return params; }) {}
130 
138  const Config& cfg,
139  const std::function<BoundTrackParameters(InputTrack_t)>& func)
140  : m_cfg(cfg), m_extractParameters(func) {}
141 
148  const std::function<BoundTrackParameters(InputTrack_t)>& func)
149  : m_extractParameters(func) {}
150 
151  private:
157  bool doesPassTrackSelection(const BoundTrackParameters& trk) const;
158 
159  // The configuration object
160  const Config m_cfg;
161 
165  std::function<BoundTrackParameters(InputTrack_t)> m_extractParameters;
166 };
167 
168 } // namespace Acts
169