About AnalyzeRootuple.C

Hi Edgar,

I am studying the program AnalyzeRootuple.C, and I remember that we were playing with the code during class. One thing that you did is to plot a histogram for mu_charge, and you declared the float variable mu_charge by the statement: float mu_charge[200]. But I don’t understand why it’s 200…

And what happens when the statement “mytree->AddBranchAddress(“mu_charge”,μ_charge)” is executed? I originally thought that it is to turn the pointer to the branch called “mu_charge” existed in mytree. But when I check the Function Members in TTree, it says the function AddBranchAddress() returns an integer. What does that integer means? Is it a temperary label for the computer to point to where mu_charge is stored?

Thanks, Elim =)

1 thought on “About AnalyzeRootuple.C

  1. Hi Elim,

    First, it was a mistake to declare mu_charge as a float, it should have been an int, because that’s how it was declared in the root file itself; you can check that opening the file with TBrowser just like we did in class. The dimension of 200 was just set to be large enough so it can contain all muons in each event. This can be made more elegant, but it’s a good start.
    As far as the SetBranchAddress method (it’s not AddBranchAddress 🙂 ), what you originally thought is true. We set the branch address to a variable we declare (of the same type obviously). The integer it returns is just a status notifier, as I understand. If you feel like digging deeper, you can actually check what the method does by clicking on its name: http://root.cern.ch/root/html/src/TTree.cxx.html#uSIsj
    Edgar

Leave a Reply