54 if not os.path.exists(inputfile)
or not inputfile.endswith(
'.root'):
59 file = ROOT.TFile.Open(larbatch_posix.root_stream(inputfile))
60 if file
and file.IsOpen()
and not file.IsZombie():
65 subrun_tree = file.Get(
'SubRuns')
66 if subrun_tree
and subrun_tree.InheritsFrom(
'TTree'):
67 nsubruns = subrun_tree.GetEntriesFast()
68 tfr = ROOT.TTreeFormula(
'runs',
69 'SubRunAuxiliary.id_.run_.run_',
71 tfs = ROOT.TTreeFormula(
'subruns',
72 'SubRunAuxiliary.id_.subRun_',
74 for entry
in range(nsubruns):
75 subrun_tree.GetEntry(entry)
76 run = tfr.EvalInstance64()
77 subrun = tfs.EvalInstance64()
78 run_subrun = (run, subrun)
79 result.append(run_subrun)
85 tdir = file.Get(
'beamdata')
86 if tdir
and tdir.InheritsFrom(
'TDirectory'):
90 bnb_tree = tdir.Get(
'bnb')
91 if bnb_tree
and bnb_tree.InheritsFrom(
'TTree'):
92 nsubruns = bnb_tree.GetEntriesFast()
93 tfr = ROOT.TTreeFormula(
'runs',
'run', bnb_tree)
94 tfs = ROOT.TTreeFormula(
'subruns',
'subrun', bnb_tree)
95 for entry
in range(nsubruns):
96 bnb_tree.GetEntry(entry)
97 run = tfr.EvalInstance64()
98 subrun = tfs.EvalInstance64()
99 run_subrun = (run, subrun)
100 if run_subrun
not in result:
101 result.append(run_subrun)
105 numi_tree = tdir.Get(
'numi')
106 if numi_tree
and numi_tree.InheritsFrom(
'TTree'):
107 nsubruns = numi_tree.GetEntriesFast()
108 tfr = ROOT.TTreeFormula(
'runs',
'run', numi_tree)
109 tfs = ROOT.TTreeFormula(
'subruns',
'subrun', numi_tree)
110 for entry
in range(nsubruns):
111 numi_tree.GetEntry(entry)
112 run = tfr.EvalInstance64()
113 subrun = tfs.EvalInstance64()
114 run_subrun = (run, subrun)
115 if run_subrun
not in result:
116 result.append(run_subrun)