Skip to content

Commit 31c6f7a

Browse files
committed
Use create() instead of push_back() to add a particle
1 parent 6a49c1e commit 31c6f7a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

test/k4FWCoreTest/src/components/ExampleFunctionalTransformer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@ struct ExampleFunctionalTransformer final
3939
info() << "Transforming " << input.size() << " particles" << endmsg;
4040
auto coll_out = edm4hep::MCParticleCollection();
4141
for (const auto& particle : input) {
42-
auto new_particle = edm4hep::MutableMCParticle();
42+
auto new_particle = coll_out.create();
4343
new_particle.setPDG(particle.getPDG() + m_offset);
4444
new_particle.setGeneratorStatus(particle.getGeneratorStatus() + m_offset);
4545
new_particle.setSimulatorStatus(particle.getSimulatorStatus() + m_offset);
4646
new_particle.setCharge(particle.getCharge() + m_offset);
4747
new_particle.setTime(particle.getTime() + m_offset);
4848
new_particle.setMass(particle.getMass() + m_offset);
49-
coll_out->push_back(new_particle);
5049
}
5150
return coll_out;
5251
}

0 commit comments

Comments
 (0)