4 """Find event in FILE(s).
6 If no event identifier(s) are specified on the command line all events are printed.
7 In addition one can save the selected events into a new file.
10 __author__ =
"Frank Winklmeier"
18 time =
' time=%d:%d' % (e.bc_time_seconds(),e.bc_time_nanoseconds())
21 return '[run=%d lb=%d l1id=%d gid=%d%s]' % (e.run_no(),e.lumi_block(),e.lvl1_id(),e.global_id(),time)
24 def __call__(self, parser, namespace, values, option_string=None):
25 times = [tuple(map(int,v.split(
':',1)))
for v
in values]
26 setattr(namespace, self.dest, times)
29 parser = argparse.ArgumentParser(description=__doc__)
31 parser.add_argument(
'-f',
'--file', metavar=
'FILE', nargs=
'*', default=[],
34 parser.add_argument(
'-g',
'--globalid', type=int, action=
'store', nargs=
'*',
35 help=
'Global event ID')
37 parser.add_argument(
'-l',
'--lvl1id', type=int, action=
'store', nargs=
'*',
40 parser.add_argument(
'--lb', type=int, action=
'store', nargs=
'*',
43 parser.add_argument(
'-t',
'--time', action=StoreTime, nargs=
'*',
44 help=
'Nanosecond time stamp (seconds:nanoseconds)')
46 parser.add_argument(
'-s',
'--save', metavar=
'OUTFILE', nargs=
'?', action=
'store', const=
'trigbs_findevent',
47 help=
'Save selected events in OUTFILE')
49 parser.add_argument(
'-v',
'--verbose', action=
'store_true',
52 args = parser.parse_args()
55 if args.save
is not None:
56 ofs = eformat.ostream(core_name=args.save)
59 ifs = eformat.istream(f)
64 if args.globalid
is not None and e.global_id()
not in args.globalid:
66 if args.lvl1id
is not None and e.lvl1_id()
not in args.lvl1id:
68 if args.lb
is not None and e.lumi_block()
not in args.lb:
70 if args.time
is not None and (e.bc_time_seconds(),e.bc_time_nanoseconds())
not in args.time:
77 if __name__ ==
'__main__':
80 except KeyboardInterrupt: