File indexing completed on 2025-08-03 08:09:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #define BOOST_TEST_MODULE PdgSelectors 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 "Fatras/Kernel/SelectorList.hpp"
0022 #include "Fatras/Selectors/PdgSelectors.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_muon = 0.51099891 * Acts::units::_MeV;
0033 double m_e = 105.658367 * Acts::units::_MeV;
0034 double m_pion = 134.9766 * Acts::units::_MeV;
0035
0036 struct Detector {};
0037
0038
0039 BOOST_AUTO_TEST_CASE(PdgSelectors_test) {
0040
0041 Detector detector;
0042
0043 Acts::Vector3D position(0., 0., 0.);
0044 Acts::Vector3D momentum(1500., 0., 0);
0045
0046 Particle electron(position, momentum, m_e, -1., 11);
0047 Particle positron(position, momentum, m_e, 1., -11);
0048 Particle muon(position, momentum, m_muon, -1., 13);
0049 Particle antimuon(position, momentum, m_muon, 1., -13);
0050
0051 AbsPdgSelector<11> epSelector;
0052
0053 BOOST_CHECK(epSelector(detector, electron));
0054 BOOST_CHECK(epSelector(detector, positron));
0055 BOOST_CHECK(!epSelector(detector, muon));
0056 BOOST_CHECK(!epSelector(detector, antimuon));
0057
0058 PdgSelector<13> muSelector;
0059
0060 BOOST_CHECK(!muSelector(detector, electron));
0061 BOOST_CHECK(!muSelector(detector, positron));
0062 BOOST_CHECK(muSelector(detector, muon));
0063 BOOST_CHECK(!muSelector(detector, antimuon));
0064
0065 AbsPdgExcluder<11> epExcluder;
0066
0067 BOOST_CHECK(!epExcluder(detector, electron));
0068 BOOST_CHECK(!epExcluder(detector, positron));
0069 BOOST_CHECK(epExcluder(detector, muon));
0070 BOOST_CHECK(epExcluder(detector, antimuon));
0071
0072 PdgExcluder<13> muExcluder;
0073
0074 BOOST_CHECK(muExcluder(detector, electron));
0075 BOOST_CHECK(muExcluder(detector, positron));
0076 BOOST_CHECK(!muExcluder(detector, muon));
0077 BOOST_CHECK(muExcluder(detector, antimuon));
0078
0079 SelectorListOR<PdgSelector<13>, PdgSelector<11>> emuSelection;
0080
0081 BOOST_CHECK(emuSelection(detector, electron));
0082 BOOST_CHECK(emuSelection(detector, muon));
0083 BOOST_CHECK(!emuSelection(detector, positron));
0084 BOOST_CHECK(!emuSelection(detector, antimuon));
0085 }
0086
0087 }
0088
0089 }