GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSE / V2-3-2 > qseprint / rhel6-64


Interface   Data Structures   File List   Data Fields   Globals  

QSE_dirPrint.c File Reference

QSE Print Utilities. More...

#include <stdio.h>
#include <QSE/QSE_dirPrint.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_evt.h>
#include <EDS/EBF_ctb.h>
#include <EDS/EBF_tem.h>
#include <EDS/EBF_tkr.h>
#include <EDS/EBF_err.h>

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 void printData (const char *name, const unsigned int *dat, int cnt)
 Simple print routine.
static int tkrLayerEndCount (const EBF_tkr *tkr)
 Counts the number of layer ends with hit strips.
static int tkrStripCount (const EBF_tkr *tkr, int layerEndCnt, int maxwrds)
 Counts the hit strips.
static int tkrLenCalc (const EBF_tkr *tkr, int maxwrds)
 Calculates the number of bytes, not including any padding, in the EBF_tkr record.
static __inline int err_pad_count (const EBF_dirCtbDsc *tem, const unsigned int **err_ptr, int *pad_cnt)
 Calculate the size of the error contribution.
void QSE_dirPrint (const EBF_dir *dir)
 Provides a formatted print out of the contributors in dir.
void QSE_dirCtbAcdPrint (const EBF_dirCtbDsc *acd)
 Provides a formatted print out of the contents of the ACD contribution.
void QSE_dirCtbCalPrint (const EBF_dirCtbDsc *tem)
 Provides a formatted print out of the contents of a CAL TEM contribution.
void QSE_dirCtbTkrPrint (const EBF_dirCtbDsc *tem)
 Provides a formatted print out of the contents of a TKR TEM contribution.
void QSE_dirCtbGemPrint (const EBF_dirCtbDsc *gem)
 Provides a formatted print out of the contents of the GEM contribution.
void QSE_dirCtbTemPrint (const EBF_dirCtbDsc *tem)
 Provides a formatted print out of the contents of a TEM contribution.
void QSE_dirCtbDgnPrint (const EBF_dirCtbDsc *tem)
 Provides a formatted print out of the contents of a TEM's diagnostic contribution.
void QSE_dirCtbErrPrint (const EBF_dirCtbDsc *tem)
 Provides a formatted print out of the contents of a TEM's error contribution.
void QSE_dirCtbPadPrint (const EBF_dirCtbDsc *tem)
 Provides a formatted print out of the contents of a TEM's pad contribution.
static __inline int countLayerEnds (const unsigned int accepts[3])
 Counts the number of layer ends with data in the accept block.


Detailed Description

QSE Print Utilities.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: QSE_dirPrint.c,v 1.6 2011/03/27 01:45:45 russell Exp $

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 tkrLayerEndCount().

static __inline int err_pad_count ( const EBF_dirCtbDsc *  tem,
const unsigned int **  err_ptr,
int *  pad_cnt 
) [static]

Calculate the size of the error contribution.

Returns:
The count, in 32-bit words, of the error contribution.
Parameters:
tem The TEM contribution descriptor
err_ptr Returned as the pointer to the error contribution
pad_cnt The number of 32-bit words in the pad block
  • If negative, this is the number of 32-bit words the calculated size of the error block exceeds the actual size of the contributor. This almost always indicates the the error block is ill-formatted, making it appear as if the start of the pad block is beyond the confines of the contribution block.
Since the error count is based on the contents of the error block itself, if the error block is ill-formatted, this value can be wrong. In the one documented case, LCI failed to add the error block but still set the bit indicating the contribution had an error block. two things happened
  • If a pad block was present, this pad block was misinterpretted as being the error block. Since the pad block is a block of between 0 and 3 0s, the length of the error block was calculated to be 1 32-bit word and the pad block was taken as the remaining (if any) 32-bit words. In this case the dump routine flags the error block as being bogus since no legitimate error block has an error summary word (the first word) being equal to 0.

  • If the pad block is absent (i.e. the contribution ended on an even cell boundary), the error block is taken to be the next contribution header. (Note since error blocks only occur on TEMs, that there is always a next contribution header. It is either another TEM contributor or the mandatory GEM contributor.) In this case, inevitably, the calculated length of the error block is impossibly large. The returned error count is limited to say within the contribution and the pad count is set to a negative value. The negative value serves as flag to the caller that something bad has happened and the value (not terribly useful) is the number of 32-bit words that error count calculation exceeds the contribution boundary

References tkrLenCalc().

Referenced by QSE_dirCtbErrPrint(), and QSE_dirCtbPadPrint().

void printData ( const char *  name,
const unsigned int *  dat,
int  cnt 
) [static]

Simple print routine.

Parameters:
name The contributor's name
dat The contributor's data
cnt The length of the data section in words

Referenced by QSE_dirCtbAcdPrint(), QSE_dirCtbCalPrint(), QSE_dirCtbDgnPrint(), QSE_dirCtbErrPrint(), QSE_dirCtbGemPrint(), QSE_dirCtbPadPrint(), QSE_dirCtbTkrPrint(), and QSE_dirPrint().

void QSE_dirCtbAcdPrint ( const EBF_dirCtbDsc *  acd  ) 

Provides a formatted print out of the contents of the ACD contribution.

Parameters:
acd Pointer to the ACD contributor descriptor

References printData().

Referenced by QSE_dirPrint().

void QSE_dirCtbCalPrint ( const EBF_dirCtbDsc *  tem  ) 

Provides a formatted print out of the contents of a CAL TEM contribution.

Parameters:
tem Pointer to the TEM contributor descriptor containing the CAL record to be printed

References printData().

Referenced by QSE_dirCtbTemPrint().

void QSE_dirCtbDgnPrint ( const EBF_dirCtbDsc *  tem  ) 

Provides a formatted print out of the contents of a TEM's diagnostic contribution.

Parameters:
tem Pointer to the TEM contributor descriptor containing the diagnostic data to be printed.

References printData(), and tkrLenCalc().

Referenced by QSE_dirCtbTemPrint().

void QSE_dirCtbErrPrint ( const EBF_dirCtbDsc *  tem  ) 

Provides a formatted print out of the contents of a TEM's error contribution.

Parameters:
tem Pointer to the TEM contributor descriptor containing the error data to be printed.

References err_pad_count(), and printData().

Referenced by QSE_dirCtbTemPrint().

void QSE_dirCtbGemPrint ( const EBF_dirCtbDsc *  gem  ) 

Provides a formatted print out of the contents of the GEM contribution.

Parameters:
gem A pointer to the trigger contributor descriptor.

References printData().

void QSE_dirCtbPadPrint ( const EBF_dirCtbDsc *  tem  ) 

Provides a formatted print out of the contents of a TEM's pad contribution.

Parameters:
tem Pointer to the TEM contributor descriptor containing the pad data to be printed.

References err_pad_count(), and printData().

Referenced by QSE_dirCtbTemPrint().

void QSE_dirCtbTemPrint ( const EBF_dirCtbDsc *  tem  ) 

Provides a formatted print out of the contents of a TEM contribution.

Parameters:
tem Pointer to the TEM contributor descriptor to be printed

References QSE_dirCtbCalPrint(), QSE_dirCtbDgnPrint(), QSE_dirCtbErrPrint(), QSE_dirCtbPadPrint(), and QSE_dirCtbTkrPrint().

Referenced by QSE_dirPrint().

void QSE_dirCtbTkrPrint ( const EBF_dirCtbDsc *  tem  ) 

Provides a formatted print out of the contents of a TKR TEM contribution.

Parameters:
tem Pointer to the TEM contributor descriptor containing the TKR data to be printed

References printData(), and tkrLenCalc().

Referenced by QSE_dirCtbTemPrint().

void QSE_dirPrint ( const EBF_dir *  dir  ) 

Provides a formatted print out of the contributors in dir.

Parameters:
dir The directory for this event

References printData(), QSE_dirCtbAcdPrint(), and QSE_dirCtbTemPrint().

static int tkrLayerEndCount ( const EBF_tkr *  tkr  )  [static]

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 countLayerEnds().

Referenced by tkrLenCalc().

static int tkrLenCalc ( const EBF_tkr *  tkr,
int  maxwrds 
) [static]

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 tkrLayerEndCount(), and tkrStripCount().

Referenced by err_pad_count(), QSE_dirCtbDgnPrint(), and QSE_dirCtbTkrPrint().

static int tkrStripCount ( const EBF_tkr *  tkr,
int  layerEndCnt,
int  maxwrds 
) [static]

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.

Referenced by tkrLenCalc().


Generated on Tue Nov 29 16:43:24 2011 by  doxygen 1.5.8