STEREO LET Event Processing Algorithm Definition
------------------------------------------------

Version 1.5 02-27-2007 Andrew Davis
	Added latest mods to L2PROC.
	Needs to be reviewed to ensure that all mods to the code since mid-2004
	have been included here.
	Does not yet describe L3PROC and PENPROC routines,
	but they are very similar to L2PROC.
	Does not yet describe some of the subroutines
	called by L2PROC.

The LET Event Processing software processes a single LET event each time it is called. 
The PROCESS module is called by Rick Cook's code whenever an event is ready for processing.

This document should accurately reflect the logic implemented in the LET flight
software. However, for clarity, some things may be spelled out here in long-winded
ways compared with the actual implementation in Forth on the MISC.

Conceptually, the indices into the response matrices are calculated as follows:

L1THRESH = 0.1 MeV
L2THRESH = 0.2 MeV
L3THRESH = 1.0 MeV

DEMATDIM = 400
EPMATDIM = 128
MAXMINRATIO = 4300. I can't currently find documentation of how we decided upon
				this number...
For Range 2, 
DEINDEX = Floor( A ( log(dE) - log(L1THRESH) ) )
	where A = DEMATDIM/log(MAXMINRATIO)

EPINDEX = Floor( B( log(Eprime) - log(L2THRESH) ) )
	where B = EPMATDIM/log(MAXMINRATIO)

The calculations for Range 3 and 4 are similar, just use the appropriate THRESH values

Note: The PROCESS module returns control back to Rick's software.
      There is no route back to Rick's software thru any other LET Event Processing
      subroutine.

Note: Some of the tables and definitions used by the software are appended to
      this document, for reference.



Module:		PROCESS
-----------------------
Givens:		address of event to process
Description:	decides if event is suitable for onboard processing,
		calls appropriate processing routines, sets event priority,
------------	increments appropriate counters.

Read event address
Preset particleID to 255
Preset DEIDX to 0 
Preset EPIDX to 0 
Increment READ counter

If ( STIM bit is set and ADCSTIM flag is set )
	Increment NADCSTIM counter
	Call SETPRI(20) to prioritize ADC Calibration event
	Return
Endif

If ( HAZ bit is set and REJHAZ flag is set )
	Increment NHAZ counter
	Call BRITEST to find the brightest signals in L1A, L2A, ...
	Call PRIORITYB to prioritize rejected event
	Return
Endif

Call TAGSORT to categorize event using the 6 tag bits
If ( SORTID = ERROR )
	Increment NERROR counter
	Call SETPRI(26) to prioritize an event that failed TAGSORT
	Return
Endif

Call ODDEVT to see if SORTID is one of PENA? PENB? or 2TEL
If ( event is odd )
	Increment NODD counter
	Call ODDFIX to try to fix event
	If ( event is fixed )
		Increment NODDFIX counter
	Else
		Note: BRITEST has already been called by ODDFIX
		Call PRIORITYB to prioritize unfixable event
		Return
	Endif
Endif

Call CNTHITS to count number of hits in each of L1A, L2A, L3A, L1B, L2B, L3B
Call SETHITS to compress the 6 hit-counters to 4 bits/counter (not important for
                understanding the logic...)
Call SETSIDE to set BSIDE flag based on SORTID

Call MULTI to see if event has multiple hits in relevant layers
If ( event is multi )
	Increment NMULTI counter
	Call MULTIFIX to try to fix event
	If ( event is fixed )
		Increment NMULTIFIX counter
	Else
	        Note: priority for unfixable multis is set within MULTIFIX
		Return
	Endif
Endif	

Note: At this stage we should have a normal event - any oddness has been
	fixed, and any layers with multiple hits have been fixed also.

Call EUNPACK to unpack event data into some variables

Call BADTRAJ to test for inconsistent trajectory
If ( trajectory is bad )
	Increment NBADTRAJ counter
	Call BRITEST to find the brightest signals in L1A, L2A, ...
	Call PRIORITYB to prioritize bad trajectory event
	Return
Endif

Call MATSORT to process a good/fixed event
Return (to Rick Cook's LET software)




Subroutine:	SETPRI
----------------------
Givens:		Priority
Description:	set priority and increment priority-buf counter
------------

Set PRIBUF# to Priority
Increment PRIRATES[Priority] counter
Return



Subroutine:	PRIORITYB
-------------------------
Parameter:	REJL3TH - commandable threshold
Description:	prioritize an event that has been rejected for onboard 
------------	processing because of Hazard, unfixable ODD, or BADTRAJ

If ( STIM bit is set )
	Call SETPRI(25)
Else
	If ( there exists an L3 signal above REJL3TH )
	        Call L3LOWZ to test for Z < 3
		If ( Z < 3 )
			Call SETPRI(20)
		Else
			Call SETPRI(9)
		Endif
	Else
	        Call L2LOWZ to test for Z < 3
		If ( Z < 3 )
			Call SETPRI(21)
		Else
			Call SETPRI(10)
		Endif
	Endif
Endif
Return


Subroutine:	L2LOWZ
----------------------
Parameters:	L2DELOWZLIM - Low-Z box boundary, for dE signal
		L2EPLOWZLIM - Low-Z box boundary, for Eprime signal
Description:	For events with no L3 signal, a simple test for Z<3.
------------	Aside/Bside is not known.

If ( (MAXIMUM(BRITABLE[L1A],BRITABLE[L1A]) < L2DELOWZLIM) AND
     (MAXIMUM(BRITABLE[L2A],BRITABLE[L2B]) < L2EPLOWZLIM) )
	Return True
Else
	Return False
Endif


Subroutine:	L3LOWZ
----------------------
Parameters:	L3DELOWZLIM - Low-Z box boundary, for dE signal
		L3EPLOWZLIM - Low-Z box boundary, for Eprime signal
Description:	For events with L3 signal present, a simple test for Z<3.
------------	Aside/Bside is not known.

If ( (MAXIMUM(BRITABLE[L2A],BRITABLE[L2A]) < L3DELOWZLIM) AND
     (MAXIMUM(BRITABLE[L3A],BRITABLE[L3B]) < L3EPLOWZLIM) )
	Return True
Else
	Return False
Endif



Subroutine:	TAGSORT
-----------------------
Description:	Use 6 ls-bits of tag word to categorize an event.
		TAGTABLE is a table of event types. The table is indexed
		by the 6 tag-bits of the event tag word. The event types
		that can populate the table are: L12A, L123A, PENA, L12B,
		L123B, PENB, PENA?, PENB?, 2TEL, ERROR.
------------	Increment appropriate COINRATES counter.		

Mask off all but the 6 tag-bits of the event tag word
Set SORTID to TAGTABLE[tag-bits]
Increment COINRATES[SORTID]
Return




Subroutine:	PERRPROC
------------------------
Description:	deal with invalid indices into a table
------------

Increment NERROR counter
Set PRIBUF# to 26
Return




Subroutine:	ODDEVT
----------------------
Description:	test if SORTID is one of PENA? PENB? or 2TEL
------------

If ( SORTID is one of PENA? PENB? 2TEL )
	Set Ret to TRUE
Else
	Set Ret to FALSE
Endif	
Return Ret




Subroutine:	ODDFIX
----------------------
Parameter: 	XTALKTH - commandable threshold
Description:	Attempt to fix an event of type PENA?, PENB?, or 2TEL.
		A PENA? event has triggered L1A, L2A, L3A, L3B, and L2B.
		A PENB? event has triggered L1B, L2B, L3B, L3A, and L2A.
		A  2TEL event is one where both the A-side and the B-side
		triggers qualify as an event independently.
------------

Call BRITEST to find the brightest signals in L1A, L2A, ...
If ( SORTID = PENA? )
	If ( brightest L2B < XTALKTH )
		Set SORTID to PENA
		Return True
	Endif
Endif
If ( SORTID = PENB? )
	If ( brightest L2A < XTALKTH )
		Set SORTID to PENB
		Return True
	Endif
Endif
If ( SORTID = 2TEL )
	Return False
	Note: fixing of 2TEL events not yet implemented
Endif
Return False




Subroutine:	CNTHITS
-----------------------
Parameters:	ADC_token_bit - it is set in the last ADC of each event
		HITTABLE - a 6-element table of counters
		NADC - counts number of ADCs in the event
Description:	count number of hits in each of L1A, L2A, L3A, L1B, L2B, L3B
------------

Set all HITTABLE counters to 0
Set NADC to 0
For i=0 to 63
	read ADC(i)
	Call GETDTYPE to get the detector type for this ADC word
	Increment HITTABLE[DTYPE]
	Increment NADC
	If ( adc_token_bit is set )
		Break out of For loop
	Endif
EndFor	
Return




Subroutine:	MULTI
----------------------
Parameters:	HITS - compressed hit-counters - 4 bits/counter.
Description:	Test if event has multiple hits in relevant layers.
		The relevant layers are determined by SORTID, which is
		set by the TAGSORT routine, e.g.
		if the event is L12A, then we look to see if there are
		multiple hits in L1A or L1B and we ignore the other layers.
------------	Note: this is implemented with masks/lookups in flt software.

Set Ret to False
Case ( SORTID )
	L12A:	If ( HITS[L1A]>1 OR HIS[L2A]>1 )
			Set Ret to True
		Endif
	L123A:	If ( HITS[L1A]>1 OR HIS[L2A]>1 OR HITS[L3A]>1 )
			Set Ret to True
		Endif
	PENA:	And so on and so on....
	L12B:	
	L123B:	
	PENB:	
	Default:Call MERRPROC
Endcase	
Return Ret




Subroutine: 	MULTIFIX
------------------------
Description:	Attempt to fix a multi event.
		Fix-method depends on SORTID.
------------	Return True if event is fixed, else false.

Set Ret to False
Case ( SORTID )
	L12A:	Call MFIXL12A to attempt fix of L12A multi event
	L123A:	Call MFIXL123A
	PENA:	Call MFIXPENA
	L12B:	Call MFIXL12B
	L123B:	Call MFIXL123B
	PENB:	Call MFIXPENB
	Default:Call MERRPROC
Endcase	
If ( event is fixed )
	Set Ret to True
Endif
Return Ret




Subroutine: 	EUNPACK
-----------------------
Parameters:	NADC - number of ADCs in the event - set in CNTHITS
		The following variables are set by the UNP-XXX routines:
		L1GAIN, L1ID, L1PHA 
		L2GAIN, L2ID, L2PHA
		L3GAIN, L3ID, L3PHA
		PENGAIN, PENID, PENPHA
Description:	unpack an event in the input buffer, and store the data in some
		variables. Do PHA offset corrections. Compute index into
		cosine lookup tables.
		Note: bit 22 in an ADC is set by MFIXXXX routines to flag
------------	that the ADC should be ignored for this event

For i=0 to (NADC-1)
	read ADC(i)
	If ( bit 22 in ADC is not set )
		Call GETDTYPE to get the detector type for this ADC word
		Case ( DTYPE )
			L1A:	Call UNP-L1A to unpack an ADC word of type L1A
			L2A:	Call UNP-L2A
			L3A:	Call UNP-L3A
			L1B:	Call UNP-L1B
			L2B:	Call UNP-L2B
			L3B:	Call UNP-L3B
			Default:Skip unpacking this ADC word
		Endcase
	Endif
EndFor	
Set L1L2IDX to ( ( L2ID AND 0xF ) << 4 ) OR ( L1ID AND 0xF )
Return




Subroutine: 	BADTRAJ
-----------------------
Description:	For Range 2: exclude events with certain L1-L2 detector combinations, 
                by table lookup.
                For Range3 and Range 4: check trajectory consistency, and exclude
                events that might be escaping out the sides.
		Return True if trajectory is bad, else false.
------------

Set Ret to False
IF ( SORTID = L12A ) 
	Lookup EXCLUDER2A using L1L2IDX as index
	If ( BAD )
		Set Ret to True
		Return Ret
	Endif
Endif
IF ( SORTID = L12B )
	Lookup EXCLUDER2B using L1L2IDX as index
	If ( BAD )
		Set Ret to True
		Return Ret
	Endif
Endif
( If we get to this point, It must be a range 3 or PEN event )
Set inner to TRUE
If ( event is BSIDE )
	If ( L3ID = L3Bouter )
		Set inner to FALSE
	Endif
Else
	If ( L3ID = L3Aouter )
		Set inner to FALSE
	Endif
Endif

If ( inner = TRUE )
	Lookup EXCLUDER3I table using L1L2IDX as index
	If ( BAD )
		Set Ret to True
	Endif
Else
	Lookup EXCLUDER3O table using L1L2IDX as index
	If ( BAD )
		Set Ret to True
	Endif
Endif
Return Ret




Subroutine: 	MATSORT
-----------------------
Description:	execute appropriate event processing routine based on SORTID
------------

Case ( SORTID )
	L12A:	Call L2PROC
	L123A:	Call L3PROC
	PENA:	Call PENPROC
	L12B:	Call L2PROC
	L123B:	Call L3PROC
	PENB:	Call PENPROC
	Default:Call PERRPROC
Endcase	
Return




Subroutine: 	BRITEST
-----------------------
Parameters:	ADC_token_bit - it is set in the last ADC of each event
		BRITABLE - a 6-element table of counters
Description:	scan event for brightest signals in L1A,L2A,L3A,L1B,L2B,L3B.
		Note: bit 22 in an ADC is set by MFIXXXX routines to flag
------------	that the ADC should be ignored for this event

Set all BRITABLE counters to 0
For i=0 to 63
        read ADC(i)
        If ( bit 22 in ADC is not set )
                Call GETDTYPE to get the detector type for this ADC word
		Call UNP-GENERIC to calculate hi/lo gain-corrected signal
                If ( signal > BRITABLE[DTYPE] )
			Set BRITABLE[DTYPE] to signal
		Endif
        Endif
        If ( adc_token_bit is set )
                Break out of For loop
        Endif
EndFor
Return




Subroutine: 	GETDTYPE
------------------------
Givens: 	ADC word
Parameters:	DETADDR, DTYPE
Description:	extract detector address and lookup detector type (L1A, L2A, 
------------	L3A, L1B, ...)

Set DETADDR to detector address extracted from ADC word
Set DTYPE to DETTYPE[DETADDR]
Return




Subroutine: 	MFIXL12A
------------------------
Parameters:	L2DELOWZLIM - Low-Z box boundary, for dE signal
		L2EPLOWZLIM - Low-Z box boundary, for Eprime signal
		priority - temporary storage for event priority
Description: 	Attempt to fix a multi event of type L12A (Range 2, A-side)
		First, Low-Z events are rejected as unfixable. We attempt to
		fix Hi-Z events by tagging high-gain ADCs with signals that
------------	are probably uninteresting.

Set Ret to True
Call BRITEST to create a table of the brightest signals in L1A, L2A, ...

If (BRITABLE[L1A] < L2DELOWZLIM) AND (BRITABLE[L2A] < L2EPLOWZLIM)
	Set priority to "Range 2 low-Z-reject" (21)
	Set Ret to False
Else
	Call XTFIXL1A to tag "uninteresting" hi-gain L1A ADCs
	Call XTFIXL2A to tag "uninteresting" hi-gain L2A ADCs
	If ( (untagged L1A hits <> 1) OR
	     (untagged L2A hits <> 1) )
		Set priority to "Range 2 hi-Z-reject" (10)
		Set Ret to False
	Endif
Endif

If (Ret = False)
	If ( STIM bit is set )
		Call SETPRI(25) to set priority to "poor-stim"
	Else
		Call SETPRI(priority)
	Endif
Endif

Return Ret




Subroutine: 	MFIXL123A
------------------------
Parameters:	L3DELOWZLIM - Low-Z box boundary, for dE signal
		L3EPLOWZLIM - Low-Z box boundary, for Eprime signal
		CRXTALKTH - an ADC signal above this level may create
		            cross-talk in other ADCs in the PHASIC.
		XTALKTH12 - cross-talk threshold for L1,L2 high-gain ADCs.
		          Must be < CRXTALKTH.
		XTALKTH3 - cross-talk threshold for L3 high-gain ADCs.
		          Must be < CRXTALKTH.
		priority - temporary storage for event priority
Description: 	Attempt to fix a multi event of type L123A (Range 3, A-side). 
		First, Low-Z events are rejected as unfixable. We attempt to
		fix Hi-Z events by tagging high-gain ADCs with signals that
------------	are probably uninteresting.

Set Ret to True
Call BRITEST to create a table of the brightest signals in L1A, L2A, ...

If (BRITABLE[L2A] < L3DELOWZLIM) AND (BRITABLE[L3A] < L3EPLOWZLIM)
	Set priority to "Range 3/4 low-Z-reject" (20)
	Set Ret to False
Else	
	Call XTFIXL1A to tag "uninteresting" hi-gain L1A ADCs
	Call XTFIXL23A to tag "uninteresting" hi-gain L2A and L3A ADCs
	If ( (untagged L1A hits <> 1) OR
	     (untagged L2A hits <> 1) OR
	     (untagged L3A hits <> 1) )
		Set priority to "Range 3/4 hi-Z-reject" (9)
		Set Ret to False
	Endif
Endif

If (Ret = False)
	If ( STIM bit is set )
		Call SETPRI(25) to set priority to "poor-stim"
	Else
		Call SETPRI(priority)
	Endif
Endif

Return Ret




Subroutine: 	MFIXPENA
------------------------
Parameters:	PDELOWZLIM - Low-Z box boundary, for dE signal
		PEPLOWZLIM - Low-Z box boundary, for Eprime signal
		CRXTALKTH - an ADC signal above this level may create
		            cross-talk in other ADCs in the PHASIC.
		XTALKTH12 - cross-talk threshold for L1,L2 high-gain ADCs.
		          Must be < CRXTALKTH.
		XTALKTH3 - cross-talk threshold for L3 high-gain ADCs.
		          Must be < CRXTALKTH.
		priority - temporary storage for event priority
Description: 	Attempt to fix a multi event of type PENA (Range 4, A-side). 
		First, Low-Z events are rejected as unfixable. We attempt to
		fix Hi-Z events by tagging high-gain ADCs with signals that
		are probably uninteresting.
		Note: If the brightest L1A hit is < CRXTALKTH
		      then all but the brightest L1A is tagged
		Note: If the brightest L2A hit is < CRXTALKTH
		      then all but the brightest L2A is tagged
		Note: If the brightest L3A hit is < CRXTALKTH
		      then all but the brightest L3A is tagged
		Note: If the brightest L3B hit is < CRXTALKTH
------------	      then all but the brightest L3B is tagged

Set Ret to True
Call BRITEST to create a table of the brightest signals in L1A, L2A, ...

If (BRITABLE[L2A] < PDELOWZLIM) AND (BRITABLE[L3A] < PEPLOWZLIM)
	Set priority to "Range 3/4 low-Z-reject" (20)
	Set Ret to False
Else
	Call XTFIXL1A to tag "uninteresting" hi-gain L1A ADCs
	Call XTFIXL23A to tag "uninteresting" hi-gain L2A and L3A ADCs
	Call XTFIXL3B to tag "uninteresting" hi-gain L3B ADCs
	If ( untagged L1A hits <> 1) OR
	   ( untagged L2A hits <> 1) OR
	   ( untagged L3A hits <> 1) OR
	   ( untagged L3B hits <> 1)
		Set priority to "Range 3/4 hi-Z-reject' (9)
		Set Ret to False
	Endif
Endif

If (Ret = False)
	If ( STIM bit is set )
		Call SETPRI(25) to set priority to "poor-stim"
	Else
		Call SETPRI(priority)
	Endif
Endif

Return Ret


Note:	B-side Subroutines MFIXL12B, MFIXL123B, MFIXPENB are very similar to
----    the three A-side routines above.




Subroutine:	XTFIXL1A
------------------------
Parameters:	CRXTALKTH - an ADC signal above this level may create
		            cross-talk in other ADCs in the PHASIC.
		XTALKTH12 - cross-talk threshold for L1,L2 high-gain ADCs.
		          Must be < CRXTALKTH.
		HITTABLE - a 6-element table of counters
Description:	Tag all the L1A hits that are likely to be caused by
------------	cross-talk.

If ( HITTABLE[L1A] == 1 )
	Return
Endif
If ( CRXTALKTH < BRITABLE[L1A] )
	CAll TAGXTALK(XTALKTH12,L1A) to tag all the L1As below XTALKTH12
Endif
Return




Subroutine:	XTFIXL2A
------------------------
Parameters:	CRXTALKTH - an ADC signal above this level may create
		            cross-talk in other ADCs in the PHASIC.
		XTALKTH12 - cross-talk threshold for L1,L2 high-gain ADCs.
		          Must be < CRXTALKTH.
		HITTABLE - a 6-element table of counters
Description:	Tag all the L2A hits that are likely to be caused by
------------	cross-talk.

If ( HITTABLE[L2A] == 1 )
	Return
Endif
If ( CRXTALKTH < BRITABLE[L2A] )
	CAll TAGXTALK(XTALKTH12,L2A) to tag all the L2As below XTALKTH12
Endif
Return



Subroutine:	XTFIXL3A
------------------------
Parameters:	CRXTALKTH - an ADC signal above this level may create
		            cross-talk in other ADCs in the PHASIC.
		XTALKTH3  - cross-talk threshold for L3 high-gain ADCs.
		          Must be < CRXTALKTH.
		HITTABLE - a 6-element table of counters
Description:	Tag all the L3A hits that are likely to be caused by
------------	cross-talk.


If ( HITTABLE[L3A] == 1 )
	Return
Endif
If ( CRXTALKTH < BRITABLE[L3A] )
	CAll TAGXTALK(XTALKTH3,L3A) to tag all the L3As below XTALKTH3
Return


Subroutine:	XTFIXL23A
------------------------
Parameters:	CRXTALKTH - an ADC signal above this level may create
		            cross-talk in other ADCs in the PHASIC.
		XTALKTH12 - cross-talk threshold for L1,L2 high-gain ADCs.
		          Must be < CRXTALKTH.
		HITTABLE - a 6-element table of counters
Description:	Tag all the L2A and L3A hits that are likely to be caused by
		cross-talk.
		Note: the reason for this subroutine's existance is that the
		L2A and L3A ADCs are on the same PHASIC. So, in a range 3 or
		range 4 event a bright L2A can cause crosstalk in L3A, and
------------	vice-versa.

If ( (HITTABLE[L2A] == 1) AND
     (HITTABLE[L3A] == 1) )
	Return
Endif
If ( (CRXTALKTH < BRITABLE[L2A]) OR
     (CRXTALKTH < BRITABLE[L3A]) )
	CAll TAGXTALK(XTALKTH12,L2A) to tag all the L2As below XTALKTH12
	CAll TAGXTALK(XTALKTH3,L3A) to tag all the L3As below XTALKTH3
Endif
Return


Note:	Subroutines XTFIXL1B, XTFIXL2B, XTFIXL3B, XTFIXL23B  are very
-----   similar to the four routines above.



Subroutine:	TAGXTALK
------------------------
Parameters:	THRESH
		TTYPE
Description:	Tag high-gain ADCs of type TTYPE that are below a given
------------	threshold

set NTAGGED to 0
For i=0 to (NADC-1)
	read ADC(i)
	Call GETDTYPE to get the detector type for this ADC word
	If ( ADC is of type TTYPE )
		If ( ADC is hi-gain )
			Extract raw pulse-height from ADC word
			Correct for pulse-height offset
			If ( corrected pulse-height < THRESH )
				Tag the ADC word
				Increment NTAGGED
			Endif
		Endif
	Endif
EndFor	
Return


Subroutine:	UNP-L1A
------------------------
Parameters:	ADC word
Description:	unpack an ADC word of detector type L1A
------------

If ( event is NOT BSIDE )
	Set L1GAIN to 1 if bit 14 in ADC word is set
	Set L1ID to detector address (bits 16-21 of ADC word)
	Set L1PHA to PHA value (bits 0-11 of ADC word)
	CAll FSETCORR(L1ID,L1GAIN) to set OFFSET	
	Set L1PHA to L1PHA - OFFSET
	If (L1PHA < 0 ) Set L1PHA to 0 Endif
	If (L1PHA > 2047 ) Set L1PHA to 2047 Endif
Else
	Ignore this ADC word
Endif	


Subroutine: 	UNP-L2A
------------------------
Parameters:	ADC word
Description:	unpack an ADC word of detector type L2A
------------

If ( event is NOT BSIDE )
	Set L2GAIN to 1 if bit 14 in ADC word is set
	Set L2ID to detector address (bits 16-21 of ADC word)
	Set L2PHA to PHA value (bits 0-11 of ADC word)
	Call FSETCORR(L2ID,L2GAIN) to set OFFSET	
	Set L2PHA to L2PHA - OFFSET
	If (L2PHA < 0 ) Set L2PHA to 0 Endif
	If (L2PHA > 2047 ) Set L2PHA to 2047 Endif
Else
	Ignore this ADC word
Endif	


Subroutine: 	UNP-L3A
------------------------
Parameters:	ADC word
Description:	unpack an ADC word of detector type L3A. If the event is a
------------	BSIDE event, then we are dealing with the PEN (range 4) signal.

If ( event IS BSIDE )
	Set PENGAIN to 1 if bit 14 in ADC word is set
	Set PENID to detector address (bits 16-21 of ADC word)
	Set PENPHA to PHA value (bits 0-11 of ADC word)
	Call FSETCORR(PENID,PENGAIN) to set OFFSET	
	Set PENPHA to PENPHA - OFFSET
	If (PENPHA < 0 ) Set PENPHA to 0 Endif
	If (PENPHA > 2047 ) Set PENPHA to 2047 Endif
Else
	Set L3GAIN to 1 if bit 14 in ADC word is set
	Set L3ID to detector address (bits 16-21 of ADC word)
	Set L3PHA to PHA value (bits 0-11 of ADC word)
	Call FSETCORR(L3ID,L3GAIN) to set OFFSET	
	Set L3PHA to L3PHA - OFFSET
	If (L3PHA < 0 ) Set L3PHA to 0 Endif
	If (L3PHA > 2047 ) Set L3PHA to 2047 Endif
Endif	


Note:	Subroutines UNP-L1B, UNP-L2B, UNP-L3B are similar to the three above.
-----


Subroutine: 	L2PROC
----------------------
Parameters:	L1ID, L1GAIN, L1PHA, L2ID, L2GAIN, L2PHA, L1L2IDX
		DEIDX = the delta_E index into the delta_E-Eprime matrix
		EPIDX = the Eprime index into the delta_E-Eprime matrix
		DELOG is a log-lookup table for delta_E signals
		EPLOG is a log-lookup table for Eprime signals
		L1COSINE is a log-lookup table for Range 2 cosine corrections
		L1DEMIN = DELOG[ 0.1MeV/0.02594 MeV/channel ]
		L2EPMIN = EPLOG[ 0.2MeV/0.02594 MeV/channel ]
		DELOG256^3 = 3 * DELOG [ 256 ] - gain, thickness and angle corrections
			are each times-256
Description:	process an unpacked Range 2 event that has passed
		all oddness, multiplicity, etc., checks.

( process the dE signal )
Set DEIDX to 	DELOG[ L1PHA ] +
		DELOG[ GAINCORR(L1ID, L1GAIN) ] +
		DELOG[ THICKCORR[L1ID] ] +
		DELOG[ L1COSINE[ L1L2IDX ] ]
		- L1DEMIN - DELOG256^3
If ( L1GAIN == LOW )
	Set DEIDX to DEIDX + DELOG[ 20 ]
Endif
If ( DEIDX < 0 ) 
        Set DEIDX to zero
Endif
Set DEIDX to (DEIDX >> 8) & 0xFFFF

( process the Eprime signal )
Set EPIDX to 	EPLOG[ L1PHA ] +
		EPLOG[ GAINCORR(L1ID, L1GAIN) ] +
		EPLOG[ THICKCORR(L1ID) ] +
		EPLOG[ L1COSINE[ L1L2IDX ] ]
		- L2EPMIN - DELOG256^3
If ( L2GAIN == LOW )
	Set EPIDX to EPIDX + EPLOG[ 20 ]
Endif
If ( EPIDX < 0 ) 
        Set EPIDX to zero
Endif
Set EPIDX to (EPIDX >> 8) & 0xFFFF

Call MATIDX(DEIDX,EPIDX) to construct INDEX into Range 2 matrix
Set species# to R2MATRIX[ INDEX ]
If ( (species# < 136) AND (STIMFLAG is set) )
   set species# to 139, indicating a STIM event that fell outside a STIM box
Endif

If ( bit 7 in species# is set, indicating event is in a background box on matrix )
	Set PRIBUF# to L2BGPRI[ species# & 0x7F ]
	Increment L2BGRATES[ species# & 0x7F ]
Else
	( event is in a foreground box on matrix )
	Set PRIBUF# to L2FGPRI[ species# ]
	Call L2ETOT to calculate total energy deposited ETOT
	Call EBINIDX(species#,ETOT) to calculate ETOT/M, and hence
			the INDEX into EBIN lookup table
	Set EBIN# to EBINS[ INDEX ]
	Increment L2FGRATES[ L2RATEIDX(EBIN#,species#) ]
	Set Sector# to GETL2SECTOR(EBIN#,species#)
	Call SECTOR(Sector#) to compute index into sector counter array and
			increment appropriate sectored rate counter
Endif

Increment NL2 counter
Return
	

Subroutine: 	L3PROC
----------------------
Description:	process an unpacked Range 3 event that has passed
		all oddness, multiplicity, etc., checks.

Pseudo-code for this subroutine is TBD, but very similar to L2PROC


Subroutine: 	PENPROC
----------------------
Description:	process an unpacked Range 4 event that has passed
		all oddness, multiplicity, etc., checks.

Pseudo-code for this subroutine is TBD, but very similar to L2PROC


The tables and definitions below are included for reference...
-------------------------------------------------------------

( The six tag bits of an ADC word are used to sort each event into
  one of the following 10 types used to populate TAGTABLE below )
0 CONSTANT L12A		( Range 2, A-side )
1 CONSTANT L123A	( Range 3, A-side )
2 CONSTANT PENA		( Range 4, A-side )
4 CONSTANT L12B
5 CONSTANT L123B
6 CONSTANT PENB
8 CONSTANT PENA?	( Needs more procesing to decide if PENA or ERRTAG )
9 CONSTANT PENB?	( Needs more procesing to decide if PENB or ERRTAG )
10 CONSTANT 2TEL	( valid coincidence on both sides )
11 CONSTANT ERRTAG	( invalid tag bits )

( define 6 types of ADC word, used in DETTYPE table below )
0 CONSTANT L1A
1 CONSTANT L2A
2 CONSTANT L3A
3 CONSTANT L1B
4 CONSTANT L2B
5 CONSTANT L3B
8 CONSTANT UNUSED ( a few detector addresses have no detectors attached )

( TAGTABLE - lookup table indexed by the six tag bits of an ADC word )
( Note: this table reflects the ordering of the bits as they appear in
  the raw event data )
ARRAY TAGTABLE

( L3B L2B L1B L3A L2A L1A )
(   0   0   0   0   0   0 ) ERRTAG ,
(   0   0   0   0   0   1 ) ERRTAG ,
(   0   0   0   0   1   0 ) ERRTAG ,
(   0   0   0   0   1   1 ) L12A ,
(   0   0   0   1   0   0 ) ERRTAG ,
(   0   0   0   1   0   1 ) ERRTAG ,
(   0   0   0   1   1   0 ) ERRTAG ,
(   0   0   0   1   1   1 ) L123A ,
(   0   0   1   0   0   0 ) ERRTAG ,
(   0   0   1   0   0   1 ) ERRTAG ,
(   0   0   1   0   1   0 ) ERRTAG ,
(   0   0   1   0   1   1 ) L12A ,
(   0   0   1   1   0   0 ) ERRTAG ,
(   0   0   1   1   0   1 ) ERRTAG ,
(   0   0   1   1   1   0 ) ERRTAG ,
(   0   0   1   1   1   1 ) L123A ,
(   0   1   0   0   0   0 ) ERRTAG ,
(   0   1   0   0   0   1 ) ERRTAG ,
(   0   1   0   0   1   0 ) ERRTAG ,
(   0   1   0   0   1   1 ) L12A ,
(   0   1   0   1   0   0 ) ERRTAG ,
(   0   1   0   1   0   1 ) ERRTAG ,
(   0   1   0   1   1   0 ) ERRTAG ,
(   0   1   0   1   1   1 ) L123A ,
(   0   1   1   0   0   0 ) L12B ,
(   0   1   1   0   0   1 ) L12B ,
(   0   1   1   0   1   0 ) L12B ,
(   0   1   1   0   1   1 ) 2TEL ,
(   0   1   1   1   0   0 ) L12B ,
(   0   1   1   1   0   1 ) L12B ,
(   0   1   1   1   1   0 ) L12B ,
(   0   1   1   1   1   1 ) 2TEL ,
(   1   0   0   0   0   0 ) ERRTAG ,
(   1   0   0   0   0   1 ) ERRTAG ,
(   1   0   0   0   1   0 ) ERRTAG ,
(   1   0   0   0   1   1 ) L12A ,
(   1   0   0   1   0   0 ) ERRTAG ,
(   1   0   0   1   0   1 ) ERRTAG ,
(   1   0   0   1   1   0 ) ERRTAG ,
(   1   0   0   1   1   1 ) PENA ,
(   1   0   1   0   0   0 ) ERRTAG ,
(   1   0   1   0   0   1 ) ERRTAG ,
(   1   0   1   0   1   0 ) ERRTAG ,
(   1   0   1   0   1   1 ) L12A ,
(   1   0   1   1   0   0 ) ERRTAG ,
(   1   0   1   1   0   1 ) ERRTAG ,
(   1   0   1   1   1   0 ) ERRTAG ,
(   1   0   1   1   1   1 ) PENA ,
(   1   1   0   0   0   0 ) ERRTAG ,
(   1   1   0   0   0   1 ) ERRTAG ,
(   1   1   0   0   1   0 ) ERRTAG ,
(   1   1   0   0   1   1 ) L12A ,
(   1   1   0   1   0   0 ) ERRTAG ,
(   1   1   0   1   0   1 ) ERRTAG ,
(   1   1   0   1   1   0 ) ERRTAG ,
(   1   1   0   1   1   1 ) PENA? ,
(   1   1   1   0   0   0 ) L123B ,
(   1   1   1   0   0   1 ) L123B ,
(   1   1   1   0   1   0 ) L123B ,
(   1   1   1   0   1   1 ) 2TEL ,
(   1   1   1   1   0   0 ) PENB ,
(   1   1   1   1   0   1 ) PENB ,
(   1   1   1   1   1   0 ) PENB? ,
(   1   1   1   1   1   1 ) 2TEL ,


( DETTYPE - lookup table indexed by the detector address of an ADC word.
            The table defines the detector type - L1A, L2A, etc...
	    This table depends upon the LET front-end electronics wiring )
ARRAY DETTYPE
( chip address 0 )
(  0 ) L2A ,
(  1 ) L2A ,
(  2 ) L2A ,
(  3 ) L2A ,
(  4 ) L2A ,
(  5 ) L2A ,
(  6 ) L2A ,
(  7 ) L2A ,
(  8 ) L2A ,
(  9 ) L2A ,
( 10 ) UNUSED ,
( 11 ) UNUSED ,
( 12 ) UNUSED ,
( 13 ) UNUSED ,
( 14 ) L3A ,
( 15 ) L3A ,

( chip address 1 )
( 16 ) L1A ,
( 17 ) L1A ,
( 18 ) L1A ,
( 19 ) L1A ,
( 20 ) L1A ,
( 21 ) L1A ,
( 22 ) L1A ,
( 23 ) L1A ,
( 24 ) L1A ,
( 25 ) L1A ,
( 26 ) L1A ,
( 27 ) L1A ,
( 28 ) L1A ,
( 29 ) L1A ,
( 30 ) L1A ,
( 31 ) UNUSED ,

( chip address 2 )
( 32 ) L1B ,
( 33 ) L1B ,
( 34 ) L1B ,
( 35 ) L1B ,
( 36 ) L1B ,
( 37 ) L1B ,
( 38 ) L1B ,
( 39 ) L1B ,
( 40 ) L1B ,
( 41 ) L1B ,
( 42 ) L1B ,
( 43 ) L1B ,
( 44 ) L1B ,
( 45 ) L1B ,
( 46 ) L1B ,
( 47 ) UNUSED ,

( chip address 3 )
( 48 ) L2B ,
( 49 ) L2B ,
( 50 ) L2B ,
( 51 ) L2B ,
( 52 ) L2B ,
( 53 ) L2B ,
( 54 ) L2B ,
( 55 ) L2B ,
( 56 ) L2B ,
( 57 ) L2B ,
( 58 ) UNUSED ,
( 59 ) UNUSED ,
( 60 ) UNUSED ,
( 61 ) UNUSED ,
( 62 ) L3B ,
( 63 )L3B ,

( lookup table for Range 2 A-side events. The table for B-side events is nominally the same.
  A table entry is set to 1 if the L1-L2 combination is to be excluded from onboard processing 
)
EXCLUDER2A ^PTR !
       ( L1A0a,b,c    L1A1a,b,c    L1A2a,b,c    L1A3a,b,c    L1A4a,b,c  spare )
( L2A0 ) 0 ^ 0 ^ 0 ^  0 ^ 0 ^ 0 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 ,  4 ,  4 ,  4 ,  4 ,  4 ,  5 ,  5 ,  5 ,  5 ,  5 ,
  5 ,  5 ,  5 ,  5 ,  5 ,  5 ,  5 ,  6 ,  6 ,  6 ,  6 ,  6 ,  6 ,  6 ,  6 ,  6 ,
  6 ,  6 ,  6 ,  6 ,  6 ,  7 ,  7 ,  7 ,  7 ,  7 ,  7 ,  7 ,  7 ,  7 ,  7 ,  7 ,
  7 ,  7 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,
  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  8 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,
  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,
  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 ,  9 , 10 , 10 , 10 , 10 , 10 ,
 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 ,
 10 , 10 , 10 , 10 , 10 , 11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 ,
 11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 , 12 , 12 , 12 , 12 , 12 ,
 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 ,
 12 , 12 , 12 , 12 , 12 , 12 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 ,
 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 ,
 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 14 ,
 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 ,
 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 15 , 15 , 15 ,
 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 ,
 15 , 15 , 15 , 15 , 15 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 ,
 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 17 , 17 , 17 , 17 ,
 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 ,
 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 18 , 18 , 18 , 18 ,
 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 ,
 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 , 18 ,