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


Interface   Data Structures   File List   Data Fields   Globals  

CDF_dgn_std_cal.c File Reference

Compresses the CAL contribution to the diagnostic data. More...

#include <LSE/CDF_dgn_std_cal.h>
#include <CDF_dgn_def.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_cal.h>
#include <EDS/EDR_cal.h>
#include <EDS/EDA_cal.h>
#include <EDS/EDR_calUnpack.h>
#include <LDT/RLE.h>
#include <LDT/BFP.h>
#include <LDT/BWP.h>
#include <LDT/BW.h>
#include <PBI/FFS.ih>
#include <dprintf.h>
#include <string.h>

Defines

#define analyze_cal_stats_twr(_twr, _which, _cols, _lo, _hi)
#define print_cal_stats(_stats)
#define PACK_CALCOLMAP(_columns_0, _columns_1, _columns_2, _colMap)

Functions

static __inline int mapTower (unsigned short int *colMapP, const EBF_dirCtbDsc *contributor)
 Creates the address map for the specified tower.
static __inline int mapTower4 (unsigned short int *colMapP, const EBF_dirCtbDsc *contributor)
 Maps the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes 4 range readout.
static __inline unsigned int dgn_std_cal_twr_extract (CDF_dgn_std_cal_twr *cdgn, unsigned int err, int twr, const unsigned int *dgn, const EBF_dirCtbDsc *dsc)
 Extracts the 8 12-bit log accept maps for the two log ends into 3 32-bit values. In addition, the equivalent set of 3x32 log accepts maps are filled using the data as the source.
static int dgn_std_cal_compress_set (unsigned int *buf, unsigned int pos, unsigned int d, unsigned int p, unsigned int n)
 Compresses one set of the positive and negative maps of 32 bits of which CAL logs where over-threshold (from the diagnostic data). This routine will typically be called 3 times for the 3 sets of maps representing the 96 logs.
static __inline unsigned int dgn_std_cal_compress (unsigned int *buf, unsigned int pos, CDF_dgn_std_cal_twr *dgn, int cnt)
 Encodes the CAL log accept data for all towers.
static __inline unsigned int dgn_std_cal_twr_layer_map (unsigned short int colMap[8], const EBF_dirCtbDsc *dsc)
int CDF_dgn_std_cal_cfg_sizeof (int level)
 Returns the size, in bytes of the DGN compression configuration needed to support the specified level.
int CDF_dgn_std_cal_cfg_construct (CDF_dgn_std_cal_cfg *cfg, int level, void **mem)
 Constructs the CDF_dgnCalCfg compression configuration.
int CDF_dgn_std_cal_sizeof (int level, const CDF_dgn_std_cal_cfg *cfg)
 Returns the size, in bytes of the CAL DGN compression structure needed to support the specified level.
int CDF_dgn_std_cal_construct (CDF_dgn_std_cal *cdf, int level, const CDF_dgn_std_cal_cfg *cfg, const LSEW_dgmFw *dgmFw, void **mem)
 Constructs the CAL standard diagnostic compression context.
unsigned int CDF_dgn_std_cal_prepare (CDF_dgn_std_cal *cdf, unsigned int map, unsigned int amap, unsigned int emap, const unsigned **dgns, const EBF_dirCtbDsc *dscs)
 Prepares the cal diagnostic data for compression.
unsigned int CDF_dgn_std_cal_compress (CDF_dgn_std_cal *cdf, unsigned int *buf, unsigned int pos)
 Compresses the CAL diagnostic data when data is taken with standard physics triggers.


Detailed Description

Compresses the CAL contribution to the diagnostic data.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: CDF_dgn_std_cal.c,v 1.2 2011/03/26 17:35:23 russell Exp $

Define Documentation

#define PACK_CALCOLMAP ( _columns_0,
_columns_1,
_columns_2,
_colMap   ) 

Value:

{                                                                   \
    unsigned short int _colMap_2;                                   \
    unsigned short int _colMap_5;                                   \
                                                                    \
                                                                    \
    _colMap_2  =  _colMap[2];                                       \
                                                                    \
    _columns_0 = (_colMap[0] <<  0)                                 \
               | (_colMap[1] << 12)                                 \
               | (_colMap_2  << 24);                                \
                                                                    \
                                                                    \
    _colMap_5  = _colMap[5];                                        \
                                                                    \
    _columns_1 = (_colMap_2  >>  8)                                 \
               | (_colMap[3] <<  4)                                 \
               | (_colMap[4] << 16)                                 \
               | (_colMap_5  << 28);                                \
                                                                    \
                                                                    \
    _columns_2 = (_colMap[5] >>  4)                                 \
               | (_colMap[6] <<  8)                                 \
               | (_colMap[7] << 20);                                \
}


Function Documentation

int CDF_dgn_std_cal_cfg_construct ( CDF_dgn_std_cal_cfg *  cfg,
int  level,
void **  mem 
)

Constructs the CDF_dgnCalCfg compression configuration.

Return values:
Status 
Parameters:
cfg Target specific configuration
level The maximum compression level that needs to be supported
mem Pointer to free memory pointer, return as the the updated pointer. If cfg is equal to the current contents of mem, then mem will be advanced by the size of CDF_dgnCfg else this routine will believe that the only the variable allocation of cdf needs to be allocated.

Referenced by CDF_dgn_std_cfg_construct().

int CDF_dgn_std_cal_cfg_sizeof ( int  level  ) 

Returns the size, in bytes of the DGN compression configuration needed to support the specified level.

Parameters:
level The maximum compression level to support

Referenced by CDF_dgn_std_cfg_sizeof().

unsigned int CDF_dgn_std_cal_compress ( CDF_dgn_std_cal *  cdf,
unsigned int *  buf,
unsigned int  pos 
)

Compresses the CAL diagnostic data when data is taken with standard physics triggers.

Returns:
The updated bit index
Parameters:
cdf The CAL diagnostic context
buf The output bit buffer
pos The output bit index
The CAL diagnostic data consists of two pieces
  • The trigger information
  • The log accept information

These are encoded in two separate blocks on a per tower basis, that is the trigger information for all towers is encoded first, followed by the log accept data for all towers.

References CDF_dgn_gen_trg_compress(), and dgn_std_cal_compress().

Referenced by CDF_dgn_std_compress().

int CDF_dgn_std_cal_construct ( CDF_dgn_std_cal *  cdf,
int  level,
const CDF_dgn_std_cal_cfg *  cfg,
const LSEW_dgmFw dgmFw,
void **  mem 
)

Constructs the CAL standard diagnostic compression context.

Returns:
Status
Parameters:
cdf The CAL standard diagnostic compression context to construct
level The compression level
cfg The CAL standard diagnostic compression configuration information. Currently this is unused, but is provided for future usage if necessary.
dgmFw The datagram framework. This would be used if the compression of the CAL standard diagnostic data needed to store any context information in the datagram header.
mem A pointer to the memory to allocate any variable length structures the CDF_dgn_std_cal context may need. Currently there are none. If this pointer is the same as cdf, the memory pointer is advanced by the size of the CDF_dgn_std_cal structure before allocating any new memory. This routine updates the memory pointer to the next available address.

Referenced by CDF_dgn_std_construct().

unsigned int CDF_dgn_std_cal_prepare ( CDF_dgn_std_cal *  cdf,
unsigned int  map,
unsigned int  amap,
unsigned int  emap,
const unsigned **  dgns,
const EBF_dirCtbDsc *  dscs 
)

Prepares the cal diagnostic data for compression.

Returns:
A 32 bit value composed of two1 16-maps, one for which towers had the CAL HI trigger set (upper 16 bits) and which towers had the CAL LO trigger set (lower 16 bits).
Parameters:
cdf The context for CAL standard diagnostics
map A left justified map indicating which towers have a CAL diagnostic contribution, either TRG or ACCEPT
amap A left justified map indicating which towers have a non-empty accept contribution.
emap A left justified map of towers with errors
dgns An array of pointers, indexed by tower number, giving the address of that tower's diagnostic block.
dscs The array of pointers to the tower contribution descriptors.
This routine provides information used to compress both the CAL diagnostic data itself, but also information used in constructing the summary header. This summary information indicates which towers have non-zero CAL HI and LO trigger bits set.

References dgn_std_cal_twr_extract().

Referenced by CDF_dgn_std_compress().

int CDF_dgn_std_cal_sizeof ( int  level,
const CDF_dgn_std_cal_cfg *  cfg 
)

Returns the size, in bytes of the CAL DGN compression structure needed to support the specified level.

Parameters:
level The maximum compression level to support
cfg Target specific configuration

Referenced by CDF_dgn_std_sizeof().

static __inline unsigned int dgn_std_cal_compress ( unsigned int *  buf,
unsigned int  pos,
CDF_dgn_std_cal_twr *  dgn,
int  cnt 
) [static]

Encodes the CAL log accept data for all towers.

Returns:
The updated bit index
Parameters:
buf The output bit buffer
pos The output bit index
dgn The prepared diagnostic data for the list of towers with non-empty diagnostic data
cnt The count of dgn

References dgn_std_cal_compress_set().

Referenced by CDF_dgn_std_cal_compress().

static int dgn_std_cal_compress_set ( unsigned int *  buf,
unsigned int  pos,
unsigned int  d,
unsigned int  p,
unsigned int  n 
) [static]

Compresses one set of the positive and negative maps of 32 bits of which CAL logs where over-threshold (from the diagnostic data). This routine will typically be called 3 times for the 3 sets of maps representing the 96 logs.

Returns:
The updated write bit position
Parameters:
buf The output buffer
pos The current bit position in the output buffer
d The 32-bit map of which logs contributed to the CAL data.
p The 32-bit map of which logs contributed to the positive end diagnostic accepts.
n The 32-bit map of which logs contributed to the negative end diagnostic accepts.
The data map, serves as a template for the compression. If the electronics functions correctly, this map will match the OR of the positive and negative maps. If this is true, then the compress is more efficient, but this routine will still compress the data.

Referenced by dgn_std_cal_compress().

static __inline unsigned int dgn_std_cal_twr_extract ( CDF_dgn_std_cal_twr *  cdgn,
unsigned int  err,
int  twr,
const unsigned int *  dgn,
const EBF_dirCtbDsc *  dsc 
) [static]

Extracts the 8 12-bit log accept maps for the two log ends into 3 32-bit values. In addition, the equivalent set of 3x32 log accepts maps are filled using the data as the source.

Returns:
The trigger bits (16 CAL HI, 16 CAL LO, 8 for each end)
Parameters:
cdgn The structure to receive the 2x3x32-bit log accepts from the diagnostic data and 3x32-bit log accepts from the CAL data
err A flag, non zero if erroring tower
twr The tower number (debug only)
dgn The CAL diagnostic data
dsc The contribution descriptor for the tower. This is used to access the CAL data. In principle, the diagnostic data could be located using this descriptor, but that would entail paging across the tracker data to find it. This has already been done once, no reason to find it again.

References PACK_CALDGNMAP.

Referenced by CDF_dgn_std_cal_prepare().

static __inline int mapTower ( unsigned short int *  colMapP,
const EBF_dirCtbDsc *  contributor 
) [static]

Creates the address map for the specified tower.

Returns:
The map of struck layers (MSB = layer 0)
Parameters:
colMapP The CAL column maps to fill, one for each layer, LSB = column 0
contributor The CAL contributor descriptor

static __inline int mapTower4 ( unsigned short int *  colMapP,
const EBF_dirCtbDsc *  contributor 
) [static]

Maps the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes 4 range readout.

Returns:
The next CAL energy location to be stored
Parameters:
colMapP The CAL column maps to fill, one for each layer, LSB = column 0
contributor The CAL contributor descriptor
This routine creates the address map for one tower that is in the 4 range readout mode
Warning:
This routine can be called if and only if there are struck logs in this tower.


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