Belle II Software  release-05-01-25
BestMatchSelector.test.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <tracking/trackFindingCDC/collectors/selectors/BestMatchSelector.h>
12 
13 #include <tracking/trackFindingCDC/numerics/WeightComperator.h>
14 
15 #include <gtest/gtest.h>
16 
17 using namespace Belle2;
18 using namespace TrackFindingCDC;
19 
20 namespace {
22  TEST(TrackFindingCDCTest, best_match_selector)
23  {
24  BestMatchSelector<int, double> selector;
25 
26  int a = 1, b = 2;
27  double c = 3, d = 4, e = 5;
28 
29  std::vector<WeightedRelation<int, const double>> relations = {
30  WeightedRelation<int, const double>(&a, 1.0, &d),
31  WeightedRelation<int, const double>(&a, 1.1, &c),
32  WeightedRelation<int, const double>(&b, 0.8, &c),
33  WeightedRelation<int, const double>(&b, 0.6, &e)
34  };
35 
36  std::sort(relations.begin(), relations.end());
37  selector.apply(relations);
38 
39  std::sort(relations.begin(), relations.end(), GreaterWeight());
40 
41  ASSERT_EQ(relations.size(), 2);
42  ASSERT_EQ(relations[0].getWeight(), 1.1);
43  ASSERT_EQ(relations[0].getFrom(), &a);
44  ASSERT_EQ(relations[0].getTo(), &c);
45  ASSERT_EQ(relations[1].getWeight(), 0.6);
46  ASSERT_EQ(relations[1].getFrom(), &b);
47  ASSERT_EQ(relations[1].getTo(), &e);
48  }
49 }
prepareAsicCrosstalkSimDB.e
e
aux.
Definition: prepareAsicCrosstalkSimDB.py:53
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TEST
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Definition: utilityFunctions.cc:18