Belle II Software  release-05-02-19
PathCollectorRecursive< ContainerType, NodeType, NeighbourContainerType, NodeCompatibilityCheckerType > Class Template Reference

Path finder for generic ContainerType. More...

#include <PathCollectorRecursive.h>

Public Types

using Path = std::vector< NodeType * >
 Using Path for vector of pointers to NodeTypes.
 

Public Member Functions

bool findPaths (ContainerType &aNetwork, std::vector< Path > &paths, unsigned int pathLimit, bool storeSubsets=false)
 Main functionality of this class Evaluates provided network and creates all allowed paths. More...
 

Static Public Member Functions

static std::string printPaths (std::vector< Path > &allPaths)
 Prints information about all paths provided in a vector of paths.
 

Public Attributes

unsigned int minPathLength = 2
 public Data members: More...
 
unsigned int nTrees = 0
 Counter for number of trees found.
 
unsigned int nRecursiveCalls = 0
 Counter for number of recursive calls.
 
bool m_storeSubsets = false
 flag if subsets should be stored or not
 

Protected Member Functions

Path clone (Path &aPath) const
 Copies path to create an identical one.
 
void storeAcceptedPath (Path newPath, std::vector< Path > &allNodePaths) const
 Tests length requirement on a path before adding it to path vector.
 
void findPathsRecursive (std::vector< Path > &allNodePaths, Path &currentPath, NeighbourContainerType &innerNeighbours)
 Recursive pathFinder: Collects all possible segment combinations to build paths.
 

Protected Attributes

NodeCompatibilityCheckerType m_compatibilityChecker
 protected Data members: More...
 

Detailed Description

template<class ContainerType, class NodeType, class NeighbourContainerType, class NodeCompatibilityCheckerType>
class Belle2::PathCollectorRecursive< ContainerType, NodeType, NeighbourContainerType, NodeCompatibilityCheckerType >

Path finder for generic ContainerType.

Uses recursive collection process and returns vector of paths, which are vectors of NodeType*.

Requirements for ContainerType:

  • must have begin() and end() with iterator pointing to pointers of entries ( = ContainerType< NodeType*>)

Requirements for NodeType:

  • must have function: bool NodeType::getMetaInfo().isSeed()
  • must have function: NeighbourContainerType& NodeType::getInnerNodes()
  • must have function: bool NodeType::getOuterNodes().empty()
  • other requirements depend on NodeCompatibilityCheckerType used.

Requirements for NeighbourContainerType:

  • must have function: bool NeighbourContainerType::empty()
  • must have function: unsigned int (or comparable) NeighbourContainerType::size()
  • must have access operator: NeighbourContainerType: operator [] returning a NodeType*

Requirements for NodeCompatibilityCheckerType:

  • must have function bool areCompatible(NodeType* outerNode, NodeType* innerNode);

Definition at line 54 of file PathCollectorRecursive.h.

Member Function Documentation

โ—† findPaths()

bool findPaths ( ContainerType &  aNetwork,
std::vector< Path > &  paths,
unsigned int  pathLimit,
bool  storeSubsets = false 
)
inline

Main functionality of this class Evaluates provided network and creates all allowed paths.

All found paths are filled into the provided vector 'paths'. If storeSubsets is turned on, also the sub-paths are saved to vector 'paths'. If a defined limit on the number of possible paths is exceeded, the search is aborted, and false is returned.

Definition at line 66 of file PathCollectorRecursive.h.

69  {
70  continue;
71  }
72  if (aNode->getOuterNodes().empty()) {
73  nTrees++;
74  }
75 
76  // creating unique_ptr of a new path:
77  Path newPath = Path{aNode};
78 
79  findPathsRecursive(allNodePaths, newPath, innerNeighbours);
80  storeAcceptedPath(newPath, allNodePaths);
81 
82  if (allNodePaths.size() > pathLimit) {
83  B2ERROR("Number of collected paths to large. Aborting Event!");
84  return false;
85  }
86  }
87  paths = allNodePaths;
88  return true;
89  }
90 
91 
93  static std::string printPaths(std::vector<Path>& allPaths)
94  {
95  std::stringstream out;
96  unsigned int longestPath = 0, longesPathIndex = 0, index = 0;
97  out << "Print " << allPaths.size() << " paths:";

Member Data Documentation

โ—† m_compatibilityChecker

NodeCompatibilityCheckerType m_compatibilityChecker
protected

protected Data members:

Stores mini-Class for checking compatibility of two nodes passed.

Definition at line 205 of file PathCollectorRecursive.h.

โ—† minPathLength

unsigned int minPathLength = 2

public Data members:

parameter for setting minimal path length: path length == number of nodes collected in a row from given network, this is not necessarily number of hits!

Definition at line 191 of file PathCollectorRecursive.h.


The documentation for this class was generated from the following file:
Belle2::PathCollectorRecursive::storeAcceptedPath
void storeAcceptedPath(Path newPath, std::vector< Path > &allNodePaths) const
Tests length requirement on a path before adding it to path vector.
Definition: PathCollectorRecursive.h:136
Belle2::PathCollectorRecursive::Path
std::vector< NodeType * > Path
Using Path for vector of pointers to NodeTypes.
Definition: PathCollectorRecursive.h:57
Belle2::PathCollectorRecursive::findPathsRecursive
void findPathsRecursive(std::vector< Path > &allNodePaths, Path &currentPath, NeighbourContainerType &innerNeighbours)
Recursive pathFinder: Collects all possible segment combinations to build paths.
Definition: PathCollectorRecursive.h:145
Belle2::PathCollectorRecursive::printPaths
static std::string printPaths(std::vector< Path > &allPaths)
Prints information about all paths provided in a vector of paths.
Definition: PathCollectorRecursive.h:101
Belle2::PathCollectorRecursive::nTrees
unsigned int nTrees
Counter for number of trees found.
Definition: PathCollectorRecursive.h:194