69 parser = argparse.ArgumentParser(description=__doc__)
71 parser.add_argument(
'file', metavar=
'FILE', nargs=1, help=
'input file')
72 parser.add_argument(
'-o',
'--output', type=str, help=
'output base file name')
73 parser.add_argument(
'-n',
'--events', type=int, default=-1, help=
'number of events to process')
74 parser.add_argument(
'-r',
'--runNumber', type=int, help=
'set run number')
75 parser.add_argument(
'-l',
'--eventsPerLB', type=int, help=
'increment lumiblock number in steps [%(default)s]')
76 parser.add_argument(
'--firstLB', type=int, default=1, help=
'first lumiblock number [%(default)s]')
77 parser.add_argument(
'--incLB', type=int, default=1, help=
'increment steps for lumiblock number [%(default)s]')
78 parser.add_argument(
'-t',
'--timestamp', type=int, help=
'set timestamp in seconds [%(default)s]')
79 parser.add_argument(
'--removeRobs', metavar=
'PATTERN', type=str, help=
'regex for removing specific ROB IDs')
81 args = parser.parse_args()
83 Config.firstLB = Store.currentLB = args.firstLB
84 Config.incLB = args.incLB
85 Config.eventsPerLB = args.eventsPerLB
86 Config.runNumber = args.runNumber
87 Config.bc_sec = args.timestamp
89 log.info(
'Opening file %s', args.file[0])
90 dr = eformat.EventStorage.pickDataReader(args.file[0])
91 ostr = eformat.ostream(core_name = args.output
or dr.fileNameCore(),
92 run_number = Config.runNumber
or dr.runNumber(),
93 trigger_type = dr.triggerType(),
94 detector_mask = dr.detectorMask(),
95 beam_type = dr.beamType(),
96 beam_energy = dr.beamEnergy())
98 bsfile = eformat.istream([args.file[0]])
102 if args.events>0
and i>args.events:
106 rw_event = eformat.write.FullEventFragment(ro_event, re.compile(args.removeRobs))
108 rw_event = eformat.write.FullEventFragment(ro_event)