10 #include <tracking/trackFindingCDC/ca/Path.h> 
   11 #include <tracking/trackFindingCDC/ca/AutomatonCell.h> 
   13 #include <tracking/trackFindingCDC/utilities/WeightedRelation.h> 
   25   namespace TrackFindingCDC {
 
   37     template<
class ACellHolder>
 
   43                                     const std::vector<ACellHolder*>& cellHolders,
 
   45                                     Weight minStateToFollow = -INFINITY)
 const 
   47         B2ASSERT(
"Expected the relations to be sorted",
 
   48                  std::is_sorted(cellHolderRelations.begin(), cellHolderRelations.end()));
 
   51         std::vector<Path<ACellHolder> > paths;
 
   54         Path<ACellHolder> path;
 
   56         for (ACellHolder* cellHolder : cellHolders) {
 
   57           const AutomatonCell& automatonCell = cellHolder->getAutomatonCell();
 
   66             path.push_back(cellHolder);
 
   83                                      Weight minStateToFollow = -INFINITY)
 const 
   85         assert(std::is_sorted(cellHolderRelations.begin(), cellHolderRelations.end()));
 
   87         Path<ACellHolder> path;
 
   88         if (not startCellHolder) 
return path;
 
   89         const AutomatonCell& startCell = startCellHolder->getAutomatonCell();
 
   96         path.push_back(startCellHolder);
 
  100           ACellHolder* cellHolder = path.back();
 
  102           auto continuations = asRange(std::equal_range(cellHolderRelations.begin(),
 
  103                                                         cellHolderRelations.end(),
 
  109               ACellHolder* neighbor = relation.getTo();
 
  110               path.push_back(neighbor);
 
  128                         std::vector<Path<ACellHolder> >& paths)
 const 
  132           ACellHolder* neighbor(neighborRelation.getTo());
 
  133           path.push_back(neighbor);
 
  139         ACellHolder* lastCellHolder = path.back();
 
  141         auto continuations = asRange(std::equal_range(cellHolderRelations.begin(),
 
  142                                                       cellHolderRelations.end(),
 
  144         int nRelationsUsed = std::count_if(continuations.begin(),
 
  148         if (nRelationsUsed == 0) {
 
  150           paths.push_back(path);
 
  159                                  Weight minStateToFollow)
 
  174         ACellHolder* cellHolderPtr(relation.
getFrom());
 
  175         ACellHolder* neighborCellHolderPtr(relation.
getTo());
 
  177         if (not cellHolderPtr or not neighborCellHolderPtr) 
return false;
 
  179         ACellHolder& cellHolder = *cellHolderPtr;
 
  180         Weight relationWeight = relation.
getWeight();
 
  181         ACellHolder& neighborCellHolder = *neighborCellHolderPtr;
 
  191                                         Weight relationWeight,
 
  192                                         ACellHolder& neighborCellHolder)
 
  194         const AutomatonCell& automatonCell = cellHolder.getAutomatonCell();
 
  195         const AutomatonCell& neighborAutomatonCell = neighborCellHolder.getAutomatonCell();
 
Cell used by the cellular automata.
bool hasCycleFlag() const
Gets the current state of the cycle marker flag.
bool hasStartFlag() const
Gets the current state of the start marker flag.
bool hasMaskedFlag() const
Gets the current state of the masked marker flag.
Weight getCellWeight() const
Getter for the cell weight.
Weight getCellState() const
Getter for the cell state.
Implements to pick up of the highest value path in neighborhood Following high value paths can be don...
void growAllPaths(Path< ACellHolder > &path, const std::vector< WeightedRelation< ACellHolder >> &cellHolderRelations, std::vector< Path< ACellHolder > > &paths) const
Helper function for recursively growing paths.
static bool isHighestContinuation(ACellHolder &cellHolder, Weight relationWeight, ACellHolder &neighborCellHolder)
Helper function determining if the given neighbor is one of the best to be followed.
static bool isHighestContinuation(const WeightedRelation< ACellHolder > &relation)
Helper function determining if the given neighbor is one of the best to be followed.
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.
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 st...
Type for two related objects with a weight.
Weight getWeight() const
Getter for the weight.
To * getTo() const
Getter for the pointer to the to side object.
From * getFrom() const
Getter for the pointer to the from side object.
Abstract base class for different kinds of events.