Belle II Software  release-05-01-25
CutSelector.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/CutSelector.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, cut_selector)
23  {
24  CutSelector<int, double> selector;
25 
26  int a = 1;
27  double b = 2, c = 3, d = 4, e = 5;
28 
29  std::vector<WeightedRelation<int, const double>> relations = {
30  WeightedRelation<int, const double>(&a, 1.1, &b),
31  WeightedRelation<int, const double>(&a, 1.0, &c),
32  WeightedRelation<int, const double>(&a, 0.8, &d),
33  WeightedRelation<int, const double>(&a, NAN, &e)
34  };
35 
36  selector.setCutValue(1.0);
37 
38  std::sort(relations.begin(), relations.end());
39  selector.apply(relations);
40 
41  std::sort(relations.begin(), relations.end(), GreaterWeight());
42 
43  ASSERT_EQ(relations.size(), 2);
44  ASSERT_EQ(relations[0].getWeight(), 1.1);
45  ASSERT_EQ(relations[1].getWeight(), 1.0);
46  }
47 }
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