EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LimitSelectorsTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file LimitSelectorsTests.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/unit_test.hpp>
10 
14 
15 #include "Dataset.hpp"
16 
17 namespace {
18 // Construct a particle that is close to its X0/L0 path limit.
19 //
20 // Passing a thin slab should still be Ok, but the thick slab should not.
21 ActsFatras::Particle makeParticleCloseToLimit() {
22  // create particle and move it close to the X0/L0 limit
24  particle.setMaterialPassed(0.125, 0.0125);
25  // limit is a bit above 1% in radiation/interaction length
26  particle.setMaterialLimits(0.125 + 0.0125, 0.0125 + 0.0125);
27  return particle;
28 }
29 } // namespace
30 
31 BOOST_AUTO_TEST_SUITE(LimitSelectors)
32 
33 BOOST_AUTO_TEST_CASE(PathLimitX0) {
35  auto particle = makeParticleCloseToLimit();
36  // particle is still within limits for thin block
37  BOOST_CHECK(not select(particle, Acts::Test::makePercentSlab()));
38  // particle would pass limits for thick block
39  BOOST_CHECK(select(particle, Acts::Test::makeUnitSlab()));
40 }
41 
42 BOOST_AUTO_TEST_CASE(PathLimitL0) {
44  auto particle = makeParticleCloseToLimit();
45  // particle is still within limits for thin block
46  BOOST_CHECK(not select(particle, Acts::Test::makePercentSlab()));
47  // particle would pass limits for thick block
48  BOOST_CHECK(select(particle, Acts::Test::makeUnitSlab()));
49 }
50 
51 BOOST_AUTO_TEST_SUITE_END()