Loading [MathJax]/extensions/tex2jax.js
Logo ROOT   6.08/07
Reference Guide
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PhaseSpace.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_physics
3 /// \notebook -js
4 /// Example of use of TGenPhaseSpace
5 ///
6 /// \macro_image
7 /// \macro_code
8 ///
9 /// \author Valerio Filippini
10 
11 void PhaseSpace() {
12 
13  if (!gROOT->GetClass("TGenPhaseSpace")) gSystem->Load("libPhysics");
14 
15  TLorentzVector target(0.0, 0.0, 0.0, 0.938);
16  TLorentzVector beam(0.0, 0.0, .65, .65);
17  TLorentzVector W = beam + target;
18 
19  //(Momentum, Energy units are Gev/C, GeV)
20  Double_t masses[3] = { 0.938, 0.139, 0.139} ;
21 
22  TGenPhaseSpace event;
23  event.SetDecay(W, 3, masses);
24 
25  TH2F *h2 = new TH2F("h2","h2", 50,1.1,1.8, 50,1.1,1.8);
26 
27  for (Int_t n=0;n<100000;n++) {
28  Double_t weight = event.Generate();
29 
30  TLorentzVector *pProton = event.GetDecay(0);
31 
32  TLorentzVector *pPip = event.GetDecay(1);
33  TLorentzVector *pPim = event.GetDecay(2);
34 
35  TLorentzVector pPPip = *pProton + *pPip;
36  TLorentzVector pPPim = *pProton + *pPim;
37 
38  h2->Fill(pPPip.M2() ,pPPim.M2() ,weight);
39  }
40  h2->Draw();
41 }
#define gROOT
Definition: TROOT.h:364
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1819
Double_t M2() const
int Int_t
Definition: RtypesCore.h:41
TLorentzVector is a general four-vector class, which can be used either for the description of positi...
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2851
tomato 2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:255
Utility class to generate n-body event, with constant cross-section (default) or with Fermi energy de...
double Double_t
Definition: RtypesCore.h:55
Bool_t SetDecay(TLorentzVector &P, Int_t nt, const Double_t *mass, Option_t *opt="")
Input:
Int_t Fill(Double_t)
Invalid Fill method.
Definition: TH2.cxx:292
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
Definition: THist.hxx:308
const Int_t n
Definition: legend1.C:16