Back to home page

EIC code displayed by LXR

 
 

    


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

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 #pragma once
0010 
0011 #include "Acts/Definitions/PdgParticle.hpp"
0012 #include "ActsFatras/EventData/Particle.hpp"
0013 
0014 namespace ActsFatras {
0015 
0016 /// No-op particle selector that selects all particles.
0017 struct EveryParticle {
0018   bool operator()(const Particle & /*particle*/) const { return true; }
0019 };
0020 
0021 /// Select neutral particles.
0022 struct NeutralSelector {
0023   bool operator()(const Particle &particle) const {
0024     return (particle.charge() == 0.);
0025   }
0026 };
0027 
0028 /// Select all charged particles.
0029 struct ChargedSelector {
0030   bool operator()(const Particle &particle) const {
0031     return (particle.charge() != 0.);
0032   }
0033 };
0034 
0035 /// Select positively charged particles.
0036 struct PositiveSelector {
0037   bool operator()(const Particle &particle) const {
0038     return (0. < particle.charge());
0039   }
0040 };
0041 
0042 /// Select negatively charged particles.
0043 struct NegativeSelector {
0044   bool operator()(const Particle &particle) const {
0045     return (particle.charge() < 0.);
0046   }
0047 };
0048 
0049 /// Select particles of one specific type.
0050 ///
0051 /// Particle and Antiparticle are treated as two separate types.
0052 template <Acts::PdgParticle Pdg>
0053 struct PdgSelector {
0054   bool operator()(const Particle &particle) const {
0055     return (particle.pdg() == Pdg);
0056   }
0057 };
0058 
0059 /// Select particles and antiparticles of one specific type.
0060 template <Acts::PdgParticle Pdg>
0061 struct AbsPdgSelector {
0062   bool operator()(const Particle &particle) const {
0063     return (makeAbsolutePdgParticle(particle.pdg()) ==
0064             makeAbsolutePdgParticle(Pdg));
0065   }
0066 };
0067 
0068 /// Select all particles except one specific type.
0069 ///
0070 /// Particle and Antiparticle are treated as two separate types.
0071 template <Acts::PdgParticle Pdg>
0072 struct PdgExcluder {
0073   bool operator()(const Particle &particle) const {
0074     return (particle.pdg() != Pdg);
0075   }
0076 };
0077 
0078 /// Select all particles except for (anti-)particles of one specific type.
0079 template <Acts::PdgParticle Pdg>
0080 struct AbsPdgExcluder {
0081   bool operator()(const Particle &particle) const {
0082     return (makeAbsolutePdgParticle(particle.pdg()) !=
0083             makeAbsolutePdgParticle(Pdg));
0084   }
0085 };
0086 
0087 }  // namespace ActsFatras