AnalysisTree
Loading...
Searching...
No Matches
AnalysisTree::Matching Class Reference

#include <Matching.hpp>

Collaboration diagram for AnalysisTree::Matching:
Collaboration graph

Public Member Functions

 Matching (size_t id1, size_t id2)
void AddMatch (Integer_t id1, Integer_t id2)
ANALYSISTREE_ATTR_NODISCARD MatchRange GetMatchesDirect (Integer_t id1) const
ANALYSISTREE_ATTR_NODISCARD MatchRange GetMatchesInverted (Integer_t id2) const
ANALYSISTREE_ATTR_NODISCARD MatchRange GetMatches (Integer_t id, bool is_inverted) const
ANALYSISTREE_ATTR_NODISCARD Integer_t GetMatchDirect (Integer_t id) const
ANALYSISTREE_ATTR_NODISCARD Integer_t GetMatchInverted (Integer_t id) const
ANALYSISTREE_ATTR_NODISCARD Integer_t GetMatch (Integer_t id, bool is_inverted=false) const
ANALYSISTREE_ATTR_NODISCARD size_t GetNumberOfPairs () const
ANALYSISTREE_ATTR_NODISCARD size_t GetNumberOfIds (bool is_inverted=false) const
void Clear ()
ANALYSISTREE_ATTR_NODISCARD size_t GetBranch1Id () const
ANALYSISTREE_ATTR_NODISCARD size_t GetBranch2Id () const

Protected Member Functions

void BuildInverse () const
void ConvertLegacy () const

Protected Attributes

size_t branch1_id_ {0}
size_t branch2_id_ {0}
std::vector< Integer_t > offsets_ {}
 partners of id1 are ids2_[offsets_[id1], offsets_[id1 + 1])
std::vector< Integer_t > ids2_ {}
 partner ids grouped by id1
std::map< Integer_t, Integer_t > match_ {}
 legacy (version <= 2): only filled when reading old files
std::map< Integer_t, Integer_t > match_inverted_ {}
 legacy (version <= 2): only filled when reading old files
std::vector< Integer_t > inv_offsets_ {}
std::vector< Integer_t > inv_ids1_ {}
 inverse CSR, built on first use
bool inverse_valid_ {false}

Detailed Description

A class for a matching information between channels of two branches (id1 of branch1, id2 of branch2).

All pairs are stored in CSR layout: the partners of id1 are ids2_[offsets_[id1], offsets_[id1 + 1]), in the order they were added. By convention the best partner is added first, GetMatch() returns it. The inverse direction (id2 -> id1) is not persisted, it is built on first use and ordered by id1. Ids are channel ids, i.e. indices in the Detector, and must be non-negative.

Member Function Documentation

◆ AddMatch()

void AnalysisTree::Matching::AddMatch ( Integer_t id1,
Integer_t id2 )

Adds a pair. Adding in increasing order of id1 is O(1), otherwise the pair is inserted in place.

◆ ConvertLegacy()

void AnalysisTree::Matching::ConvertLegacy ( ) const
protected

Moves the pairs of match_ and match_inverted_ (read from a file of version <= 2) into the CSR layout

◆ GetMatchDirect()

Integer_t AnalysisTree::Matching::GetMatchDirect ( Integer_t id) const

First partner of an object (inverted: smallest id1); UndefValueInt if there is none

◆ GetMatchesDirect()

MatchRange AnalysisTree::Matching::GetMatchesDirect ( Integer_t id1) const

All partners of an object; empty if there is none

◆ GetNumberOfIds()

size_t AnalysisTree::Matching::GetNumberOfIds ( bool is_inverted = false) const

Upper bound of the ids on the origin side: all ids with partners are smaller


The documentation for this class was generated from the following files: