Advertisement
andybuckley

rootbrowse -- open a ROOT TBrowser from the terminal

Nov 21st, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. #! /usr/bin/env python
  2.  
  3. """\
  4. %prog <rootfile> [<rootfile2> ...]
  5.  
  6. Open a ROOT TBrowser to view the given files' contents.\
  7. """
  8.  
  9. import optparse
  10. op = optparse.OptionParser(usage=__doc__)
  11. opts, args = op.parse_args()
  12. if not args:
  13.     op.print_usage()
  14.     exit(1)
  15.  
  16. import os
  17. if not os.path.exists(args[0]):
  18.     print "File '%s' does not exist... exiting\n" % args[0]
  19.     exit(2)
  20.  
  21. import ROOT, time
  22. files = [ROOT.TFile(a) for a in args]
  23. b = ROOT.TBrowser()
  24. while b:
  25.    time.sleep(1)
  26. for f in files:
  27.     f.Close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement