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 KinemtaicCast 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/Utilities/Units.hpp"
0022 #include "Fatras/Selectors/KinematicCasts.hpp"
0023 #include "Particle.hpp"
0024 
0025 namespace bdata = boost::unit_test::data;
0026 namespace tt = boost::test_tools;
0027 
0028 namespace Fatras {
0029 
0030 namespace Test {
0031 
0032 double m = 134.9766 * Acts::units::_MeV;
0033 
0034 // This tests the implementation of kinematic cast operators
0035 BOOST_AUTO_TEST_CASE(Kinematic_cast_tests) {
0036 
0037   // a central pion
0038   Acts::Vector3D position(0., 0., 0.);
0039   Acts::Vector3D momentumCentral(1500. * Acts::units::_MeV, 0., 0.);
0040   Particle pionCentral(position, momentumCentral, m, -1.);
0041 
0042   // a forward pion
0043   Acts::Vector3D positionFwd(0., 0., 100.);
0044   Acts::Vector3D momentumFwd(10. * Acts::units::_MeV, 10. * Acts::units::_MeV,
0045                              1500. * Acts::units::_MeV);
0046   Particle pionFwd(positionFwd, momentumFwd, m, -1.);
0047 
0048   // the list of possible casts
0049   casts::eta eta_c;
0050   casts::absEta absEta_c;
0051   casts::pT pT_c;
0052   casts::p p_c;
0053   casts::E E_c;
0054   casts::vR vR_c;
0055   casts::vZ vZ_c;
0056 
0057   // test the central
0058   BOOST_TEST(eta_c(pionCentral) == 0., tt::tolerance(1e-10));
0059   BOOST_TEST(absEta_c(pionCentral) == 0., tt::tolerance(1e-10));
0060   BOOST_TEST(pT_c(pionCentral), 1500. * Acts::units::_MeV);
0061   BOOST_TEST(p_c(pionCentral), 1500. * Acts::units::_MeV);
0062   BOOST_CHECK(E_c(pionCentral) > p_c(pionCentral));
0063 
0064   BOOST_CHECK_CLOSE(vR_c(pionCentral), 0., 10e-5);
0065   BOOST_CHECK_CLOSE(vZ_c(pionCentral), 0., 10e-5);
0066 
0067   // test the forward
0068   BOOST_CHECK(eta_c(pionFwd) > eta_c(pionCentral));
0069   BOOST_TEST(vZ_c(pionFwd), 100. * Acts::units::_MeV);
0070 }
0071 
0072 } // namespace Test
0073 } // namespace Fatras