@@ -129,6 +129,12 @@ def is_frame_trailer1(word, plane): # Check if frame trailer1 word for the actu
129129 return (0x0000ffff & word ) == (0xaa50 | plane )
130130
131131
132+ # Trigger words
133+ @njit
134+ def is_trigger_word (word ): # Check if TLU word (trigger)
135+ return (0x80000000 & word ) == 0x80000000
136+
137+
132138@njit
133139def histogram (raw_data , occ_hist , m26_frame_ids , m26_frame_length , m26_data_loss , m26_word_index , m26_timestamps , last_m26_timestamps , m26_n_words , m26_rows , m26_frame_status , last_completed_m26_frame_ids ):
134140 ''' Raw data to 2D occupancy histogram '''
@@ -230,8 +236,11 @@ def histogram(raw_data, occ_hist, m26_frame_ids, m26_frame_length, m26_data_loss
230236 break
231237 # Fill occupancy hist
232238 occ_hist [column + k , m26_rows [plane_id ], plane_id ] += 1
233- else : # Raw data word is TLU/trigger word
239+ elif is_trigger_word ( raw_data_word ) : # Raw data word is TLU/trigger word
234240 pass # Not needed here
241+ else : # Raw data contains unknown word, neither M26 nor TLU word
242+ for tmp_plane_index in range (6 ):
243+ m26_data_loss [tmp_plane_index ] = True
235244
236245 return m26_frame_ids , m26_frame_length , m26_data_loss , m26_word_index , m26_timestamps , last_m26_timestamps , m26_n_words , m26_rows , m26_frame_status , last_completed_m26_frame_ids
237246
@@ -313,14 +322,14 @@ def worker(self, raw_data_queue, shared_array_base, lock, stop):
313322 # Per frame variables
314323 m26_frame_ids = np .zeros (shape = (6 , ), dtype = np .int64 ) # The Mimosa26 frame ID of the actual frame
315324 m26_frame_length = np .zeros (shape = (6 , ), dtype = np .uint32 ) # The number of "useful" data words for the actual frame
316- m26_data_loss = np .ones ((6 , ), dtype = np .bool ) # The data loss status for the actual frame
325+ m26_data_loss = np .ones ((6 , ), dtype = np .bool_ ) # The data loss status for the actual frame
317326 m26_word_index = np .zeros (shape = (6 , ), dtype = np .uint32 ) # The word index per device of the actual frame
318327 m26_timestamps = np .zeros (shape = (6 , ), dtype = np .int64 ) # The timestamp for each plane (in units of 40 MHz)
319328 last_m26_timestamps = np .zeros (shape = (6 , ), dtype = np .int64 )
320329 m26_n_words = np .zeros (shape = (6 , ), dtype = np .uint32 ) # The number of words containing column / row info
321330 m26_rows = np .zeros (shape = (6 , ), dtype = np .uint32 ) # The actual readout row (rolling shutter)
322331 m26_frame_status = np .zeros (shape = (6 , ), dtype = np .uint32 ) # The status flags for the actual frames
323- last_completed_m26_frame_ids = np .full (shape = 6 , dtype = np .int64 , fill_value = - 1 ) # The status if the frame is complete for the actual frame
332+ last_completed_m26_frame_ids = - 1 * np .ones (shape = 6 , dtype = np .int64 ) # The status if the frame is complete for the actual frame
324333 while not stop .is_set ():
325334 try :
326335 raw_data = raw_data_queue .get (timeout = self ._queue_timeout )
0 commit comments