Hi,
I have some problems while trying to copy entries from the branch “D0_M” of the old tree ‘t0’ and put them into a new tree named ‘t1’.
here is the error output:
Traceback (most recent call last):
File “/users/c/Desktop/simp.py”, line 18, in
t0.GetEntry(entry)
TypeError: int TTree::GetEntry(Long64_t entry, Int_t getall = 0) =>
TypeError: could not convert argument 1 (int/long conversion expects an integer object)
here is the code:
from array import array
import ROOT
f0 = ROOT.TFile.Open(“p1.root”,“READ”)
t0 = f0.Get(“DecayTree”)
t0.SetBranchStatus(“*”,0)
t0.SetBranchStatus(“D0_M”,1)
f1 = ROOT.TFile.Open(“simplify.root”, “RECREATE”)
t1 = ROOT.TTree(“tree”, “newt”)
Provide a one-element array, so ROOT can read data from this memory.
var = array(‘f’, [ 0 ])
t1.Branch(“branch0”, var, “mass”)
for entry in t0:
t0.GetEntry(entry)
t1.Fill()
Now write the header
t1.Write()
Thanks in advance,
Cheers,
Lisa