diff --git a/Scripts/testB2L.py b/Scripts/testB2L.py index f69c6314668727a7b4e04e94070ac3a9892a572f..5e5bd29510af3f722b19166252e4d82c7ca5afc6 100644 --- a/Scripts/testB2L.py +++ b/Scripts/testB2L.py @@ -54,26 +54,31 @@ def _crc16(data, crc, table): crc = ((crc<<8)&0xff00) ^ table[((crc>>8)&0xff)^byte1] return crc & 0xffff +import socket +hname = socket.gethostname() + for nev in range( 10 ): # Send trigger (adapt this line to your system) - os.system( "ssh vme \"trigft -80 pulse 1 1\"" ) ### ADD this to suppress output >/dev/null 2>&1" ) + if ( hname == 'belle2daq.local' ): + os.system( "ssh vme \"trigft -80 pulse 1 1\"" ) ### ADD this to suppress output >/dev/null 2>&1" ) + else: ### KEK + os.system( "ssh ttd3 \"trigft -23 pulse 1 1\"" ) # wait for data to arrive - attempt = 0 size = 0 - while size != 892: - status, val = mem.read( 0 , 0x00050080) - size = val - attempt = attempt + 1 - if attempt > 1000: - for i in range( 10000 ): - mem.read( 0 , 0x00050060 ) - print 'Error in reading: try again now' - exit( 0 ) + ## temporisation of 2s + import time + time.sleep( 2 ) + status, val = mem.read( 0 , 0x00050080) + size = val print "Number of words received = {}".format( size ) + if size == 0: + print 'Not enough data read, exit' + exit( 0 ) + # read data data = []