Tuda logbooks General E1104 ISACII E1195 E1103 E1147 S1287 S1203 S1233 S1284 S1447 23Na(a,p) S1540 S1381  S1847 Catania
  S1284  ELOG logo
Message ID: 2     Entry time: Fri Nov 29 16:00:09 2013
Author: Naomi 
Type:  
Category: General 
Subject: MIDASUK sort 

1) some info is written in tuda/Documents/READMEs/readme.MIDASsort

MIDAS Main Menu -> Sorting -> MIDASsort

enter sort.f file in Sortfile window and compile with Compile Sortfile

- example file sort3.f with the variables.dat file that contains gain, offset, calibration and other variables, is attached below.

- the base code which just unpacks data without sorting it, sort.f is also attached

- make sure you have the correct path for the variables.dat file in sort3.f

- Note that this variables.dat file was downloaded on a Mac OSX and which adds extra invisible characters at the end of each line and therefore won't be read in properly in MIDASsort.

for online sorting go to Input Media -> Online

for offline sorting go to Input Media -> Disc, the Disc Info. Browse file, Add it and Save and Quit

hit Start button to run sort file. the output is printed in the terminal running MIDAS-session

in Spectrum Directory Browser or Spectrum Viewer go to Resource -> SortSas the Redisplay. here you'll see all spectra created in sort.f

you can add a spectrum title files like the example given below in the Spectrum Directory Browser via Actions -> Apply title and then Options -> Details

- you can add titles for the Resource -> hist spectra with the another title file

if the spectra don't refresh properly Select all and Actions -> Delete in Spectrum Directory Browser and then Start the sorting program 

 

2) you can view online spectra in Spectrum Directory Browser -> Resource -> hist

remember to Select all and Actions -> zero and deselect if you want to view only the current run, otherwise you are seeing the spectra of incremented runs

 

3) to get gain, offset and calibration coefficients go to tuda/Documents/READMEs/readme.calibration

you need to have pulsar runs with amplitude varied from 90,000 to 10,000 in step size of 10,000 and the peaks should span the entire spectrum if possible and all contain ~1000 counts

you need 3-alpha calibration source runs

- gain and offsets are calculated for ADCs and offsets only for TDCs since clock is the same and there are offsets due to cable lengths, hence delay times

- Tom did this for us since we couldn't figure out the first step in the readme file using the peakfind program. The correct syntax for future knowledge is:

peakfind -spectrum <spectrum file name> -limit <low limit> <high limit> -fwhm <fwhm> -accept <accept>

 

4) to view scalars during run go to VME Module Control -> CEN V560 scalar and wait 10 s for refresh rate

 

5) meaning of c and w variables in sort3.f

c(0) and c(1) are calibration constants

c(8) and c(9) are used in equation pi (particle identification) which uses the total energy of S2 delE and E

c(8)=b is based on the semi-empirical range formula of charged particles in the detector r=(a*E)^b. You can find the values in the Knoll book of F. Goulding paper.

c(9) stretches the spectrum and can be a value between 0.5 and 5

w(0) and w(1) are windows for the (front strip - back strip) S2 delE values which should be a Gaussian peak centered around 2048, an arbitrary value so that the center is not around 0.

w(2) and w(3) are the same but for S2 E

w(17) and w(18) are windows used to select a particle type from the equation pi

w(19) and w(20) ignore. was used for a second delE and E detector in a previous experiment

 

6) summary of spectra created and used in sort3.f:

0-351 1D ADC histograms

3100-3115 1D scalar histograms

3000 1D channels w/ hits

3003 2D ADC ch vs ADC histo ch

3006 1D multiplicity + (3000 + number of good delE hits) + (3100 + number of good E hits)

3050 2D S2 delE front vs back

3060 1D S2 delE (front - back)

3051 2D S2 delE good front vs back

3061 1D S2 delE good (front - back)

3052 2D S2 E front vs back

3062 1D S2 E (front - back)

3053 2D S2 E good front vs back

3063 1D S2 E good (front - back)

4000 2D S2 energy vs annulus strip + (48 + energy vs annulus strip)

4010 2D S2 delE vs E

4011 1D pi

4012 2D pi vs tot energy

4013 1D total energy of selected particle using gates w(17) and w(18)

 

7) unpacking raw data in sort.f

ADC channels are put into channels 0-999

ADCs have 32 channels each and the first module is in the right slot of the VME crate.

TDC channels are put into channels 1000-1999 and ADC channel 1 corresponds to TDC channel 1001

TDC have 128 channels but only 112 channels are used. The first 16 are empty. So channels 16-127 from TDC#1 are put into channel 1000-1111 and from TDC#2 into channel 1112-1223, etc

Attachment 1: sort3.f  33 kB  | Hide | Hide all
*trigger
128  
*oned
0..351  s 4096
1000..1335  s 512
3000  s 1024	
3001  s 1024	
3002  s 1024	
3006  s 4096	
3060..3067  s 4096
3100..3115  s 16384
4011  s 1024
4013  s 1024
4015  s 1024
4017  s 1024
*twod
2000..2335  s 512 512
3003  s 512 512
3004  s 512 512
3005  s 512 512
3050..3057  s 512 512
4000..4007  s 512 512
4010  s 512 512
4012  s 512 512
4014  s 512 512
4016  s 512 512
*vars
*sort
C----67---------------------------------------------------------------72------80
C http://npg.dl.ac.uk/MIDAS/manual/MIDASsortHOWTO/info.pdf
      SUBROUTINE init

      IMPLICIT none

      SAVE
C
C     External functions
C
      EXTERNAL de_1h_al, de_1h_cd2, dtime, elab2ex, gate2d, path_factor
      EXTERNAL s2order, s2_1_theta, s2_3_theta
C
      INTEGER and, gate2d, int, rshift, s2order
C
      REAL de_1h_al, de_1h_cd2, dtime, elab2ex, float, path_factor, rand
      REAL s2_1_theta, s2_3_theta
C
C     Parameter variables
C
      INTEGER maxadcs
      PARAMETER (maxadcs = 2200)
      INTEGER adcs_max
      PARAMETER (adcs_max = 11*32)
      INTEGER tdcs_max
      PARAMETER (tdcs_max = 3*112) !not 3*127?
      INTEGER maxscalers
      PARAMETER (maxscalers = 16)
      INTEGER maxepics
      PARAMETER (maxepics = 64)
      INTEGER event_prescaler
      PARAMETER (event_prescaler = 1000000)
      INTEGER scaler_prescaler
      PARAMETER (scaler_prescaler = 1000000)
      INTEGER epics_prescaler
      PARAMETER (epics_prescaler = 1000000)
C
      LOGICAL csm
      PARAMETER (csm = .true.)
C
C     Local variables	!**********************************************
C
      INTEGER channel, counter_old(0:maxscalers-1), data(0:maxadcs-1)
      INTEGER epics_counter, events, events_old, gate1(18), good_s2_1
      INTEGER good_s2_1_back(0:63), good_s2_1_front(0:63), good_s2_2
      INTEGER good_s2_2_back(0:63), good_s2_2_front(0:63), i
      INTEGER*2 i2(2)
      INTEGER i4, ierr, iflag, ireturn, ix, iy, j, k, l, monitor(0:9)
      INTEGER monitor_old(0:9), m_adc, m_tdc, scaler(0:maxscalers-1)
      INTEGER scaler_old(0:maxscalers-1), sc_counter, sector
      INTEGER sum(0:maxscalers-1), type, w(0:31)
C
      LOGICAL good_s2_1_event, good_s2_2_event, hit(0:maxadcs-1)
C
      REAL c(0:31), de1, de2, dt, e(0:adcs_max-1), e1, e2, ediff
      REAL epics(0:maxepics-1), event_rate, e_lab, e_x
      REAL gain(0:maxadcs-1), lt, offset(0:maxadcs-1), pi, r4
      REAL rate(0:maxscalers-1), temp, time(2)

C
C     Namelists
C
      NAMELIST /variables/ offset, gain, c, w
C
C     Common variables
C
      INTEGER*2 adc_data(0:maxadcs-1)
C
      COMMON /fdata/ adc_data
C
C     Common variables
C
      INTEGER*2 adcs(0:maxadcs-1)
C
      COMMON /fid/ adcs
C
C     Common variables
C
      INTEGER noadcs
C
      COMMON /fmult/ noadcs
C
      EQUIVALENCE  ( i4, i2( 1 ) )

C     MIDAS polygon
C     {{396 96} {404 109} {421 124} {448 144} {475 144} {454 129} {432 113} {416 96}}
C
!**********************************************
      DATA gate1 /396, 96,404,109,421,124,448,144,475,144,454,129,
     +            432,113,416, 96, -1, -1/

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

      WRITE ( 6, * ) ' *** S1284 - sort3 - November 2013'
      WRITE ( 6, * ) ' *** Entry init commences'

C     Initialise arrays for unpacked event data.

      DO i = 0, maxadcs - 1
       data( i ) = 0
       hit( i ) = .FALSE.
      ENDDO

C     Initialise gains/offsets

      DO i = 0, maxadcs - 1
       gain( i ) = 1.0
       offset( i ) = 0.0
      ENDDO

C     Initialise constants/1D windows

      DO i = 0, 31
       c( i ) = 1.0
       w( i ) = 0
      ENDDO

C     Initialise scalers

      DO i = 0, maxscalers - 1
       scaler( i ) = 0
       scaler_old( i ) = 0
       counter_old( i ) = 0
       rate( i ) = 0.0
      ENDDO

C     Initialise counters

      sc_counter = 0
      epics_counter = 0
      events = 0
      events_old = 0
      channel = 0

      DO i = 0, 9
       monitor( i ) = 0
       monitor_old( i ) = 0
      ENDDO

      OPEN( 1, FILE = '/home/tuda/S1284/calibration/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, adcs_max-1, 8
       WRITE( 6, 9001 ) i, i+7, ( gain( j ), j = i, i+7 )
      ENDDO

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

      DO i = 1000, 1000+tdcs_max-1, 8
       WRITE( 6, 9002 ) i, i+7, ( offset( j ), j = i, i+7 )
      ENDDO

      DO i = 0, 31, 8
       WRITE( 6, 9003 ) i, i+7, ( c( j ), j = i, i+7 )
      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

      events = events + 1

      IF ( MOD( events, event_prescaler ).EQ.0 ) THEN
       rate = FLOAT( events - events_old ) / dtime(time)
       WRITE( 6, * ) ' *** event:', events, ' (', rate,' events/s)'
       events_old = events
      ENDIF

C     Convert Eurogam type 0 ID to (a more) logical channel number.
C	ADC data	channels 0-999
C	TDC data	channels 1000-1999
C	Scaler data	channels 2000-2099
C	EPICS data	channels 2100-2199

      call egid2logical( noadcs, adcs, adc_data, type, csm )

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

      IF ( MOD( events, event_prescaler ).EQ.0 ) THEN
       WRITE( 6, * ) ' *** Packed event:', events, ' noadcs:', noadcs
       DO i = 0, noadcs - 1
        WRITE( 6, 9050 ) adcs( i ), adc_data( i )
       ENDDO
      ENDIF

C     Unpack event data from packed data arrays.
c If you want to write events in ascii format do it here event number = 'events'

      DO i = 0, noadcs - 1
       IF ( adcs( i ).GE.0 .AND. adcs( i ).LT.maxadcs ) THEN
        data( adcs( i ) ) = adc_data( i )
        hit( adcs( i ) ) = .TRUE.
       ENDIF
      ENDDO

      IF ( MOD( events, event_prescaler ).EQ.0 ) THEN
       WRITE( 6, * ) ' *** Unpacked event:', events
       DO i = 0, adcs_max-1, 16
c        WRITE(6,9060) i, i+15, (data(j),hit(j),j=i,i+15)
       ENDDO
       DO i = 1000, 1000+tdcs_max-1, 16
c        WRITE(6,9060) i, i+15, (data(j),hit(j),j=i,i+15)
       ENDDO
      ENDIF

C----67---------------------------------------------------------------72------80
C     Scaler data.

      IF ( AND( X'00000002', type ).EQ.2 ) THEN

C       IF ( MOD( sc_counter, scaler_prescaler ).EQ.0 ) THEN
C        WRITE( 6, 9010 ) sc_counter
C        DO i = 0, maxscalers-1, 4
C         WRITE( 6, 9020 ) i, i+3, ( scaler(j),
C     +                    1.0E-03 * rate(j), j = i, i+3 )
C        ENDDO
C       ENDIF

       j = 0

       DO  i = 2000, 2000 + ( 2 * maxscalers ) - 1, 2
        i2( 1 ) = data( i + 1 )
        i2( 2 ) = data( i )
        scaler( j ) = i4
        j = j + 1
       ENDDO

C      Scalers are reset at the start of each run.
C
C      Note that scalers do not necessarily increase monotonically
C      from event to event - this probably indicates that the most
C      frequently changing (least significant) bits are not stable
C      at readout.

       IF ( scaler( 2 )+100.LT.counter_old( 2 ) ) THEN
        DO i = 0, maxscalers - 1
         sum( i ) = sum( i ) + counter_old( i )
         counter_old( i ) = 0
        ENDDO
       ELSE
        DO i = 0, maxscalers - 1
         counter_old( i ) = scaler( i )
        ENDDO
       ENDIF

       IF ( scaler( 2 ).LT.scaler_old( 2 ) ) THEN
... 857 more lines ...
Attachment 2: variables.dat  10 kB  | Hide | Hide all
  $variables
  offset(   0) =    31.41
  offset(   1) =    31.29
  offset(   2) =    31.79
  offset(   3) =    31.87
  offset(   4) =    33.64
  offset(   5) =    31.30
  offset(   6) =    32.19
  offset(   7) =    33.39
  offset(   8) =    34.29
  offset(   9) =    33.57
  offset(  10) =    36.11
  offset(  11) =    37.50
  offset(  12) =    37.62
  offset(  13) =    35.17
  offset(  14) =    35.58
  offset(  15) =    37.27
  offset(  16) = -9999.99
  offset(  17) =    32.02
  offset(  18) =    37.84
  offset(  19) =    36.62
  offset(  20) =    36.39
  offset(  21) =    36.95
  offset(  22) =    37.84
  offset(  23) =    35.13
  offset(  24) =    35.62
  offset(  25) =    34.73
  offset(  26) =    35.63
  offset(  27) =    38.12
  offset(  28) =    36.32
  offset(  29) =    35.51
  offset(  30) =    32.97
  offset(  31) =    35.77
  offset(  32) =    31.75
  offset(  33) =    33.50
  offset(  34) =    33.28
  offset(  35) =    33.97
  offset(  36) =    32.90
  offset(  37) =    32.63
  offset(  38) =    32.89
  offset(  39) =    33.37
  offset(  40) =   -17.41
  offset(  41) =   -13.32
  offset(  42) =   -13.73
  offset(  43) =   -12.24
  offset(  44) =   -14.26
  offset(  45) =   -12.23
  offset(  46) =   -12.82
  offset(  47) =   -12.28
  offset(  48) =    24.16
  offset(  49) =    28.12
  offset(  50) =    45.24
  offset(  51) =    26.33
  offset(  52) = -9999.99
  offset(  53) = -9999.99
  offset(  54) = -9999.99
  offset(  55) = -9999.99
  offset(  56) =    40.21
  offset(  57) =    39.20
  offset(  58) =    33.12
  offset(  59) =    35.13
  offset(  60) =    36.40
  offset(  61) =    35.18
  offset(  62) =    35.74
  offset(  63) =    36.09
  offset(  64) =    27.40
  offset(  65) =    27.24
  offset(  66) =    27.52
  offset(  67) =    27.10
  offset(  68) =    27.57
  offset(  69) =    27.70
  offset(  70) =    29.03
  offset(  71) =    26.87
  offset(  72) =   -36.36
  offset(  73) =   -31.53
  offset(  74) =   -30.36
  offset(  75) =   -29.43
  offset(  76) =   -30.47
  offset(  77) =   -28.96
  offset(  78) =   -32.84
  offset(  79) =   -31.52
  offset(  80) =   -23.06
  offset(  81) =   -18.09
  offset(  82) =   -15.50
  offset(  83) =   -19.60
  offset(  84) =   -18.12
  offset(  85) =   -18.66
  offset(  86) =   -16.42
  offset(  87) =   -22.14
  offset(  88) =   -22.39
  offset(  89) =   -18.49
  offset(  90) =   -19.65
  offset(  91) =   -17.35
  offset(  92) =   -20.03
  offset(  93) =   -16.58
  offset(  94) =   -18.52
  offset(  95) =   -22.13
  offset(  96) =    43.37
  offset(  97) =    44.19
  offset(  98) =    43.32
  offset(  99) =    41.98
  offset( 100) =    43.88
  offset( 101) =    43.42
  offset( 102) =    43.98
  offset( 103) =    41.18
  offset( 104) =    51.60
  offset( 105) =    49.56
  offset( 106) =    48.34
  offset( 107) =    49.15
  offset( 108) =    48.39
  offset( 109) =    49.26
  offset( 110) =    48.76
  offset( 111) =    49.65
  offset( 112) =    28.31
  offset( 113) =    25.35
  offset( 114) =    21.72
  offset( 115) =    23.50
  offset( 116) =    24.52
  offset( 117) =    28.99
  offset( 118) =    27.40
  offset( 119) =    23.97
  offset( 120) =    29.23
  offset( 121) =    30.69
  offset( 122) =    29.95
  offset( 123) =    27.70
  offset( 124) =    28.73
  offset( 125) =    30.00
  offset( 126) =    29.31
  offset( 127) =    30.25
  offset( 128) =    20.90
  offset( 129) =    22.26
  offset( 130) =    22.64
  offset( 131) =    26.74
  offset( 132) =    24.38
  offset( 133) =    22.22
  offset( 134) =    22.90
  offset( 135) =    23.62
  offset( 136) =    27.99
  offset( 137) =    26.52
  offset( 138) =    27.80
  offset( 139) =    27.41
  offset( 140) =    25.65
  offset( 141) =    26.23
  offset( 142) =    26.12
  offset( 143) =    24.43
  offset( 144) =    27.80
  offset( 145) =    27.06
  offset( 146) =    29.27
  offset( 147) =    30.10
  offset( 148) =    28.28
  offset( 149) =    27.17
  offset( 150) =    28.03
  offset( 151) =    25.26
  offset( 152) =    27.64
  offset( 153) =    23.81
  offset( 154) =    24.29
  offset( 155) =    26.64
  offset( 156) =    25.77
  offset( 157) =    25.07
  offset( 158) =    23.78
  offset( 159) =    25.81
  offset( 160) =    22.41
  offset( 161) =    25.83
  offset( 162) =    26.11
  offset( 163) =    23.48
  offset( 164) =    26.00
  offset( 165) =    23.42
  offset( 166) =    20.81
  offset( 167) =    23.35
  offset( 168) =    25.29
  offset( 169) =    21.69
  offset( 170) =    22.04
  offset( 171) =    21.08
  offset( 172) =    23.79
  offset( 173) =    19.86
  offset( 174) =    19.94
  offset( 175) =    19.68
  offset( 176) =    28.38
  offset( 177) =    26.20
  offset( 178) =    27.22
  offset( 179) =    25.10
  offset( 180) =    31.31
  offset( 181) =    29.20
  offset( 182) =    27.74
  offset( 183) =    24.80
  offset( 184) =    26.69
  offset( 185) =    27.00
  offset( 186) =    26.83
  offset( 187) =    24.19
  offset( 188) =    22.71
  offset( 189) =    24.02
  offset( 190) =    23.84
  offset( 191) =    21.18
  offset( 192) =    19.09
  offset( 193) =    20.71
  offset( 194) =    18.45
  offset( 195) =    19.36
  offset( 196) =    19.31
  offset( 197) =    19.02
  offset( 198) =    19.95
  offset( 199) =    18.29
  offset( 200) =   -23.34
  offset( 201) =   -24.26
  offset( 202) =     0.00
  offset( 203) =   -23.53
  offset( 204) =   -26.73
  offset( 205) =   -23.81
  offset( 206) =   -24.30
  offset( 207) =   -27.00
  offset( 208) =   -19.63
  offset( 209) =   -21.13
  offset( 210) =   -22.79
  offset( 211) = -9999.99
  offset( 212) =   -22.70
  offset( 213) =   -22.73
  offset( 214) =   -24.32
  offset( 215) =   -23.63
  offset( 216) =   -38.25
  offset( 217) =   -38.35
  offset( 218) =   -38.55
  offset( 219) =   -39.72
  offset( 220) =   -38.57
  offset( 221) =   -40.33
  offset( 222) =   -40.50
  offset( 223) =   -41.18
  offset( 224) =    25.74
  offset( 225) =    27.95
  offset( 226) =    27.69
  offset( 227) =    25.68
  offset( 228) =    27.78
  offset( 229) =    27.97
  offset( 230) =    26.08
  offset( 231) =    28.08
  offset( 232) =   -32.10
  offset( 233) =   -32.45
  offset( 234) =   -33.02
  offset( 235) =   -32.41
  offset( 236) =   -32.52
  offset( 237) =   -24.52
  offset( 238) =   -32.77
  offset( 239) =   -34.87
  offset( 240) =   -33.55
  offset( 241) =   -35.15
  offset( 242) =   -34.74
  offset( 243) =   -34.38
  offset( 244) =   -34.24
  offset( 245) =   -34.78
  offset( 246) =   -34.57
  offset( 247) =   -34.79
  offset( 248) =   -36.63
  offset( 249) =   -36.75
  offset( 250) =   -35.59
  offset( 251) =   -35.02
  offset( 252) =   -37.42
  offset( 253) =   -37.84
  offset( 254) =   -36.60
  offset( 255) =   -37.22
  gain(   0) =    0.9408154
  gain(   1) =    0.9432995
  gain(   2) =    0.9275470
  gain(   3) =    0.9044398
  gain(   4) =    1.0000000
  gain(   5) =    0.9106534
  gain(   6) =    0.9723005
  gain(   7) =    0.9143751
  gain(   8) =    0.9632197
  gain(   9) =    0.9683237
  gain(  10) =    0.9703364
  gain(  11) =    0.9284047
  gain(  12) =    0.9579666
  gain(  13) =    0.9669750
  gain(  14) =    0.9431901
  gain(  15) =    0.9444321
  gain(  16) =   -1.9999999
  gain(  17) =   -1.9999999
  gain(  18) =    0.9527306
  gain(  19) =    0.9462996
  gain(  20) =    0.9657578
  gain(  21) =    0.9265667
  gain(  22) =    0.9205554
  gain(  23) =    0.9162895
  gain(  24) =    0.9413665
  gain(  25) =    0.9282222
  gain(  26) =    0.9303361
  gain(  27) =    0.9378214
  gain(  28) =    0.9456897
  gain(  29) =    0.9602508
  gain(  30) =    0.9427250
  gain(  31) =    0.9513409
  gain(  32) =    0.9119371
  gain(  33) =    0.9569856
  gain(  34) =    0.9309798
  gain(  35) =    0.9473361
  gain(  36) =    0.9212945
  gain(  37) =    0.9826480
  gain(  38) =    0.9588793
  gain(  39) =    0.9500576
  gain(  40) =    0.9413007
  gain(  41) =    0.9313699
  gain(  42) =    0.9417806
... 97 more lines ...
Attachment 3: S1284_sort_spectrum_titles.txt  3 kB  | Hide | Hide all
s0 DE1 p+n strip 0 ADC
s47 DE1 p+n strip 47 ADC
s48 DE1 n+n strip 0 ADC
s63 DE1 n+n strip 15 ADC

s64 E1 p+n strip 0 ADC
s111 E1 p+n strip 47 ADC
s112 E1 n+n strip 0 ADC
s127 E1 n+n strip 15 ADC

s128 DE2 p+n strip 0 ADC
s175 DE2 p+n strip 47 ADC
s176 DE2 n+n strip 0 ADC
s191 DE2 n+n strip 15 ADC

s192 E2 p+n strip 0 ADC
s239 E2 p+n strip 47 ADC
s240 E2 n+n strip 0 ADC
s255 E2 n+n strip 15 ADC

s1000 DE1 p+n strip 0 TDC
s1047 DE1 p+n strip 47 TDC
s1048 DE1 n+n strip 0 TDC
s1063 DE1 n+n strip 15 TDC

s1064 E1 p+n strip 0 TDC
s1111 E1 p+n strip 47 TDC
s1112 E1 n+n strip 0 TDC
s1127 E1 n+n strip 15 TDC

s1128 DE2 p+n strip 0 TDC
s1175 DE2 p+n strip 47 TDC
s1176 DE2 n+n strip 0 TDC
s1191 DE2 n+n strip 15 TDC

s1192 E2 p+n strip 0 TDC
s1239 E2 p+n strip 47 TDC
s1240 E2 n+n strip 0 TDC
s1255 E2 n+n strip 15 TDC

s2000 DE1 p+n strip 0 TDC versus ADC
s2047 DE1 p+n strip 47 TDC versus ADC
s2048 DE1 n+n strip 0 TDC versus ADC
s2063 DE1 n+n strip 15 TDC versus ADC

s2064 E1 p+n strip 0 TDC versus ADC
s2111 E1 p+n strip 47 TDC versus ADC
s2112 E1 n+n strip 0 TDC versus ADC
s2127 E1 n+n strip 15 TDC versus ADC

s2128 DE2 p+n strip 0 TDC versus ADC
s2175 DE2 p+n strip 47 TDC versus ADC
s2176 DE2 n+n strip 0 TDC versus ADC
s2191 DE2 n+n strip 15 TDC versus ADC

s2192 E2 p+n strip 0 TDC versus ADC
s2239 E2 p+n strip 47 TDC versus ADC
s2240 E2 n+n strip 0 TDC versus ADC
s2255 E2 n+n strip 15 TDC versus ADC

s3000 ADC Hit Pattern
s3001 TDC Hit Pattern
s3002 ADC.TDC Hit Pattern
s3003 channel versus ADC
s3004 channel versus TDC
s3005 TDC channel versus ADC channel
s3006 Multiplicity

s3050 DE1 p+n energy versus n+n energy
s3051 DE1 p+n energy versus n+n energy: gated
s3052 E1 p+n energy versus n+n energy
s3053 E1 p+n energy versus n+n energy: gated
s3054 DE2 p+n energy versus n+n energy
s3055 DE2 p+n energy versus n+n energy: gated
s3056 E2 p+n energy versus n+n energy
s3057 E2 p+n energy versus n+n energy: gated

s3060 DE1 E(p+n) - E(n+n) + 2048
s3061 DE1 E(p+n) - E(n+n) + 2048: gated
s3062 E1 E(p+n) - E(n+n) + 2048
s3063 E1 E(p+n) - E(n+n) + 2048: gated
s3064 DE2 E(p+n) - E(n+n) + 2048
s3065 DE2 E(p+n) - E(n+n) + 2048: gated
s3066 E2 E(p+n) - E(n+n) + 2048
s3067 E2 E(p+n) - E(n+n) + 2048: gated

s3100 Scaler #0 - triggers - 1000*rate(Hz) updated every 60s
s3101 Scaler #1 - triggers accepted
s3102 Scaler #2 - 1kHz clock
s3103 Scaler #3 - pulser
s3104 Scaler #4

s3108 Scaler #8 
s3109 Scaler #9 
s3110 Scaler #10 
s3111 Scaler #11 
s3112 Scaler #12 
s3113 Scaler #13 
s3114 Scaler #14 
s3115 Scaler #15 

s4000  Energy vs ordered strip S2s
s4002  Energy vs ordered strip for 'good' events S2s
s4004  dE1+E1 (proton gate) lab energy versus S2-1 strip #
s4005  dE1+E1 (proton gate) excitation energy versus S2-1 strip #
s4006  dE2+E2 (proton gate) lab energy versus S2-3 strip #
s4007  dE2+E2 (proton gate) excitation energy versus S2-3 strip #
s4008  Energy vs ordered strip LEDAs

s4010  S2-2 E1 versus S2-1 dE1 (100keV/channel)
s4011  Particle ID
s4012  Particle ID versus dE1+E1 (100keV/channel)
s4013  dE1+E1 (proton gate) (100keV/channel)
s4014  S2-4 E2 versus S2-3 dE2 (100keV/channel)
s4015  Particle ID
s4016  Particle ID versus dE2+E2 (100keV/channel)
s4017  dE2+E2 (proton gate) (100keV/channel)
s4018  dE1+E1 (proton gate) lab energy versus angle
s4019  dE2+E2 (proton gate) lab energy versus angle
s4120  dphi
Attachment 4: S1284_VME_spectrum_titles.txt  1 kB  | Hide | Hide all
s9418#1.adc0 dE1 p+n strip 0 ADC
s9418#2.adc15 dE1 p+n strip 47 ADC
s9418#2.adc16 dE1 n+n strip 0 ADC
s9418#2.adc31 dE1 n+n strip 15 ADC

s9418#3.adc0 E1 p+n strip 0 ADC
s9418#4.adc15 E1 p+n strip 47 ADC
s9418#4.adc16 E1 n+n strip 0 ADC
s9418#4.adc31 E1 n+n strip 15 ADC

s9418#5.adc0 dE2 p+n strip 0 ADC
s9418#6.adc15 dE2 p+n strip 47 ADC
s9418#6.adc16 dE2 n+n strip 0 ADC
s9418#6.adc31 dE2 n+n strip 15 ADC

s9418#7.adc0 E2 p+n strip 0 ADC
s9418#8.adc15 E2 p+n strip 47 ADC
s9418#8.adc16 E2 n+n strip 0 ADC
s9418#8.adc31 E2 n+n strip 15 ADC

s9418#9.adc0 LEDA-0 strip 0 ADC
s9418#9.adc15 LEDA-0 strip 15 ADC
s9418#9.adc16 LEDA-1 strip 0 ADC
s9418#9.adc31 LEDA-1 strip 15 ADC
s9418#10.adc0 LEDA-2 strip 0 ADC
s9418#10.adc15 LEDA-2 strip 15 ADC
s9418#10.adc16 LEDA-3 strip 0 ADC
s9418#10.adc31 LEDA-3 strip 15 ADC

s9418#11.adc0 PIN photodiode 1 ADC
s9418#11.adc1 PIN photodiode 2 ADC
s9418#11.adc2 PIN photodiode 3 ADC
s9418#11.adc3 PIN photodiode 4 ADC

v1190#1.tdc16 dE1 p+n strip 0 TDC
v1190#1.tdc63 dE1 p+n strip 47 TDC
v1190#1.tdc64 dE1 n+n strip 0 TDC
v1190#1.tdc79 dE1 n+n strip 15 TDC

v1190#1.tdc80 E1 p+n strip 0 TDC
v1190#1.tdc127 E1 p+n strip 47 TDC
v1190#2.tdc16 E1 n+n strip 0 TDC
v1190#2.tdc31 E1 n+n strip 15 TDC

v1190#2.tdc32 dE2 p+n strip 0 TDC
v1190#2.tdc79 dE2 p+n strip 47 TDC
v1190#2.tdc80 dE2 n+n strip 0 TDC
v1190#2.tdc95 dE2 n+n strip 15 TDC

v1190#2.tdc96 E2 p+n strip 0 TDC
v1190#3.tdc31 E2 p+n strip 47 TDC
v1190#3.tdc32 E2 n+n strip 0 TDC
v1190#3.tdc47 E2 n+n strip 15 TDC

v1190#3.tdc48 LEDA-0 strip 0 TDC
v1190#3.tdc63 LEDA-0 strip 15 TDC
v1190#2.tdc64 LEDA-1 strip 0 TDC
v1190#2.tdc79 LEDA-1 strip 15 TDC
v1190#3.tdc80 LEDA-2 strip 0 TDC
v1190#3.tdc95 LEDA-2 strip 15 TDC
v1190#3.tdc96 LEDA-3 strip 0 TDC
v1190#3.tdc111 LEDA-3 strip 15 TDC

v1190#3.tdc112 PIN photodiode 1 TDC
v1190#3.tdc113 PIN photodiode 2 TDC
v1190#3.tdc114 PIN photodiode 3 TDC
v1190#3.tdc115 PIN photodiode 4 TDC
Attachment 5: sort.f  12 kB  | Hide | Hide all
*trigger
128  
*oned
0..351  s 4096
*twod
*vars
*sort
C----67---------------------------------------------------------------72------80
      SUBROUTINE init

      IMPLICIT none

      SAVE
C
C     External functions
C
      EXTERNAL dtime
C
      INTEGER int, rshift, s2order
C
      REAL dtime, float, rand
C
C     Parameter variables
C
      INTEGER maxadcs
      PARAMETER (maxadcs = 2200)
      INTEGER adcs_max
      PARAMETER (adcs_max = 11*32)
      INTEGER tdcs_max
      PARAMETER (tdcs_max = 3*112)
      INTEGER maxscalers
      PARAMETER (maxscalers = 32)
      INTEGER maxepics
      PARAMETER (maxepics = 64)
      INTEGER event_prescaler
      PARAMETER (event_prescaler = 1000000)
      INTEGER scaler_prescaler
      PARAMETER (scaler_prescaler = 1000000)
      INTEGER epics_prescaler
      PARAMETER (epics_prescaler = 1000000)
C
      LOGICAL csm
      PARAMETER (csm = .true.)
C
C     Local variables
C
      INTEGER data(0:maxadcs-1), epics_counter, events, events_old, i
      INTEGER*2 i2(2)
      INTEGER i4, ierr, iflag, ireturn, j, k, m_adc, sc_counter, type
      INTEGER w(0:31)
C
      LOGICAL hit(0:maxadcs-1)
C
      REAL c(0:31), gain(0:maxadcs-1), offset(0:maxadcs-1), r4, rate
      REAL time(2)
C
C     Namelists
C
      NAMELIST /variables/ gain, offset, c, w
C
C     Common variables
C
      INTEGER*2 adc_data(0:maxadcs-1)
C
      COMMON /fdata/ adc_data
C
C     Common variables
C
      INTEGER*2 adcs(0:maxadcs-1)
C
      COMMON /fid/ adcs
C
C     Common variables
C
      INTEGER noadcs
C
      COMMON /fmult/ noadcs
C
      EQUIVALENCE  ( i4, i2( 1 ) )
C
C----67---------------------------------------------------------------72------80

      WRITE ( 6, * ) ' *** S1284 - sort - November 2013'
      WRITE ( 6, * ) ' *** Entry init commences'

C     Initialise arrays for unpacked event data.

      DO i = 0, maxadcs - 1
       data( i ) = 0
       hit( i ) = .FALSE.
      ENDDO

C     Initialise gains/offsets

      DO i = 0, maxadcs - 1
       gain( i ) = 1.0
       offset( i ) = 0.0
      ENDDO

C     Initialise constants/1D windows

      DO i = 0, 31
       c( i ) = 1.0
       w( i ) = 0
      ENDDO

C     Initialise counters

      sc_counter = 0
      epics_counter = 0
      events = 0
      events_old = 0

C     Read program variables via NAMELIST I/O

      OPEN( 1, FILE = '',
     + 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, adcs_max-1, 8
       WRITE( 6, 9001 ) i, i+7, ( gain( j ), j = i, i+7 )
      ENDDO

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

      DO i = 1000, 1000+tdcs_max-1, 8
       WRITE( 6, 9002 ) i, i+7, ( offset( j ), j = i, i+7 )
      ENDDO

      DO i = 0, 31, 8
       WRITE( 6, 9003 ) i, i+7, ( c( j ), j = i, i+7 )
      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

      events = events + 1

      IF ( MOD( events, event_prescaler ).EQ.0 ) THEN
       rate = FLOAT( events - events_old ) / dtime(time)
       WRITE( 6, * ) ' *** event:', events, ' (', rate,' events/s)'
       events_old = events
      ENDIF

C     Convert Eurogam type 0 ID to (a more) logical channel number.
C	ADC data	channels 0-999
C	TDC data	channels 1000-1999
C	Scaler data	channels 2000-2099
C	EPICS data	channels 2100-2199

      call egid2logical( noadcs, adcs, adc_data, type, csm )

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

      IF ( MOD( events, event_prescaler ).EQ.0 ) THEN
       WRITE( 6, * ) ' *** Packed event:', events, ' noadcs:', noadcs
       DO i = 0, noadcs - 1
        WRITE( 6, 9050 ) adcs( i ), adc_data( i )
       ENDDO
      ENDIF

C     Unpack event data from packed data arrays.

      DO i = 0, noadcs - 1
       IF ( adcs( i ).GE.0 .AND. adcs( i ).LT.maxadcs ) THEN
        data( adcs( i ) ) = adc_data( i )
        hit( adcs( i ) ) = .TRUE.
       ENDIF
      ENDDO

      IF ( MOD( events, event_prescaler ).EQ.0 ) THEN
       WRITE( 6, * ) ' *** Unpacked event:', events
       DO i = 0, adcs_max-1, 16
        WRITE(6,9060) i, i+15, (data(j),hit(j),j=i,i+15)
       ENDDO
       DO i = 1000, 1000+tdcs_max-1, 16
        WRITE(6,9060) i, i+15, (data(j),hit(j),j=i,i+15)
       ENDDO
      ENDIF

C----67---------------------------------------------------------------72------80
C     Scaler data.

      IF ( AND( X'00000002', type ).EQ.2 ) THEN

       sc_counter = sc_counter + 1

C----67---------------------------------------------------------------72------80
C     EPICS data.

      ELSEIF ( AND( X'00000004', type ).EQ.4 ) THEN

       epics_counter = epics_counter + 1

C----67---------------------------------------------------------------72------80
C     Unexpected data type.

      ELSEIF ( AND( X'00000008', type ).EQ.8 ) THEN

       RETURN

C     If event does not contain any ADC/TDC data return.

      ELSEIF ( AND( X'00000001', type ).NE.1 ) THEN

       RETURN

      ENDIF

C----67---------------------------------------------------------------72------80
C     Sort unpacked event data

      m_adc = 0

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

      DO i = 0, adcs_max-1
       IF ( hit( i ) ) THEN
        m_adc = m_adc + 1    
       ENDIF
      ENDDO

c      IF ( m_adc.GT.16 ) GOTO 1000

C      IF ( m_adc.LT.16 ) GOTO 1000  ! use this line to get rid of alpha source

      DO i = 0, adcs_max - 1
       IF ( hit( i ) ) THEN
        j = INT( c(0) * gain(i) * (data(i) - offset(i)) + rand(iflag) )
        CALL inc1d( i, j )
       ENDIF
      ENDDO

C----67---------------------------------------------------------------72------80      
C     Re-initialise unpacked data arrays using the packed data arrays.
C     Note: assumes packed data arrays are not modified by event.

 1000 CONTINUE

      DO i = 0, noadcs - 1
       data( adcs( i ) ) = 0
       hit( adcs( i ) ) = .FALSE.
      ENDDO

      RETURN

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

      ENTRY finish
      WRITE ( 6, * ) ' *** Entry finish '
      RETURN

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

 9001 FORMAT( '   gain(', i4, '-', i4, ')', 8f8.5 )
 9002 FORMAT( ' offset(', i4, '-', i4, ')', 8f8.2 )
 9003 FORMAT( '      c(', i4, '-', i4, ')', 8f8.3 )
 9004 FORMAT( '      w(', i4, '-', i4, ')', 8i8 )
 9010 FORMAT(/' *** scaler event: ', i10 )
 9020 FORMAT( ' scaler(', i2, '-', i2, ')', 8(1x,i10) )
 9030 FORMAT(/' ***  epics event:', i10 )
 9040 FORMAT( '  epics(', i2, '-', i2, ')', 8(1x,g13.6) )
 9050 FORMAT( 2(1x,i4) )
 9060 FORMAT( 2(1x,i4), 16(1x,i4,1x,l1) )

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

      END

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

      SUBROUTINE egid2logical( noadcs, adcs, adc_data, type, csm )

... 209 more lines ...
ELOG V2.9.2-2455