summaryrefslogtreecommitdiff
path: root/fileio/root.py
diff options
context:
space:
mode:
Diffstat (limited to 'fileio/root.py')
-rw-r--r--fileio/root.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/fileio/root.py b/fileio/root.py
new file mode 100644
index 0000000..e43f5d4
--- /dev/null
+++ b/fileio/root.py
@@ -0,0 +1,19 @@
+import ROOT
+import os.path
+
+ROOT.gROOT.ProcessLine('.L '+os.path.join(os.path.dirname(__file__), 'root.C+g'))
+
+from ROOT import Event
+
+fill_photons = ROOT.fill_photons
+fill_hits = ROOT.fill_hits
+
+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