# File GaussianTrackDensity.hpp¶

namespace Acts

Note

This file is foreseen for the `Geometry` module to replace `Extent`

template<typename input_track_t>
class GaussianTrackDensity
#include <Acts/Vertexing/GaussianTrackDensity.hpp>

Class to model tracks as 2D density functions based on their d0 and z0 perigee parameters (mean value) and covariance matrices (determining the width of the function)

Public Functions

GaussianTrackDensity() = default

Default constructor.

inline GaussianTrackDensity(const Config &cfg)

Constructor with config.

double globalMaximum(State &state, const std::vector<const input_track_t*> &trackList, const std::function<BoundTrackParameters(input_track_t)> &extractParameters) const

Calculates the z position of the global maximum.

Parameters
• state – The track density state

• trackList – All input tracks

• extractParameters – Function extracting BoundTrackParameters from InputTrack

Returns

z position of the global maximum

std::pair<double, double> globalMaximumWithWidth(State &state, const std::vector<const input_track_t*> &trackList, const std::function<BoundTrackParameters(input_track_t)> &extractParameters) const

Calculates z position of global maximum with Gaussian width for density function.

Strategy: The global maximum must be somewhere near a track. Since we can calculate the first and second derivatives, at each point we can determine a) whether the function is curved up (minimum) or down (maximum) b) the distance to nearest maximum, assuming either Newton (parabolic) or Gaussian local behavior. For each track where the second derivative is negative, find step to nearest maximum, take that step and then do one final refinement. The largest density encountered in this procedure (after checking all tracks) is considered the maximum.

Parameters
• state – The track density state

• trackList – All input tracks

• extractParameters – Function extracting BoundTrackParameters from InputTrack

Returns

Pair of position of global maximum and Gaussian width

Private Functions

Result<void> addTracks(State &state, const std::vector<const input_track_t*> &trackList, const std::function<BoundTrackParameters(input_track_t)> &extractParameters) const

Add a track to the set being considered.

Parameters
• state – The track density state

• trackList – All input tracks

• extractParameters – Function extracting BoundTrackParameters from InputTrack

double stepSize(double y, double dy, double ddy) const

Calculates the step size.

Parameters
• y – Position value

• dy – First derivative

• ddy – Second derivative

Returns

The step size

std::tuple<double, double, double> trackDensityAndDerivatives(State &state, double z) const

Evaluate the density function and its two first derivatives at the specified coordinate along the beamline.

Parameters
• state – The track density state

• z – z-position along the beamline

Returns

Track density, first and second derivatives

std::tuple<double, double, double> updateMaximum(double newZ, double newValue, double newSecondDerivative, double maxZ, double maxValue, double maxSecondDerivative) const

Update the current maximum values.

Parameters
• newZ – The new z value

• newValue – The new value at z position

• newSecondDerivative – The new second derivative

• maxZ – Maximum z value, will be compared against `newZ`

• maxValue – Maximum value

• maxSecondDerivative – Maximum of the second derivative

Returns

The max z position, the max value at z position, the max second derivative

Private Members

Config m_cfg

The configuration.

struct Config
#include <Acts/Vertexing/GaussianTrackDensity.hpp>

The Config struct.

Public Functions

inline Config(double d0Sig = 3.5, double z0Sig = 12.)

Public Members

double d0MaxSignificance
double d0SignificanceCut
bool isGaussianShaped = true
double z0MaxSignificance
double z0SignificanceCut
class GaussianTrackDensityStore

Public Functions

inline GaussianTrackDensityStore(double z_coordinate)
inline std::tuple<double, double, double> densityAndDerivatives() const

Private Members

double m_density = {0}
double m_firstDerivative = {0}
double m_secondDerivative = {0}
double m_z
struct State
#include <Acts/Vertexing/GaussianTrackDensity.hpp>

The State struct.

Public Functions

inline State(unsigned int nTracks)

Public Members

std::vector<TrackEntry> trackEntries
struct TrackEntry
#include <Acts/Vertexing/GaussianTrackDensity.hpp>

Struct to store information for a single track.

Public Functions

TrackEntry() = default

Default constructor.

inline TrackEntry(double z_, double c0_, double c1_, double c2_, double lowerBound_, double upperBound_)

Constructor initializing all members.

Parameters
• z_ – Trial z position

• c0_ – z-independent term in exponent

• c1_ – Linear coefficient in exponent

• c2_ – Quadratic coefficient in exponent

• lowerBound_ – The lower bound

• upperBound_ – The upper bound

Public Members

double c0 = 0
double c1 = 0
double c2 = 0
double lowerBound = 0
double upperBound = 0
double z = 0