AddressOf problem

Hi,

I get a strange error when trying to use SetBranchAddress:

Traceback (most recent call last):
  File "test.py", line 16, in <module>
    BDT_branch = t.SetBranchAddress(var, r.AddressOf(tree_branch, "numb"))
TypeError: AddressOf() takes 2 positional arguments but 3 were given

I actually pass only two arguments to AddressOf, I don’t understand the error.
I am using:
ROOT Version: 6.22/02
Python version: 3.6.11
Platform: centos7
Compiler: gcc 7.5.0

I attach a very simple script to reproduce my problem. You can run it with:
test.py <file.root> <tree_name> <some_variable_in_tree>

Cheers,
Jacopo
test.py (338 Bytes)

@etejedor will most probably be able to help you

Hello,

This has changed in the new PyROOT (I see you are using 6.22, which features a new PyROOT).

The documentation for AddressOf and addressof is here:

I believe that, since what you want to do is get the address of a field of a struct, you basically need to replace AddressOf by addressof.

Doing so causes issues with SetBranchAddress. Has this changed as well?

What issue did you observe with SetBranchAddress?