Created
June 21, 2012 13:39
-
-
Save mgmarino/2965762 to your computer and use it in GitHub Desktop.
Example pyROOT script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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