Skip to content

Instantly share code, notes, and snippets.

@alexpearce
Created January 30, 2015 10:57
Show Gist options
  • Save alexpearce/5fcc81a93bda3c0b6008 to your computer and use it in GitHub Desktop.
Save alexpearce/5fcc81a93bda3c0b6008 to your computer and use it in GitHub Desktop.
TTree::SetAlias example
import ROOT
import numpy
f = ROOT.TFile('alias.root', 'recreate')
t = ROOT.TTree('t', 't')
a = numpy.zeros(1, dtype=float)
t.Branch('a', a, 'a/D')
for i in range(10):
a[0] = i*i
t.Fill()
t.Write()
f.Close()
f = ROOT.TFile('alias.root', 'update')
t = f.Get('t')
t.SetAlias('b', 'a/10.0')
t.Write()
f.Close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment