8#include <framework/gearbox/Const.h> 
   10#include <TParticlePDG.h> 
   12#include <gtest/gtest.h> 
   19  TEST(ConstTest, ParticleBasics)
 
   46    EXPECT_EQ(1, p.getIndex());
 
   58  TEST(ConstTest, ParticleIteration)
 
   65    EXPECT_EQ(1, (++prefix).getIndex());
 
   67    EXPECT_EQ(0, (postfix++).getIndex());
 
   71    for (
const auto& c : set) {
 
   93          EXPECT_EQ(1000010020, pdg);
 
   96          EXPECT_TRUE(
false) << 
"Index >5 encountered?";
 
  101    EXPECT_EQ(setSize, size);
 
  119  TEST(ConstTest, ParticleCombination)
 
  144  TEST(ConstTest, FindInParticleSet)
 
  154  TEST(ConstTest, TDatabasePDG)
 
  156    EXPECT_DOUBLE_EQ(
Const::Klong.getParticlePDG()->Charge(), 0);
 
  157    EXPECT_EQ(
Const::Klong.getParticlePDG()->PdgCode(), 130);
 
  159    EXPECT_DOUBLE_EQ(
Const::proton.getParticlePDG()->Charge(), 3);
 
  163    EXPECT_DOUBLE_EQ(antiproton.getParticlePDG()->Charge(), -3);
 
  164    EXPECT_EQ(antiproton.getParticlePDG()->PdgCode(), -2212);
 
  167    EXPECT_DOUBLE_EQ(1.0, 
Const::photon.getParticlePDG()->Spin());
 
  168    EXPECT_DOUBLE_EQ(0.5, 
Const::proton.getParticlePDG()->Spin());
 
  171    EXPECT_DOUBLE_EQ(0.0, 
Const::proton.getParticlePDG()->Lifetime());
 
  175    EXPECT_TRUE(
Const::muon.getParticlePDG()->Lifetime() < 2.2e-6);
 
  176    EXPECT_TRUE(
Const::muon.getParticlePDG()->Lifetime() > 2.1e-6);
 
  179    auto* protonnonconst = 
const_cast<TParticlePDG*
>(
Const::proton.getParticlePDG());
 
  180    auto* photonnonconst = 
const_cast<TParticlePDG*
>(
Const::photon.getParticlePDG());
 
  183    EXPECT_DOUBLE_EQ(protonnonconst->AntiParticle()->Charge(), -3);
 
  184    EXPECT_EQ(protonnonconst->AntiParticle()->PdgCode(), -2212);
 
  186    EXPECT_TRUE(photonnonconst->AntiParticle() == photonnonconst);
 
  194  TEST(ConstTest, DetectorSet)
 
  197    EXPECT_EQ(set, Const::IR);
 
  199    EXPECT_EQ(set, Const::IR + Const::PXD);
 
  201    EXPECT_EQ(set, Const::IR + Const::PXD);
 
  202    EXPECT_TRUE(set == Const::IR + Const::PXD);
 
  203    EXPECT_FALSE(set == Const::IR);
 
  205    EXPECT_EQ(set, Const::PXD);
 
  206    EXPECT_TRUE(set.contains(Const::PXD));
 
  207    EXPECT_FALSE(set.contains(Const::IR));
 
  208    set += Const::SVD + Const::TEST;
 
  209    EXPECT_EQ(set.getIndex(Const::IR), -1);
 
  210    EXPECT_EQ(set.getIndex(Const::PXD), 0);
 
  211    EXPECT_EQ(set.getIndex(Const::TEST), 2);
 
  213    EXPECT_EQ(*it, Const::PXD);
 
  216    EXPECT_EQ(*it, Const::TEST);
 
  218    EXPECT_EQ(*it, Const::invalidDetector);
 
  219    EXPECT_EQ(set.size(), (
size_t)3);
 
  224  TEST(ConstTest, RestrictedDetectorSet)
 
Provides a type-safe way to pass members of the chargedStableSet set.
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
The DetectorSet class for sets of detector IDs in the form of EDetector values.
static const size_t c_size
Number of PID detectors, temporary workaround.
static const DetectorSet c_set
The set of valid PID detectors.
A set of ParticleType objects, with defined order.
ParticleType begin() const
Returns first particle.
bool contains(const ParticleType &p) const
Returns true if and only if the set contains 'p'.
ParticleType end() const
Returns an invalid particle to check if iteration should be stopped.
The ParticleType class for identifying different particle types.
int getPDGCode() const
PDG code.
int getIndex() const
This particle's index in the associated set.
static const ParticleType neutron
neutron particle
static const ParticleType unspecifiedParticle
Unspecified particle, used when no other particle type fits.
static const DetectorSet allDetectors
The set of all detectors.
static const ChargedStable muon
muon particle
static const ParticleSet chargedStableSet
set of charged stable particles
static const ChargedStable pion
charged pion particle
static const ParticleType Klong
K^0_L particle.
static const ChargedStable proton
proton particle
static const ParticleType invalidParticle
Invalid particle, used internally.
static const ParticleType Kshort
K^0_S particle.
static const ChargedStable kaon
charged kaon particle
static const ParticleType photon
photon particle
static const ChargedStable electron
electron particle
static const ChargedStable deuteron
deuteron particle
Abstract base class for different kinds of events.