Pluto v6.3.0
Loading...
Searching...
No Matches
hello_world.C
Go to the documentation of this file.
1//TITLE <b>Hello World</b>
2
3{
4 //This macro combines several features of Pluto:
5 // 1.) Setting up a reaction
6 // 2.) Adding a filter
7 // 3.) Writing an additional NTuple
8 // 4.) Making an online histogram
9
10 //Create a file for the NTuple:
11 TFile *f = new TFile("ntuple.root", "RECREATE");
12 //Create an NTuple with several variables
13 TNtuple *ntuple = new TNtuple("ntuple", "data from Pluto events", "eta_px:eta_py:eta_pz:opang");
14
15 //Create a control histo
16 TH1F *histo1 = new TH1F ("histo1", "dilepton mass with opening angle < 9deg", 100, 0.0, 0.7);
17
18 //Define the reaction: pp -> pp eta @ 3.5 kinetic beam energy
19 PReaction my_reaction("3.5", "p", "p", "p p eta [g dilepton [e+ e-]]", "eta_dalitz");
20
21 //Adding a filter
22 //It is very simple: all variables starting with "#" are recognized as an file event filter
23 my_reaction.Do("theta_ep = ([e+]->Theta() * 180.)/TMath::Pi()");
24 my_reaction.Do("theta_em = ([e-]->Theta() * 180.)/TMath::Pi()");
25 my_reaction.Do("#acc_filter = 1; if theta_ep<18 || theta_ep>85 || theta_em<18 || theta_em>85; #acc_filter = 0");
26
27 //Writing variables to an NTuple
28 my_reaction.Do("eta_px = [eta]->Px() ; eta_py = [eta]->Py() ; eta_pz = [eta]->Pz();");
29 my_reaction.Do("opang = [e+]->Angle([e-])");
31
32 //An additional filter on opening angle...
33 my_reaction.Do("#opang_filter = 0; if opang > (9./180.)*TMath::Pi(); #opang_filter = 1");
34
35 //Some control histo
36 my_reaction.Do(histo1,"if opang > (9./180.)*TMath::Pi(); _x = ([e+] + [e-])->M()");
37
38 cout << my_reaction.Loop(100000) << " events recorded" << endl;
39
40 histo1->Draw();
41 f->Write();
42}
TFile * f
Definition analyze_g12C.C:8
TNtuple * ntuple
PReaction my_reaction("3.5", "p", "p", "p p eta [g dilepton [e+ e-]]", "eta_dalitz")
TH1F * histo1
PReaction my_reaction("3.5","p","7Li","p (n) phi [K+ K-] (6Li)","delme")