12#define BOOST_TEST_MODULE Test ITSMFTTracking ITSMFTDetectorDefinitions
13#include <boost/test/unit_test.hpp>
25#include "MFTTracking/Constants.h"
31uint32_t bitsOf(
float value)
38float parseToken(
const char* token)
40 char* endptr =
nullptr;
41 const float value = std::strtof(token, &endptr);
42 BOOST_REQUIRE_MESSAGE(endptr !=
nullptr && *endptr ==
'\0',
"strtof left unparsed characters in \"" << token <<
"\"");
46struct ExpectedSurface {
48 const char* referenceCoordinateToken;
54const std::vector<ExpectedSurface> kExpectedITS{
55 {0,
"2.33959", 0, SurfaceKind::Cylinder},
56 {1,
"3.14076", 0, SurfaceKind::Cylinder},
57 {2,
"3.91924", 0, SurfaceKind::Cylinder},
58 {3,
"19.6213", 0, SurfaceKind::Cylinder},
59 {4,
"24.5597", 0, SurfaceKind::Cylinder},
60 {5,
"34.388", 0, SurfaceKind::Cylinder},
61 {6,
"39.3329", 0, SurfaceKind::Cylinder},
70const std::vector<ExpectedSurface> kExpectedMFT{
71 {0,
"-45.2889", 8, SurfaceKind::Disk},
72 {1,
"-46.7111", 8, SurfaceKind::Disk},
73 {2,
"-48.5889", 8, SurfaceKind::Disk},
74 {3,
"-50.0111", 8, SurfaceKind::Disk},
75 {4,
"-52.3889", 8, SurfaceKind::Disk},
76 {5,
"-53.8111", 8, SurfaceKind::Disk},
77 {6,
"-67.6889", 8, SurfaceKind::Disk},
78 {7,
"-69.1111", 8, SurfaceKind::Disk},
79 {8,
"-76.0889", 8, SurfaceKind::Disk},
80 {9,
"-77.5111", 8, SurfaceKind::Disk},
83template <std::
size_t N>
84void checkAuthoredLiteralsMatchExpectedTokens(
const std::array<SurfaceDescriptor, N>& surfaces,
const std::vector<ExpectedSurface>&
expected)
86 BOOST_REQUIRE_EQUAL(surfaces.size(),
expected.size());
88 const auto& authored = surfaces[
row.index];
89 const float fromToken = parseToken(
row.referenceCoordinateToken);
90 BOOST_CHECK_MESSAGE(bitsOf(authored.referenceCoordinate) == bitsOf(fromToken),
91 "surface " <<
row.index <<
": authored literal (bits 0x" << std::hex
92 << bitsOf(authored.referenceCoordinate) <<
") does not bit-match expected token \""
93 <<
row.referenceCoordinateToken <<
"\" (bits 0x" << bitsOf(fromToken) <<
")" << std::dec);
97template <std::
size_t N>
98void checkIdentityAndKind(
const std::array<SurfaceDescriptor, N>& surfaces,
const std::vector<ExpectedSurface>&
expected)
101 const auto& authored = surfaces[
row.index];
113 checkAuthoredLiteralsMatchExpectedTokens(
kITSSurfaces, kExpectedITS);
118 checkAuthoredLiteralsMatchExpectedTokens(
kMFTSurfaces, kExpectedMFT);
133 constexpr std::array<float, ITSNLayers> expectedX0{5.e-3f, 5.e-3f, 5.e-3f, 1.e-2f, 1.e-2f, 1.e-2f, 1.e-2f};
154 constexpr float expectedSurfaceX0 = 0.0084f;
156 float totalArealDensity = 0.f;
158 BOOST_CHECK_CLOSE(surface.material.xOverX0, expectedSurfaceX0, 1.e-4f);
159 BOOST_CHECK_CLOSE(surface.material.arealDensityGPerCm2,
161 totalX0 += surface.material.xOverX0;
162 totalArealDensity += surface.material.arealDensityGPerCm2;
164 BOOST_CHECK_CLOSE(totalX0, 0.084f, 1.e-4f);
165 BOOST_CHECK_CLOSE(totalArealDensity,
GLsizei const GLfloat * value
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
GLenum GLuint GLint GLint layer
constexpr std::array< SurfaceDescriptor, MFTNLayers > kMFTSurfaces
constexpr int MFTNLayers
MFT CA half-disk layer count.
constexpr std::array< SurfaceDescriptor, ITSNLayers > kITSSurfaces
constexpr int ITSNLayers
ITS CA layer count.
constexpr std::array< Float_t, o2::mft::constants::mft::LayersNumber > RMin
constexpr std::array< Float_t, o2::mft::constants::mft::LayersNumber > RMax
std::vector< float > LayerZ
std::map< std::string, ID > expected
BOOST_AUTO_TEST_CASE(ITSAuthoredLiteralsMatchProductionRadiiBitExactly)
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())