Hi, Folks,
I’m trying to use SetBranchAddress to set the address of a TBranch to a specific data member of a python class. For example:
import ROOT
class Selector( ) :
def __init__( self, options ):
self.vars = ['pt']
self.chain = ROOT.TChain("ana", "ana")
self.chain.AddFile( options.input )
self.chain.SetBranchStatus ('*', 0)
for var in vars:
setattr( self, var, array.array('d', [-1] ) )
self.chain.SetBranchAddress( var, getattr( self, var ) )
self.chain.SetBranchStatus( var, 1 )
However, when I do
[code]selector = Selector( options)
for ientry in xrange(entries):
selector.chain.GetEntry(ientry)
print selector.pt[/code]
the value of “selector.pt” is not read out. If I do “selector.chain.pt”, this is correctly done, but this has terrible performance because it reads out branches I am uninterested in.
Any ideas? I’ve tried some instances of ‘AddressOf’ but it doesn’t seem to work.
Thanks,
Sal Rappoccio