# Four Momentum from TLorentzVector in PtEtaPhiM

Hi everyone,

I have a question that maybe is stupid, but I’m a beginner, so have pity!

I have some data: for each event I have four particles, and for each particle I have their values of pt, eta, phi and m.
For each particles I collected that values in a TLorentzVector (for example i call it “elec1”) in such ways that:
elec1=pt
elec1=eta
elec1=phi
elec1=m

That’s the question:
What can I do if I want to calculate the invariant mass of two of these four-vectors (for example elec1 and elec2)?

If I try using something like this:

``````TLorentzVector sum;
float m;

sum=elec1+elec2;
m=sum.M();

``````

I obtain something that haven’t any physic meaning.
That’s probably because I have to use four-momentum of each particle instead of four vector like elec. But I can’t found a way to trasform a vector in a system of variables like elec in the corresponding four momentum of the same particle, thus in the system EPxPyPz.

Can you help me?

Thank you!

Maybe I have to use SetPtEtaPhiM in order to define Px,Py,Pz,E from Pt,Eta,Phi,M, but I’m not sure and I don’t know how to use it, and I can’t understand it reading in the reference guide…

Hi,

What you are doing is not correct, because the operator [] will set the x,y,x,t components.
Just do:

``````TLorentzVector elec1;
elec1.SetPtEtaPhiM(pt, eta,phi,m);
``````

Best Regards

Lorenzo

Ok, thank you!

Another questions: if I have to axcess to component, after that I have set components with:

``````elec1.SetPtEtaPhiM(pt, eta,phi,m);
``````

Can I use the [] method, or I have to use elec1.Pt() (for example).
I try to explain myself. The two methods:

``````TLorentzVector elec1;
elec1.SetPtEtaPhiM(pt, eta,phi,m);
float x1,x2;

x1=elec1.Pt();
x2=elec1;

``````

Are equivalent? X1 and X2 are the same varaibles? Thank you kindly,

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