#include#include "TLorentzVector.h" int main() { TLorentzVector p(10., 20., 30., 40.); std::cout << "Pz = " << p.Pz() << std::endl; return 0; }
#includeThis code creates two instances of the TLorentzVector class, `p1` and `p2`, with different 4 components. It then adds them together using the `+` operator, and stores the result in `psum`. Finally, it prints out the z-component of the sum vector (65 in this case) using the `Pz` method. This example also uses the ROOT package library.#include "TLorentzVector.h" int main() { TLorentzVector p1(10., 20., 30., 40.); TLorentzVector p2(5., 15., 25., 35.); TLorentzVector psum = p1 + p2; std::cout << "Pz = " << psum.Pz() << std::endl; return 0; }