59 def preSkim(tree, jsonInput=None, cutstring=None, maxEntries=None, firstEntry=0):
60 if jsonInput ==
None and cutstring ==
None:
65 if type(jsonInput)
is dict:
66 jsonFilter = JSONFilter(runsAndLumis=jsonInput)
68 jsonFilter = JSONFilter(jsonInput)
69 cut = jsonFilter.runCut()
71 cut =
"(%s) && (%s)" % (cutstring, cut)
if cut
else cutstring
72 if maxEntries
is None:
73 maxEntries = ROOT.TVirtualTreePlayer.kMaxEntries
74 while "AltBranch$" in cut:
75 m = re.search(
r"AltBranch\$\(\s*(\w+)\s*,\s*(\w+)\s*\)", cut)
78 "Error, found AltBranch$ in cut string, but it doesn't comply with the syntax this code can support. The cut is %r" % cut)
79 cut = cut.replace(m.group(0), m.group(
80 1)
if tree.GetBranch(m.group(1))
else m.group(2))
81 tree.Draw(
'>>elist', cut,
"entrylist", maxEntries, firstEntry)
82 elist = ROOT.gDirectory.Get(
'elist')
84 elist = jsonFilter.filterEList(tree, elist)
85 return elist, jsonFilter
86 def preSkim(tree, jsonInput=None, cutstring=None, maxEntries=None, firstEntry=0)