7 Module for removing raw and time/quality information from LAr data,
8 raw digits from Tile data, preprocessor information from L1Calo data and
9 pre-existing L2 and EF results. None of this information is currently used by
10 the HLT and removing it reduces file size by up to a factor 4.
12 Note that this requires datafiles to have energy readings
19 import libpyevent_storage
as EventStorage
22 return (word&0xffff0000)>>16
28 sizeenergy=
lo16(data[3])
29 offenergy=
hi16(data[3])
30 nsamples=
lo16(data[7])
33 if total>data[0]
or sizeenergy==0:
34 return [data[ii]
for ii
in range(data[0])]
35 newdata=[data[ii]
for ii
in range(total-3)+
range(data[0]-3,data[0])]
37 newdata[3]=(18<<16)+83+radd
40 for ii
in range(offenergy,offenergy+9):
49 type=data[idx+2]>>16&0xff
51 newdata+=[data[ii]
for ii
in range(idx,idx+size)]
56 new_event=eformat.write.FullEventFragment()
57 new_event.copy_header(event)
59 newrob=eformat.write.ROBFragment(rob)
60 if rob.source_id().human_detector()==
'TDAQ_CALO_PREPROC':
62 if rob.source_id().human_detector()==
'TDAQ_LVL2':
64 if rob.source_id().human_detector()==
'TDAQ_EVENT_FILTER':
66 if rob.source_id().human_group()==
"TILECAL":
69 newrob.rod_data(newdata)
71 if rob.source_id().human_group()==
"LAR" and rob.rod_minor_version()==11:
76 newdata+=[data[data[0]+ii]
for ii
in range(7)]
79 newrob.rod_data(newdata)
80 new_event.append(newrob)
81 return new_event.readonly()
83 if __name__ ==
"__main__":
85 print(
'usage: %s <infile> <outfile>' % sys.argv[0])
87 input_file = sys.argv[1]
88 output_file = sys.argv[2]
90 input = eformat.istream([input_file])
91 dr=EventStorage.pickDataReader(input_file)
92 output = eformat.ostream(core_name=
"subset",
93 run_number=dr.runNumber(),
94 trigger_type=dr.triggerType(),
95 detector_mask=dr.detectorMask(),
96 beam_type=dr.beamType(),
97 beam_energy=dr.beamEnergy())
99 output.write(
modify(event))
100 tmp_file_name = output.last_filename()
102 os.rename(tmp_file_name,output_file)