GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-0-2 > lsew / sun-gcc
#include "LSE/CDF_tkr_std.h"
#include "CDF_tkr_def.h"
#include "LDT/BFP.h"
#include "LDT/BWP.h"
#include "LDT/BW.h"
#include "EDS/EDR_tkr.h"
#include "EDS/FFS.h"
#include "LDT/BTE.h"
#include "LDT/HUFF.h"
#include "LSE/cdf_buf_print.h"
#include <string.h>
Classes | |
struct | _TowerMaps |
Captures the map of the tower classification and the XY layers for all 16 towers. More... | |
struct | _TotsRep |
The tots represented as a count of the significant bits + the significant bits. More... | |
struct | _TotsRet |
Return value from the tots_acquire, captures the next write location plus a bit mask of those TOTs having each particular value of the number of significant digits. More... | |
struct | _LayerCntsStatus |
Captures the result of the layer counts assessment. More... | |
struct | _CDF_tkr_twr_sum_blk_f |
union | _CDF_tkr_twr_sum_blk |
Defines | |
#define | _mon cdf_tkr_std_mon |
Typedefs | |
typedef struct _TowerMaps | TowerMaps |
Typedef for struct _TowerMaps. | |
typedef struct _TotsRep | TotsRep |
Typedef for struct _TotsRep. | |
typedef struct _TotsRet | TotsRet |
Typedef for struct _TotsRet. | |
typedef struct _LayerCntsStatus | LayerCntsStatus |
Typedef for struct _LayerCntsStatus. | |
typedef struct _CDF_tkr_twr_sum_blk_f | CDF_tkr_twr_sum_blk_f |
typedef union _CDF_tkr_twr_sum_blk | CDF_tkr_twr_sum_blk |
Functions | |
static BW_vector | tree18_encode (unsigned int w) |
Does a binary-like tree encode of an 18-bit number. | |
static __inline int | layer_map_pack (CDF_tkr *tkr, unsigned int *buf, unsigned int pos, unsigned int map) |
Packs the specified layer map. | |
static TotsRet | tots_acquire (CDF_tkr *tkr, TotsRep *tots, unsigned int present, unsigned int hist[8], const EDR_tkrLayer *lyrs, unsigned int layerMap) |
Packs the TOTs for the specified layers. | |
static __inline int | tots_huff_build (HUFF_code *codes, const unsigned int *hist, int *size, int *validMask) |
static __inline unsigned int | tots_huff_pack (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, unsigned int mask, const HUFF_code *codes, int ncodes) |
Encodes the Huffman table used to encode the TOT exponents. | |
static __inline unsigned int | tots_expman_pack (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, TotsRep *tots, int ntots, const HUFF_code *codes) |
Compresses what is essentially the exponent map of the TOTs. | |
static __inline unsigned int | tots_copy (unsigned int *buf, unsigned int pos, const TotsRep *tots, int ntots) |
Packs the TOT values using a straight copy. | |
static __inline unsigned int | tots_pack (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, const EDR_tkrTower *twrs, unsigned int twrMap) |
Driver routine to pack the strips from each non-empty layer. | |
static __inline unsigned int | layer_maps_pack (CDF_tkr *cdf, unsigned int *buf, int position, const EDR_tkrTower *twrs, unsigned int twrMap) |
Driver routine to pack the layer masks. | |
static __inline int | layer_cnts_assess (LayerCntsStatus *lcs, const EDR_tkrTower *twrs, unsigned int twrMap, unsigned int classMap) |
Gathers and asseses the information about how to encode the number of hit strips in each layer. | |
static __inline unsigned int | layer_cnts_pack_cmaps (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, const LayerCntsStatus *lcs) |
Packs the count maps for the active layers. | |
static __inline unsigned int | layer_cnts_pack_cnts (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, const LayerCntsStatus *lcs, int style) |
Packs the strip counts for each active layer. | |
static __inline unsigned int | find_next_strip (unsigned int map, int xy, const unsigned int *maps, unsigned int twrMap, const EDR_tkrTower *twrs, const EDR_tkrLayer *lyrs) |
Effectively does a look-ahead to find the next hit strip. If there is none, -1 is returned. | |
static __inline unsigned int | layer_cnts_pack (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, const EDR_tkrTower *twrs, unsigned int twrMap, unsigned int classMap) |
Driver routine to pack the layer masks. | |
static __inline unsigned int | strips_pack_lyrs (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, int class, const EDR_tkrLayer *lyrs, unsigned int map, unsigned char *cmax) |
Packs the beginning strip number for each cluster. | |
static __inline int | strips_pack_twrs (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, const EDR_tkrTower *twrs, unsigned int twrMap, unsigned int classMap, unsigned char cmax[17]) |
Driver routine to pack the strips from each non-empty layer. | |
static __inline unsigned int | clusters_pack_lyrs (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, const EDR_tkrLayer *lyrs, unsigned int map, int class, int nbits) |
Packs the cluster width for each cluster. | |
static __inline int | clusters_pack_twrs (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, const EDR_tkrTower *twrs, unsigned int twrMap, unsigned int classMap, const unsigned char cmax[17]) |
Driver routine to pack the cluster widths from each non-empty layer. | |
static __inline unsigned int | layer_map_size (CDF_tkr *cdf, const EDR_tkrTower *twr) |
Computes the number of bits to encode the layer maps from the specified tower,. | |
static __inline unsigned long long int | tower_analyze (CDF_tkr *cdf, const EDR_tkrTower *twr, CDF_tkr_std_mon_twr *mtwr) |
Analyzes all struck layers indicated by the layer map. | |
static __inline unsigned char | tower_classify (CDF_tkr *cdf, CDF_tkr_std_mon_twr *mtwr, unsigned long long int tsb_ull) |
static BW_vector | towers_classify (CDF_tkr *cdf, const EDR_tkrTower *twrs, unsigned int twrMap) |
Picks the optimal encoding method for all towers. | |
unsigned int | CDF_tkr_std_compress (CDF_tkr *cdf, unsigned int *buf, unsigned int pos, const EDR_tkr *tkr) |
Adds the TKR record. | |
void | CDF_tkr_std_mon_print (const CDF_tkr_std_mon *mon) |
CVS $Id: CDF_tkr_std.c,v 1.4 2009/04/30 18:58:53 russell Exp $
Typedef for struct _LayerCntsStatus.
The cmaps array is dense in the active layers, while the cnts array is dense in layers that have counts associated with them
Typedef for struct _TotsRet.
The pointer to the next TOTs location to write is absolutely necessary. The present mask is an optimization to avoid scanning NS values that are not populated. Perhaps even better would be a histogram of the values, That way the scan loop could abort when the number reached 0. We will try this simple approach until it is found that something more sophisiticated is warranted.
Typedef for struct _TowerMaps.
Each map contains 2 bits of information per tower.
For the layer maps the 2 bits represent whether the X and/or Y layers have any hits. The order is X0 = Bit 0 (MSb) Y0 = bit 1, X1 = bit2, etc
For the class maps, the two bits give the tower encoding scheme to use. The order is Tower 0 class = Bits 0,1 (MSb = bit 0), Tower 1 class = Bits 2,3 etc.
unsigned int CDF_tkr_std_compress | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EDR_tkr * | tkr | |||
) |
Adds the TKR record.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
tkr | The unpacked TKR event |
static __inline unsigned int clusters_pack_lyrs | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EDR_tkrLayer * | lyrs, | |||
unsigned int | map, | |||
int | class, | |||
int | nbits | |||
) | [static] |
Packs the cluster width for each cluster.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
lyrs | The layers to pack | |
map | The bit map of which layer to pack | |
class | The class of the tower (diagnostic only) | |
nbits | The number of bits to devote to the width (diagnostic onlY) |
static __inline unsigned int clusters_pack_twrs | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EDR_tkrTower * | twrs, | |||
unsigned int | twrMap, | |||
unsigned int | classMap, | |||
const unsigned char | cmax[17] | |||
) | [static] |
Driver routine to pack the cluster widths from each non-empty layer.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit position | |
twrs | The array of unpacked tower information | |
twrMap | The map of struck towers | |
classMap | The big-endian style classMap | |
cmax | The array of the maximum number of clusters by tower The last entry gives the maximum of all towers. |
static __inline unsigned int find_next_strip | ( | unsigned int | map, | |
int | xy, | |||
const unsigned int * | maps, | |||
unsigned int | twrMap, | |||
const EDR_tkrTower * | twrs, | |||
const EDR_tkrLayer * | lyrs | |||
) | [static] |
Effectively does a look-ahead to find the next hit strip. If there is none, -1 is returned.
The | next hit strip | |
-1 | if there is no next strip |
map | The current layer map | |
xy | 0 if the current layer map is an X map, 1 if a Y map | |
maps | The array X and Y layer maps for the current tower | |
twrMap | The tower map | |
twrs | The array of towers | |
lyrs | The layers for the current tower. |
static __inline int layer_cnts_assess | ( | LayerCntsStatus * | lcs, | |
const EDR_tkrTower * | twrs, | |||
unsigned int | twrMap, | |||
unsigned int | classMap | |||
) | [static] |
Gathers and asseses the information about how to encode the number of hit strips in each layer.
lcs | The layer count status structure to fill in | |
twrs | The tower structures for this event | |
twrMap | The map of active towers | |
classMap | The class of each active tower |
static __inline unsigned int layer_cnts_pack | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EDR_tkrTower * | twrs, | |||
unsigned int | twrMap, | |||
unsigned int | classMap | |||
) | [static] |
Driver routine to pack the layer masks.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit position | |
twrs | The array of towers for this event | |
twrMap | The array of struck towers | |
classMap | The tower class map |
static __inline unsigned int layer_cnts_pack_cmaps | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const LayerCntsStatus * | lcs | |||
) | [static] |
Packs the count maps for the active layers.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit position | |
lcs | The layer count status structure |
static __inline unsigned int layer_cnts_pack_cnts | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const LayerCntsStatus * | lcs, | |||
int | style | |||
) | [static] |
Packs the strip counts for each active layer.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit position | |
lcs | The layer count status structure | |
style | The packing style |
static __inline int layer_map_pack | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
unsigned int | map | |||
) | [static] |
Packs the specified layer map.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit position | |
map | The layer map to pack |
static __inline unsigned int layer_map_size | ( | CDF_tkr * | cdf, | |
const EDR_tkrTower * | twr | |||
) | [static] |
Computes the number of bits to encode the layer maps from the specified tower,.
cdf | The TKR compression data formatting handle | |
twr | The target tower |
static __inline unsigned int layer_maps_pack | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
int | position, | |||
const EDR_tkrTower * | twrs, | |||
unsigned int | twrMap | |||
) | [static] |
Driver routine to pack the layer masks.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
position | The current bit position | |
twrs | The array of towers for this event | |
twrMap | The array of struck towers |
static __inline unsigned int strips_pack_lyrs | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
int | class, | |||
const EDR_tkrLayer * | lyrs, | |||
unsigned int | map, | |||
unsigned char * | cmax | |||
) | [static] |
Packs the beginning strip number for each cluster.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
class | The class specification of the tower. | |
lyrs | The array of layers to traverse | |
map | Bit map of the layers to process | |
cmax | Returned as a number which has the same number of bits as the maximum cluster width |
static __inline int strips_pack_twrs | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EDR_tkrTower * | twrs, | |||
unsigned int | twrMap, | |||
unsigned int | classMap, | |||
unsigned char | cmax[17] | |||
) | [static] |
Driver routine to pack the strips from each non-empty layer.
cdf | The TKR compression context | |
buf | The output buffer | |
pos | The current bit position | |
twrs | The array of unpacked tower information | |
twrMap | The map of struck towers | |
classMap | The big-endian style classMap | |
cmax | The maximum count by tower, the last entry is returned as the overall maximum |
static TotsRet tots_acquire | ( | CDF_tkr * | cdf, | |
TotsRep * | tots, | |||
unsigned int | present, | |||
unsigned int | hist[8], | |||
const EDR_tkrLayer * | lyrs, | |||
unsigned int | layerMap | |||
) | [static] |
Packs the TOTs for the specified layers.
cdf | The TKR compression data formatting handle | |
tots | The output buffer | |
present | Bit mask of 'ns' values present | |
hist | Histogram of the 8 possible values for the number of signficant digits in the TOTs | |
lyrs | The array of layers for this tower | |
layerMap | The map of struck layers for this tower |
static __inline unsigned int tots_copy | ( | unsigned int * | buf, | |
unsigned int | pos, | |||
const TotsRep * | tots, | |||
int | ntots | |||
) | [static] |
Packs the TOT values using a straight copy.
buf | The output buffer | |
pos | The current bit position | |
tots | The array of TOTs in leading zero format | |
ntots | The number to pack |
static __inline unsigned int tots_expman_pack | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
TotsRep * | tots, | |||
int | ntots, | |||
const HUFF_code * | codes | |||
) | [static] |
Compresses what is essentially the exponent map of the TOTs.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit position | |
tots | The array of TOTs in leading zero format | |
ntots | The number to pack | |
codes | The Huffman codes |
static __inline unsigned int tots_huff_pack | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
unsigned int | mask, | |||
const HUFF_code * | codes, | |||
int | ncodes | |||
) | [static] |
Encodes the Huffman table used to encode the TOT exponents.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit position | |
mask | The 8-bit mask of which length codes are valid. The most significant bit (bit 0) is for codes of length 0 and bit 7 is for codes of length 7. | |
codes | The dense list of Huffman codes | |
ncodes | The count of Huffman codes |
static __inline unsigned int tots_pack | ( | CDF_tkr * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EDR_tkrTower * | twrs, | |||
unsigned int | twrMap | |||
) | [static] |
Driver routine to pack the strips from each non-empty layer.
cdf | The TKR compression data formatting handle | |
buf | The output buffer | |
pos | The current bit position | |
twrs | The array of unpacked tower information | |
twrMap | The map of struck towers |
The cheaper of the two methods is used.
The TOT packing algorithm attempts to take advantage of the fact that the number of significant bits in a TOT value is only 3-6 bits out of the possible 8 bits. There are two types of TOT values, noise hits and MIP type hits. Evidence is that noise hits are quite small (likely less the 4 bits) and 1 MIP hits are around 40 counts (in the 5-6 bit range.)
Consequently a Huffman code is used to encode the number of leading zeroes. The remaining significant digits are just coded as is. Given the fact that 0 and 1 are very unlikely, these to values are collapsed to the same exponent value with the consequence that an exponent of 0 cannot be interpretted as being 1.
If the
if (ntots < 4) goto COPY;
static __inline unsigned long long int tower_analyze | ( | CDF_tkr * | cdf, | |
const EDR_tkrTower * | twr, | |||
CDF_tkr_std_mon_twr * | mtwr | |||
) | [static] |
Analyzes all struck layers indicated by the layer map.
cdf | The TKR compression data formatting handle | |
twr | The tower to analyze | |
mtwr | Monitor structure |
static BW_vector towers_classify | ( | CDF_tkr * | cdf, | |
const EDR_tkrTower * | twrs, | |||
unsigned int | twrMap | |||
) | [static] |
Picks the optimal encoding method for all towers.
cdf | The TKR compression data formatting handle | |
twrs | The unpacked tower information | |
twrMap | Map of the towers with hits |
static Tree18 tree18_encode | ( | unsigned int | w | ) | [static] |
Does a binary-like tree encode of an 18-bit number.
w | The word to encode |