ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PhaseSpace.C
Go to the documentation of this file.
1 void PhaseSpace() {
2 // example of use of TGenPhaseSpace
3 //Author: Valerio Filippini
4 
5  if (!gROOT->GetClass("TGenPhaseSpace")) gSystem->Load("libPhysics");
6 
7  TLorentzVector target(0.0, 0.0, 0.0, 0.938);
8  TLorentzVector beam(0.0, 0.0, .65, .65);
9  TLorentzVector W = beam + target;
10 
11  //(Momentum, Energy units are Gev/C, GeV)
12  Double_t masses[3] = { 0.938, 0.139, 0.139} ;
13 
14  TGenPhaseSpace event;
15  event.SetDecay(W, 3, masses);
16 
17  TH2F *h2 = new TH2F("h2","h2", 50,1.1,1.8, 50,1.1,1.8);
18 
19  for (Int_t n=0;n<100000;n++) {
20  Double_t weight = event.Generate();
21 
22  TLorentzVector *pProton = event.GetDecay(0);
23 
24  TLorentzVector *pPip = event.GetDecay(1);
25  TLorentzVector *pPim = event.GetDecay(2);
26 
27  TLorentzVector pPPip = *pProton + *pPip;
28  TLorentzVector pPPim = *pProton + *pPim;
29 
30  h2->Fill(pPPip.M2() ,pPPim.M2() ,weight);
31  }
32  h2->Draw();
33 }
#define gROOT
Definition: TROOT.h:344
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1766
int Int_t
Definition: RtypesCore.h:41
void PhaseSpace()
Definition: PhaseSpace.C:1
TH2D * h2
Definition: fit2dHist.C:45
R__EXTERN TSystem * gSystem
Definition: TSystem.h:545
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2878
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:256
double Double_t
Definition: RtypesCore.h:55
Bool_t SetDecay(TLorentzVector &P, Int_t nt, const Double_t *mass, Option_t *opt="")
input: TLorentzVector &P: decay particle (Momentum, Energy units are Gev/C, GeV) Int_t nt: number of ...
Double_t M2() const
Int_t Fill(Double_t)
Invalid Fill method.
Definition: TH2.cxx:287
const Int_t n
Definition: legend1.C:16