summaryrefslogtreecommitdiff
path: root/fileio/root.py
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-08-10 11:25:39 -0400
committerStan Seibert <stan@mtrr.org>2011-08-10 11:25:39 -0400
commit01d5527db39520ca548518ed1194f8b863a4f077 (patch)
treeac75370a5677bac0f64e0b7529af40b94cfef4f8 /fileio/root.py
parent23b4bedf43f2ff120c1178c3445e39b8735030f3 (diff)
downloadchroma-01d5527db39520ca548518ed1194f8b863a4f077.tar.gz
chroma-01d5527db39520ca548518ed1194f8b863a4f077.tar.bz2
chroma-01d5527db39520ca548518ed1194f8b863a4f077.zip
Rename chroma.io to chroma.fileio to avoid collision with Python package named io
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