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