GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LSE / V1-3-6
Constituent: lsew     Tag: rad750
#include "LSE/CDF_caldef.h"
#include "LSE/CDF_cal.h"
#include "LSE/CDF_cal_std.h"
#include "CDF_cal_def.h"
#include "LSE/cdf_buf_print.h"
#include "dprintf.h"
#include "EDS/EDA_cal.h"
#include "EDS/ECR_cal.h"
#include "EDS/EDR_calUnpack.h"
#include "EDS/EDR_cal.h"
#include "EDS/EBF_cal.h"
#include "EDS/EBF_dir.h"
#include "EDS/EBF_cid.h"
#include "EDS/EDS_endianness.h"
#include "EDS/FFS.h"
#include "LDT/BTE.h"
#include "LDT/BFP.h"
#include "LDT/HUFF.h"
#include "LDT/HDE.h"
#include <string.h>
Include dependency graph for CDF_cal_std.c:
Data Structures | |
struct | _Vn |
A structure containing two fields, one with the bit pattern of a packed PHA value and one with the number of bits in the bit pattern. More... | |
Typedefs | |
typedef _Vn | Vn |
Typedef for struct _Vn. | |
Functions | |
static int | pha_ctx1_fill (CDF_calPhaCtx *pha_ctx, const EDR_cal *cal, const ECR_cal *calCal) |
Transforms the CAL PHA values from EBF format to the leading zero representation. This routine works for CAL data in single range readout mode. | |
static int | pha_ctx4_fill (CDF_calPhaCtx *pha_ctx, const EDR_cal *cal, const ECR_cal *calCal, const CDF_cal *cdf, const EBF_dir *dir) |
Transforms the CAL PHA values from EBF format to the leading zero representation. This routine works for CAL data in four range readout mode. | |
static __inline unsigned int | pha_ctx4_fill_layers (CDF_calPhaLz *lz, short int *dif, unsigned int present, unsigned short int hist[2][16], unsigned short int *rhist, const EBF_calLogData *logs, const ECR_calTower *calTwr, const CDF_cal_prd_layer *prdLyr, int twr, int lay, int cnt, int stride) |
Evaluates a CAL layer when in 4-range readout. The checks are
| |
static __inline void | pha_predict (unsigned short int *hist, short int *dif, EBF_calLogData log0, EBF_calLogData log1, EBF_calLogData log2, EBF_calLogData log3, const ECR_calTower *calTwr, const CDF_cal_prd_layer *prdLyr, int twr, int lyr) |
Fills in the difference between the actual PHA value and the predicted value. | |
static unsigned int | compress1_raw_adr (unsigned int *buf, unsigned int pos, const EDR_cal *cal) |
Compresses the CAL address data. | |
static unsigned int | compress1_raw1_pha (unsigned int *buf, unsigned int pos, CDF_calPhaCtx *pha_ctx) |
Compresses the CAL pha data when in single range readout mode. | |
static __inline unsigned int | compress1_raw4_pha (unsigned int *buf, unsigned int pos, CDF_calPhaCtx *pha_ctx, HDE *hde) |
Compresses the CAL pha data when in four range readout mode. | |
static __inline unsigned int | compress1_rng4_pha (unsigned int *buf, unsigned int pos, CDF_calPhaCtx *phaCtx, HDE *hde) |
Compresses the CAL pha data for the 'other 4' ranges. | |
static __inline unsigned int | lz_compose (CDF_calPhaLz *lz, unsigned int present, unsigned short int hist[2][16], const EBF_calLogData log, const ECR_calTower *calTwr, int twr, int lay) |
Fills in the LZ structure for the specified log. | |
unsigned int | CDF_cal_std_compress (CDF_cal *cdf, unsigned int *buf, unsigned int pos, const EBF_dir *dir, const EDR_cal *cal, const ECR_cal *calCal) |
Compresses the CAL data. | |
static void | pha_compute_dif3 (unsigned short int hist[32], unsigned short int *difs, const CDF_cal_prd_log_end_table *ple_tbl, int rng, unsigned short int vals[4]) |
Computes the difference between the actual and predicted values for the 'other 3' ranges. | |
static __inline unsigned int | join (unsigned int colMap0, unsigned int colMap1) |
Combines to 12 bit column masks into 1 24 left justified mask. | |
static __inline unsigned int | prepare (unsigned int colMap0, unsigned int colMap1) |
Transforms the the 2 12-bit column masks into 4 groups of 2 rows x 3 columns masks packed into the least significant bits of a 32-bit word One 24-bit mask arranged as 4 groups of 2 rows x 3 columns. | |
static __inline unsigned int | pack_adrs_1 (unsigned int *buf, unsigned int pos, unsigned int biase, unsigned int stop, unsigned int colMap) |
Packs the column addresses associated with the specified column mask. | |
static __inline unsigned int | pack_adrs (unsigned int *buf, unsigned int pos, unsigned int colMapx01, unsigned int colMapx23, unsigned int colMapy01, unsigned int colMapy23) |
Packs the addresses associated with the hit columns. | |
static __inline unsigned int | collapse_24x6 (unsigned int pat) |
Collapses the 4 groups of 6 consecutive bits in a 24 bit number to a 4 bit mask. | |
static __inline unsigned int | collapse_4x4 (unsigned int pat) |
Collapses the 4 bits in a 4 bit pattern to a single bit, indicating whether the value is 0 or non-zero. | |
static __inline unsigned int | compose_qmapn (unsigned int r0, unsigned int r1) |
Compose the bit pattern for the negative quadtree encoding. | |
static __inline unsigned int | compose_qmapp (unsigned int r0, unsigned int r1) |
Compose the bit pattern for the positive quadtree encoding. | |
static __inline unsigned int | compose_qmap (unsigned int scheme, unsigned int patternx01, unsigned int patternx23, unsigned int patterny01, unsigned int patterny23) |
Composes a representation of the level 0 and level quad tree map of the 96 bits specified by the 4 24 bit masks. | |
static __inline unsigned int | pack_blks (unsigned int *buf, unsigned int pos, int map, unsigned int pattern) |
Packs the non-zero 6 bit groups in the specified 24-bit pattern. | |
static __inline unsigned int | pack_qtree (unsigned int *buf, unsigned int pos, unsigned int qmap, unsigned int patternx01, unsigned int patternx23, unsigned int patterny01, unsigned int patterny23) |
Packs the complete quad tree representation for the specified patterns. | |
static __inline unsigned int | compress1_twr_adr (unsigned int *buf, unsigned int pos, unsigned int nhits, unsigned int colMapx0, unsigned int colMapx1, unsigned int colMapx2, unsigned int colMapx3, unsigned int colMapy0, unsigned int colMapy1, unsigned int colMapy2, unsigned int colMapy3) |
Compresses the addresses for this tower. | |
static __inline Vn | pack_present (unsigned int present) |
Constructs the packed version of the present mask. | |
static __inline unsigned int | pha_exp_compose (const CDF_calPhaLz *lz, int ndif, unsigned char mappings[2][16]) |
Composes the bit pattern to encode the exponents. | |
static __inline Vn | pha_val_compose (const CDF_calPhaLz *lz) |
Composes the packed bit pattern from the leading zero representation of a PHA value. | |
static unsigned int | pha_max_dif_pack (unsigned int *buf, int pos, const CDF_calPhaLz *lz, int lzcnt, unsigned int cnts) |
Packs each PHA value into the output structure, using a fixed number of bits (specified by the cnts) for the maximum and difference values. | |
static unsigned int | pha_exp_man_pack (unsigned int *buf, int pos, const CDF_calPhaLz *lz, int lzcnt) |
Packs each PHA value into the output structure, uses full 8 bit exponent. This version represents the exponents using two fixed 4 bit fields. | |
static unsigned int | pha_exp_man_s_pack (unsigned int *buf, int pos, const CDF_calPhaLz *lz, int lzcnt, Vn present, unsigned int ntot, unsigned int ndif, unsigned char mappings[2][16]) |
Packs each PHA value into the output structure, using a pseudo- floating point scheme. | |
static __inline unsigned int | create_mapping (unsigned char map[16], unsigned int msk) |
Creates a crossing mapping array, yielding, for a given set bit, the number of that set bit. | |
static __inline int | chose (unsigned short int hist[2][16], unsigned int novr_a, unsigned int novr_b, unsigned int nexp_b, unsigned int npha, unsigned int *a) |
Evaluates the cost to encode the PHAs values as an exponent and manitissa in for two encoding methods. |
CVS $Id: CDF_cal_std.c,v 1.5 2008/08/26 16:11:48 russell Exp $
|
Compresses the CAL data.
|
|
Evaluates the cost to encode the PHAs values as an exponent and manitissa in for two encoding methods.
|
|
Collapses the 4 groups of 6 consecutive bits in a 24 bit number to a 4 bit mask.
|
|
Composes a representation of the level 0 and level quad tree map of the 96 bits specified by the 4 24 bit masks.
33 2222 2222 2211 1111 1111 10 9876 5432 1098 7654 3210 9 87654 3210 +--+----+----+----+----+----+-+-----+----+ |ss|MapA|Map0|Map1|Map2|Map3|0| Ng6s|NmpA| +--+----+----+----+----+----+-+-----+----+ Where ss = Scheme 10 for + image, 11 for - image Mapa = Bit map of which of pattern words are non-zero Equivalently, it indicates the which of the following maps are present. Map0 = Bit map of which groups of 6 from the 1rst hit group are hit Map1 = Bit map of which groups of 6 from the 2nd hit group are hit Map2 = Bit map of which groups of 6 from the 3rd hit group are hit Map3 = Bit map of which groups of 6 from the 4rth hit group are hit 0 = MBZ Ng6s = Number of 6 that are hit (ie bit count of Map0-Map3) (0-4) Nqmap = Number of bits in the qmap (0-16) In the maps, 0 is never a valid number. |
|
Compresses the CAL pha data when in single range readout mode.
|
|
Compresses the CAL pha data when in four range readout mode.
|
|
Compresses the CAL address data.
|
|
Compresses the CAL pha data for the 'other 4' ranges.
|
|
Creates a crossing mapping array, yielding, for a given set bit, the number of that set bit.
|
|
Combines to 12 bit column masks into 1 24 left justified mask.
|
|
Fills in the LZ structure for the specified log.
|
|
Packs the addresses associated with the hit columns.
|
|
Packs the column addresses associated with the specified column mask.
|
|
Packs the non-zero 6 bit groups in the specified 24-bit pattern.
|
|
Constructs the packed version of the present mask.
|
|
Packs the complete quad tree representation for the specified patterns.
|
|
Computes the difference between the actual and predicted values for the 'other 3' ranges.
|
|
Transforms the CAL PHA values from EBF format to the leading zero representation. This routine works for CAL data in single range readout mode.
|
|
Transforms the CAL PHA values from EBF format to the leading zero representation. This routine works for CAL data in four range readout mode.
|
|
Evaluates a CAL layer when in 4-range readout. The checks are
printf ("Logs %8.8x %8.8x %8.8x %8.8x\n", log_0.ui, log_1.ui, log_2.ui, log_3.ui); |
|
Composes the bit pattern to encode the exponents.
|
|
Packs each PHA value into the output structure, uses full 8 bit exponent. This version represents the exponents using two fixed 4 bit fields.
|
|
Packs each PHA value into the output structure, using a pseudo- floating point scheme.
|
|
Packs each PHA value into the output structure, using a fixed number of bits (specified by the cnts) for the maximum and difference values.
|
|
Fills in the difference between the actual PHA value and the predicted value.
Best Use Range # to Predict Range 0 1 2 3 ------+----+---+---+---+ 0 | NA 0 0 2 1 | 1 NA 1 2 2 | 1 2 NA 2 3 | 1 2 3 NA Looking at the above table, there are 7 unique predictor combinations. The predictor constants are stored in a table in the following order
Thus given a best value, one can arrange a lookup table to give the prediction constants for the 3 ranges (i.e. the ones following the best. This table is
Note that predictors with indices 4,5 and 6 are used when using a base range to predict a value with a larger value. In this case saturation may and presumably does occur (that's why a lower gain range was selected in the first place). |
|
Composes the packed bit pattern from the leading zero representation of a PHA value.
|
|
Transforms the the 2 12-bit column masks into 4 groups of 2 rows x 3 columns masks packed into the least significant bits of a 32-bit word One 24-bit mask arranged as 4 groups of 2 rows x 3 columns.
|