Belle II Software development
CutSelector.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/CutSelector.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, cut_selector)
21 {
23
24 int a = 1;
25 double b = 2, c = 3, d = 4, e = 5;
26
27 std::vector<WeightedRelation<int, const double>> relations = {
32 };
33
34 selector.setCutValue(1.0);
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[1].getWeight(), 1.0);
44 }
45}
Selector to remove all weighted relations with a weight below a certain cut value.
Definition: CutSelector.h:43
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