Skip to content

Instantly share code, notes, and snippets.

@vgenty
Created June 4, 2018 15:27
Show Gist options
  • Save vgenty/ea95128fdc4f47949dd83ecf45ade9b3 to your computer and use it in GitHub Desktop.
Save vgenty/ea95128fdc4f47949dd83ecf45ade9b3 to your computer and use it in GitHub Desktop.
Python 2.7.10 (default, Jan 31 2018, 14:07:19)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> tf = ROOT.TFile.Open("1e1p_study.root")
tfTClass::Init:0: RuntimeWarning: no dictionary for class larcv::EventImage2D is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::EventBase is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::Image2D is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::ImageMeta is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::Point2D is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::EventChStatus is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::EventROI is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::ROI is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::Vertex is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::EventPixel2D is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::EventPGraph is available
TClass::Init:0: RuntimeWarning: no dictionary for class larcv::PGraph is available
>>> tree = tf.ShowerTruthMatch
>>> tree.GetEntry(0)
310
>>> tree.shr_type_v
<ROOT.vector<int> object at 0x2673f00>
>>> import numpy as np
^P^P
>>> np.array(tree.shr_type_v)
array([9, 3])
>>> np.array(tree.shr_type_vv)
array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 0],
[233, 0, 0, 397, 0, 0, 0, 0, 0, 0, 0]])
>>> np.array(tree.protonfrac_v)
array([1., 0.])
>>> np.array(tree.electronfrac_v)
array([0. , 0.63015872])
>>> np.array(tree.protonfrac_v)
array([1., 0.])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment