Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
PhaseSpace.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_legacy
3/// Example of use of TGenPhaseSpace
4///
5/// \macro_image
6/// \macro_code
7///
8/// \author Valerio Filippini
9
10void PhaseSpace() {
11
12 TLorentzVector target(0.0, 0.0, 0.0, 0.938);
13 TLorentzVector beam(0.0, 0.0, .65, .65);
14 TLorentzVector W = beam + target;
15
16 //(Momentum, Energy units are Gev/C, GeV)
17 Double_t masses[3] = { 0.938, 0.139, 0.139} ;
18
19 TGenPhaseSpace event;
20 event.SetDecay(W, 3, masses);
21
22 TH2F *h2 = new TH2F("h2","h2", 50,1.1,1.8, 50,1.1,1.8);
23
24 for (Int_t n=0;n<100000;n++) {
25 Double_t weight = event.Generate();
26
27 TLorentzVector *pProton = event.GetDecay(0);
28
29 TLorentzVector *pPip = event.GetDecay(1);
30 TLorentzVector *pPim = event.GetDecay(2);
31
32 TLorentzVector pPPip = *pProton + *pPip;
33 TLorentzVector pPPim = *pProton + *pPim;
34
35 h2->Fill(pPPip.M2() ,pPPim.M2() ,weight);
36 }
37 h2->Draw();
38}
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
Phase Space Generator, based on the GENBOD routine of CERNLIB.
Bool_t SetDecay(TLorentzVector &P, Int_t nt, const Double_t *mass, Option_t *opt="")
Input:
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3097
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:345
Int_t Fill(Double_t) override
Invalid Fill method.
Definition TH2.cxx:363
Double_t M2() const
const Int_t n
Definition legend1.C:16