From 210007616e775a079b0fdf48d6a0c355574b6505 Mon Sep 17 00:00:00 2001 From: tmadlener Date: Mon, 13 Nov 2023 12:11:30 +0100 Subject: [PATCH] Simplify python util unittests --- test/utils/test_kinematics.py | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/test/utils/test_kinematics.py b/test/utils/test_kinematics.py index 80c8c2a99..238f13d90 100644 --- a/test/utils/test_kinematics.py +++ b/test/utils/test_kinematics.py @@ -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))