Project
Loading...
Searching...
No Matches
testTPCBase.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#define BOOST_TEST_MODULE Test TPC Base
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
16#include "DataFormatsTPC/Defs.h"
17#include "TPCBase/Sector.h"
18#include <cmath>
19
20namespace o2
21{
22namespace tpc
23{
24
26{
27 math_utils::Point3D<double> testpoint(2., 3., 4.);
28 BOOST_CHECK_CLOSE(testpoint.X(), 2., 1E-12);
29 BOOST_CHECK_CLOSE(testpoint.Y(), 3., 1E-12);
30 BOOST_CHECK_CLOSE(testpoint.Z(), 4., 1E-12);
31}
32
33// test Sector stuff
35{
36 // generate a point in each possible sector
37 const auto HALFSECTORS = Sector::MAXSECTOR / 2;
38 float x[HALFSECTORS];
39 float y[HALFSECTORS];
40
41 const auto startphi = 10. * M_PI / 180.;
42 const auto deltaphi = 20. * M_PI / 180.;
43 for (int s = 0; s < HALFSECTORS; ++s) {
44 x[s] = std::cos(s * deltaphi + startphi);
45 y[s] = std::sin(s * deltaphi + startphi);
46 }
47
48 for (int s = 0; s < HALFSECTORS; ++s) {
49 // check for A side
50 BOOST_CHECK_EQUAL(Sector::ToSector(x[s], y[s], 1.f), s);
51 // check for C side
52 BOOST_CHECK_EQUAL(Sector::ToSector(x[s], y[s], -1.f), s + HALFSECTORS);
53 }
54}
55} // namespace tpc
56} // namespace o2
static int ToSector(T x, T y, T z)
Definition Sector.h:107
static constexpr int MAXSECTOR
Definition Sector.h:44
GLint GLenum GLint x
Definition glcorearb.h:403
BOOST_AUTO_TEST_CASE(ClusterHardware_test1)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())