[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unintuitive behavior of Math::PxPyPzMVector in calculations #15842

Open
1 task done
Zehvogel opened this issue Jun 13, 2024 · 1 comment
Open
1 task done

Unintuitive behavior of Math::PxPyPzMVector in calculations #15842

Zehvogel opened this issue Jun 13, 2024 · 1 comment
Assignees
Labels

Comments

@Zehvogel
Copy link
Contributor

Check duplicate issues.

  • Checked for duplicates

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

import ROOT

lv1 = ROOT.Math.PxPyPzEVector(0, 0, 1, 1)
lv2 = ROOT.Math.PxPyPzMVector(lv1)

print(lv1 - lv2)
# (0,0,0,0)
print(lv2 - lv1)
# (0,0,0,0)
print(-lv1 + lv2)
# (0,0,0,0)
print(-lv2 + lv1)
# (0,0,0,2)

but I am relatively sure that it will also happen in c++

ROOT version

ROOT Version: 6.33.01
Built for linuxx8664gcc on Jun 12 2024, 23:54:24
From heads/master@v6-31-01-2329-g4fe33d2d91

Installation method

LCG dev3

Operating system

Alma9

Additional context

No response

@m-fila
Copy link
m-fila commented Jun 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants