Belle II Software development
overlapMatrixCreator.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/trackSetEvaluator/OverlapMatrixCreator.h>
12
13using namespace std;
14using namespace Belle2;
15
16
18class OverlapMatrixCreatorTest : public ::testing::Test {
19protected:
21 vector<vector <unsigned short> > hitRelatedTracks =
22 //hit 0 1 2 3 4 5 6 7 8 9
23 {{1, 2, 3}, {0, 5, 7}, {5}, {1, 5, 9}, {1}, {4}, {4}, {7, 8, 9}, {8}, {0, 1}};
25 vector<vector <unsigned short> > smallOverlapTestMatrix =
26 //track 0 1 2 3 4 5 6 7 8 9
27 {{1, 5, 7}, {0, 2, 3, 5, 9}, {1, 3}, {1, 2}, {}, {0, 1, 7, 9}, {}, {0, 5, 8, 9}, {7, 9}, {1, 5, 7, 8}};
28
30 vector<vector <unsigned short> > hitRelatedTracks2 =
31 {{0, 1, 2, 3}, {1, 2, 3}, {3, 4, 5, 6}, {2, 4}, {3, 5}};
33 vector<vector <unsigned short> > allowOneOverlapTestMatrix =
34 {{}, {2, 3}, {1, 3}, {1, 2, 5}, {}, {3}, {}};
35
37 vector<vector <unsigned short> > hitRelatedTracks3 =
38 {{0, 1, 2, 3}, {1, 2, 3}, {3, 4, 5, 6}, {2, 3, 4}, {3, 5}};
40 vector<vector <unsigned short> > allowTwoOverlapTestMatrix =
41 {{}, {}, {3}, {2}, {}, {}, {}};
42};
43
44TEST_F(OverlapMatrixCreatorTest, TestGetter)
45{
46 OverlapMatrixCreator overlapMatrixCreator(hitRelatedTracks, 10);
47 EXPECT_EQ(smallOverlapTestMatrix, overlapMatrixCreator.getOverlapMatrix());
48
49 OverlapMatrixCreator overlapMatrixCreator2(hitRelatedTracks2, 7);
50 EXPECT_EQ(allowOneOverlapTestMatrix, overlapMatrixCreator2.getOverlapMatrix(1));
51
52 OverlapMatrixCreator overlapMatrixCreator3(hitRelatedTracks3, 7);
53 EXPECT_EQ(allowTwoOverlapTestMatrix, overlapMatrixCreator3.getOverlapMatrix(2));
54}
Creates a vector of vectors, that knows which track is conflicting with which other.
Test the overlap-matrix creator using known input.
vector< vector< unsigned short > > hitRelatedTracks2
Another hitRelatedTracks matrix with multiple double overlaps:
vector< vector< unsigned short > > hitRelatedTracks
A hitRelatedTracks matrix for Testing purposes:
vector< vector< unsigned short > > allowOneOverlapTestMatrix
and its overlap matrix which allows for 1 cluster overlaps
vector< vector< unsigned short > > hitRelatedTracks3
This time, we want to check for double overlaps.
vector< vector< unsigned short > > allowTwoOverlapTestMatrix
and its overlap matrix which allows for 2 cluster overlaps
vector< vector< unsigned short > > smallOverlapTestMatrix
Corresponding overlap matrix for testing purposes: [assumes sorting].
Abstract base class for different kinds of events.
STL namespace.