Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:09:25

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2018 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 ///  Boost include(s)
0010 #define BOOST_TEST_MODULE LimitSelector Tests
0011 
0012 #include <boost/test/included/unit_test.hpp>
0013 // leave blank line
0014 
0015 #include <boost/test/data/test_case.hpp>
0016 // leave blank line
0017 
0018 #include <boost/test/output_test_stream.hpp>
0019 // leave blank line
0020 
0021 #include "Acts/Material/Material.hpp"
0022 #include "Acts/Material/MaterialProperties.hpp"
0023 #include "Acts/Utilities/Units.hpp"
0024 #include "Fatras/Selectors/LimitSelectors.hpp"
0025 #include "Particle.hpp"
0026 
0027 namespace bdata = boost::unit_test::data;
0028 namespace tt = boost::test_tools;
0029 
0030 namespace Fatras {
0031 
0032 namespace Test {
0033 
0034 // some material
0035 Acts::Material berilium = Acts::Material(352.8, 407., 9.012, 4., 1.848e-3);
0036 
0037 double m = 134.9766 * Acts::UnitConstants::MeV;
0038 
0039 // This tests the implementation of kinematic cast operators
0040 BOOST_AUTO_TEST_CASE(Kinematic_cast_tests) {
0041 
0042   Acts::MaterialProperties detector(berilium, 1. * Acts::UnitConstants::mm);
0043 
0044   // a central pion
0045   Acts::Vector3D position(0., 0., 0.);
0046 
0047   Acts::Vector3D momentum(1500. * Acts::UnitConstants::MeV, 0., 0.);
0048   Particle pion(position, momentum, m, -1.);
0049 
0050   // the limit of the particle
0051   pion.setLimits(0.15, 0.45);
0052   // the path of the particle
0053   pion.update(position, momentum, 0.10, 0.34);
0054 
0055   X0Limit x0LimitSelector;
0056   L0Limit l0LimitSelector;
0057   // the limit is not yet reached
0058   BOOST_CHECK(!x0LimitSelector(detector, pion));
0059   BOOST_CHECK(!l0LimitSelector(detector, pion));
0060 
0061   detector = Acts::MaterialProperties(berilium, 150. * Acts::UnitConstants::mm);
0062 
0063   // the limit is now reached
0064   BOOST_CHECK(x0LimitSelector(detector, pion));
0065   BOOST_CHECK(l0LimitSelector(detector, pion));
0066 }
0067 
0068 } // namespace Test
0069 } // namespace Fatras