Belle II Software  release-08-01-10
CellularPathFollower.test.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include <gtest/gtest.h>
9 
10 #include <tracking/trackFindingCDC/ca/MultipassCellularPathFinder.h>
11 #include <tracking/trackFindingCDC/ca/WithAutomatonCell.h>
12 
13 #include <utility>
14 
15 using namespace Belle2;
16 using namespace TrackFindingCDC;
17 
18 TEST(TrackFindingCDCTest, CellularPathFollower_followSingle)
19 {
20  using Element = WithAutomatonCell<std::pair<int, int> >;
21  Element startElement(std::make_pair(1, 1));
22  startElement.getAutomatonCell().setCellWeight(1);
23 
24  Element secondElement(std::make_pair(1, 1));
25  secondElement.getAutomatonCell().setCellWeight(1);
26 
27  std::vector<WeightedRelation<Element>> relations;
28  relations.emplace_back(&startElement, 1, &secondElement);
29 
30  // Mimic execution of the cellular automaton
31  startElement.getAutomatonCell().setStartFlag();
32  startElement.getAutomatonCell().setCellState(3);
33  startElement.getAutomatonCell().setAssignedFlag();
34 
35  secondElement.getAutomatonCell().setCellState(1);
36  secondElement.getAutomatonCell().setAssignedFlag();
37 
38  CellularPathFollower<Element> cellularPathFollower;
39  const std::vector<Element*> elementPath =
40  cellularPathFollower.followSingle(&startElement, relations, -INFINITY);
41  EXPECT_EQ(2, elementPath.size());
42  EXPECT_EQ(&startElement, elementPath.front());
43  EXPECT_EQ(&secondElement, elementPath.back());
44 }
Implements to pick up of the highest value path in neighborhood Following high value paths can be don...
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.
Mixin class to attach an automaton cell to an object or pointer.
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Abstract base class for different kinds of events.