File AdaptiveGridTrackDensity.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

template<int trkGridSize = 15>
class AdaptiveGridTrackDensity
#include <Acts/Vertexing/AdaptiveGridTrackDensity.hpp>

Implements a 1-dim density grid to be filled with track Gaussian distributions.

Each single track is modelled as a 2-dim Gaussian distribution grid in the d0-z0 plane, but only the overlap with the z-axis (i.e. a 1-dim density vector) needs to be calculated. The position of the highest track density (of either a single bin or the sum of a certain region) can be determined. Single tracks can be cached and removed from the overall density. Unlike the GaussianGridTrackDensity, the overall density vector grows adaptively with the tracks densities being added to the grid.

Template Parameters

trkGridSize – The 2-dim grid size of a single track, i.e. a single track is modelled as a (trkGridSize x trkGridSize) grid in the d0-z0 plane. Note: trkGridSize has to be an odd value.

Public Types

using DensityMap = std::unordered_map<int, float>

Public Functions

inline AdaptiveGridTrackDensity(const Config &cfg)
DensityMap addTrack(const BoundTrackParameters &trk, DensityMap &mainDensityMap) const

Adds a single track to the overall grid density.

Parameters
  • trk – The track to be added.

  • mainDensityMap – Map from z bins to corresponding track density.

Returns

The density map of the track that was added

int getBin(float value) const

Calculates the bin number corresponding to a d or z value.

Parameters

value – d or z value

Returns

Bin number

float getBinCenter(int bin) const

Calculates the bin center from the bin number.

Parameters

bin – Bin number

Returns

Bin center

Result<float> getMaxZPosition(DensityMap &densityMap) const

Returns the z position of maximum (surrounding) track density.

Parameters

densityMap – Map from z bins to corresponding track density

Returns

The z position of maximum track density

Result<std::pair<float, float>> getMaxZPositionAndWidth(DensityMap &densityMap) const

Returns the z position of maximum track density and the estimated width.

Parameters

densityMap – Map from z bins to corresponding track density

Returns

The z position of maximum track density and width

DensityMap::const_iterator highestDensityEntry(const DensityMap &densityMap) const

Finds the maximum density of a DensityMap.

Parameters

densityMap – Map between z bins and corresponding density value

Returns

Iterator of the map entry with the highest density value

void subtractTrack(const DensityMap &trackDensityMap, DensityMap &mainDensityMap) const

Removes a track from the overall grid density.

Note

The track density comes from a single track.

Note

The track density comes an arbitrary number of tracks.

Parameters
  • trackDensityMap – Map from z bins to corresponding track density.

  • mainDensityMap – Map from z bins to corresponding track density.

Private Functions

DensityMap createTrackGrid(float d0, float z0, int centralZBin, const Acts::SquareMatrix2 &cov) const

Function that creates a track density map, i.e., a map of z bins to corresponding density values coming from a single track.

Parameters
  • d0 – Transverse impact parameter

  • z0 – Longitudinal impact parameter

  • centralZBin – Central z bin of the track (where its density is the highest)

  • cov – 2x2 impact parameter covariance matrix

Result<float> estimateSeedWidth(const DensityMap &densityMap, float maxZ) const

Function that estimates the seed width based on the full width at half maximum (FWHM) of the maximum density peak.

Note

This only works if the maximum is sufficiently isolated since overlapping neighboring peaks might lead to an overestimation of the seed width.

Parameters
  • densityMap – Map from z bins to corresponding track density

  • maxZ – z-position of the maximum density value

Returns

The width

float getDensitySum(const DensityMap &densityMap, int zBin) const

Calculates the density sum of a z-bin and its two neighboring bins as needed for ‘highestDensitySumBin’.

Parameters
  • densityMap – Map between z bins and corresponding density value

  • zBin – The center z-bin whose neighbors we want to sum up

Returns

The sum

int highestDensitySumBin(DensityMap &densityMap) const

Checks the (up to) first three density maxima (only those that have a maximum relative deviation of ‘relativeDensityDev’ from the main maximum) and take the z-bin of the maximum with the highest surrounding density.

Parameters

densityMap – Map between z bins and corresponding density value

Returns

The z-bin position

float normal2D(float d, float z, const SquareMatrix2 &cov) const

Helper to retrieve values according to a 2-dim normal distribution.

Note

This function is defined in coordinate system centered around d0 and z0

Private Members

Config m_cfg
struct Config
#include <Acts/Vertexing/AdaptiveGridTrackDensity.hpp>

The configuration struct.

Public Functions

inline Config(float binSize_ = 0.1)
Parameters

binSize_ – The binSize in mm

Public Members

float binSize
float maxRelativeDensityDev = 0.01
bool useHighestSumZPosition = false