Open Zehvogel opened 3 months ago
Hi, I think this is a known limitation of the design
The issue here is not a mixture of vector classes but a negation of a vector from a coordinate system using mass (so just the PxPyPzMVector
part):
root [0] auto v = ROOT::Math::PxPyPzMVector(0,0,1,0)
(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > &) (0,0,1,0)
root [1] v-v
(ROOT::Math::LorentzVector) (0,0,0,0)
root [2] v+(-v)
(ROOT::Math::LorentzVector) (0,0,0,2)
For coordinate systems represented with mass an unary operator-
doesn't model a '4-vector negation' operation, because it returns a vector with negated momentum and negated mass instead of returning a properly negated 4-vector. A negated 4-vector should have negated momentum and negated energy but the same mass, and that can't be achieved with a representation containing only momentum and mass. It could be done by introducing another member (sign of energy), but that would be intrusive into design
Check duplicate issues.
Description
Depending on the mixture of 4-vector types and the order of operations the result can change, e.g. lv1 - lv2 != -lv2 + lv1 See reproducer for all combinations.
Reproducer
but I am relatively sure that it will also happen in c++
ROOT version
Installation method
LCG dev3
Operating system
Alma9
Additional context
No response