File indexing completed on 2025-08-03 08:09:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #define BOOST_TEST_MODULE KinemtaicCast Tests
0011
0012 #include <boost/test/included/unit_test.hpp>
0013
0014
0015 #include <boost/test/data/test_case.hpp>
0016
0017
0018 #include <boost/test/output_test_stream.hpp>
0019
0020
0021 #include "Acts/Utilities/Units.hpp"
0022 #include "Fatras/Selectors/KinematicCasts.hpp"
0023 #include "Fatras/Selectors/SelectorHelpers.hpp"
0024 #include "Particle.hpp"
0025
0026 namespace bdata = boost::unit_test::data;
0027 namespace tt = boost::test_tools;
0028
0029 namespace Fatras {
0030
0031 namespace Test {
0032
0033 struct Detector {};
0034
0035 double m_pion = 134.9766 * Acts::units::_MeV;
0036
0037
0038 BOOST_AUTO_TEST_CASE(SelectorHelper_tests) {
0039
0040 Detector detector;
0041
0042 Acts::Vector3D position(0., 0., 0.);
0043 Acts::Vector3D momentumCast(1500. * Acts::units::_MeV, 0., 0.);
0044
0045
0046 Particle pionCast(position, momentumCast, m_pion, -1.);
0047 Acts::Vector3D positionForward(0., 0., 100. * Acts::units::_mm);
0048 Acts::Vector3D momentumForward(10. * Acts::units::_MeV,
0049 10. * Acts::units::_MeV,
0050 1500. * Acts::units::_MeV);
0051
0052 Particle pionForward(positionForward, momentumForward, m_pion, -1.);
0053
0054 Acts::Vector3D positionBackward(0., 0., 0.);
0055 Acts::Vector3D momentumBackward(10. * Acts::units::_MeV,
0056 10. * Acts::units::_MeV,
0057 -1500. * Acts::units::_MeV);
0058
0059 Particle pionBackward(positionBackward, momentumBackward, m_pion, -1.);
0060
0061
0062 casts::eta etaCast;
0063 casts::absEta etaAbsCast;
0064
0065
0066 Min<casts::eta> minEta05;
0067 minEta05.valMin = 0.5;
0068
0069 Min<casts::absEta> minEtaAbs05;
0070 minEtaAbs05.valMin = 0.5;
0071
0072
0073 BOOST_CHECK(!minEta05(detector, pionCast));
0074 BOOST_CHECK(!minEtaAbs05(detector, pionCast));
0075
0076
0077 BOOST_CHECK(minEta05(detector, pionForward));
0078 BOOST_CHECK(minEtaAbs05(detector, pionForward));
0079
0080
0081 Max<casts::eta> maxEta05;
0082 maxEta05.valMax = 0.5;
0083
0084
0085 BOOST_CHECK(maxEta05(detector, pionCast));
0086 BOOST_CHECK(maxEta05(detector, pionCast));
0087
0088
0089 BOOST_CHECK(!maxEta05(detector, pionForward));
0090 BOOST_CHECK(!maxEta05(detector, pionForward));
0091
0092
0093 Range<casts::eta> rangeEtaM0;
0094 rangeEtaM0.valMin = -6.;
0095 rangeEtaM0.valMax = -0.5;
0096
0097 Range<casts::absEta> rangeEtaM1;
0098 rangeEtaM1.valMin = -6.;
0099 rangeEtaM1.valMax = -0.5;
0100
0101
0102 BOOST_CHECK(!rangeEtaM0(detector, pionCast));
0103 BOOST_CHECK(!rangeEtaM1(detector, pionCast));
0104
0105
0106 BOOST_CHECK(!rangeEtaM0(detector, pionForward));
0107 BOOST_CHECK(!rangeEtaM1(detector, pionForward));
0108
0109
0110 BOOST_CHECK(rangeEtaM0(detector, pionBackward));
0111 BOOST_CHECK(!rangeEtaM1(detector, pionBackward));
0112 }
0113
0114 }
0115 }