Analysis Software
Documentation for sPHENIX simulation 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 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 
10 #define BOOST_TEST_MODULE LimitSelector Tests
11 
12 #include <boost/test/included/unit_test.hpp>
13 // leave blank line
14 
15 #include <boost/test/data/test_case.hpp>
16 // leave blank line
17 
18 #include <boost/test/output_test_stream.hpp>
19 // leave blank line
20 
22 #include "Acts/Material/MaterialProperties.hpp"
23 #include "Acts/Utilities/Units.hpp"
25 #include "Particle.hpp"
26 
27 namespace bdata = boost::unit_test::data;
28 namespace tt = boost::test_tools;
29 
30 namespace Fatras {
31 
32 namespace Test {
33 
34 // some material
35 Acts::Material berilium = Acts::Material(352.8, 407., 9.012, 4., 1.848e-3);
36 
37 double m = 134.9766 * Acts::UnitConstants::MeV;
38 
39 // This tests the implementation of kinematic cast operators
40 BOOST_AUTO_TEST_CASE(Kinematic_cast_tests) {
41 
42  Acts::MaterialProperties detector(berilium, 1. * Acts::UnitConstants::mm);
43 
44  // a central pion
45  Acts::Vector3D position(0., 0., 0.);
46 
47  Acts::Vector3D momentum(1500. * Acts::UnitConstants::MeV, 0., 0.);
48  Particle pion(position, momentum, m, -1.);
49 
50  // the limit of the particle
51  pion.setLimits(0.15, 0.45);
52  // the path of the particle
53  pion.update(position, momentum, 0.10, 0.34);
54 
55  X0Limit x0LimitSelector;
56  L0Limit l0LimitSelector;
57  // the limit is not yet reached
58  BOOST_CHECK(!x0LimitSelector(detector, pion));
59  BOOST_CHECK(!l0LimitSelector(detector, pion));
60 
61  detector = Acts::MaterialProperties(berilium, 150. * Acts::UnitConstants::mm);
62 
63  // the limit is now reached
64  BOOST_CHECK(x0LimitSelector(detector, pion));
65  BOOST_CHECK(l0LimitSelector(detector, pion));
66 }
67 
68 } // namespace Test
69 } // namespace Fatras