This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
root:example_ttree [2017/06/22 15:24] – iwn | root:example_ttree [2017/06/22 15:25] (current) – iwn | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Below is an example on the use of '' | + | Below is an example on the use of '' |
< | < | ||
- | python trees.py | + | $ python trees.py |
</ | </ | ||
- | and check result | + | and check output |
< | < | ||
- | root -l tree.root | + | $ root -l tree.root |
+ | root [1] TBrowser a | ||
</ | </ | ||
Line 14: | Line 15: | ||
start = time.time() | start = time.time() | ||
- | from ROOT import gRandom, TFile, TTree, TH1D, TObject | + | from ROOT import gRandom, TFile, TTree, TH1D |
from array import array | from array import array | ||
import numpy # alternative to array | import numpy # alternative to array | ||
Line 77: | Line 78: | ||
# overwrite the tree in the output file and close the file | # overwrite the tree in the output file and close the file | ||
- | f.Write("", | + | f.Write("", |
f.Close() | f.Close() | ||
Line 96: | Line 97: | ||
h1.Fill(gRandom.Gaus(2, | h1.Fill(gRandom.Gaus(2, | ||
- | f.Write("", | + | f.Write("", |
f.Close() | f.Close() | ||
Line 123: | Line 124: | ||
h1.Fill(gRandom.Gaus(4, | h1.Fill(gRandom.Gaus(4, | ||
- | f.Write("", | + | f.Write("", |
f.Close() | f.Close() | ||
Line 153: | Line 154: | ||
t.Fill() | t.Fill() | ||
- | f.Write("", | + | f.Write("", |
f.Close() | f.Close() | ||