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