Belle II Software  release-05-01-25
FeasibleRLFacetFilter.test.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost <oliver.frost@desy.de> *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <gtest/gtest.h>
11 
12 #include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithTopology.h>
13 
14 #include <tracking/trackFindingCDC/filters/facet/FeasibleRLFacetFilter.h>
15 
16 #include <tracking/trackFindingCDC/eventdata/hits/CDCFacet.h>
17 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
18 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
19 
20 #include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
21 
22 #include <framework/utilities/TestHelpers.h>
23 
24 using namespace Belle2;
25 using namespace TrackFindingCDC;
26 
27 TEST_F(TrackFindingCDCTestWithTopology, filter_facet_FeasibleRLFacetFilter_accepts_long_para)
28 {
29  FeasibleRLFacetFilter filter;
30 
31  filter.initialize();
32  filter.beginRun();
33 
34  const CDCWireTopology& wireTopology = CDCWireTopology::getInstance();
35 
36  const CDCWire& aWire = wireTopology.getWire(0, 0, 0);
37  const CDCWire& bWire = wireTopology.getWire(0, 0, 1);
38  const CDCWire& cWire = wireTopology.getWire(0, 0, 3);
39 
40  const CDCWireHit aWireHit(aWire.getWireID(), 0.1);
41  const CDCWireHit bWireHit(bWire.getWireID(), 0.1);
42  const CDCWireHit cWireHit(cWire.getWireID(), 0.1);
43 
44  filter.beginEvent();
45 
46  std::vector<std::array<ERightLeft, 3> > acceptableRLs = {
47  { ERightLeft::c_Right, ERightLeft::c_Right, ERightLeft::c_Right,},
48  { ERightLeft::c_Right, ERightLeft::c_Right, ERightLeft::c_Left,},
49  { ERightLeft::c_Left, ERightLeft::c_Right, ERightLeft::c_Right,},
50  { ERightLeft::c_Left, ERightLeft::c_Left, ERightLeft::c_Left,},
51  { ERightLeft::c_Left, ERightLeft::c_Left, ERightLeft::c_Right,},
52  { ERightLeft::c_Right, ERightLeft::c_Left, ERightLeft::c_Left,},
53  };
54 
55  for (const std::array<ERightLeft, 3>& acceptableRL : acceptableRLs) {
56 
57  TEST_CONTEXT("For rl combination " << static_cast<int>(acceptableRL[0]) << ", "
58  << static_cast<int>(acceptableRL[1]) << ", "
59  << static_cast<int>(acceptableRL[2]));
60  CDCRLWireHit aRLWireHit(&aWireHit, acceptableRL[0]);
61  CDCRLWireHit bRLWireHit(&bWireHit, acceptableRL[1]);
62  CDCRLWireHit cRLWireHit(&cWireHit, acceptableRL[2]);
63  CDCFacet facet(aRLWireHit, bRLWireHit, cRLWireHit);
64  Weight weight = filter(facet);
65  EXPECT_TRUE(not std::isnan(weight));
66  }
67 
68  filter.endRun();
69  filter.terminate();
70 }
Belle2::TrackFindingCDC::CDCWireTopology::getInstance
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
Definition: CDCWireTopology.cc:22
Belle2::filter
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double >> &runs, double cut, std::map< ExpRun, std::pair< double, double >> &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
Definition: Splitter.cc:43
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TEST_F
TEST_F(GlobalLabelTest, LargeNumberOfTimeDependentParameters)
Test large number of time-dep params for registration and retrieval.
Definition: globalLabel.cc:65
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65