summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chroma/io/root.py3
-rw-r--r--chroma/parabola.py3
-rw-r--r--chroma/rootimport.py10
3 files changed, 14 insertions, 2 deletions
diff --git a/chroma/io/root.py b/chroma/io/root.py
index 55f7858..3fb7062 100644
--- a/chroma/io/root.py
+++ b/chroma/io/root.py
@@ -1,9 +1,10 @@
-import ROOT
import os, os.path
import shutil
import numpy as np
import chroma.event as event
+from chroma.rootimport import ROOT
+
# Create .chroma directory if it doesn't exist
chroma_dir = os.path.expanduser('~/.chroma')
if not os.path.isdir(chroma_dir):
diff --git a/chroma/parabola.py b/chroma/parabola.py
index f4160fb..425f71b 100644
--- a/chroma/parabola.py
+++ b/chroma/parabola.py
@@ -1,7 +1,8 @@
import numpy as np
import uncertainties
from uncertainties import unumpy
-import ROOT
+
+from chroma.rootimport import ROOT
def build_design_matrix(x, y):
y_invsigma = 1.0/unumpy.std_devs(y)
diff --git a/chroma/rootimport.py b/chroma/rootimport.py
new file mode 100644
index 0000000..6bcb6f6
--- /dev/null
+++ b/chroma/rootimport.py
@@ -0,0 +1,10 @@
+# TApplication is so incredibly annoying.
+# STOP SNOOPING THE ARGUMENT LIST AND PRINTING BOGUS HELP MESSAGES!!
+import sys
+_argv = sys.argv
+sys.argv = []
+import ROOT
+# Have to do something with the module to get TApplication initialized
+ROOT.TObject # This just fetches the class and does nothing else
+sys.argv = _argv
+del _argv