Skip to content

Instantly share code, notes, and snippets.

@mgmarino
Created June 21, 2012 13:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgmarino/2965762 to your computer and use it in GitHub Desktop.
Save mgmarino/2965762 to your computer and use it in GitHub Desktop.
Example pyROOT script.
import ROOT
import sys
# Following necessary for loading dictionaries of classes stored in tree could
# also go in .rootlogon.C file
ROOT.gSystem.Load("libEXOUtilities")
def do_analysis(atree):
c1 = ROOT.TCanvas()
atree.Draw("fUWires.fChiSquare:fUWires.fRawEnergy")
c1.Update()
raw_input("E")
# Or get things directly
for i in range(atree.GetEntries()):
atree.GetEntry(i)
ed = atree.EventBranch
print ed.GetNumChargeClusters()
break
if __name__ == '__main__':
afile = "/nfs/slac/g/exo_data3/exo_data/data/WIPP/processed/ateam/3560/recon00003560-000.root"
root_file = ROOT.TFile.Open(afile)
tree = root_file.Get("tree")
do_analysis(tree)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment