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
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
master
CI
Core
doc
Examples
Fatras
Plugins
Tests
Benchmarks
CommonHelpers
IntegrationTests
UnitTests
Benchmarks
Core
Fatras
EventData
Kernel
Physics
Dataset.hpp
EnergyLossTests.cpp
ScatteringTests.cpp
Selectors
Utilities
Plugins
thirdparty
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
geant4
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ScatteringTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ScatteringTests.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2018-2020 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/data/test_case.hpp>
10
#include <boost/test/unit_test.hpp>
11
12
#include <limits>
13
#include <random>
14
15
#include "
Acts/Material/MaterialProperties.hpp
"
16
#include "
Acts/Tests/CommonHelpers/FloatComparisons.hpp
"
17
#include "
Acts/Tests/CommonHelpers/PredefinedMaterials.hpp
"
18
#include "
ActsFatras/EventData/Particle.hpp
"
19
#include "
ActsFatras/Physics/Scattering/GaussianMixture.hpp
"
20
#include "
ActsFatras/Physics/Scattering/GeneralMixture.hpp
"
21
#include "
ActsFatras/Physics/Scattering/Highland.hpp
"
22
#include "
Dataset.hpp
"
23
24
namespace
{
25
constexpr
auto
eps
=
std::numeric_limits<double>::epsilon
();
26
27
// Common test method that will be instantiated for each scattering model.
28
template
<
typename
Scattering>
29
void
test
(
const
Scattering& scattering, uint32_t
seed
,
30
const
ActsFatras::Particle
& before) {
31
std::ranlux48 gen(seed);
32
ActsFatras::Particle
after = before;
33
34
const
auto
outgoing = scattering(gen,
Acts::Test::makePercentSlab
(), after);
35
// scattering leaves absolute energy/momentum unchanged
36
CHECK_CLOSE_REL
(after.
absMomentum
(), before.
absMomentum
(),
eps
);
37
CHECK_CLOSE_REL
(after.
energy
(), before.
energy
(),
eps
);
38
// scattering has changed the direction
39
BOOST_TEST(before.
unitDirection
().dot(after.
unitDirection
()) < 1);
40
// scattering creates no new particles
41
BOOST_TEST(outgoing.empty());
42
}
43
}
// namespace
44
45
BOOST_AUTO_TEST_SUITE(FatrasScattering)
46
47
BOOST_DATA_TEST_CASE
(GeneralMixture, Dataset::
parameters
,
pdg
,
phi
,
lambda
,
p
,
48
seed) {
49
test
(
ActsFatras::GeneralMixtureScattering
(), seed,
50
Dataset::makeParticle
(pdg, phi, lambda, p));
51
}
52
53
BOOST_DATA_TEST_CASE
(GaussianMixture,
Dataset::parameters
,
pdg
,
phi
,
lambda
,
p
,
54
seed) {
55
test
(
ActsFatras::GaussianMixtureScattering
(), seed,
56
Dataset::makeParticle
(
pdg
,
phi
,
lambda
,
p
));
57
}
58
59
BOOST_DATA_TEST_CASE
(Highland,
Dataset::parameters
,
pdg
,
phi
,
lambda
,
p
, seed) {
60
test
(
ActsFatras::HighlandScattering
(), seed,
61
Dataset::makeParticle
(
pdg
,
phi
,
lambda
,
p
));
62
}
63
64
BOOST_AUTO_TEST_SUITE_END()
acts
blob
master
Tests
UnitTests
Fatras
Physics
ScatteringTests.cpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:27
using
1.8.2 with
ECCE GitHub integration