Analysis Software
Documentation for sPHENIX simulation 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:
37  using MainGridVector = Eigen::Matrix<float, mainGridSize, 1>;
38  using TrackGridVector = Eigen::Matrix<float, trkGridSize, 1>;
39 
41  struct Config {
47  Config(float zMinMax_ = 100) : zMinMax(zMinMax_) {
48  binSize = 2. * zMinMax / mainGridSize;
49  }
50  // Min and max z value of big grid
51  float zMinMax; // mm
52 
53  // Z size of one single bin in grid
54  float binSize; // mm
55 
56  // Do NOT use just the z-bin with the highest
57  // track density, but instead check the (up to)
58  // first three density maxima (only those that have
59  // a maximum relative deviation of 'relativeDensityDev'
60  // from the main maximum) and take the z-bin of the
61  // maximum with the highest surrounding density sum
62  bool useHighestSumZPosition = false;
63 
64  // The maximum relative density deviation from the main
65  // maximum to consider the second and third maximum for
66  // the highest-sum approach from above
67  float maxRelativeDensityDev = 0.01;
68  };
69 
71 
78 
86  MainGridVector& mainGrid) const;
87 
96  std::pair<int, TrackGridVector> addTrack(const BoundTrackParameters& trk,
97  MainGridVector& mainGrid) const;
98 
105  void removeTrackGridFromMainGrid(int zBin, const TrackGridVector& trkGrid,
106  MainGridVector& mainGrid) const;
107 
108  private:
115  void addTrackGridToMainGrid(int zBin, const TrackGridVector& trkGrid,
116  MainGridVector& mainGrid) const;
117 
126  void modifyMainGridWithTrackGrid(int zBin, const TrackGridVector& trkGrid,
127  MainGridVector& mainGrid,
128  int modifyModeSign) const;
129 
137  TrackGridVector createTrackGrid(float d0, float distCtrZ,
138  const Acts::SquareMatrix2& cov) const;
139 
150  Result<float> estimateSeedWidth(MainGridVector& mainGrid, float maxZ) const;
151 
154  float normal2D(float d, float z, const SquareMatrix2& cov) const;
155 
164  int getHighestSumZPosition(MainGridVector& mainGrid) const;
165 
173  double getDensitySum(const MainGridVector& mainGrid, int pos) const;
174 
176 };
177 
178 } // namespace Acts
179