There is a more Pythonic way to iterate over the entries of a TTree in Python and accessing its branches, as illustrated in this example.
However, in your C++ macro you are using a wrapper class for TTreeReader (ExRootTreeReader), so you can’t use the pythonization directly. You can still write a range loop in Python to iterate over the entries, but the rest of the code should look very similar to the C++ version.