Is the following not expected to work (e.g. in the ROOT interpreter):
ROOT::Math::PxPyPzE4D<double> p1(0., 0., 1., 1.);
ROOT::Math::PxPyPzE4D<double> p2(0., 0., 1., 1.);
p1 + p2
ROOT_prompt_5:1:4: error: invalid operands to binary expression ('ROOT::Math::PxPyPzE4D<double>' and 'ROOT::Math::PxPyPzE4D<double>')
p1 + p2
~~ ^ ~~
/usr/local/Cellar/root/6.26.06_1/include/root/TString.h:521:1: note: candidate function template not viable: no known conversion from 'ROOT::Math::PxPyPzE4D<double>' to 'TString' for 1st argument
(...)
?
If not, why is that?
ROOT Version: 6.28/10
Built for linuxx8664gcc on Nov 27 2023, 21:04:13
From tags/v6-28-10@v6-28-10 Platform: AlmaLinux9
With cvmfs access, the environment can be retrieved with: source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh
Thanks for the interesting post and welcome to the ROOT community!
The problem is that you are trying to sum two instances of a class describing a 4D cartesian coordinate system (momentum-energy coordinates). See here.
The class to use to represent 4-vectors in your case would indeed be ROOT::Math::PxPyPzEVector which is nothing but a typedef of LorentzVector<PxPyPzE4D<double> >
I hope this helps, if not feel free to come back with more questions.