I am trying to take the data from a ntuple and fill a histogram with it using pyroot. Everything that i found until now is on c++, and i wrote my script based on that. But i am having trouble with the .SetBranchAddres(), i dont know how to implement it in python. The code that i wrote is down below:
histFile = root.TFile.Open(histFileName, "READ") tree = histFile.Get("T_s2thh_NOMINAL") nLeafs = tree.GetListOfBranches() histo = root.TH1F("histo", "My histogram", 100, -3, 3) tree.SetBranchAddres("TauEta", &TauEta) entries = tree.GetEntries() for k in range(entries): tree.GetEntry(k) histo.Fill(TauEta) histo.Write()
And i keep getting the error:
SyntaxError: invalid syntax
and we i dont use & before TauEta,i get:
AttributeError: ‘TTree’ object has no attribute ‘SetBranchAddres’
And here is how the .root file was configured:
I really would appreciate any tips or some indication of materials.