I am new to Python and PyROOT and must loop over several files containing one tree each with branches named using the following convention:
I need to loop from LBA01 to LBA64. How can I deal with the changing variable name in python? How can i deal with the ‘.’? Won’t python think it is a member operator? Why would someone name branches this way to begin with? Can I easily change the branchnames? If so, how?
a ROOT expert should comment: I’m not familiar with an example of renaming a branch.
However, you can still use SetBranchAddress (see e.g. this set of examples from Karol and Duc: root.cern.ch/phpBB2/viewtopic.ph … 7&start=15), and you can also use
getattr( mytree, 'LBA64.AI_3VDIG_INPUT_V_VALUE' ) at which point the ‘.’ is no longer interpreted by python.
We do not yet support renaming a branch … However, you might be able to use the branch alias mechanism (SetAlias)