Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParticleSelectorsTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ParticleSelectorsTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2021 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 
9 #include <boost/test/unit_test.hpp>
10 
14 
15 #include "Dataset.hpp"
16 
17 using namespace ActsFatras;
18 
19 BOOST_AUTO_TEST_SUITE(FatrasParticleSelectors)
20 
21 BOOST_AUTO_TEST_CASE(NegativeParticle) {
22  const auto& particle = Dataset::centralElectron;
23  BOOST_CHECK(not NeutralSelector()(particle));
24  BOOST_CHECK(ChargedSelector()(particle));
25  BOOST_CHECK(not PositiveSelector()(particle));
26  BOOST_CHECK(NegativeSelector()(particle));
27 }
28 
29 BOOST_AUTO_TEST_CASE(NeutralParticle) {
30  const auto& particle = Dataset::centralNeutron;
31  BOOST_CHECK(NeutralSelector()(particle));
32  BOOST_CHECK(not ChargedSelector()(particle));
33  BOOST_CHECK(not PositiveSelector()(particle));
34  BOOST_CHECK(not NegativeSelector()(particle));
35 }
36 
37 BOOST_AUTO_TEST_CASE(PositiveParticle) {
38  const auto& particle = Dataset::centralPositron;
39  BOOST_CHECK(not NeutralSelector()(particle));
40  BOOST_CHECK(ChargedSelector()(particle));
41  BOOST_CHECK(PositiveSelector()(particle));
42  BOOST_CHECK(not NegativeSelector()(particle));
43 }
44 
45 namespace {
47 const auto& positron = Dataset::centralPositron;
48 const auto& muon = Dataset::centralMuon;
49 const auto& antimuon = Dataset::centralAntiMuon;
50 const auto& pion = Dataset::centralPion;
51 } // namespace
52 
55  BOOST_CHECK(selectElectron(electron));
56  BOOST_CHECK(not selectElectron(positron));
57  BOOST_CHECK(not selectElectron(muon));
58  BOOST_CHECK(not selectElectron(antimuon));
59  BOOST_CHECK(not selectElectron(pion));
60 }
61 
64  BOOST_CHECK(selectElectronLike(electron));
65  BOOST_CHECK(selectElectronLike(positron));
66  BOOST_CHECK(not selectElectronLike(muon));
67  BOOST_CHECK(not selectElectronLike(antimuon));
68  BOOST_CHECK(not selectElectronLike(pion));
69 }
70 
73  BOOST_CHECK(excludeMuon(electron));
74  BOOST_CHECK(excludeMuon(positron));
75  BOOST_CHECK(not excludeMuon(muon));
76  BOOST_CHECK(excludeMuon(antimuon));
77  BOOST_CHECK(excludeMuon(pion));
78 }
79 
82  BOOST_CHECK(excludeMuonLike(electron));
83  BOOST_CHECK(excludeMuonLike(positron));
84  BOOST_CHECK(not excludeMuonLike(muon));
85  BOOST_CHECK(not excludeMuonLike(antimuon));
86  BOOST_CHECK(excludeMuonLike(pion));
87 }
88 
89 BOOST_AUTO_TEST_SUITE_END()