Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PdgSelectors.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PdgSelectors.hpp
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 
9 #pragma once
10 
11 namespace Fatras {
12 
13 template <int pdg_t> struct AbsPdgSelector {
14 
15  // absolute Pdg selection
16  const int saPDG = pdg_t;
17 
20  template <typename detector_t, typename particle_t>
21  bool operator()(const detector_t &, const particle_t &particle) const {
22  return (particle.pdg() * particle.pdg() == saPDG * saPDG);
23  }
24 };
25 
26 template <int pdg_t> struct PdgSelector {
27 
28  // Pdg selection
29  const int saPDG = pdg_t;
30 
33  template <typename detector_t, typename particle_t>
34  bool operator()(const detector_t &, const particle_t &particle) const {
35  return (particle.pdg() == saPDG);
36  }
37 };
38 
39 template <int pdg_t> struct AbsPdgExcluder {
40 
41  // absolute Pdg selection
42  const int saPDG = pdg_t;
43 
46  template <typename detector_t, typename particle_t>
47  bool operator()(const detector_t &, const particle_t &particle) const {
48  return !(particle.pdg() * particle.pdg() == saPDG * saPDG);
49  }
50 };
51 
52 template <int pdg_t> struct PdgExcluder {
53 
54  // Pdg selection
55  const int saPDG = pdg_t;
56 
59  template <typename detector_t, typename particle_t>
60  bool operator()(const detector_t &, const particle_t &particle) const {
61  return !(particle.pdg() == saPDG);
62  }
63 };
64 
65 } // namespace Fatras