Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PdgSelectorsTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PdgSelectorsTests.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 PdgSelectors 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 
23 #include "Particle.hpp"
24 
25 namespace bdata = boost::unit_test::data;
26 namespace tt = boost::test_tools;
27 
28 namespace Fatras {
29 
30 namespace Test {
31 
32 double m_muon = 0.51099891 * Acts::units::_MeV; // electron mass
33 double m_e = 105.658367 * Acts::units::_MeV; // muon mass
34 double m_pion = 134.9766 * Acts::units::_MeV; // pi0 rest mass
35 
36 struct Detector {};
37 
38 // This tests the implementation of the pdg selcetors
39 BOOST_AUTO_TEST_CASE(PdgSelectors_test) {
40 
42 
43  Acts::Vector3D position(0., 0., 0.);
44  Acts::Vector3D momentum(1500., 0., 0);
45 
46  Particle electron(position, momentum, m_e, -1., 11);
47  Particle positron(position, momentum, m_e, 1., -11);
48  Particle muon(position, momentum, m_muon, -1., 13);
49  Particle antimuon(position, momentum, m_muon, 1., -13);
50 
51  AbsPdgSelector<11> epSelector;
52 
53  BOOST_CHECK(epSelector(detector, electron));
54  BOOST_CHECK(epSelector(detector, positron));
55  BOOST_CHECK(!epSelector(detector, muon));
56  BOOST_CHECK(!epSelector(detector, antimuon));
57 
58  PdgSelector<13> muSelector;
59 
60  BOOST_CHECK(!muSelector(detector, electron));
61  BOOST_CHECK(!muSelector(detector, positron));
62  BOOST_CHECK(muSelector(detector, muon));
63  BOOST_CHECK(!muSelector(detector, antimuon));
64 
65  AbsPdgExcluder<11> epExcluder;
66 
67  BOOST_CHECK(!epExcluder(detector, electron));
68  BOOST_CHECK(!epExcluder(detector, positron));
69  BOOST_CHECK(epExcluder(detector, muon));
70  BOOST_CHECK(epExcluder(detector, antimuon));
71 
72  PdgExcluder<13> muExcluder;
73 
74  BOOST_CHECK(muExcluder(detector, electron));
75  BOOST_CHECK(muExcluder(detector, positron));
76  BOOST_CHECK(!muExcluder(detector, muon));
77  BOOST_CHECK(muExcluder(detector, antimuon));
78 
80 
81  BOOST_CHECK(emuSelection(detector, electron));
82  BOOST_CHECK(emuSelection(detector, muon));
83  BOOST_CHECK(!emuSelection(detector, positron));
84  BOOST_CHECK(!emuSelection(detector, antimuon));
85 }
86 
87 } // namespace Test
88 
89 } // namespace Fatras