Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:06

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "Acts/Definitions/PdgParticle.hpp"
0012 #include "ActsFatras/EventData/Barcode.hpp"
0013 #include "ActsFatras/Selectors/ParticleSelectors.hpp"
0014 
0015 #include "Dataset.hpp"
0016 
0017 using namespace ActsFatras;
0018 
0019 BOOST_AUTO_TEST_SUITE(FatrasParticleSelectors)
0020 
0021 BOOST_AUTO_TEST_CASE(NegativeParticle) {
0022   const auto& particle = Dataset::centralElectron;
0023   BOOST_CHECK(!NeutralSelector()(particle));
0024   BOOST_CHECK(ChargedSelector()(particle));
0025   BOOST_CHECK(!PositiveSelector()(particle));
0026   BOOST_CHECK(NegativeSelector()(particle));
0027 }
0028 
0029 BOOST_AUTO_TEST_CASE(NeutralParticle) {
0030   const auto& particle = Dataset::centralNeutron;
0031   BOOST_CHECK(NeutralSelector()(particle));
0032   BOOST_CHECK(!ChargedSelector()(particle));
0033   BOOST_CHECK(!PositiveSelector()(particle));
0034   BOOST_CHECK(!NegativeSelector()(particle));
0035 }
0036 
0037 BOOST_AUTO_TEST_CASE(PositiveParticle) {
0038   const auto& particle = Dataset::centralPositron;
0039   BOOST_CHECK(!NeutralSelector()(particle));
0040   BOOST_CHECK(ChargedSelector()(particle));
0041   BOOST_CHECK(PositiveSelector()(particle));
0042   BOOST_CHECK(!NegativeSelector()(particle));
0043 }
0044 
0045 namespace {
0046 const auto& electron = Dataset::centralElectron;
0047 const auto& positron = Dataset::centralPositron;
0048 const auto& muon = Dataset::centralMuon;
0049 const auto& antimuon = Dataset::centralAntiMuon;
0050 const auto& pion = Dataset::centralPion;
0051 }  // namespace
0052 
0053 BOOST_AUTO_TEST_CASE(PdgSelector) {
0054   ActsFatras::PdgSelector<Acts::PdgParticle::eElectron> selectElectron;
0055   BOOST_CHECK(selectElectron(electron));
0056   BOOST_CHECK(!selectElectron(positron));
0057   BOOST_CHECK(!selectElectron(muon));
0058   BOOST_CHECK(!selectElectron(antimuon));
0059   BOOST_CHECK(!selectElectron(pion));
0060 }
0061 
0062 BOOST_AUTO_TEST_CASE(AbsPdgSelector) {
0063   ActsFatras::AbsPdgSelector<Acts::PdgParticle::eElectron> selectElectronLike;
0064   BOOST_CHECK(selectElectronLike(electron));
0065   BOOST_CHECK(selectElectronLike(positron));
0066   BOOST_CHECK(!selectElectronLike(muon));
0067   BOOST_CHECK(!selectElectronLike(antimuon));
0068   BOOST_CHECK(!selectElectronLike(pion));
0069 }
0070 
0071 BOOST_AUTO_TEST_CASE(PdgExcluder) {
0072   ActsFatras::PdgExcluder<Acts::PdgParticle::eMuon> excludeMuon;
0073   BOOST_CHECK(excludeMuon(electron));
0074   BOOST_CHECK(excludeMuon(positron));
0075   BOOST_CHECK(!excludeMuon(muon));
0076   BOOST_CHECK(excludeMuon(antimuon));
0077   BOOST_CHECK(excludeMuon(pion));
0078 }
0079 
0080 BOOST_AUTO_TEST_CASE(AbsPdgExcluder) {
0081   ActsFatras::AbsPdgExcluder<Acts::PdgParticle::eMuon> excludeMuonLike;
0082   BOOST_CHECK(excludeMuonLike(electron));
0083   BOOST_CHECK(excludeMuonLike(positron));
0084   BOOST_CHECK(!excludeMuonLike(muon));
0085   BOOST_CHECK(!excludeMuonLike(antimuon));
0086   BOOST_CHECK(excludeMuonLike(pion));
0087 }
0088 
0089 BOOST_AUTO_TEST_SUITE_END()