我正在尝试运行此python代码来克隆根树。问题似乎是树没有属性CloneTree(0)
fileName =sys.argv[1]
outFileName = sys.argv[2]
fileIn=ROOT.TFile(fileName)
#tree=fileIn.Get("recoTree")
fOut =ROOT.TFile("./"+outFileName+".decorateGRL.root", "RECREATE")
fOut.cd()
tOut = ROOT.TTree("recoTree","recoTree")
tOut = tree.CloneTree(0)
passGRL = array.array("i",(0 for i in range(0,1)))
tOut.Branch("passGRL",passGRL ,"passGRL/I")
for entry in xrange( tree.GetEntries() ):
if entry%10000 == 0 :
print entry , " out of ", tree.GetEntries()
tree.GetEntry( entry )
if not grl.HasRunLumiBlock(tree.runNumber,tree.lumiBlock):
passGRL[0] = 0
else:
passGRL[0] = 1
tOut.Fill()
print "Write out EB ntuple ", fOut.GetName() , " with ", tOut.GetEntries(), " events"
您知道问题出在哪里吗?