We will use the TLorentzVector class from ROOT, which has useful functions for converting coordinates, adding together four-momenta, and calculating the invariant mass.
In [1]:
from ROOT import TLorentzVector
Some arbitrary numbers for illustration
In [2]:
pt1 = 25.0
eta1 = 1.0
phi1 = 0.25
energy1 = 50.0
pt2 = 29.0
eta2 = 1.5
phi2 = -0.35
energy2 = 62.0
Put these numbers into two TLorentzVector objects representing the four-momenta of the two particles.
In [3]:
p1 = TLorentzVector()
p1.SetPtEtaPhiE(pt1, eta1, phi1, energy1)
p2 = TLorentzVector()
p2.SetPtEtaPhiE(pt2, eta2, phi2, energy2)
Add together the four-momenta of the two particles, and calculate the invariant mass of the combined system:
In [4]:
total = p1 + p2
m = total.M()
print(m)