Workaround feature in HepMC3::GenVertex::position()
In HepMC3, if a GenVertex is positioned at the origin, then it is treated as not having its position set. In such a case, the method will loop over the production vertices of particles incoming to the current vertex and return their positions if possible.
In the case of events generated at the origin, then many of the GenVertex objects end up being flagged as not having their positions set.
Once the position of a GenVertex is reset by the vertex positioning code, calling position()
on any "downstream" GenVertex objects which were positioned at the origin, then returns the "upstream"
GenVertex (already-shifted) position, the shift is then applied to this causing the positions of these
"downstream" GenVertex objects to effectively be shifted twice, and so on.
The workaround is to avoid calling GenVertex::position()
in the case that GenVertex::has_set_position()
returns false
and directly use HepMC::FourVector::ZERO_VECTOR()
as the GenVertex position.