Belle II Software  release-05-02-19
CosSinLookupTableTest.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 <gtest/gtest.h>
11 
12 #include <tracking/trackFindingCDC/legendre/quadtree/AxialHitQuadTreeProcessor.h>
13 
14 #include <cmath>
15 
16 using namespace Belle2;
17 using namespace TrackFindingCDC;
18 
19 TEST(CosSinLookupTableTest, compute_sin_cos)
20 {
22 
23  auto binCount = inst.getNBins();
24  float binWidth = 2 * M_PI / binCount;
25 
26  // test the range of bins
27  for (long i = 0; i <= binCount; i++) {
28  float cs_0 = inst.at(i).x();
29  EXPECT_NEAR(cos(i * binWidth - M_PI), cs_0, 0.000001);
30  float ss_0 = inst.at(i).y();
31  EXPECT_NEAR(sin(i * binWidth - M_PI), ss_0, 0.000001);
32  }
33 }
Belle2::TrackFindingCDC::AxialHitQuadTreeProcessor::getCosSinLookupTable
static const LookupTable< Vector2D > & getCosSinLookupTable()
Get the standard lookup table containing equally spaces unit vectors (cos, sin)
Definition: AxialHitQuadTreeProcessor.cc:91
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TEST
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Definition: utilityFunctions.cc:18