Plotting the momentum using TVector

I’m still new to root.
I’m struggling with this problem: suppose that I have ntuple which contain plots of say px, py, pz.
My question is how to plot the total momentum using TVector?
I think I should export the data from px,py,pz and store them in TVector3 and fill a new histogram with momentum magnitude?
I don’t know how to do this, I need some clues.
Thank you.

The various ways to fill a TVector3 are explained here.

And this macro shows a simple possible way to retrieve the ntuple variables.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.