Trigger Programming for Hall A Spectrometers


     Notes on Trigger Programming for e99117 and Beyond
     ==================================================

 update May 20, 2001, R. Michaels and B. Reitz

 Software and notes in adaql1:~atrig/trigger/mlu
 Note: some stuff stored in ./save20may01, e.g. old MLU
 files no longer used.  See also README* for earlier
 experiments.

 I. Overview

 The main spectrometer triggers T1 (R-arm) and T3 (L-arm)
 are formed from an overlap of S1 and S2 scintllators.
 Note, these main triggers do not involve an MLU any more.

 The triggers are

       T1 = Main R-arm trigger
       T2 = Loose R-arm trigger, for measuring efficiency
       T3 = Main L-arm trigger
       T4 = Loose L-arm trigger, for measuring efficiency
       T5 = coincidence of T1 and T3.

 The MLU is used to form T2 and T4.  It can also be used to
 form additional triggers that require other detectors.

 Let us first describe the MAIN TRIGGER, T1 and T3, which
 is based on scintillators.  First the Left and Right PMTs
 are AND'd.  There are then 6 signals from each scintillator
 planes S1 and S2 (the result of L+R).  These 6 are OR'd to 
 make one signal each from S1 and S2.  Finally, the trigger 
 is the AND of these two signals.  Here is an ASCII diagram:

 S1 - paddle 1 - Left   --\
 S1 - paddle 1 - Right  ---AND -->
 S1 - paddle 2 - Left   --\       \ 
 S1 - paddle 2 - Right  ---AND --> \ OR of S1
   paddle 3... 6                    \
                                     \ 
                                      \ AND -------> T1 (T3)         
                                      /
                                    / 
 S2 - paddle 1 - Left   --\        / OR of S2 
 S2 - paddle 1 - Right  ---AND -->
   paddle 2... 6

 Trigger T5 will be formed as a coincidence between Left and
 Right spectrometers.  Of course, this is irrelevant for single
 arm experiments like e99117, but we will try to make it ready
 anyway.

 The timing at the trigger supervisor will be such that T5 arrives
 first and takes priority in deciding the event type.  However,
 one may look at the trigger latch pattern to see which triggers
 coexist.

 A ``trigger latch pattern'' in the datastream shows the
 pattern of triggers which co-exist in an event.  This is
 a TDC 1877 (multi-hit with up to 6 hits, a 5 microsec 
 window, one trigger on each of 12 channels, each channel
 a separate trigger) which shows on channels 1-12 the
 trigger 1-12 AFTER prescaling.  So, if a T5 is accompanied
 by a T3 which survived prescaling, one would see a signal
 on channels 3 & 5 with the appropriate timing.  This 
 trigger latch pattern is called ``spare7'' in the detector
 map.


 II. MLU Programming -- Concepts

    Since Jan 1, the S-Ray trigger plays no role anymore.
    Notes on this exist, but not here.

  MLU for T2, T4 -- Identical for Left and Right Spectrometers

  Greatly simplified compared to the past, this MLU now
  runs in strobe mode.  The strobe comes from "OR" of
  S2-R and S1-R (i.e. Right PMTs of S2 and S1) where S2
  is timed to arrive first; hence normally S2 makes the 
  timing but if it is absent due to inefficiency or whatever
  then S1 makes the timing.

   Inputs
         1 = S1-or
         2 = S2-or
         3 = Gas Cerenkov -or 

   Logic
      Put out bit 1 (and bit 3 is a copy) if S1.and.S2 exists.
      This should be identical to the main trigger, however
      the main trigger is formed by a separate logic unit and
      is therefore immune to MLU deadtimes.  We will scale the
      output of bit 1.

      Definition of T2 (same for T4):  Exclusive of the above logic, 
      we put out a bit 2 (and bit 4 is a copy) if one of the following
      conditions exist.
          Cerenkov and S1-or (but not S2-or)
          Cerenkov and S2-or (but not S1-or)

    Generate T2, T4 with

        mlu_t2t4_generate.dat


        
 III. Technical Details of MLU Programming

The following script generated the MLU file for a1ng2n (e99117, etc)
                                                ======
#!/bin/bash
# Generate the MLU file used to make T2(T4) for A1n/g2n
#
XYmlu -f mlu_t2t4_generate.dat
# (output is 'mlu.data')
#
mlu_compress mlu.data
# (output is 'mlu_compress.out')
#
mv mlu_compress.out mlu_t2t4.data

 
=======================================================

  Appendix -- MLU utilities routines 
              (Ported to Linux, Jan 2001)

  Type the name of the utility without arguments and
  it will introduce itself, and explain its usage.

    XYmlu -- takes a pattern like 10xx01 and
    generates all mlu entries.  1=bit must be true;
    0=bit must be false; x=bit may be 0 or 1.
    There is a Y option, but it is little used
    and not too important.

    btst -- Examines a pattern of bits 

    mlu_compress -- Takes an mlu file and
    examines all pairs of line-entries.  If the
    two line entries are identical, one is kept,
    the other discarded (this isn't really necessary
    but speeds up the download).  Also the bit-wise
    OR of 2nd components is taken if first components
    are identical.

    mlu_compare -- Compares two mlu files
    to see what is different.  If no optional
    argument is given, any difference in the 
    file are noted.  If an argument is given
    (any number), only the first entry of each
    pair are compared.

    mlu_bitmerge -- Merges two mlu files.  For
    each pair of line entries "X1 Y1" from file 1
    and "X2 Y2" from file2, if X1=X2, then the
    two entries are merged to form bit-wise OR
    of Y1,Y2, i.e. we get "X3 Y3" where Y3 = Y1 | Y2.

This page maintained by rom@jlab.org