Dear experts,
I’m trying to draw histogram from TTree using TTree::Draw() in python and running on multiple root files as shown in a loop below.
for i in range(1,100):
filein = ROOT.TFile.Open("job%i.root"%i)
testtree = filein.Get("Cut1/Events")
denominator.SetDirectory(ROOT.gDirectory)
num_120.SetDirectory(ROOT.gDirectory)
testtree.Draw("min(MET_pt, MHT_pt)>>+denominator")
if (testtree.GetBranchStatus("HLT_PFMET120_PFMHT120_IDTight")):
testtree.Draw("min(MET_pt, MHT_pt)>>+num_120","HLT_PFMET120_PFMHT120_IDTight")
denominator.SetDirectory(0)
num_120.SetDirectory(0)
But then I got
Traceback (most recent call last):
File "makeTEfficiency2018.py", line 47, in <module>
testtree.Draw("min(MET_pt, MHT_pt)>>+denominator")
ReferenceError: attempt to access a null-pointer
Could you suggest how to fix this null-pointer issue?
ROOT Version: 6.14/09
Python: 2.7.14
Platform: CMSSW on lxplus
Thanks,
Chayanit