Belle II Software  release-05-01-25
QuadTree.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: Thomas Hauth <thomas.hauth@kit.edu> *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithSimpleSimulation.h>
11 
12 #include <tracking/trackFindingCDC/legendre/quadtree/AxialHitQuadTreeProcessor.h>
13 #include <tracking/trackFindingCDC/legendre/precisionFunctions/PrecisionUtil.h>
14 
15 #include <vector>
16 #include <gtest/gtest.h>
17 
18 using namespace Belle2;
19 using namespace TrackFindingCDC;
20 
21 namespace {
22 
23  TEST_F(TrackFindingCDCTestWithSimpleSimulation, legendre_QuadTreeTest)
24  {
25  using XYSpans = AxialHitQuadTreeProcessor::XYSpans;
26  const int maxTheta = std::pow(2, PrecisionUtil::getLookupGridLevel());
27 
28  // high-pt candidate
29  XYSpans xySpans1({0, maxTheta}, {0., 0.15});
31 
32  // low-pt candidate
33  XYSpans xySpans2({0, maxTheta}, {0., 0.30});
35 
36  using Candidate = std::vector<const CDCWireHit*>;
37  std::vector<Candidate> candidates;
38 
39  this->loadPreparedEvent();
40  const int nMCTracks = m_mcTracks.size();
41 
42  auto candidateReceiver = [&candidates](const Candidate & candidate, void*) {
43  candidates.push_back(candidate);
44  };
45 
46  TimeItResult timeItResult = timeIt(100, true, [&]() {
47  candidates.clear();
48  for (const CDCWireHit* wireHit : m_axialWireHits) {
49  (*wireHit)->unsetTakenFlag();
50  (*wireHit)->unsetMaskedFlag();
51  }
52 
53  AxialHitQuadTreeProcessor qtProcessor1(13, 4, xySpans1, highPtPrecisionFunction);
54  qtProcessor1.seed(m_axialWireHits);
55 
56  // actual filling of the hits into the quad tree structure
57  qtProcessor1.fill(candidateReceiver, 30);
58 
59  AxialHitQuadTreeProcessor qtProcessor2(11, 1, xySpans2, lowPtPrecisionFunction);
60  qtProcessor2.seed(m_axialWireHits);
61 
62  // actual filling of the hits into the quad tree structure
63  qtProcessor2.fill(candidateReceiver, 30);
64  });
65  timeItResult.printSummary();
66 
67  // Check that the two tracks have been found.
68  ASSERT_EQ(nMCTracks, candidates.size());
69 
70  // Check for the parameters of the track candidates
71  // The actual hit numbers are more than 30, but this is somewhat a lower bound
72  EXPECT_GE(candidates[0].size(), 30);
73  EXPECT_GE(candidates[1].size(), 30);
74  }
75 }
Belle2::TrackFindingCDC::PrecisionUtil::getOriginCurvPrecision
static double getOriginCurvPrecision(double curv)
Function which estimates desired curvature resolution of quadtree node in the given pt region paramet...
Definition: PrecisionUtil.h:75
Belle2::TrackFindingCDC::QuadTreeProcessor< long, float, const CDCWireHit >::XYSpans
std::pair< XSpan, YSpan > XYSpans
This pair of spans describes the span of a node.
Definition: QuadTreeProcessor.h:63
Belle2::TrackFindingCDC::TimeItResult::printSummary
void printSummary() const
Print a summary of the collected time to the console.
Definition: TimeIt.h:67
Belle2::TrackFindingCDC::PrecisionUtil::getNonOriginCurvPrecision
static double getNonOriginCurvPrecision(double curv)
Function which estimates desired curvature resolution of quadtree node in the given pt region paramet...
Definition: PrecisionUtil.h:100
Belle2::TrackFindingCDC::PrecisionUtil::getLookupGridLevel
static constexpr int getLookupGridLevel()
Returns desired deepness of the trigonometrical lookup table. Used as template parameter for the Trig...
Definition: PrecisionUtil.h:39
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
Belle2::TrackFindingCDC::PrecisionUtil::PrecisionFunction
std::function< double(double)> PrecisionFunction
Function type which is used for resolution calculations (resolution=f(curvature)) Takes a curvature v...
Definition: PrecisionUtil.h:53