EIC 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 
17 
18 #include "DummyVertexFitter.hpp"
19 
20 namespace Acts {
21 
33 template <int mainGridSize = 2000, int trkGridSize = 15,
34  typename vfitter_t = DummyVertexFitter<>>
36  // Assert odd trkGridSize
37  static_assert(trkGridSize % 2);
38  // Assert bigger main grid than track grid
39  static_assert(mainGridSize > trkGridSize);
40 
41  using InputTrack_t = typename vfitter_t::InputTrack_t;
43 
44  public:
46  struct Config {
48  Config(float zMinMax = 100)
49  : gridDensity(typename GridDensity::Config(zMinMax)) {}
51  Config(const GridDensity& gDensity) : gridDensity(gDensity) {}
52 
53  // The grid density object
55 
56  // Cache the main grid and the density contributions (trackGrid and z-bin)
57  // for every single track.
58  // This option enables the possibility to calculate the entire main grid
59  // only once in the first iteration. If tracks are removed from the track
60  // collection, the individual track density contributions to the main grid
61  // can just be removed without calculating the entire grid from scratch.
63 
64  // Maximum d0 impact parameter significance to use a track
65  double maxD0TrackSignificance = 3.5;
66  // Maximum z0 impact parameter significance to use a track
67  double maxZ0TrackSignificance = 12.;
68  // The actual corresponding cut values in the algorithm
71  bool estimateSeedWidth = false;
72  };
73 
77  struct State {
78  // The main density grid
80  // Map to store z-bin and track grid (i.e. the density contribution of
81  // a single track to the main grid) for every single track
82  std::map<const InputTrack_t*, std::pair<int, ActsVectorF<trkGridSize>>>
84 
85  // Map to store bool if track has passed track selection or not
86  std::map<const InputTrack_t*, bool> trackSelectionMap;
87 
88  // Store tracks that have been removed from track collection. These
89  // track will be removed from the main grid
90  std::vector<const InputTrack_t*> tracksToRemove;
91 
92  bool isInitialized = false;
93  };
94 
106  const std::vector<const InputTrack_t*>& trackVector,
107  const VertexingOptions<InputTrack_t>& vertexingOptions,
108  State& state) const;
109 
113  template <
114  typename T = InputTrack_t,
117  : m_cfg(cfg), m_extractParameters([](T params) { return params; }) {}
118 
121  template <
122  typename T = InputTrack_t,
125  : m_extractParameters([](T params) { return params; }) {}
126 
134  const Config& cfg,
135  const std::function<BoundTrackParameters(InputTrack_t)>& func)
137 
144  const std::function<BoundTrackParameters(InputTrack_t)>& func)
146 
147  private:
153  bool doesPassTrackSelection(const BoundTrackParameters& trk) const;
154 
155  // The configuration object
156  const Config m_cfg;
157 
163  std::function<BoundTrackParameters(InputTrack_t)> m_extractParameters;
164 };
165 
166 } // namespace Acts
167