# TGeneratorPhaseSpace invariant mass

ROOT Version: 6.12/04
Platform: macOS Mojave 10.14.1
Compiler:
Hi ROOTers,

I tried to write a code to simulate invariant mass of a specific particle. The code is:

``````void massa_invariante() {
TLorentzVector rho(0.0, 0.0, 0.0, 0.770);

Double_t masses[2] = {0.139, 0.139} ;

TGenPhaseSpace event;

event.SetDecay(rho, 2, masses);

TH1F mass_inv("Note","Distribuzione in massa invariante del processo #rho#rightarrow#pi^{+}#pi^{-}", 1000,0,2);

for (Int_t n=0;n<1000000;n++) {

Double_t weight = event.Generate();

TLorentzVector *pmeno = event.GetDecay(0);
TLorentzVector *ppiu = event.GetDecay(1);

mass_inv.Fill((pmeno+ppiu).Mag() ,weight);
}

TCanvas *c1=new TCanvas();

mass_inv.SetXTitle("M_{#pi^{+}#pi^{-}} GeV");
mass_inv.SetYTitle("N");

mass_inv.DrawCopy();

c1->SaveAs("mass_inv.pdf");
}

``````

the output generate a fake rho(770) invariant mass. Why this happened?

mass_inv.pdf (17.8 KB)

Someone could help me?
Thanks.

You should use: `(*pmeno + *ppiu).Mag()`

You set the total energy of “rho” at rest to 0.770 so why are you surprised that you get it back?

The code works like before.
You are right, it is a doubt that I had previously. I do not know how to build the program, I have not been taught and I am making attempts. I would like to generate a defined number of pions + and pions - and build invariant mass of mother particle with them. I don’t find anything about it on the web . Can you give me some hint or reference? I do not have other ideas …

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