# Invariant mass reconstruction

i have created 1000 events for each event there are produced particles and i have set Px , Py, Pz for all those with the help of poisson distribution. and mass with then help of grandom now i want to reconstruct mass of dimuon using lorentz vector, how i can do?

Hi, welcome to the ROOT forum!

You can take a look at this RDataFrame tutorial for an example analysis with invariant masses:
https://root.cern.ch/doc/master/df106__HiggsToFourLeptons_8py.html

The key part is this one:

``````    ROOT::Math::PtEtaPhiEVector p1(pt[0], eta[0], phi[0], e[0]);
ROOT::Math::PtEtaPhiEVector p2(pt[1], eta[1], phi[1], e[1]);
ROOT::Math::PtEtaPhiEVector p3(pt[2], eta[2], phi[2], e[2]);
ROOT::Math::PtEtaPhiEVector p4(pt[3], eta[3], phi[3], e[3]);
return (p1 + p2 + p3 + p4).M() / 1000;
``````

So you use your kinematic variables to build Lorentz vectors, which you sum and then you get the invariant mass with `.M()`.

Note that since, you have Px, Py, Pz, you need to use the `ROOT::Math::PxPyPzMVector` instead (I presume that you either have the mass available too, or youâ€™re going to assume that the particles are massless).

How i can choose these p1, p2 vector among all of available vector that i have constructed?

That depends, how did you construct the vectors, and how do you want to select them? Are you using RDataFrame?

Your question is a bit too vague to be answered, maybe it helps if you explain again more concisely and attach your code so we understand better what you mean?