Belle II Software development
BestMatchSelector.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
9#include <tracking/trackFindingCDC/collectors/selectors/BestMatchSelector.h>
10
11#include <tracking/trackFindingCDC/numerics/WeightComperator.h>
12
13#include <gtest/gtest.h>
14
15using namespace Belle2;
16using namespace TrackFindingCDC;
17
18namespace {
20 TEST(TrackFindingCDCTest, best_match_selector)
21 {
23
24 int a = 1, b = 2;
25 double c = 3, d = 4, e = 5;
26
27 std::vector<WeightedRelation<int, const double>> relations = {
32 };
33
34 std::sort(relations.begin(), relations.end());
35 selector.apply(relations);
36
37 std::sort(relations.begin(), relations.end(), GreaterWeight());
38
39 ASSERT_EQ(relations.size(), 2);
40 ASSERT_EQ(relations[0].getWeight(), 1.1);
41 ASSERT_EQ(relations[0].getFrom(), &a);
42 ASSERT_EQ(relations[0].getTo(), &c);
43 ASSERT_EQ(relations[1].getWeight(), 0.6);
44 ASSERT_EQ(relations[1].getFrom(), &b);
45 ASSERT_EQ(relations[1].getTo(), &e);
46 }
47}
Selector to remove all relations in the list, which share the same collection item - except the one w...
Type for two related objects with a weight.
Abstract base class for different kinds of events.
Functor factory turning a binary functor and two functors into a new functor which executes the binar...
Definition: Functional.h:127