TLorentzVector p; p.SetPxPyPzE(10.0, 0.0, 0.0, 10.0); double mass = p.M(); std::cout << "mass: " << mass << std::endl;
TLorentzVector p1, p2; p1.SetPxPyPzE(10.0, 0.0, 0.0, 10.0); p2.SetPxPyPzE(0.0, 10.0, 0.0, 10.0); double invMass = (p1 + p2).M(); std::cout << "invariant mass: " << invMass << std::endl;This example creates two TLorentzVector objects with equal energy and perpendicular momentum. The invariant mass of the system is then calculated by adding the two four-vectors together and computing the mass using the .M() method. The TLorentzVector Vect class is part of the ROOT package library, which is a data analysis framework used in particle physics research.