13 std::vector<ActsExamples::SimParticle>
15 const std::vector<HepMC3::GenParticlePtr>& genParticles) {
18 std::vector<SimParticle> actsParticles;
20 for (
auto& genParticle : genParticles)
21 actsParticles.push_back(*(
22 simPart.
particle(std::make_shared<HepMC3::GenParticle>(*genParticle))));
26 std::unique_ptr<ActsExamples::SimVertex>
28 const std::shared_ptr<HepMC3::GenVertex> vertex) {
29 SimVertex vtx({vertex->position().x(), vertex->position().y(),
30 vertex->position().z(), vertex->position().t()});
31 vtx.incoming = genParticlesToActs(vertex->particles_in());
32 vtx.outgoing = genParticlesToActs(vertex->particles_out());
34 return std::make_unique<SimVertex>(std::move(
vtx));
38 const std::shared_ptr<HepMC3::GenVertex> vertex) {
39 return vertex->in_event();
43 const std::shared_ptr<HepMC3::GenVertex> vertex) {
48 const std::shared_ptr<HepMC3::GenVertex> vertex) {
49 return genParticlesToActs(vertex->particles_in());
53 const std::shared_ptr<HepMC3::GenVertex> vertex) {
54 return genParticlesToActs(vertex->particles_out());
58 const std::shared_ptr<HepMC3::GenVertex> vertex) {
60 vec(0) = vertex->position().x();
61 vec(1) = vertex->position().y();
62 vec(2) = vertex->position().z();
67 const std::shared_ptr<HepMC3::GenVertex> vertex) {
68 return vertex->position().t();
72 std::shared_ptr<SimParticle> actsParticle) {
74 const auto mom = actsParticle->momentum4();
75 const HepMC3::FourVector vec(
mom[0],
mom[1],
mom[2],
mom[3]);
77 HepMC3::GenParticle genParticle(vec, actsParticle->pdg());
78 genParticle.set_generated_mass(actsParticle->mass());
80 return std::shared_ptr<HepMC3::GenParticle>(&genParticle);
84 std::shared_ptr<HepMC3::GenVertex> vertex,
85 std::shared_ptr<SimParticle>
particle) {
86 vertex->add_particle_in(actsParticleToGen(particle));
90 std::shared_ptr<HepMC3::GenVertex> vertex,
91 std::shared_ptr<SimParticle>
particle) {
92 vertex->add_particle_out(actsParticleToGen(particle));
96 const std::vector<HepMC3::GenParticlePtr>& genParticles,
97 std::shared_ptr<SimParticle> actsParticle) {
98 const auto id = actsParticle->particleId();
100 for (
auto& genParticle : genParticles) {
101 if (genParticle->id() == id) {
110 std::shared_ptr<HepMC3::GenVertex> vertex,
111 std::shared_ptr<SimParticle>
particle) {
113 if (HepMC3::GenParticlePtr genParticle =
114 matchParticles(vertex->particles_in(),
particle))
115 vertex->remove_particle_in(genParticle);
119 std::shared_ptr<HepMC3::GenVertex> vertex,
120 std::shared_ptr<SimParticle>
particle) {
122 if (HepMC3::GenParticlePtr genParticle =
123 matchParticles(vertex->particles_out(),
particle))
124 vertex->remove_particle_out(genParticle);
129 HepMC3::FourVector fVec(
pos(0),
pos(1),
pos(2), vertex->position().t());
130 vertex->set_position(fVec);
134 const std::shared_ptr<HepMC3::GenVertex> vertex,
double time) {
135 HepMC3::FourVector fVec(vertex->position().x(), vertex->position().y(),
136 vertex->position().z(),
time);
137 vertex->set_position(fVec);