How to Branch and Fill a TTree?

I am familiar with using TTrees in C++, but I am confused about what the equivalent of a reference is in the Python translation of the following:

TTree t("TestTree", "TestTree");
float f = 0.0;
t.Branch("myFloat", &f, "f/F");  // how do I do this in python?
for(int i=0; i<numEvents; i++)
    f = myFunc();



there is a simple example in the User’s Guide (, and the same is also here: There is also the little $ROOTSYS/tutorials/pyroot/ script.

In short, either use a C++ object with a dictionary attached to it (either compiled or interpreted), or use python array.array (of size 1, if need be). Putting actual python objects into a TTree only works by pickling them into a TObjString, and then putting the TObjString into the TTree.