File CandidatesForMiddleSp.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

Note

this is foreseen for the ‘Geometry’ module

template<typename external_space_point_t>
class CandidatesForMiddleSp
#include <Acts/Seeding/CandidatesForMiddleSp.hpp>

The CandidatesForMiddleSp collects the triplet candidates given a fixed middle spacepoint.

It internally stores the triplet candidates keeping only those with the higher quality.

Template Parameters

external_space_point_t – The external spacepoint type.

Public Types

using value_type = TripletCandidate<external_space_point_t>

Public Functions

CandidatesForMiddleSp() = default

constructor

~CandidatesForMiddleSp() = default

Destructor.

void clear()

Clear the internal storage.

bool push(external_space_point_t &SpB, external_space_point_t &SpM, external_space_point_t &SpT, float weight, float zOrigin, bool isQuality)

Adding a new triplet candidate to the collection, should it satisfy the selection criteria.

Parameters
  • SpB – Bottom space point

  • SpM – Medium space point

  • SpT – Top space point

  • weight – The quality of the triplet candidate

  • zOrigin – The z-coordinate of the origin

  • isQuality – Whether the triplet candidate is high or low quality

Returns

whether the triplet candidate has been added or not to the collection

void setMaxElements(std::size_t n_low, std::size_t n_high)

Setting maximum number of candidates to keep.

Parameters
  • n_low – Maximum number of candidates in the low-quality collection

  • n_high – Maximum number of candidates in the high-quality collection

std::vector<value_type> storage()

Retrieve the triplet candidates, the resulting vector is already sorted, elements with higher quality first.

Returns

Vector of triplet candidates

Public Static Functions

static bool ascendingByQuality(const value_type &i1, const value_type &i2)

A function for sorting the triplet candidates from lower to higher quality.

Parameters
  • i1 – First triplet candidate

  • i2 – Second triplet candidate

Returns

The comparison result

static bool descendingByQuality(const value_type &i1, const value_type &i2)

A function for sorting the triplet candidates from higher to lower quality.

Parameters
  • i1 – First triplet candidate

  • i2 – Second triplet candidate

Returns

The comparison result

Private Functions

void addToCollection(std::vector<std::size_t> &indices, std::size_t &n, const std::size_t &n_max, value_type &&element)

Adding a new triplet candidate to the collection.

The function is called after the candidate has satisfied all the selection criteria

Parameters
  • indices – The collection

  • n – Current number of stored elements in the collection

  • n_max – The maximum number of elements that can be stored in the collection

  • element – The element that must be added to the collection

void bubbledw(std::vector<std::size_t> &indices, std::size_t n, std::size_t actual_size)

Move an element down in the min heap tree.

The function checks whether the elements’s weight is lower of its child’s weights. If so, it swaps the element with the child with the lowest weight. Reiterate the process untill the element is in the correct position on the tree

Parameters
  • indices – The collection

  • n – The index of the element to place in the correct position

  • actual_size – The current number of elements stored in the collection

void bubbleup(std::vector<std::size_t> &indices, std::size_t n)

Move an element up in the min heap tree.

The function checks whether the element’s weight is lower of its parent’s weight. If so, it swaps them. Reiterate the process untill the element is in the correct position on the tree

Parameters
  • indices – The collection

  • n – The index of the element to place in the correct position

bool exists(const std::size_t &n, const std::size_t &max_size) const

Check if an element exists in the collection.

The element to be checked is supposed to be in the n position of the collection.

Parameters
  • n – Index of the requested element

  • max_size – Number of elements currently stored in the collection

Returns

Whether the element exists

void pop(std::vector<std::size_t> &indices, std::size_t &current_size)

Pop an element from a collection.

The removal of the element from the collection does not imply its destruction. In fact, the number of stored elements is simply diminished by 1. The popped element is tecnically still available at the end of the collection.

Parameters
  • indices – The collection

  • current_size – The current number of element stored in the collection. The function will diminish this value by 1

bool push(std::vector<std::size_t> &indices, std::size_t &n, const std::size_t &n_max, external_space_point_t &SpB, external_space_point_t &SpM, external_space_point_t &SpT, float weight, float zOrigin, bool isQuality)

dding a new triplet candidate to the collection, should it satisfy the selection criteria

Parameters
  • indices – The collection into which the candidate should be stored

  • n – The current number of stored elements in the container

  • n_max – The maximum number of elements that can be stored in the container

  • SpB – The bottom space point

  • SpM – The middle space point

  • SpT – The top space point

  • weight – The quality of the triplet candidate

  • zOrigin – The z-coordinate of the origin

  • isQuality – Whether the triplet candidate is high or low quality

Returns

whether the triplet candidate has been added or not to the collection

float weight(const std::vector<std::size_t> &indices, std::size_t n) const

Return the weight for a candidate.

Parameters
  • indices – The collection in which the element is stored

  • n – Index of the element in the collection

Returns

The weight of the candidate

Private Members

std::vector<std::size_t> m_indices_high = {}
std::vector<std::size_t> m_indices_low = {}
std::size_t m_max_size_high = {0}
std::size_t m_max_size_low = {0}
std::size_t m_n_high = {0}
std::size_t m_n_low = {0}
std::vector<value_type> m_storage = {}
template<typename external_space_point_t>
struct TripletCandidate
#include <Acts/Seeding/CandidatesForMiddleSp.hpp>

A description of a triplet candidate.

Template Parameters

external_space_point_t – The external spacepoint type.

Public Functions

TripletCandidate() = default

Default Constructor.

inline TripletCandidate(external_space_point_t &b, external_space_point_t &m, external_space_point_t &t, float w, float z, bool q)

constructor

Parameters
  • b – The bottom space point

  • m – The middle space point

  • t – The top space point

  • w – The quality of the candidate

  • z – The z coordinate of the origin

  • q – Whether the candidate is high or low quality

TripletCandidate(const TripletCandidate&) = default

Copy operations.

TripletCandidate(TripletCandidate&&) = default

Move operations.

~TripletCandidate() = default

Default Destructor.

TripletCandidate &operator=(const TripletCandidate&) = default
TripletCandidate &operator=(TripletCandidate&&) = default

Public Members

external_space_point_t *bottom = {nullptr}
bool isQuality = {false}
external_space_point_t *middle = {nullptr}
external_space_point_t *top = {nullptr}
float weight = {0.}
float zOrigin = {0.}