Different methods for sum of Pt from two particles

Hello, I’m trying to get the total transverse momentum of a lepton pair and I have two methods giving slightly different answers.

The two methods are:

1. Create vectors for each lepton, combine them and use .Pt()
2. Directly sum the pt values
The leptons can be electrons or muons, e.g. for muons:
``````   //Find pt, eta, phi, energy for muon 1 and 2 (u1 and u2)
pT_u1 = childl1 -> pt(); pT_u2 = childl2 -> pt();
eta_u1 = childl1 -> eta(); eta_u2 = childl2 -> eta();
phi_u1 = childl1 -> phi(); phi_u2 = childl2 -> phi();
e_u1 = childl1 -> e(); e_u2 = childl2 -> e();

//Define vectors
vec_u1 = get_PtEtaPhiEVector(pT_u1, eta_u1, phi_u1, e_u1);
vec_u2 = get_PtEtaPhiEVector(pT_u2, eta_u2, phi_u2, e_u2);
vec_l1l2 = vec_u1 + vec_u2;

//Two methods for the total pt
pT_l1l2_m1 = vec_l1l2.Pt(); //method 1
pT_l1l2_m2 = pT_u1 + pT_u2; //method 2
``````

The difference between values from the two methods is usually small (<1%) but can be up to 10%, which seems larger than just a difference in rounding.

Which method is correct?
Perhaps I am misunderstanding how two transverse momenta should be added, or maybe .Pt() does not do what I expect?
Any help is appreciated!

All variables are initialized earlier in the code and get_PtEtaPhiEVector refers to the function:

``````// Create PtEtaPhiEVector from doubles
ROOT::Math::PtEtaPhiEVector get_PtEtaPhiEVector(double pT, double eta, double phi, double e){
ROOT::Math::PtEtaPhiEVector particle_vector(pT, eta, phi, e);
return particle_vector;
}
``````

The documentation for LorentzVector
explains .Pt() as “return the transverse spatial component sqrt ( X^2 + Y^2 )”, which seems like it refers to (Px, Py, Pz, E) vectors (apologies if this is something clear from a conversion a different coordinate system)

Cheers,
Matt

ROOT Version: 6.28/10
Platform: lxplus
Compiler: g++ (GCC) 13.1.0

Hello @4lplusMatt,
welcome on the ROOT forum!
What computing precision are you using? Can you provide the values of two vectors for which you notice a large difference in the result?
Cheers,
Monica

Hello @mdessole,

Thank you!

I think it is in double since that’s what the LorentzVector class uses. Is there a way I can check?

Here are a couple examples (units are MeV):
u3u4: Method 1: 15289.7 | Method 2: 17080.1
u3u4: Difference: 1790.39 | %% difference: 10.4823

e3e4: Method 1: 28563.8 | Method 2: 32903.3
e3e4: Difference: 4339.53 | %% difference: 13.1888

I also attached the analysis code file and the printed output.
The calculations take place in lines 317-382 of the analysis file.
The above examples are lines 44-45 and 386-387 in the output file.

event-analysis.cxx (28.7 KB)
out.txt (24.2 KB)

Cheers, Matt

The first method is correct, i.e. `pT_l1l2_m1 = vec_l1l2.Pt()`.

Using `pt, eta, phi, E` coordinates you can’t add vectors like you would do in cartesian coordinates, you have to take into account these relations `x = pt*cos(phi)` and `y = pt*sin(phi)`

Yes here they are:

1st example
u3 (Pt, Eta, Phi, E): (14128.4, -1.35277, -1.05362, 29151.7,)
u4 (Pt, Eta, Phi, E): (2951.73, 0.959817, -2.31431, 4420.27,)
u3u4 (Pt, Eta, Phi, E): (15289.7, -1.1682, -1.23851, 33571.9,)
u3u4: Method 1: 15289.7 | Method 2: 17080.1
u3u4: Difference: 1790.39 | %% difference: 10.4823

2nd example
e3 (Pt, Eta, Phi, E): (22339.4, 1.83381, 0.512155, 71681.2,)
e4 (Pt, Eta, Phi, E): (10563.9, 1.09899, -0.608764, 17611.9,)
e3e4 (Pt, Eta, Phi, E): (28563.8, 1.77911, 0.172631, 89293.1)
e3e4: Method 1: 28563.8 | Method 2: 32903.3
e3e4: Difference: 4339.53 | %% difference: 13.1888

As reported above, you should use the `Pt()` method after summing your vectors, this will work regardless of the coordinate system

Ah ok so the naïve sum was incorrect.

Thank you very much!

Kind regards, Matt