123 if not os.path.exists(inputfile):
127 md[
'file_name'] = os.path.basename(inputfile)
128 md[
'file_size'] = str(os.path.getsize(inputfile))
133 if not inputfile.endswith(
'.root'):
138 ROOT.gEnv.SetValue(
'RooFit.Banner',
'0')
139 file = ROOT.TFile.Open(larbatch_posix.root_stream(inputfile))
140 if file
and file.IsOpen()
and not file.IsZombie():
145 obj = file.Get(
'Events')
146 if obj
and obj.InheritsFrom(
'TTree'):
150 nev = obj.GetEntriesFast()
151 md[
'events'] = str(nev)
155 subrun_tree = file.Get(
'SubRuns')
156 if subrun_tree
and subrun_tree.InheritsFrom(
'TTree'):
158 nsubruns = subrun_tree.GetEntriesFast()
159 tfr = ROOT.TTreeFormula(
'subruns',
160 'SubRunAuxiliary.id_.run_.run_',
162 tfs = ROOT.TTreeFormula(
'subruns',
163 'SubRunAuxiliary.id_.subRun_',
165 for entry
in range(nsubruns):
166 subrun_tree.GetEntry(entry)
167 run = tfr.EvalInstance64()
168 subrun = tfs.EvalInstance64()
169 run_subrun = (run, subrun)
170 if not run_subrun
in md[
'subruns']:
171 md[
'subruns'].append(run_subrun)
176 stream_name = stream.get_stream(inputfile)
177 md[
'data_stream'] = stream_name