Created
May 29, 2011 15:12
-
-
Save mgmarino/997845 to your computer and use it in GitHub Desktop.
Reading large number of data from file.
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 numpy | |
ROOT.gROOT.SetBatch() | |
ROOT.gSystem.Load("libEXOUtilities") | |
ROOT.gROOT.ProcessLine(".L $EXOLIB/htmldoc/exo_tree_alias.C") | |
chain = ROOT.TChain("tree") | |
chain.Add("/nfs/slac/g/exo/exo_data/data/MC/ATeamBackgrounds/MC_Background_0000*.root") | |
ROOT.SetEXOAlias(chain) | |
entries = chain.GetEntries() | |
chain.SetBranchStatus("*", 0) | |
chain.SetBranchStatus("fChargeClusters.fCollectionTime", 1) | |
chain.SetBranchStatus("fChargeClusters.fX", 1) | |
chain.SetBranchStatus("fChargeClusters.fY", 1) | |
chain.SetBranchStatus("fChargeClusters.fZ", 1) | |
#c1 = ROOT.TCanvas() | |
print "Getting initial estimate" | |
chain.Draw("tcl:xcl:ycl:zcl", "", "goff") | |
#c1.Print("temp.eps") | |
num = chain.GetSelectedRows() | |
chain.SetEstimate(num) | |
print "Getting data" | |
chain.Draw("tcl:xcl:ycl:zcl", "", "goff") | |
tcl_arr = numpy.array([chain.GetV1()[i] for i in range(num)]) | |
xcl_arr = numpy.array([chain.GetV2()[i] for i in range(num)]) | |
ycl_arr = numpy.array([chain.GetV3()[i] for i in range(num)]) | |
zcl_arr = numpy.array([chain.GetV4()[i] for i in range(num)]) | |
print tcl_arr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment