I have saved a TVector3 with pt, eta, and phi components to a TTree. I am trying to read back and use the pt and phi components in a macro, but all I get in the output are zeros. The original root file that I am reading the vector branch from has meaningful information for the vector components, however. My method is
If I instead save the individual pt and phi components for the resultant vector obtained from summing over all track vectors, which method will give me the correct pt and phi :
Looping over all tracks, and for each track, create a TLorentzVector, call trkVector.Pt(), trkVector.Phi(), and calculate a running sum of Pt and Phi
For each track, call trkVector.SetPtEtaPhiM(trkPt,trkEta,trkPhi,trkM), keep a running sum of the track vectors, then after exiting the track loop, call sumOfTrkVectors.Pt(), sumOfTrkVectors.Phi()
The 2 methods are not equivalent (I checked). I just don’t know which one is correct. I’m favoring the latter.