AIDA GELINA BRIKEN nToF CRIB ISOLDE CIRCE nTOFCapture DESPEC DTAS EDI_PSA 179Ta CARME StellarModelling DCF K40
  AIDA  ELOG logo
Message ID: 407     Entry time: Sat Oct 29 07:26:59 2016
Author: TD 
Subject: AIDA ADC & disc data synchronisation check 
Following analysis of AIDA ADC & disc readout ( see https://elog.ph.ed.ac.uk/AIDA/404 )
changed timestamp resolution from 1us/channel to 20.48us/channel


Offline sort (from disk file)

Attachments 1-3  s1-s32  # ADC data items per FEE64, s100-132  # disc data items per FEE64 (20.48us/channel)

Attachments 4-5  s1000   4 * ( module # - 1 ) + ASIC # versus timestamp (ch 0-95 ADC data, ch 100-195 disc data,
20.48us/channel)

Attachments 6-7  MIDASsort terminal session logs for *offline* sort


Online sort (from TapeServer)

Attachment 8     s1-s32  # ADC data items per FEE64, s100-132  # disc data items per FEE64 (20.48us/channel)

Attachments 9-10 s1000   4 * ( module # - 1 ) + ASIC # versus timestamp (ch 0-95 ADC data, ch 100-195 disc data,
20.48us/channel)

Attachments 11-12 MIDASsort terminal session logs for *online* sort

Attachment 13   MIDASsort FORTRAN sort routine sync.f

Attachment 14   Spectrum titles for the above sort routine

Note

1) data is discontinuous as a function of timestamp because we are sampling buffers
from the TapeServer rather than sorting all data as above
2) a low rate of timewarps is reported which appears to be an artifact of the buffer
sampling - no timewarps reported by analyses of the corresponding data files
 
Attachment 1: 100.png  90 kB  Uploaded Sat Oct 29 08:27:32 2016  | Hide | Hide all | Show all
100.png
Attachment 2: 101.png  93 kB  Uploaded Sat Oct 29 08:27:32 2016  | Hide | Hide all | Show all
101.png
Attachment 3: 103.png  93 kB  Uploaded Sat Oct 29 08:27:32 2016  | Hide | Hide all | Show all
103.png
Attachment 4: 104.png  29 kB  Uploaded Sat Oct 29 08:27:32 2016  | Hide | Hide all | Show all
104.png
Attachment 5: 105.png  30 kB  Uploaded Sat Oct 29 08:27:32 2016  | Show | Hide all | Show all
Attachment 6: 106.png  37 kB  Uploaded Sat Oct 29 08:27:32 2016  | Show | Hide all | Show all
Attachment 7: 107.png  75 kB  Uploaded Sat Oct 29 08:27:32 2016  | Hide | Hide all | Show all
107.png
Attachment 8: 110.png  92 kB  Uploaded Sat Oct 29 08:39:14 2016  | Hide | Hide all | Show all
110.png
Attachment 9: 112.png  25 kB  Uploaded Sat Oct 29 08:39:14 2016  | Hide | Hide all | Show all
112.png
Attachment 10: 113.png  30 kB  Uploaded Sat Oct 29 08:39:14 2016  | Hide | Hide all | Show all
113.png
Attachment 11: 116.png  70 kB  Uploaded Sat Oct 29 08:43:20 2016  | Hide | Hide all | Show all
116.png
Attachment 12: 117.png  96 kB  Uploaded Sat Oct 29 08:43:20 2016  | Show | Hide all | Show all
Attachment 13: sync.f  11 kB  Uploaded Sat Oct 29 08:45:44 2016  | Hide | Hide all | Show all
*trigger
128  
*oned
1..32       s 65536
101..132       s 65536
*twod
1000        s 4096 4096
*vars
*sort
C----67---------------------------------------------------------------72------80
      SUBROUTINE init

      IMPLICIT none

      SAVE                                 
C
C     External functions
C
      EXTERNAL dtime
C
      INTEGER and, lshift, rshift
C
      LOGICAL btest
C
      REAL float, secnds
C
C     Parameter variables
C
      INTEGER max
      PARAMETER (max = 2048)
C
C     Local variables
C
      INTEGER adc_data, asic, ch, channel, channel_ident
      INTEGER count, data(0:4095), disc
      INTEGER*8 dt
      INTEGER events, events_old
      INTEGER*8 e_time, e_time_old
      INTEGER i
      INTEGER*2 i2(2), i2_2(4)
      INTEGER i4, i4_2(2)
      INTEGER*8 i8
      INTEGER ierr, information, information_index, int
      INTEGER invalid_id, items, items_old, j, j1, j1_old, j2, j2_old, k
      INTEGER l, mbs_data(0:3), module, m_disc
      INTEGER range, time_warp, total
      INTEGER*8 ts
      INTEGER ts28
      INTEGER ts48
      INTEGER*8 ts_old
      INTEGER type, w(0:31)
C
      LOGICAL first, hit(0:4095)
C
      REAL c(0:7), delta_t, gain(0:max-1), offset(0:max-1)
      REAL t1, t2, t2_old
C
C     Namelists
C
      NAMELIST /variables/ gain, offset, c, w
C
C     Common variables
C
      INTEGER*2 gdata(0:max-1)
C
      COMMON /fdata/ gdata
C
C     Common variables
C
      INTEGER*2 gid(0:max-1)
C
      COMMON /fid/ gid
C
C     Common variables
C
      INTEGER mult
C
      COMMON /fmult/ mult
C
      EQUIVALENCE ( i8, i4_2(1) )
      EQUIVALENCE ( i4, i2(1) )
C
C----67---------------------------------------------------------------72------80

      WRITE ( 6, * ) ' *** AIDA @ RIKEN - sync check - October 2016'
      WRITE ( 6, * ) ' *** Entry init commences'

C     Initialise counters

      events = 0
      events_old = 0

      time_warp = 0
      invalid_id = 0

C     Initialise event data

      DO i = 0, 2047
       data( i ) = 0
       hit( i ) = .FALSE.
      ENDDO

      first = .true.
      ts_old = 0
      e_time_old = 0
      count = 0
      total = 0

      DO i = 0, 127
       gain( i ) = 1.0
       offset( i ) = 0.0
      ENDDO
 
      DO i = 0, 31
       w( i ) = 0
      ENDDO

      DO i = 0, 7
       c( i ) = 1.0
      ENDDO

C     Initialise time

      t1 = SECNDS(0.0)

C     Read program variables via NAMELIST I/O

      OPEN( 1, FILE = '/home/td/GREAT/variables.dat',
     +         IOSTAT = ierr )
      IF ( ierr.NE.0 ) THEN
       WRITE( 6, * ) ' *** OPEN I/O error:', ierr
       RETURN
      ENDIF
      READ( 1, NML = variables, IOSTAT = ierr )
      IF ( ierr.NE.0 ) THEN
       WRITE( 6, * ) ' *** READ I/O error:', ierr
      ENDIF
      CLOSE( 1, IOSTAT = ierr )
      IF ( ierr.NE.0 ) THEN
       WRITE( 6, * ) ' *** CLOSE I/O error:', ierr
       RETURN
      ENDIF  

C     Display program variables

      DO i = 0, 127, 8
       WRITE( 6, 9001 ) i, i+7, ( gain( j ), j = i, i+7 )
      ENDDO

      DO i = 0, 127, 8
       WRITE( 6, 9002 ) i, i+7, ( offset( j ), j = i, i+7 )
      ENDDO

      DO i = 0, 7, 8
       WRITE( 6, 9003 ) i, i+7, ( c(j), j = 1, 8 )
      ENDDO

      DO i = 0, 31, 8
       WRITE( 6, 9004 ) i, i+7, ( w(j), j = i, i+7 )
      ENDDO

      WRITE ( 6, * ) ' *** Entry init ends'

      RETURN

C----67---------------------------------------------------------------72------80

      ENTRY sortin

      items = items + 1

      IF ( MOD( items, 10000000 ).EQ.0 ) THEN
       t2 = SECNDS( t1 )
       delta_t = t2 - t2_old
       WRITE( 6, 9010 ) items, FLOAT( items - items_old ) / delta_t,
     +                  events, FLOAT( events - events_old ) / delta_t
       items_old = items
       events_old = events
       t2_old = t2
      ENDIF

C----67---------------------------------------------------------------72------80
C     Event data

C     For Linux/x64 & Windows/x86 least significant 16-bit word i2(1)
C     For Solaris/SPARC least significant 16-bit word i2(2)

C     GREAT 3.2.1 format
C
C     Other information
C      gid[0]=-1
C     gdata[0]=module number
C     gdata[1]=information type (2=Pause, 3=Resume, 4=SYNC100, 6=FEE64 disc etc)
C     gdata[2]=information field (bits 16-19)
C     gdata[3]=information field (bits 0-15)
C     gdata[4]=time stamp (bits 16-27)
C     gdata[5]=time stamp (bits 0-15) 
C
C     ADC data format
C
C       gid[0]=channel ident (FEE64 module bits 6-11, channel bits 0-5)
C     gdata[0]=fail/veto bits (AIDA: fail=0, veto=0 LEC/MEC, veto=1 HEC)
C     gdata[1]=?
C     gdata[2]=ADC data
C     gdata[3]=time stamp (bits 16-27)
C     gdata[4]=time stamp (bits 0-15) 

C----67---------------------------------------------------------------72------80
C     gid = - 1   Other information

      IF ( gid(0).EQ.-1 ) THEN

       i2(2) = 0
       i2(1) = gdata(0)
       module = AND( i4, Z'0000003f' )
       i2(1) = gdata(1)
       type = AND( i4, Z'0000000f' )
       i2(2) = gdata(2)
       i2(1) = gdata(3)
       information = AND( i4, Z'000fffff' )
       i2(2) = gdata(4)
       i2(1) = gdata(5)
       ts28 = AND( i4, Z'0fffffff' )

       IF ( type.EQ.2 ) THEN

C----67---------------------------------------------------------------72------80
C     PAUSE timestamp

        ts48 = information

        i8 = 0
        i4_2( 1 ) = ts48
        ts = LSHIFT( i8, 28 )
        i8 = 0
        i4_2(1) = ts28
        ts = ts + i8

       ELSEIF( type.EQ.3 ) THEN

C----67---------------------------------------------------------------72------80
C     RESUME timestamp

        ts48 = information

        i8 = 0
        i4_2( 1 ) = ts48
        ts = LSHIFT( i8, 28 )
        i8 = 0
        i4_2(1) = ts28
        ts = ts + i8

       ELSEIF( type.EQ.4 ) THEN

C----67---------------------------------------------------------------72------80
C     SYNC100 timestamp

        ts48 = information

        i8 = 0
        i4_2( 1 ) = ts48
        ts = LSHIFT( i8, 28 )
        i8 = 0
        i4_2(1) = ts28
        ts = ts + i8

       ELSEIF( type.EQ.6 ) THEN

C----67---------------------------------------------------------------72------80
C     FEE64 discriminator

        i8 = 0
        IF ( ts28.LE.Z'00000A0' ) THEN
         i4_2( 1 ) = ts48 + 1
        ELSE
         i4_2( 1 ) = ts48
        ENDIF
        ts = LSHIFT( i8, 28 )
        i8 = 0
        i4_2(1) = ts28
        ts = ts + i8

        disc = AND( information, Z'0000ffff' )
        asic = AND( RSHIFT( information, 16 ), Z'0000000f' )
        m_disc = 0
        DO i = 0, 15
         IF ( btest( disc, i ) ) THEN
          m_disc = m_disc + 1
         ENDIF
        ENDDO

C       Increment ts spectra per FEE64 module
        j1 = MOD( RSHIFT( ts, 11 ), 65536 )
        CALL incv1d( module + 100, j1, m_disc)

C       Increment ts spectra per FEE64 module
        j2 = MOD( RSHIFT( ts, 11 ), 65536 )
        ch = ( ( module - 1 ) * 4 ) + asic + 100
        CALL incv2d( 1000, ch, j2, m_disc )

... 186 more lines ...
Attachment 14: titles.dat  2 kB  Uploaded Sat Oct 29 08:46:07 2016  | Hide | Hide all | Show all
s1 nnaida1: ADC data items (20us/ch)
s2 nnaida2: ADC data items (20us/ch)
s3 nnaida3: ADC data items (20us/ch)
s4 nnaida4: ADC data items (20us/ch)
s5 nnaida5: ADC data items (20us/ch)
s6 nnaida6: ADC data items (20us/ch)
s7 nnaida7: ADC data items (20us/ch)
s8 nnaida8: ADC data items (20us/ch)
s9 nnaida9: ADC data items (20us/ch)
s10 nnaida10: ADC data items (20us/ch)
s11 nnaida11: ADC data items (20us/ch)
s12 nnaida12: ADC data items (20us/ch)
s13 nnaida13: ADC data items (20us/ch)
s14 nnaida14: ADC data items (20us/ch)
s15 nnaida15: ADC data items (20us/ch)
s16 nnaida16: ADC data items (20us/ch)
s17 nnaida17: ADC data items (20us/ch)
s18 nnaida18: ADC data items (20us/ch)
s19 nnaida19: ADC data items (20us/ch)
s20 nnaida20: ADC data items (20us/ch)
s21 nnaida21: ADC data items (20us/ch)
s22 nnaida22: ADC data items (20us/ch)
s23 nnaida23: ADC data items (20us/ch)
s24 nnaida24: ADC data items (20us/ch)
s25 nnaida25: ADC data items (20us/ch)
s26 nnaida26: ADC data items (20us/ch)
s27 nnaida27: ADC data items (20us/ch)
s28 nnaida28: ADC data items (20us/ch)
s29 nnaida29: ADC data items (20us/ch)
s30 nnaida30: ADC data items (20us/ch)
s31 nnaida31: ADC data items (20us/ch)
s32 nnaida32: ADC data items (20us/ch)

s101 nnaida1: Disc data items (20us/ch)
s102 nnaida2: Disc data items (20us/ch)
s103 nnaida3: Disc data items (20us/ch)
s104 nnaida4: Disc data items (20us/ch)
s105 nnaida5: Disc data items (20us/ch)
s106 nnaida6: Disc data items (20us/ch)
s107 nnaida7: Disc data items (20us/ch)
s108 nnaida8: Disc data items (20us/ch)
s109 nnaida9: Disc data items (20us/ch)
s110 nnaida10: Disc data items (20us/ch)
s111 nnaida11: Disc data items (20us/ch)
s112 nnaida12: Disc data items (20us/ch)
s113 nnaida13: Disc data items (20us/ch)
s114 nnaida14: Disc data items (20us/ch)
s115 nnaida15: Disc data items (20us/ch)
s116 nnaida16: Disc data items (20us/ch)
s117 nnaida17: Disc data items (20us/ch)
s118 nnaida18: Disc data items (20us/ch)
s119 nnaida19: Disc data items (20us/ch)
s120 nnaida20: Disc data items (20us/ch)
s121 nnaida21: Disc data items (20us/ch)
s122 nnaida22: Disc data items (20us/ch)
s123 nnaida23: Disc data items (20us/ch)
s124 nnaida24: Disc data items (20us/ch)
s125 nnaida25: Disc data items (20us/ch)
s126 nnaida26: Disc data items (20us/ch)
s127 nnaida27: Disc data items (20us/ch)
s128 nnaida28: Disc data items (20us/ch)
s129 nnaida29: Disc data items (20us/ch)
s130 nnaida30: Disc data items (20us/ch)
s131 nnaida31: Disc data items (20us/ch)
s132 nnaida32: Disc data items (20us/ch)

s1000 4*(module # - 1) + asic # (0-95 ADC; 100-195 Disc) versus timestamp (20us/ch)

ELOG V3.1.4-unknown