Belle II Software  release-05-02-19
CellularPathFollower< ACellHolder > Class Template Reference

Implements to pick up of the highest value path in neighborhood Following high value paths can be done two ways. More...

#include <CellularPathFollower.h>

Public Member Functions

std::vector< Path< ACellHolder > > followAll (const std::vector< ACellHolder * > &cellHolders, const std::vector< WeightedRelation< ACellHolder >> &cellHolderRelations, Weight minStateToFollow=-INFINITY) const
 Follow paths from all start cells marked with the start flag.
 
Path< ACellHolder > followSingle (ACellHolder *startCellHolder, const std::vector< WeightedRelation< ACellHolder >> &cellHolderRelations, Weight minStateToFollow=-INFINITY) const
 Follows a single maximal path starting with the given start cell. More...
 

Private Member Functions

void growAllPaths (Path< ACellHolder > &path, const std::vector< WeightedRelation< ACellHolder >> &cellHolderRelations, std::vector< Path< ACellHolder > > &paths) const
 Helper function for recursively growing paths. More...
 

Static Private Member Functions

static bool validStartCell (const AutomatonCell &automatonCell, Weight minStateToFollow)
 Helper function to determine, if the cell has all flags indicating to be a start cell and that its state exceeds the minimal requirement.
 
static bool isHighestContinuation (const WeightedRelation< ACellHolder > &relation)
 Helper function determining if the given neighbor is one of the best to be followed. More...
 
static bool isHighestContinuation (ACellHolder &cellHolder, Weight relationWeight, ACellHolder &neighborCellHolder)
 Helper function determining if the given neighbor is one of the best to be followed. More...
 

Detailed Description

template<class ACellHolder>
class Belle2::TrackFindingCDC::CellularPathFollower< ACellHolder >

Implements to pick up of the highest value path in neighborhood Following high value paths can be done two ways.

First construct a single path that has the highest value of all. This carried out by follow single which uses the highest cell returned by the cellular automaton. Second construct all paths which are maximal. A maximal path means that there is no longer path including this path. If there are many disjoint paths this is the way to get them. However you most certainly pick up a lot of elements twice if there are many start culminating into a common long path. This is carried out recursively by followAll over the start cells marked with start flag.

Definition at line 48 of file CellularPathFollower.h.

Member Function Documentation

◆ followSingle()

Path<ACellHolder> followSingle ( ACellHolder *  startCellHolder,
const std::vector< WeightedRelation< ACellHolder >> &  cellHolderRelations,
Weight  minStateToFollow = -INFINITY 
) const
inline

Follows a single maximal path starting with the given start cell.

If the start cell is nullptr or has a state lower than the minimum state to follow an empty vector is returned.

Definition at line 91 of file CellularPathFollower.h.

100  {
101  grew = false;
102  ACellHolder* cellHolder = path.back();
103 
104  auto continuations = asRange(std::equal_range(cellHolderRelations.begin(),
105  cellHolderRelations.end(),
106  cellHolder));
107 
108  for (const WeightedRelation<ACellHolder>& relation : continuations) {
109  // cppcheck-suppress useStlAlgorithm
110  if (isHighestContinuation(relation)) {
111  ACellHolder* neighbor = relation.getTo();
112  path.push_back(neighbor);
113  grew = true;
114  break;
115  }
116  }
117  }
118  return path;
119  }
120 
121  private:

◆ growAllPaths()

void growAllPaths ( Path< ACellHolder > &  path,
const std::vector< WeightedRelation< ACellHolder >> &  cellHolderRelations,
std::vector< Path< ACellHolder > > &  paths 
) const
inlineprivate

Helper function for recursively growing paths.

Parameters
[in]pathCurrent path to be extended
[in]cellHolderNeighborhoodConsidered relations to follow to extend the path
[out]pathsLongest paths generated

Definition at line 136 of file CellularPathFollower.h.

◆ isHighestContinuation() [1/2]

static bool isHighestContinuation ( ACellHolder &  cellHolder,
Weight  relationWeight,
ACellHolder &  neighborCellHolder 
)
inlinestaticprivate

Helper function determining if the given neighbor is one of the best to be followed.

Since this is an algebraic property no comparision to the other alternatives is necessary.

Definition at line 200 of file CellularPathFollower.h.

◆ isHighestContinuation() [2/2]

static bool isHighestContinuation ( const WeightedRelation< ACellHolder > &  relation)
inlinestaticprivate

Helper function determining if the given neighbor is one of the best to be followed.

Since this is an algebraic property on comparision to the other alternatives is necessary.

Definition at line 182 of file CellularPathFollower.h.


The documentation for this class was generated from the following file:
Belle2::TrackFindingCDC::CellularPathFollower::isHighestContinuation
static bool isHighestContinuation(const WeightedRelation< ACellHolder > &relation)
Helper function determining if the given neighbor is one of the best to be followed.
Definition: CellularPathFollower.h:182