ATLAS Offline Software
Loading...
Searching...
No Matches
trigbs_truncateEvents Namespace Reference

Functions

 readEvent (file)
 corruptEvent (event, badList)

Variables

 input_file = sys.argv[1]
 output_file = sys.argv[2]
 inFile = open(input_file, mode='rb')
 outFile = open(output_file, mode='wb')
int cnt = 0
 binvalues = array.array('I')
 event = readEvent(inFile)
 corrupt = corruptEvent(event,[0x00100000,0x00350000])

Function Documentation

◆ corruptEvent()

trigbs_truncateEvents.corruptEvent ( event,
badList )

Definition at line 22 of file trigbs_truncateEvents.py.

22def corruptEvent(event,badList):
23 newEvent=array.array('I')
24 headerSize=event[4+2]
25 robIdx=4+headerSize
26 #copy header - we will adjust size at the end
27 newEvent.fromlist(event.tolist()[0:robIdx])
28 reducedWords=0
29 while robIdx<len(event):
30 rob=event[robIdx:robIdx+event[robIdx+1]]
31 #corrupt rob
32 id=rob[4]
33 if (id >= badList[0]) and (id<=badList[1]):
34 print('Found rob to be truncated: %08x - org length %d' % (id,len(rob)))
35 if (len(rob)>50): #don't truncate basically empty fragments
36 newrob=array.array('I',rob[0:len(rob)-20])
37 reducedWords+=20
38 newrob[1]-=20
39 newrob[6]|=(1<<27)|8 #mark as truncated
40 #make sure trailer is messed up
41 newrob[-1]=0xfe77efdd
42 newrob[-2]=0xfe77efdd
43 newrob[-3]=0xfe77efdd
44 rob=newrob
45 else:
46 print('good rob %08x' % id)
47# newEvent.fromlist(rob.tolist())
48 newEvent.extend(rob)
49 robIdx+=event[robIdx+1]
50 newEvent[3]-=4*reducedWords
51 newEvent[5]-=reducedWords
52 return newEvent
53
void print(char *figname, TCanvas *c1)

◆ readEvent()

trigbs_truncateEvents.readEvent ( file)

Definition at line 10 of file trigbs_truncateEvents.py.

10def readEvent(file):
11 event = array.array('I')
12 event.read(file, 4)
13 if event[0]!=0x1234cccc:
14 inFile.seek(-16,1)
15 return None
16# for val in event:
17# print '%08x' % val
18
19 event.read(file, event[3]/4)
20 return event
21

Variable Documentation

◆ binvalues

trigbs_truncateEvents.binvalues = array.array('I')

Definition at line 63 of file trigbs_truncateEvents.py.

◆ cnt

int trigbs_truncateEvents.cnt = 0

Definition at line 61 of file trigbs_truncateEvents.py.

◆ corrupt

trigbs_truncateEvents.corrupt = corruptEvent(event,[0x00100000,0x00350000])

Definition at line 77 of file trigbs_truncateEvents.py.

◆ event

trigbs_truncateEvents.event = readEvent(inFile)

Definition at line 71 of file trigbs_truncateEvents.py.

◆ inFile

trigbs_truncateEvents.inFile = open(input_file, mode='rb')

Definition at line 57 of file trigbs_truncateEvents.py.

◆ input_file

trigbs_truncateEvents.input_file = sys.argv[1]

Definition at line 54 of file trigbs_truncateEvents.py.

◆ outFile

trigbs_truncateEvents.outFile = open(output_file, mode='wb')

Definition at line 58 of file trigbs_truncateEvents.py.

◆ output_file

trigbs_truncateEvents.output_file = sys.argv[2]

Definition at line 55 of file trigbs_truncateEvents.py.