ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
MaterialTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file MaterialTests.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2017-2018 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#include <boost/test/unit_test.hpp>
10
11
#include <limits>
12
13
#include "
Acts/Material/Material.hpp
"
14
#include "
Acts/Tests/CommonHelpers/FloatComparisons.hpp
"
15
#include "
Acts/Tests/CommonHelpers/PredefinedMaterials.hpp
"
16
#include "
Acts/Utilities/Units.hpp
"
17
18
using namespace
Acts::UnitLiterals;
19
20
static
constexpr
auto
eps
= 2 *
std::numeric_limits<float>::epsilon
();
21
// manually calculated derived values for silicon
22
static
constexpr
float
SiNe
= 1.160954941 / 1_cm3;
23
static
constexpr
float
SiI
= 172.042290036_eV;
24
25
BOOST_AUTO_TEST_SUITE(
material
)
26
27
BOOST_AUTO_TEST_CASE
(construct_vacuum) {
28
// default constructor builds invalid material a.k.a. vacuum
29
Acts::Material
vacuum;
30
BOOST_TEST(!vacuum);
31
}
32
33
BOOST_AUTO_TEST_CASE
(construct_something) {
34
// anything with non-zero Ar is a valid material
35
Acts::Material
notVacuum(1, 2, 3, 4, 5);
36
BOOST_TEST(!!notVacuum);
37
}
38
39
BOOST_AUTO_TEST_CASE
(units) {
40
Acts::Material
silicon =
Acts::Test::makeSilicon
();
41
42
// check values w/ different units if possible
43
CHECK_CLOSE_REL
(silicon.
X0
(), 93.70_mm,
eps
);
44
CHECK_CLOSE_REL
(silicon.
X0
(), 9.370_cm,
eps
);
45
CHECK_CLOSE_REL
(silicon.
X0
(), 0.09370_m,
eps
);
46
CHECK_CLOSE_REL
(silicon.
L0
(), 465.2_mm,
eps
);
47
CHECK_CLOSE_REL
(silicon.
L0
(), 46.52_cm,
eps
);
48
CHECK_CLOSE_REL
(silicon.
L0
(), 0.4652_m,
eps
);
49
CHECK_CLOSE_REL
(silicon.
Ar
(), 28.0855,
eps
);
50
CHECK_CLOSE_REL
(silicon.
Z
(), 14.0,
eps
);
51
CHECK_CLOSE_REL
(silicon.
massDensity
(), 2.329_g / 1_cm3,
eps
);
52
CHECK_CLOSE_REL
(silicon.
massDensity
(), 0.002329_kg / 1_cm3,
eps
);
53
CHECK_CLOSE_REL
(silicon.
massDensity
(), 0.002329_g / 1_mm3,
eps
);
54
// check derived values
55
CHECK_CLOSE_REL
(silicon.
molarElectronDensity
(),
SiNe
,
eps
);
56
CHECK_CLOSE_REL
(silicon.
meanExcitationEnergy
(),
SiI
,
eps
);
57
}
58
59
// encode values as classification vector
60
static
Acts::ActsVectorF<5>
makeSiClassificationNumbers
() {
61
Acts::ActsVectorF<5>
values
;
62
values[
Acts::Material::eX0
] =
Acts::Test::makeSilicon
().
X0
();
63
values[
Acts::Material::eL0
] =
Acts::Test::makeSilicon
().
L0
();
64
values[
Acts::Material::eAr
] =
Acts::Test::makeSilicon
().
Ar
();
65
values[
Acts::Material::eZ
] =
Acts::Test::makeSilicon
().
Z
();
66
values[
Acts::Material::eRho
] =
Acts::Test::makeSilicon
().
massDensity
();
67
return
values
;
68
}
69
70
BOOST_AUTO_TEST_CASE
(classification_numbers) {
71
const
auto
numbers =
makeSiClassificationNumbers
();
72
Acts::Material
fromNumbers(numbers);
73
Acts::Material
manual =
Acts::Test::makeSilicon
();
74
75
BOOST_TEST(fromNumbers == manual);
76
CHECK_CLOSE_REL
(fromNumbers.
classificationNumbers
(), numbers,
eps
);
77
CHECK_CLOSE_REL
(manual.
classificationNumbers
(), numbers,
eps
);
78
}
79
80
BOOST_AUTO_TEST_SUITE_END()
acts
blob
master
Tests
UnitTests
Core
Material
MaterialTests.cpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:26
using
1.8.2 with
ECCE GitHub integration