Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Simplify python util unittests #238

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 7 additions & 24 deletions test/utils/test_kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,18 @@ class TestKinematics(unittest.TestCase):

def test_p4(self):
"""Test the p4 functionality since that has shown to trip-up cppyy"""
# podio doesn't expose the Mutable constructors so we have to use the full
# glory of the immutable types here
p = edm4hep.MCParticle(11, # PDG
-1, # generatorStatus
-1, # simulatorStatus
1.0, # charge
0.0, # time
125.0, # charge
edm4hep.Vector3d(0, 0, 0), # vertex
edm4hep.Vector3d(0, 0, 0), # endpoint
edm4hep.Vector3f(1.0, 2.0, 3.0), # momentum
edm4hep.Vector3f(0, 0, 0), # momentumAtEndpoint
edm4hep.Vector3f(0, 0, 0), # spin
edm4hep.Vector2i(0, 0) # colorFlow
)
p = edm4hep.MutableMCParticle()
p.setMomentum(edm4hep.Vector3f(1.0, 2.0, 3.0))
p.setMass(125.0)

self.assertEqual(p4(p), LVM(1.0, 2.0, 3.0, 125.0))
self.assertEqual(p4(p, SetEnergy(42.0)), LVE(1.0, 2.0, 3.0, 42.0))
self.assertEqual(p4(p, SetMass(250.0)), LVM(1.0, 2.0, 3.0, 250.0))

p = edm4hep.ReconstructedParticle(11, # type
250.0, # energy
edm4hep.Vector3f(1.0, 2.0, 3.0), # momentum
edm4hep.Vector3f(0, 0, 0), # referencePoint
1.0, # charge
125.0, # mass
0.0, # goodnessOfPID
cppyy.gbl.std.array('float', 10)() # covMatrix
)
p = edm4hep.MutableReconstructedParticle()
p.setMomentum(edm4hep.Vector3f(1.0, 2.0, 3.0))
p.setMass(125.0)
p.setEnergy(250.0)

self.assertEqual(p4(p), LVM(1.0, 2.0, 3.0, 125.0))
self.assertEqual(p4(p, UseEnergy), LVE(1.0, 2.0, 3.0, 250.0))
Expand Down
Loading