Trigger Programming for Hall A Spectrometers


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

 For Year 2003 and earlier see trigsetup_2003.html. 

 updated Jan 2004
 experts:  R. Michaels, R. Feuerbach, and  B. Reitz

 This file describes some details about the Hall A trigger system.
 Click HERE for simple instructions to set up the trigger.
 A less detailed general introduction is 
 hallaweb.jlab.org/equipment/daq/trigger.html

 We have circuit diagrams of the single arm trigger 
 and coincidence trigger (postscript format).
 The trigger was refurbished in 2003, it was torn apart in March
 to clean all modules, and then in May the S2m scintillator was added 
 by R. Feuerbach to achieve better time resolution.
 Here are same diagrams in PDF format: 
 single arm (PDF)  
 coincidence (PDF)  

 The main triggers (T1 on R-arm and T3 on L-arm)
 are formed from an overlap of S1 and S2 scintillators.
 This is described in detail below.

 The triggers during e94107 (hypernuclear) 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.
       T6 = T3.and.A2.and.NOT.A1 (Clean Kaon Trigger) -- see below
       T7 = T6.and.T1
       T8 = 1024 Hz pulser

 These may be prescaled by editing ~a-onl/prescale/prescale.dat.
 The maximum prescale factors are 24 bits for T1-T4 (i.e.
 2^24 - 1 = 16,777,215) and 16 bits for T5-18 (2^16 - 1 = 65535).
 Meanwhile T9-T12 cannot be prescaled.
 The prescale factor is a modulus of these limits, so if you
 put ps8=100000, then 100000 % 65536 = 34464 is the prescale factor
 you ACTUALLY used.  Be careful. 

 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 (16) signals from each scintillator 
 planes S1 (S2).  These results 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... 16

 Coincidence trigger T5 is defined as the overlap between 
 T1 and T3.  Typically the two signals are 100 and 50 nsec 
 wide respectively, see the halog for the details of the
 timing.  

 For e94107 there are two new triggers: T6 and T7 defined
 as follows.
 T6 = T3 .AND. A2 .AND. .NOT.A1
 where A1(A2) = the summed PMTs from A1(A2) aerogel, attenuated 
 and put through a discriminator with typically 30 mV level.
 T3 and A2 are inputs to a Phillips 764 logical coincidence
 unit. The ".NOT.A1" means the signal is used as a veto in a 
 the same Phillips 764 module.

 The timing at the trigger supervisor will be such that T5 
 and T7 arrive at approx the same time and about 40 nsec
 before the other triggers.  Thus the coincidence triggers
 normally take  priority in deciding the event type.  However,
 one may look at the trigger bit pattern to see which triggers
 coexist.  

 A ``trigger bit 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.  For the
 Hall A analyzer the data are parsed by the THaDecData
 class, see db_D.dat in the database.  

 T2 and T4 are for measuring scintillator efficiency.  
 The definition has changed over time and at present 
 (Jan 2004) the definition requires 2 out of 3 from 
 among S1, S2, and a 3rd detector.  On the R-arm the
 3rd detector is the "OR" of the 10 gas Cerenkov PMTs.
 On the L-arm the 3rd detector is the "AND" of the 2 PMTs
 of the S0 scintillator.  But as I said, this has changed
 over time.  Let this 3rd detector be called D3.  Then:
  
    T2 = ((D3.and.S1) .or. (D3.and.S2)) .and.  (.not.T1)

 and similarly T4.
 
 Typically the raw rate of T2(T4) should be 5% of T1(T3).
 After cleanup cuts that require a track, etc, the T2(T4) 
 may be 2% of T1(T3), indicating a 1% scintillator inefficiency.
 These are ballbpark expectations; if you don't see it, then
 you have a problem.

 WARNING !!!  WARNING !!  WARNING !!  : 
 The "CODA event type" is NOT NECESSARILY the "trigger type".  
 This is because of trigger supervisor functionality.  
 We try to arrange it such that the CODA event type is indeed 
 the trigger type, but the most fundamental way to sort out
 what trigger type is to look at the trigger bit pattern explained
 above.  Here is how the CODA event type is defined:  If trigger N
 arrives first and survives prescaling then the CODA event type is N.
 However, if triggers N and M overlap within 10 nsec and both survive
 prescaling, then it is defined as event type 5.  (In former times this
 was defined as event type 14, but that proved dangerously confusing.)
 Ideally all triggers would be split apart enough that there would be
 no such ambiguities, but this is difficult to arrange for other reasons.
 So, in practice T5 is arranged to arrive first and will make CODA
 event type 5, but if T5 is prescaled away then T1 and T3 may overlap
 at the TS (especially for EDTM pulser signals) which again makes an
 event type 5.  I realize this is confusing, but if you rely on the
 trigger bit pattern, you can sort things out.

 One reason the trigger bit pattern is important is that it 
 affects calculation of deadtime.  As I write this, the online
 calculation does not know how many triggers of each type were 
 accepted, so we estimate the deadtime for online display (datamon 
 and end-of-run halog summary) by accounting for the correlations:  
 Every T5 is also a T1 and a T3, and every T7 is also a T6 and T5.
 At present we don't account for the correlation of T3 and T6
 which would be hard to do since it is neither 1.0 nor 0.0.
 I will try to fix the online display before the experiment.
 Offline, however, it is easy to calculate deadtime.

 How the coincidence time is measured, and some explanation of
 the glitchy features seen there, are explained in this document:
 ctime.ps (postscript).

 Electronics deadtime is a complicated issue.  There can be losses
 in the trigger electronics, but also smearing of distributions
 (TDCs, etc), and pileup in VDCs.  To provide a handle on some
 of these things we have implemented a scheme to measure the
  electronics deadtime.

A general intro to the trigger complete with circuit diagrams can be found at hallaweb.jlab.org/equipment/daq/trigger.html.

This page maintained by rom@jlab.org