Belle II Software development
NodeFamilyDefiner.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
9#include <gtest/gtest.h>
10
11#include <tracking/trackFindingVXD/segmentNetwork/DirectedNode.h>
12#include <tracking/trackFindingVXD/segmentNetwork/DirectedNodeNetwork.h>
13
14#include <tracking/trackFindingVXD/segmentNetwork/CACell.h>
15
16#include <tracking/trackFindingVXD/algorithms/NodeCompatibilityCheckerPathCollector.h>
17#include <tracking/trackFindingVXD/algorithms/NodeFamilyDefiner.h>
18
19#include <array>
20#include <iostream>
21
22
23using namespace std;
24using namespace Belle2;
25
30namespace NodeFamilyTests {
31
33 TEST(NodeFamilyDefinerTest, TestNodeFamiliesUsingDirectedNodeNetworkInt)
34 {
35 // just some input for testing (same as in DirectedNodeNetwork-tests):
36 std::array<int, 5> intArray = { { 1, 5, 3, 4, 2} };
37 std::array<int, 5> intArray2 = { { 0, 3, 4, 6, 7} };
38 std::array<int, 5> intArray3 = { { 99, 101, 103, 104, 105} };
39 std::array<int, 3> intArray4 = { { 100, 101, 102} };
42 EXPECT_EQ(0, intNetwork.size());
43
44 // filling network:
45 for (unsigned int index = 1 ; index < 5; index++) {
46 // correct order: outerEntry, innerEntry:
47 intNetwork.addNode(intArray.at(index - 1), intArray.at(index - 1));
48 intNetwork.addNode(intArray.at(index), intArray.at(index));
49
50 intNetwork.linkNodes(intArray.at(index - 1), intArray.at(index));
51 }
52
53 for (unsigned int index = 1 ; index < 5; index++) {
54 intNetwork.addNode(intArray2.at(index - 1), intArray2.at(index - 1));
55 intNetwork.addNode(intArray2.at(index), intArray2.at(index));
56
57 intNetwork.linkNodes(intArray2.at(index - 1), intArray2.at(index));
58 }
59
60 for (unsigned int index = 1 ; index < 5; index++) {
61 intNetwork.addNode(intArray3.at(index - 1), intArray3.at(index - 1));
62 intNetwork.addNode(intArray3.at(index), intArray3.at(index));
63
64 intNetwork.linkNodes(intArray3.at(index - 1), intArray3.at(index));
65 }
66
67 for (unsigned int index = 1 ; index < 3; index++) {
68 intNetwork.addNode(intArray4.at(index - 1), intArray4.at(index - 1));
69 intNetwork.addNode(intArray4.at(index), intArray4.at(index));
70
71 intNetwork.linkNodes(intArray4.at(index - 1), intArray4.at(index));
72 }
73
74 // filling network - end.
75 EXPECT_EQ(15, intNetwork.size());
76
80 std::vector<DirectedNode<int, CACell>* >> familyDefiner;
81
82 short nFamilies = familyDefiner.defineFamilies(intNetwork);
83
84 EXPECT_EQ(2, nFamilies);
85 }
86}
Network of directed nodes of the type EntryType.
unsigned int size() const
Returns number of nodes to be found in the network.
bool linkNodes(NodeID outerNodeID, NodeID innerNodeID)
takes two entry IDs and weaves them into the network
bool addNode(NodeID nodeID, EntryType &newEntry)
************************* PUBLIC MEMBER FUNCTIONS *************************
The Node-Class.
Definition: DirectedNode.h:31
This class assigns a common family identifier to all CACells in the network that are connected.
Abstract base class for different kinds of events.
These tests cover the functionality of the classes: DirectedNode, DirectedNodeNetwork.
STL namespace.