EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GaussianGridTrackDensity.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GaussianGridTrackDensity.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
13 
14 namespace Acts {
29 template <int mainGridSize = 2000, int trkGridSize = 15>
31  // Assert odd trkGridSize
32  static_assert(trkGridSize % 2);
33  // Assert bigger main grid than track grid
34  static_assert(mainGridSize > trkGridSize);
35 
36  public:
38  struct Config {
43  Config(float zMinMax_ = 100) : zMinMax(zMinMax_) {
44  binSize = 2. * zMinMax / mainGridSize;
45  }
46  // Min and max z value of big grid
47  float zMinMax; // mm
48 
49  // Z size of one single bin in grid
50  float binSize; // mm
51 
52  // Do NOT use just the z-bin with the highest
53  // track density, but instead check the (up to)
54  // first three density maxima (only those that have
55  // a maximum relative deviation of 'relativeDensityDev'
56  // from the main maximum) and take the z-bin of the
57  // maximum with the highest surrounding density sum
58  bool useHighestSumZPosition = false;
59 
60  // The maximum relative density deviation from the main
61  // maximum to consider the second and third maximum for
62  // the highest-sum approach from above
63  float maxRelativeDensityDev = 0.01;
64  };
65 
66  GaussianGridTrackDensity(const Config& cfg) : m_cfg(cfg) {}
67 
74 
82  ActsVectorF<mainGridSize>& mainGrid) const;
83 
92  std::pair<int, ActsVectorF<trkGridSize>> addTrack(
93  const BoundTrackParameters& trk,
94  ActsVectorF<mainGridSize>& mainGrid) const;
95 
102  void removeTrackGridFromMainGrid(int zBin,
103  const ActsVectorF<trkGridSize>& trkGrid,
104  ActsVectorF<mainGridSize>& mainGrid) const;
105 
106  private:
113  void addTrackGridToMainGrid(int zBin, const ActsVectorF<trkGridSize>& trkGrid,
114  ActsVectorF<mainGridSize>& mainGrid) const;
115 
124  void modifyMainGridWithTrackGrid(int zBin,
125  const ActsVectorF<trkGridSize>& trkGrid,
126  ActsVectorF<mainGridSize>& mainGrid,
127  int modifyModeSign) const;
128 
140  float distCtrD,
141  float distCtrZ) const;
142 
151  float maxZ) const;
152 
154  float normal2D(float d, float z, const SymMatrix2D& cov) const;
155 
165 
173  double getDensitySum(const ActsVectorF<mainGridSize>& mainGrid,
174  int pos) const;
175 
177 };
178 
179 } // namespace Acts
180