Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:14:56

0001 import acts
0002 
0003 
0004 def test_particle_hypothesis():
0005     muon = acts.ParticleHypothesis.muon
0006     pion = acts.ParticleHypothesis.pion
0007     electron = acts.ParticleHypothesis.electron
0008     proton = acts.ParticleHypothesis.proton
0009     kaon = acts.ParticleHypothesis.kaon
0010     geantino = acts.ParticleHypothesis.geantino
0011     chargedGeantino = acts.ParticleHypothesis.chargedGeantino
0012 
0013     # create new particle hypothesis
0014 
0015     # check pdg
0016     assert muon.absolutePdg() == acts.PdgParticle.eMuon
0017     assert pion.absolutePdg() == acts.PdgParticle.ePionPlus
0018     assert electron.absolutePdg() == acts.PdgParticle.eElectron
0019     assert kaon.absolutePdg() == acts.PdgParticle.eKaonPlus
0020     assert proton.absolutePdg() == acts.PdgParticle.eProton
0021     assert geantino.absolutePdg() == acts.PdgParticle.eInvalid
0022     assert chargedGeantino.absolutePdg() == acts.PdgParticle.eInvalid
0023 
0024     # check mass
0025     assert electron.mass() != 0
0026     assert electron.mass() < muon.mass()
0027     assert muon.mass() < pion.mass()
0028     assert pion.mass() < kaon.mass()
0029     assert kaon.mass() < proton.mass()
0030     assert geantino.mass() == 0
0031     assert chargedGeantino.mass() == 0
0032 
0033     # check charge
0034     assert electron.absoluteCharge() == 1
0035     assert muon.absoluteCharge() == 1
0036     assert pion.absoluteCharge() == 1
0037     assert proton.absoluteCharge() == 1
0038     assert geantino.absoluteCharge() == 0
0039     assert chargedGeantino.absoluteCharge() == 1
0040     assert kaon.absoluteCharge() == 1
0041 
0042     # printing should show something sensible
0043     assert str(muon) == "ParticleHypothesis{absPdg=mu, mass=0.105658, absCharge=1}"
0044     assert str(pion) == "ParticleHypothesis{absPdg=pi, mass=0.13957, absCharge=1}"
0045     assert (
0046         str(electron) == "ParticleHypothesis{absPdg=e, mass=0.000510999, absCharge=1}"
0047     )
0048     assert str(kaon) == "ParticleHypothesis{absPdg=K, mass=0.493677, absCharge=1}"
0049     assert str(proton) == "ParticleHypothesis{absPdg=p, mass=0.938272, absCharge=1}"
0050     assert str(geantino) == "ParticleHypothesis{absPdg=0, mass=0, absCharge=0}"
0051     assert str(chargedGeantino) == "ParticleHypothesis{absPdg=0, mass=0, absCharge=1}"