From 84ee538b5144e848dde9a9da721e129871ff4e78 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Mon, 18 Mar 2024 15:17:26 +0100 Subject: [PATCH] Use setMomentum for particles --- .../src/components/ExampleFunctionalProducerMultiple.cpp | 5 +---- .../src/components/k4FWCoreTest_AlgorithmWithTFile.cpp | 6 +----- .../src/components/k4FWCoreTest_CreateExampleEventData.cpp | 6 +----- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp index b8bcce0f..1d0403bc 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp @@ -68,10 +68,7 @@ struct ExampleFunctionalProducerMultiple final auto particles = edm4hep::MCParticleCollection(); auto particle = particles.create(); - auto& p4 = particle.getMomentum(); - p4.x = m_magicNumberOffset + m_event + 5; - p4.y = m_magicNumberOffset + 6; - p4.z = m_magicNumberOffset + 7; + particle.setMomentum({m_magicNumberOffset + m_event + 5.0, m_magicNumberOffset + 6.0, m_magicNumberOffset + 7.0}); particle.setMass(m_magicNumberOffset + m_event + 8); auto simTrackerHits = edm4hep::SimTrackerHitCollection(); diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp index d93b2347..aa586a88 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp @@ -57,11 +57,7 @@ StatusCode k4FWCoreTest_AlgorithmWithTFile::execute(const EventContext&) const { edm4hep::MCParticleCollection* particles = m_mcParticleHandle.createAndPut(); auto particle = particles->create(); - - auto& p4 = particle.getMomentum(); - p4.x = m_magicNumberOffset + 5; - p4.y = m_magicNumberOffset + 6; - p4.z = m_magicNumberOffset + 7; + particle.setMomentum({m_magicNumberOffset + 5.0, m_magicNumberOffset + 6.0, m_magicNumberOffset + 7.0}); particle.setMass(m_magicNumberOffset + 8); auto* hits = m_simTrackerHitHandle.createAndPut(); diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp index 3ecf4e9d..36e0aa84 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp @@ -64,11 +64,7 @@ StatusCode k4FWCoreTest_CreateExampleEventData::execute(const EventContext&) con edm4hep::MCParticleCollection* particles = m_mcParticleHandle.createAndPut(); auto particle = particles->create(); - - auto& p4 = particle.getMomentum(); - p4.x = m_magicNumberOffset + m_event + 5; - p4.y = m_magicNumberOffset + 6; - p4.z = m_magicNumberOffset + 7; + particle.setMomentum({m_magicNumberOffset + m_event + 5.0, m_magicNumberOffset + 6.0, m_magicNumberOffset + 7.0}); particle.setMass(m_magicNumberOffset + m_event + 8); edm4hep::SimTrackerHitCollection* simTrackerHits = m_simTrackerHitHandle.createAndPut();