Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:47:24

0001 import acts
0002 
0003 
0004 def test_space_point_container():
0005     """Test SpacePointContainer2 and ConstSpacePointProxy2 bindings (read-only)."""
0006     columns = (
0007         acts.SpacePointColumns.X | acts.SpacePointColumns.Y | acts.SpacePointColumns.Z
0008     )
0009     container = acts.SpacePointContainer2(columns)
0010     assert container.empty
0011     assert len(container) == 0
0012 
0013     # Mutable bindings removed - container is read-only from Python
0014     # Can still test iteration and len on empty container
0015     assert list(container) == []
0016 
0017 
0018 def test_seed_container():
0019     """Test SeedContainer2 and ConstSeedProxy2 bindings (read-only)."""
0020     seed_container = acts.SeedContainer2()
0021     assert seed_container.empty
0022     assert len(seed_container) == 0
0023 
0024     # Mutable bindings removed - container is read-only from Python
0025     assert list(seed_container) == []
0026 
0027 
0028 def test_particle_hypothesis():
0029     muon = acts.ParticleHypothesis.muon
0030     pion = acts.ParticleHypothesis.pion
0031     electron = acts.ParticleHypothesis.electron
0032     proton = acts.ParticleHypothesis.proton
0033     kaon = acts.ParticleHypothesis.kaon
0034     geantino = acts.ParticleHypothesis.geantino
0035     chargedGeantino = acts.ParticleHypothesis.chargedGeantino
0036 
0037     # create new particle hypothesis
0038 
0039     # check pdg
0040     assert muon.absolutePdg == acts.PdgParticle.eMuon
0041     assert pion.absolutePdg == acts.PdgParticle.ePionPlus
0042     assert electron.absolutePdg == acts.PdgParticle.eElectron
0043     assert kaon.absolutePdg == acts.PdgParticle.eKaonPlus
0044     assert proton.absolutePdg == acts.PdgParticle.eProton
0045     assert geantino.absolutePdg == acts.PdgParticle.eInvalid
0046     assert chargedGeantino.absolutePdg == acts.PdgParticle.eInvalid
0047 
0048     # check mass
0049     assert electron.mass != 0
0050     assert electron.mass < muon.mass
0051     assert muon.mass < pion.mass
0052     assert pion.mass < kaon.mass
0053     assert kaon.mass < proton.mass
0054     assert geantino.mass == 0
0055     assert chargedGeantino.mass == 0
0056 
0057     # check charge
0058     assert electron.absoluteCharge == 1
0059     assert muon.absoluteCharge == 1
0060     assert pion.absoluteCharge == 1
0061     assert proton.absoluteCharge == 1
0062     assert geantino.absoluteCharge == 0
0063     assert chargedGeantino.absoluteCharge == 1
0064     assert kaon.absoluteCharge == 1
0065 
0066     # printing should show something sensible
0067     assert str(muon) == "ParticleHypothesis{absPdg=mu, mass=0.105658, absCharge=1}"
0068     assert str(pion) == "ParticleHypothesis{absPdg=pi, mass=0.13957, absCharge=1}"
0069     assert (
0070         str(electron) == "ParticleHypothesis{absPdg=e, mass=0.000510999, absCharge=1}"
0071     )
0072     assert str(kaon) == "ParticleHypothesis{absPdg=K, mass=0.493677, absCharge=1}"
0073     assert str(proton) == "ParticleHypothesis{absPdg=p, mass=0.938272, absCharge=1}"
0074     assert str(geantino) == "ParticleHypothesis{absPdg=0, mass=0, absCharge=0}"
0075     assert str(chargedGeantino) == "ParticleHypothesis{absPdg=0, mass=0, absCharge=1}"