GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-1-0 > lsew / rhel6-32


Interface   Data Structures   File List   Data Fields   Globals  

CDF_tkr_err.c File Reference

Implementation to produce Compressed Data Format for the TKR contributors that are in error. More...

#include <CDF_err_def.h>
#include <CDF_tkr_def.h>
#include <LSE/CDF_tkr_err.h>
#include <LSE/CDF_tkrdef.h>
#include <EDS/EDR_tkr.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_tkr.h>
#include <LDT/BFU.h>
#include <LDT/BFP.h>
#include <LDT/BIT.h>
#include <LDT/BW.h>
#include <PBI/FFS.ih>
#include <PBI/PARITY.ih>
#include <PBI/Endianness.h>
#include <string.h>
#include <dprintf.h>

Defines

#define TIMEOUT_COMPRESSION_ENABLED   0

Functions

static __inline unsigned int tkr_err_zcopy (const EBF_tkr *tkr, unsigned int *buf, unsigned int pos, int n32)
static __inline unsigned int tkr_err_compress (const EBF_dirCtbDsc *ctb, const EBF_dirAuxDsc *aux, CDF_tkr_err *tkr_err, const CDF_errTem *err_tem, unsigned int tag, unsigned int *buf, unsigned int pos)
unsigned int CDF_tkr_err_compress (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, const EBF_dir *dir, const EDR_tkr *tkr, const CDF_err *err)
 Adds the TKR record.


Detailed Description

Implementation to produce Compressed Data Format for the TKR contributors that are in error.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: CDF_tkr_err.c,v 1.3 2011/03/26 17:35:24 russell Exp $

Overview
This file compresses TKR towers that are in error.
Compression Method 0: Zcopy
This is a basic compresser that does a reasonably efficient job of just squeezing out the zeroes for such TKR data. This is particularly effective for the timed-out cable controllers. Note that this method care only about the start and length of the TKR data; it does not care anything about its internal details.
Compression Method 1: Timeout compression
For those TKR towers that are a mixture of just okay RCs, RCs with phase errors and RCs with timeouts, this method can achieve extremely high compression ratios. For example, a TKR tower with all 8 of its cable controllers timed-out and with no strip addreses within these cable controllers a factor of 100 can be achieved.
In this case each timed out cable controller contribtutes on the order of 128 - 12 bit cells, that, with exception of the location of the starting bit, are entirely predictable. Thus 8 cables x 128 cells x 12 bits/cell = 1536 bytes.
The encoding of the start bits generally only takes on the order of ` 20 bytes or less. errors)
This high compression factor comes at a cost of a hefty chunk of fairly intricate code. The issue is not really the compression of the events, but in the selection of which events this method can safely handle. There are enormous number of special cases and given the marginal gains and the complexity with the attendant risk of errors, the selection routine is very conservative on which events it will compress. Note that even with the very conservation selection, only about 1% of the events are not compressed.
Having said all that, given the risk that selection routine may error and select an event that is not suitable for compression, a compile-time symbol TIMEOUT_COMPRESSION_ENABLED is provided to selectively compile in this code. Not specifying this funnels all the events through the zcopy method.
In testing, this more sophisicated method netted a 15% reduction in overall compression on a sample of pure error events. Given that error events currently are at the <1% level, this translates into only a net savings of .15%. So the intial implementation of compressing the TKR towers in error is conservatively choosen to be the simple-minded zcopy. If the error rate substantially increases one may wish to revisit this decision. (Note that the timeout method has been tested on approximately 125K events with errors, so it is very probable that it is sound.)

Function Documentation

unsigned int CDF_tkr_err_compress ( CDF_tkr cdf,
unsigned int *  buf,
unsigned int  pos,
const EBF_dir *  dir,
const EDR_tkr *  tkr,
const CDF_err err 
)

Adds the TKR record.

Returns:
The next available bit position in the output buffer
Parameters:
cdf The TKR compression data formatting handle
buf The output buffer
pos The current bit offset
dir The event directory
tkr The unpacked tracker data
err The CDF compile error information

References _CDF_tkr::err, _CDF_tkr::std_map, _CDF_err::tag, and _CDF_err::tems.


Generated on Thu Aug 4 13:00:09 2011 by  doxygen 1.5.8