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 | Show 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  | Show | Hide all | Show all
Attachment 3: S1284_sort_spectrum_titles.txt  3 kB  | Hide | Hide all | Show 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 | Show 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  | Show | Hide all | Show all
ELOG V2.9.2-2455