AddressOf problem


I get a strange error when trying to use SetBranchAddress:

Traceback (most recent call last):
  File "", 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: <file.root> <tree_name> <some_variable_in_tree>

Jacopo (338 Bytes)

@etejedor will most probably be able to help you


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?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

What issue did you observe with SetBranchAddress?

This topic was automatically closed after 24 days. New replies are no longer allowed.