TLorentzVector vec; vec.SetPxPyPzE(10.0, 20.0, 30.0, 40.0);
double px = 5.0; double py = 10.0; double pz = 15.0; double e = sqrt(px*px + py*py + pz*pz + 25.0); TLorentzVector vec(px, py, pz, e);In this example, we first calculate the energy of our four-vector using the momentum in the x, y, and z directions. We then create a TLorentzVector object called vec and use the energy and momentum components to set its values using the constructor. Both examples demonstrate how easy it is to set the components of a TLorentzVector using SetPxPyPzE. Additionally, these examples highlight the importance of the four-vector in relativity theory and particle physics.