Four-Vectors
Table of Contents
TLorentzVector
In particle and nuclear physics, many quantities are most naturally described with four-vectors. ROOT provides the class TLorentzVector to represent a relativistic four-momentum, and this class is used extensively in real analyses.
Conceptually, a four-vector for a particle is written as
$$
p^\mu = (E, p_x, p_y, p_z)
$$
where $E$ is the energy and $(p_x, p_y, p_z)$ are the components of the three-momentum. In ROOT, TLorentzVector stores these components and provides many convenience methods to compute derived kinematic quantities.
A TLorentzVector object can be created on the stack like any other C++ object:
TLorentzVector p;
At this point, its components are zero. You normally set its value using one of the setter methods. The most common are SetPxPyPzE and SetPtEtaPhiM:
TLorentzVector p1;
p1.SetPxPyPzE(0.3, 0.4, 1.2, 2.0); // px, py, pz in GeV, E in GeV
TLorentzVector p2;
p2.SetPtEtaPhiM(20.0, 0.5, 1.0, 0.139); // pt, eta, phi, mass
The choice of method depends on how your data are stored. Collider experiments often provide transverse momentum $p_T$, pseudorapidity $\eta$, azimuthal angle $\phi$, and mass, so SetPtEtaPhiM is especially useful.
You can also construct and initialize a four-vector in a single line:
TLorentzVector p3(0.1, 0.2, 0.3, 0.5); // px, py, pz, EBy default, this constructor expects the Cartesian components $(p_x, p_y, p_z)$ and the energy $E$.
One of the main advantages of TLorentzVector is that it overloads arithmetic operators. You can add four-vectors to obtain the combined four-momentum of a system:
TLorentzVector p_total = p1 + p2;This expression corresponds to event-by-event combination of two particles into a composite system, for example two photons forming a $\pi^0$, or two leptons forming a $Z$ boson candidate.
Subtraction is also defined and sometimes used to form differences of four-momenta, though addition is more common in analyses that reconstruct invariant masses and similar quantities.
The class provides many member functions to access its components and derived kinematic variables. The basic getters are
double px = p1.Px();
double py = p1.Py();
double pz = p1.Pz();
double e = p1.E();
double m = p1.M(); // invariant mass
double pt = p1.Pt();
double p = p1.P(); // magnitude of 3-momentum
double eta = p1.Eta();
double phi = p1.Phi();
The invariant mass is computed internally via
$$
m^2 = E^2 - \vec{p}^{\,2} = E^2 - (p_x^2 + p_y^2 + p_z^2)
$$
using the convention $c = 1$ and metric signature $(+,-,-,-)$.
Key invariant quantity:
For a TLorentzVector $p$, the invariant mass is defined by
$$m^2 = E^2 - \vec{p}^{\,2}$$
This quantity is the same in all inertial reference frames.
ROOT also includes methods for more advanced operations, such as Lorentz boosts. For example, if you have a boost vector $\vec{\beta}$, you can transform p into a different frame:
TVector3 beta_vec(0.1, 0.0, 0.0); // boost along x
p.Boost(-beta_vec); // perform a Lorentz boost
Boosts are typically used in detailed analyses that transform to the center-of-mass frame of a system or to the rest frame of a particle. The general concept of reference frames and boosts is discussed elsewhere, so here it is enough to recognize that TLorentzVector natively supports these operations.
In many event analyses, you work with collections of particles. For example, you might loop over two muon candidates and combine them:
TLorentzVector mu1, mu2;
// ... set mu1 and mu2 from event data ...
TLorentzVector dimuon = mu1 + mu2;
double m_dimuon = dimuon.M();This pattern, adding four-vectors and using the mass or other derived quantities, appears very frequently when reconstructing decays or resonances from their decay products.
TLorentzVector also integrates well with ROOT histograms and TTrees. You can store components or derived quantities like Pt() and M() as branches, fill histograms of these values, and use them for selection cuts. The object itself is a regular ROOT class, so it can be written to and read from ROOT files where needed.
Overall, TLorentzVector provides a compact, convenient, and physics-friendly representation of four-momenta, with built-in functionality that supports most of the standard kinematic calculations in particle and nuclear physics analyses.
Energy and momentum
In relativistic kinematics, energy and momentum are tightly connected. For a particle of mass $m$, three-momentum $\vec{p}$, and energy $E$, the fundamental relation is
$$
E^2 = \vec{p}^{\,2} + m^2,
$$
with $c = 1$ units. This relation is built into TLorentzVector and underlies its invariant mass calculations.
In ROOT, the spatial momentum magnitude $p$ and the energy $E$ are related through this formula. If you set the four-vector using SetPxPyPzE, you must ensure that the values are physically consistent if you want a real mass. If $E^2 < \vec{p}^{\,2}$, the mass becomes imaginary and the kinematics no longer represent a physical particle.
TLorentzVector allows you to start from different sets of input quantities. The two most common are:
- Energy and Cartesian momentum components:
$$
(E, p_x, p_y, p_z)
$$
You pass these toSetPxPyPzE(px, py, pz, E)and ROOT computes all derived quantities for you. - Transverse momentum, pseudorapidity, azimuthal angle, and mass:
$$
(p_T, \eta, \phi, m).
$$
You pass these toSetPtEtaPhiM(pt, eta, phi, m). Internally,TLorentzVectorconverts them to $p_x, p_y, p_z, E$ using the standard relations between these variables.
For many collider analyses, information is naturally provided in terms of $p_T, \eta, \phi$ and either a known particle mass or an approximation. In that situation, you can view energy as a derived quantity:
$$
E = \sqrt{\vec{p}^{\,2} + m^2}, \quad \vec{p}^{\,2} = p_T^2 + p_z^2.
$$
ROOT handles this automatically once the appropriate four-vector is set.
In code, you can inspect how energy and momentum relate for a given particle:
TLorentzVector p;
p.SetPtEtaPhiM(50.0, 0.3, 2.5, 0.105); // pt in GeV, m in GeV
double e = p.E();
double p3 = p.P();
double m = p.M();
If you check numerically, the values satisfy:
$$
E^2 \approx p^2 + m^2.
$$
Relativistic energy momentum relation:
For any TLorentzVector representing a physical particle,
$$E^2 = \vec{p}^{\,2} + m^2,$$
with $c = 1$. This relation connects energy, momentum, and mass and is used to compute the invariant mass via
$$m^2 = E^2 - \vec{p}^{\,2}.$$
When you combine particles into a composite system, energy and momentum also add as four-vectors. Suppose you have two particles with four-momenta $p_1^\mu$ and $p_2^\mu$. The total four-momentum is
$$
P^\mu = p_1^\mu + p_2^\mu,
$$
so its energy and three-momentum are
$$
E_{\text{tot}} = E_1 + E_2,
\quad
\vec{P}_{\text{tot}} = \vec{p}_1 + \vec{p}_2.
$$
In ROOT:
TLorentzVector p1, p2;
// ... set both vectors ...
TLorentzVector Ptot = p1 + p2;
double E_tot = Ptot.E();
double P_tot = Ptot.P();
double M_tot = Ptot.M(); // invariant mass of the system
This is the basis for reconstructing resonances. For example, if p1 and p2 are two photon four-vectors from a $\pi^0$ decay, Ptot.M() approximates the $\pi^0$ mass.
In fixed-target or collider setups, you sometimes work in a specific reference frame where the total spatial momentum is zero. In that center-of-mass frame, the total energy is particularly simple:
$$
E_{\text{cm}} = \sqrt{s},
$$
where $s = P_{\text{tot}}^2$ is the invariant mass squared of the system. TLorentzVector lets you inspect this through:
double s = Ptot.M2(); // invariant mass squared
double sqrt_s = Ptot.M(); // invariant massEnergy and momentum conservation then become conservation of the total four-vector in an interaction or decay.
Although TLorentzVector does not enforce conservation laws by itself, it provides the tools to check them. In an event, you can sum visible final state four-momenta, compare with the initial state, and study missing momentum or energy as needed in more advanced analyses.
From a practical standpoint, working with energy and momentum through TLorentzVector keeps the relativistic relations consistent and reduces the need to manually recompute kinematic quantities. You specify whichever set of variables your experiment provides, and then rely on ROOT to give you energies, momenta, and invariant masses in a uniform and convenient way.
Views: 12
KAHIBARO