Pluto
v6.3.0
Loading...
Searching...
No Matches
batch_write_ntuple.C
Go to the documentation of this file.
1
//TITLE Writing TNtuple(s) and ASCII files
2
3
{
4
5
TFile *
f
=
new
TFile(
"ntuple.root"
,
"RECREATE"
);
6
TNtuple *
ntuple
=
new
TNtuple(
"ntuple"
,
"data from Pluto events"
,
"eta_px:eta_py:eta_pz:eta_m"
);
7
8
TFile *
f2
=
new
TFile(
"ntuple2.root"
,
"RECREATE"
);
9
TNtuple *
ntuple2
=
new
TNtuple(
"ntuple2"
,
"data from Pluto events"
,
"cos_theta_eta"
);
10
11
//Define the reaction
12
PReaction
my_reaction
(
"3.5"
,
"p"
,
"p"
,
"p p eta [pi+ pi- pi0]"
);
13
14
//Writing to the ntuple is done by defining the variables of the branches:
15
my_reaction
.Output(
ntuple
,
"eta_px = [eta]->Px() ; eta_py = [eta]->Py() ; eta_pz = [eta]->Pz(); eta_m = [eta]->M()"
);
16
my_reaction
.Output(
ntuple2
,
"myeta = [eta]; myeta->Boost([p + p]); cos_theta_eta = myeta->CosTheta()"
);
17
18
//Writing to ASCII output files works with the same syntax as the "echo" command:
19
my_reaction
.Output(
"eta_sample.txt"
,
"echo $eta_px $eta_py $eta_pz $eta_m"
);
20
21
my_reaction
.Print();
22
23
cout <<
my_reaction
.Loop(100000) <<
" events recorded"
<< endl;
24
25
f
->Write();
26
f2
->Write();
27
28
}
f2
TFile * f2
Definition
ana_eta_generator.C:40
f
TFile * f
Definition
analyze_g12C.C:8
ntuple
TNtuple * ntuple
Definition
batch_write_ntuple.C:6
ntuple2
TNtuple * ntuple2
Definition
batch_write_ntuple.C:9
my_reaction
PReaction my_reaction("3.5", "p", "p", "p p eta [pi+ pi- pi0]")
PReaction
Definition
PReaction.h:37
my_reaction
PReaction my_reaction("3.5","p","7Li","p (n) phi [K+ K-] (6Li)","delme")
pluto6
macros
batch_write_ntuple.C
Generated by
1.14.0