Belle II Software  release-05-01-25
CellularPathFollower.test.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost <oliver.frost@desy.de> *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <gtest/gtest.h>
11 
12 #include <tracking/trackFindingCDC/ca/MultipassCellularPathFinder.h>
13 #include <tracking/trackFindingCDC/ca/WithAutomatonCell.h>
14 
15 #include <utility>
16 
17 using namespace Belle2;
18 using namespace TrackFindingCDC;
19 
20 TEST(TrackFindingCDCTest, CellularPathFollower_followSingle)
21 {
22  using Element = WithAutomatonCell<std::pair<int, int> >;
23  Element startElement(std::make_pair(1, 1));
24  startElement.getAutomatonCell().setCellWeight(1);
25 
26  Element secondElement(std::make_pair(1, 1));
27  secondElement.getAutomatonCell().setCellWeight(1);
28 
29  std::vector<WeightedRelation<Element>> relations;
30  relations.emplace_back(&startElement, 1, &secondElement);
31 
32  // Mimic execution of the cellular automaton
33  startElement.getAutomatonCell().setStartFlag();
34  startElement.getAutomatonCell().setCellState(3);
35  startElement.getAutomatonCell().setAssignedFlag();
36 
37  secondElement.getAutomatonCell().setCellState(1);
38  secondElement.getAutomatonCell().setAssignedFlag();
39 
40  CellularPathFollower<Element> cellularPathFollower;
41  const std::vector<Element*> elementPath =
42  cellularPathFollower.followSingle(&startElement, relations, -INFINITY);
43  EXPECT_EQ(2, elementPath.size());
44  EXPECT_EQ(&startElement, elementPath.front());
45  EXPECT_EQ(&secondElement, elementPath.back());
46 }
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TEST
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Definition: utilityFunctions.cc:18