A MCA Scan

In this example, the data sources are an ADC and some VFCs. The online display shows the counters, the MCA spectrum and also a SCA spectrum which is an integration of a part of the MCA spectrum. The ADC and the counters have to be gated by a common signal. As a consequence we cannot setup a fast scan for the counters and operate the MCA separatly in the during~ file. The solution is that the measurement is explicitly carried out in the durin~ file.

Table 15.6 displays the before~ file.


Table 15.6: Example: Before_mca_scan.gra
 
!
! before_mca_scan.gra
!

!
! This statement block above has to be repeated also for d2, d3 and d4 
!
  if !search_symbol( scan_offset_d1)
    cls
    say/line=10 "Failed to find SCAN_OFFSET_D1"
    wait
    scan_interrupt = 1
    end 0
  endif

  scan_c1 = dummy_d1
  scan_c2 = dummy_d2
  scan_c3 = dummy_d3
  scan_c4 = dummy_d4
  scan_c5 = dummy_sca

  fname_d1 = scan_name"_d1"
  fname_d2 = scan_name"_d2"
  fname_d3 = scan_name"_d3"
  fname_d4 = scan_name"_d4"
  fname_sca = scan_name"_sca"

  scan_display_set = (1, 2, 5)

!
! MCA_DATA stores the MCA output at every energy point
! 
  if !search_scan( mca_data)
    create/notext mca_data 1 2048 2047 0
    set mca_data/v4
    create/text/string=MCA/y=1.05/x=0.2/h_align=1 mca_data
  endif

  activate mca_data.*

  deactivate scan_name

  end


Explanations:

 if !search_symbol( scan_offset_d1)
Make sure that the counter offsets have been set. They are needed in the duringt~ file.

 scan_c1 = dummy_d1
scan_c2 = dummy_d2, etc.
The dummy counters are introduced. They will be used for the VFC signals and the SCA data. See the example [*] for some details about dummy counters.

 d1_name = scan_name”_d1”
d2_name = scan_name”_d2”
The symbols d1_name, d2_name, etc. are used in the during~ file.

 scan_display_set = (2, 3, 5)
Scan_c2, scan_c3 and scan_c5 are monitored during the scan. The other counter is also measured and written to disk. Since we selected only 3 SCAN GQEs for the online display, the lower right corner of the graphics window remains empty.

 if !search_scan( mca_data)
...
If the SCAN GQE MCA_DATA is created, if it does not exist already. It is displayed in the lower right corner of the graphics window (/v4).

 activate mca_data.$*$
This command is not needed for newly created SCAN GQEs since they are always active. But MCA_DATA may have been created earlier and therefore be deactivated like all other GQEs when the scan is started.

The during~ file (15.6) contains commands, which operate the counters and the MCA.


Table 15.7: Example: During_mca_scan.gra
 
!
! during_mca_scan.gra
!

!
! reset-all-counters
!
  do resaco()

  s1 = clear_mca( mca, 0)
  s1 = start_mca( mca, 0)

!
! start-and-wait-for-timer
!
  sawft( t1) = sample_time

!
! read-counter
!
  fname_d1(sindex) = rc(d1) - scan_offset_d1*sample_time
  fname_d2(sindex) = rc(d2) - scan_offset_d2*sample_time
  fname_d3(sindex) = rc(d3) - scan_offset_d3*sample_time
  fname_d4(sindex) = rc(d4) - scan_offset_d4*sample_time

  s1 = stop_mca( mca, 0)
  s1 = read_mca( mca, 0, mca_data, 2048)

  activate mca_data

  fname_sca( sindex) = sum( mca_data, 1, 2048)

  s1 = ifix(position*10)
  file_name = scan_name"_"s1
  write/fio/file=file_name mca_data file_name


Explanations:

 s1 = clear_mca( mca, 0)
The ADC is connected to a VME MCA board (MCA) which has 2 memory banks. We use bank 0 only.

 fname_sca( sindex) = sum( mca_data, 1000, 1500)
The SCAN fname_sca is filled with the sum of the channels between 1000 and 1500. The symbol sindex (scan index) is maintained by ONLINE. It starts at 1 and it is incremented for every call of during_fast_scan.gra.

 s1 = ifix(position$*$10)
file_name = scan_name"_"s1
The name of the output file of the MCA data is the scan name concatenated with the current position (times 10). The function ifix() returns integer values. We use it because we don't want any additional points “.” in the file name.

The after-file is identical to simple fast scans.