Skip to content

Commit

Permalink
Use setMomentum for particles (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored Mar 18, 2024
1 parent 017cba2 commit bc9bfc7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,9 @@ struct ExampleFunctionalProducerMultiple final
floatVector.push_back(25.);
floatVector.push_back(m_event);

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;
auto particles = edm4hep::MCParticleCollection();
auto particle = particles.create();
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit bc9bfc7

Please sign in to comment.