summaryrefslogtreecommitdiff
path: root/io/root.py
diff options
context:
space:
mode:
Diffstat (limited to 'io/root.py')
-rw-r--r--io/root.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/io/root.py b/io/root.py
new file mode 100644
index 0000000..d970d1d
--- /dev/null
+++ b/io/root.py
@@ -0,0 +1,18 @@
+import ROOT
+import os.path
+
+ROOT.gROOT.ProcessLine('.L '+os.path.join(os.path.dirname(__file__), 'root.C+g'))
+
+from ROOT import Event
+
+fill_event = ROOT.fill_event
+
+def make_tree(name, desc=''):
+ '''Create a ROOT tree for holding event information.
+
+ Returns tuple of Event object for filling and TTree.
+ '''
+ tree = ROOT.TTree(name, desc)
+ ev = ROOT.Event()
+ tree.Branch('ev', ev)
+ return ev, tree