GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EDS / V2-12-1 > eds / rhel6-64


Interface   Data Structures   File List   Data Fields   Globals  

EBF_tkr.c File Reference

Utility routines to partially parse the tracker data. More...

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

Defines

#define BITCOUNT(x)   (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)
 Computes the number of bits set (1) in 32-bit argument.
#define BX_(x)
 Replaces each 4-bit sequence in arg by the number of bits in sequence.

Functions

static __inline int countLayerEnds (const unsigned int accepts[3])
 Counts the number of layer ends with data in the accept block.
int EBF_tkrLayerEndCount (const EBF_tkr *tkr)
 Counts the number of layer ends with hit strips.
int EBF_tkrStripCount (const EBF_tkr *tkr, int layerEndCnt, int maxwrds)
 Counts the hit strips.
int EBF_tkrLenCalc (const EBF_tkr *tkr, int maxwrds)
 Calculates the number of bytes, not including any padding, in the EBF_tkr record.


Detailed Description

Utility routines to partially parse the tracker data.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: EBF_tkr.c,v 1.3 2011/03/25 22:16:56 russell Exp $

The tracker data is particularly hard to parse. One must serially decode the data. In many cases, one is not interested in a full unpacking, merely overall quantities, such as the TKR data length, the number of hit strips, etc. These routines provide as fast as possible method to do this.

Define Documentation

#define BITCOUNT (  )     (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)

Computes the number of bits set (1) in 32-bit argument.

See also:
BX_
Credit to Chris Smith (original algorithm) Jane Huffman (original writer) Brad Merril & Jerry Leichter (ported from 36-bit words to 32-bit words)

Referenced by countLayerEnds().

#define BX_ (  ) 

Value:

((x) - (((x)>>1)&0x77777777)                    \
                             - (((x)>>2)&0x33333333)                    \
                             - (((x)>>3)&0x11111111))
Replaces each 4-bit sequence in arg by the number of bits in sequence.

See also:
BITCOUNT
Replaces each 4-bit sequence in 32-bit argument by the number of bits in that sequence (which will, of course, fit in 4 bits).


Function Documentation

int countLayerEnds ( const unsigned int  accepts[3]  )  [static]

Counts the number of layer ends with data in the accept block.

Returns:
The number of layer ends with data in the accept block
Parameters:
accepts The array of the 3 accept words (only 72 bits active)

References BITCOUNT.

Referenced by EBF_tkrLayerEndCount(), and EBF_tkrLenCalc().

int EBF_tkrLayerEndCount ( const EBF_tkr tkr  ) 

Counts the number of layer ends with hit strips.

Returns:
The number of layer ends with hit strips
Parameters:
tkr Pointer to the tracker data

References _EBF_tkr::accepts, and countLayerEnds().

int EBF_tkrLenCalc ( const EBF_tkr tkr,
int  maxwrds 
)

Calculates the number of bytes, not including any padding, in the EBF_tkr record.

Returns:
The byte length of the active information in the EBF_tkr record
Parameters:
tkr Pointer to the tracker data
maxwrds The maximum number of words that can possibly be in the EBF_tkr record. This serves as a sanity check in case the serial decode of the record goes haywire.
This function must serially parse the entire TKR record for a given tower and, is, therefore, is not cheap, particularly in the case of large EBF_tkr records. If one needs both the number of layers hit, the strip count and the length of the record, it is better to use EBF_tkrLayerEndCnt and EBF_tkrStripCnt and compute the length from these values. Note that if the diagnostic block and/or the error block is present, the lengths of these blocks need to be added in.

References _EBF_tkr::accepts, countLayerEnds(), and EBF_tkrStripCount().

Referenced by EBF_dirAuxFill().

int EBF_tkrStripCount ( const EBF_tkr tkr,
int  layerEndCnt,
int  maxwrds 
)

Counts the hit strips.

Returns:
The number hit strips
Parameters:
tkr Pointer to the tracker data
layerEndCnt Count of the number hit layer end ends. This is most easily acquired from EBF_tkrLayerEndCount.
maxwrds The maximum number of words in the TKR record. This value is currently not used, but may be used in the future as an integrity check.

References _EBF_tkr::accepts.

Referenced by EBF_tkrLenCalc().


Generated on Thu Sep 27 13:52:20 2012 by  doxygen 1.5.8