The algorithm makes a deep copy of the event and drops the particles and vertices created by the simulation from the copied event.
79 {
82 std::unique_ptr<HepMC::GenEvent> outputEvent = std::make_unique<HepMC::GenEvent>(inputEvent);
83 if (inputEvent.run_info()) {
84 outputEvent->set_run_info(std::make_shared<HepMC3::GenRunInfo>(*(inputEvent.run_info().get())));
85 }
86 if (inputEvent.heavy_ion()) {
87 outputEvent->set_heavy_ion(std::make_shared<HepMC::GenHeavyIon>(*(inputEvent.heavy_ion())));
88 }
90
91
92 for (auto& particle: outputEvent->particles()) {
95
97
99 std::make_shared<HepMC3::IntAttribute>(shadowId));
100
101
102
103
104 }
105 }
106
107
108 for (;;) {
109 std::vector<HepMC::GenParticlePtr> p_to_remove;
110 std::vector<HepMC::GenVertexPtr> v_to_remove;
111 for (auto& particle: outputEvent->particles()) {
114 p_to_remove.push_back(particle);
115 }
116 }
117 for (auto& particle: p_to_remove) outputEvent->remove_particle(particle);
118 for (auto& vertex: outputEvent->vertices()) {
121 v_to_remove.push_back(vertex);
122 }
123 }
124 for (auto& vertex: v_to_remove) outputEvent->remove_vertex(vertex);
125 if (p_to_remove.empty() && v_to_remove.empty()) break;
126 }
127
128 return outputEvent;
129}
const std::string ShadowParticleId
void fillBarcodesAttribute(GenEvent *e)
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
HepMC3::ConstGenVertexPtr ConstGenVertexPtr
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses