GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EFC / V4-5-5 > tkrtrgformtest / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

TFC_triggerForm.h File Reference

Defines the interface and inline routines needed to form a tracking trigger from a bit list of hit tracker layers. More...

#include <EDS/EBF_tkr.h>
#include <EFC/../src/TFC_trigger.h>
#include <PBI/FFS.ih>

Defines

#define TFC_TRIGGER_PRINT
 If defined, then the internal debugging macro TFC_TRIGGER_PRINTF is activated.
#define TFC_TRIGGER_PRINTF(_args)
 Internal debugging macro, activated by defining TFC_TRIGGER_PRINT.
#define OFFSET_EVEN   0
 An additional offset (from the right) in a 32-bit word from where the set of even layers normally begin.
#define OFFSET_ODD   7
 An additional offset (from the right) in a 32-bit word from where the set of odd layers begin.
#define TFC_TRG_REMAP_INIT(_trigger, _even, _odd, _e, _o)
 Remaps the specified even and odd layers from the trigger word to the canonical (LSB=Layer 0) order.
#define TFC_TRG_REMAP(_trigger, _even, _odd, _e, _o)
 Remaps the specified even and odd layers from the trigger word to the canonical (LSB=Layer 0) order.

Functions

static __inline int TFC__triggerRemap (int trigger)
 Remaps the trigger pattern word into the more conventional order.
static __inline int TFC__trigger7of8Form (unsigned int x, unsigned int y, unsigned int xy012, unsigned int xy013, unsigned int xy023, unsigned int xy123)
 Forms the 7 / 8 coincidence pattern.
static __inline int TFC__triggerForm (unsigned int x, unsigned int y)
 Looks for a 7/8 or 6/6 coincidence. If one is found returns the starting layer and number of layers in the coincidence.


Detailed Description

Defines the interface and inline routines needed to form a tracking trigger from a bit list of hit tracker layers.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: TFC_triggerForm.h,v 1.4 2011/03/31 22:16:45 russell Exp $

A layer hit bit list is presented in the event builder data format. Each 18-bit accept word, one of the X layers and one for the Y layers, contains two sets of bits, one representing the odd layers one the even layers. The returned word contains summary information on the highest coincidence achieved, e.g. none, 4/4, 6/6 or 7/8, plus information on the start layer and the length of the coincidence closest to the top of the LAT. See TFC_trigger.h for the exact definition of the returned word.

Define Documentation

#define OFFSET_EVEN   0

An additional offset (from the right) in a 32-bit word from where the set of even layers normally begin.

In order to properly form the coincidences, a buffer area between the bits representing the even and odd layers must be maintained. This defines the beginning of the set of bits representing the even layers. There is also an offset defined for the set of bits representing the odd bits. Only one of these is non-zero, but the code is written in such a way that the non-zero one can be either.

#define OFFSET_ODD   7

An additional offset (from the right) in a 32-bit word from where the set of odd layers begin.

In order to properly form the coincidences, a buffer area between the bits representing the even and odd layers must be maintained. This defines the beginning of the set of bits representing the idd layers. There is also an offset defined for the set of bits representing the even bits. Only one of these is non-zero, but the code is written in such a way that the non-zero one can be either.

Referenced by TFC__triggerForm().

#define TFC_TRG_REMAP ( _trigger,
_even,
_odd,
_e,
_o   ) 

Value:

_even |=  ((((_trigger)>>(EBF_TKR_RIGHT_BIT_K_L ## _e + OFFSET_EVEN)) & 1) \
      << (EBF_TKR_K_L ## _e));                                             \
_odd  |=  ((((_trigger)>>(EBF_TKR_RIGHT_BIT_K_L ## _o + OFFSET_ODD )) & 1) \
      << (EBF_TKR_K_L ## _o))
Remaps the specified even and odd layers from the trigger word to the canonical (LSB=Layer 0) order.

Parameters:
_trigger The trigger word to remap
_even Variable to receive the remapped even layers
_odd Variable to receive the remapped odd layers
_e The designator of the even layer to remap (0,2,4,6,8,A,C,E,G)
_o The designator of the odd layer to remap (1,3,5,7,9,B,D,F,H)
This differs from TFC_TRG_REMAP_INIT in that it believes that _even and _odd are already initialized. This macro, together with TFC_TRG_REMAP_INIT allow TFC__triggerRemap to be implemented in a generic form.

Referenced by TFC__triggerRemap().

#define TFC_TRG_REMAP_INIT ( _trigger,
_even,
_odd,
_e,
_o   ) 

Value:

_even  =  ((((_trigger)>>(EBF_TKR_RIGHT_BIT_K_L ## _e + OFFSET_EVEN)) & 1) \
      << (EBF_TKR_K_L ## _e));                                             \
_odd   =  ((((_trigger)>>(EBF_TKR_RIGHT_BIT_K_L ## _o + OFFSET_ODD )) & 1) \
      << (EBF_TKR_K_L ## _o))
Remaps the specified even and odd layers from the trigger word to the canonical (LSB=Layer 0) order.

Parameters:
_trigger The trigger word to remap
_even Variable to receive the remapped even layers
_odd Variable to receive the remapped odd layers
_e The designator of the even layer to remap (0,2,4,6,8,A,C,E,G)
_o The designator of the odd layer to remap (1,3,5,7,9,B,D,F,H)
This differs from TFC_TRG_REMAP in that it initializes _even and _odd. This macro, together with TFC_TRG_REMAP allow TFC__triggerRemap to be implemented in a generic form.

Referenced by TFC__triggerRemap().


Function Documentation

static int TFC__trigger7of8Form ( unsigned int  x,
unsigned int  y,
unsigned int  xy012,
unsigned int  xy013,
unsigned int  xy023,
unsigned int  xy123 
) [static]

Forms the 7 / 8 coincidence pattern.

Parameters:
x The bit mask of X layers with hits with Xodd << 16 | Xeven
y The bit mask of Y layers with hits with Yodd << 16 | Xeven
xy012 The bit-wise and of layers 0,1 and 2
xy013 The bit-wise and of layers 0,1 and 3
xy023 The bit-wise and of layers 0,2 and 3
xy123 The bit-wise and of layers 1,2 and 3
Returns:
The coincidence pattern, aligned such that a coincidence pattern beginning in layer 17 has bit 15 set.
This forms the 7 of 8 pattern for the input masks. The calling convention is a little weird, but it is assumed that that the triple coincidences have been formed.

If the coincidence pattern is over only 4 layers, the minimum, then only one bit will be set. If the pattern is over 5 layers, then 2 consecutive bits will be set.

The 7 of 8 coincidence is formed by and'd all the possible 3-fold coincidence between the x and y with the OR of the 'left-out' layer.

    = xy012 & (x_or_y_3)
    | xy013 & (x_or_y_2)
    | xy023 & (x_or_y_1)
    | xy123 & (x_or_y_0)
  

The notation xy012, for example, means the 6/6 coincidence of the X and Y of layers 0,1,2.

Warning:
This is intended to be for internal usage only.

Referenced by TFC__triggerForm().

static int TFC__triggerForm ( unsigned int  x,
unsigned int  y 
) [static]

Looks for a 7/8 or 6/6 coincidence. If one is found returns the starting layer and number of layers in the coincidence.

Parameters:
x A bit mask of the X layers that have a hit strip.
y A bit mask of the Y layers that have a hit strip.
Return values:
-1,No possibiity of a trigger
-2,A possibility of a trigger, but no 7/8 or 6/6
>0,The starting layer and length of the coincidence packed together as two 16 bit words, with the starting layer number in the MSB 16 bits.
This routine attempts to look first for a coincidence of 4/4 layers, 2 X and 2 Y. If this is not found, it is deemed that there is no possibility of finding a trigger in this tower. If a coincidence of 4/4 layers is found, then one looks first for a string of 7/8. If that fails, 6/6. If both fail, a -2 is returned, indicating only a possibility of a trigger.
If a 7/8 or 6/6 is found, the starting layer number (with 0 being closest to the set ACD top tiles) is returned. The length of the coincidence beyond a 6/6 (ie 0 indicates at least 3 X,Y pairs of layers have been crossed) is computed and returned. (Each X,Y pair counts as 2 in the coincidence length.)
The bit masks for x and y must have the bits for the even layers in the low 16 bits and the bits for the odd layers in the high 16 bits.

References _TFC_trigger::bf, _TFC_trigger_bf::layers, _TFC_trigger_bf::length, OFFSET_ODD, _TFC_trigger::si, _TFC_trigger_bf::start, TFC__trigger7of8Form(), TFC__triggerRemap(), TFC_K_TRIGGER_TYPE_4_OF_4, TFC_K_TRIGGER_TYPE_6_OF_6, TFC_K_TRIGGER_TYPE_7_OF_8, TFC_TRIGGER_PRINTF, and _TFC_trigger_bf::type.

static int TFC__triggerRemap ( int  trigger  )  [static]

Remaps the trigger pattern word into the more conventional order.

Parameters:
trigger The trigger pattern word to remap. This is a bit mask of the struck layers as produced by the hardware
Returns:
The trigger pattern word in layer order
TFC_triggerRemap remaps the trigger pattern word into the more conventional order. The PPC version is written in assembler, achieving about twice the performance of the normal C version.
The accept word was first split into the odd and even portions. This provides some 'dead' area between the two, preventing accidental coincidences from being formed during the shifting operations. This means the remap operation found in EBF_tkr does not work, necessitating this special purpose remap.

        0123456789abcdef0123456789abcdef
        fedcba9876543210fedcba9876543210
        --------------------------------
               13579bdfh       02468aceg

  

The following remaps this to
                      hgfdebca9876543210
   

Another slight difference occurs because layers 0 and 1 can never start 3/3 and 4/4 type of coincidences, so these layers do not need to be remapped; a slight optimization.
This routine has a platform dependent implementation. The PPC version takes advantage of the PPC CPUs that have 2 execution units, using the rlwimi instructions in pairs, one remapping the even layers, the other the odd layers.

References TFC_TRG_REMAP, TFC_TRG_REMAP_INIT, and TFC_TRIGGER_PRINTF.

Referenced by TFC__triggerForm().


Generated on Wed Jan 16 14:11:06 2013 by  doxygen 1.5.8