GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSEC / dev > lsec / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

compact.c File Reference

Compaction implementation. More...

#include <compact.h>
#include <compress.ic>
#include <LSEC_p.h>
#include <LSEC/LSEC.h>
#include <LSEC/LSEC_ctx.h>
#include <LSEC/LSEC_msgs.h>
#include <LDT/APE.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_cal.h>
#include <EDS/EBF_tem.h>
#include <EDS/EBF_tkr.h>
#include <PBS/MBA.h>
#include <PBS/WCT.h>
#include <MSG/MSG_pubdefs.h>
#include <string.h>

Functions

void LSEC_accumCalMeans (LSEC_compaction *cpc, unsigned int *evt, EBF_dir *dir)
 Accumulate the means of the CAL log end values.
unsigned LSEC_checkCalCompaction (LSEC_compaction *cpc)
 Check the CAL substructure for errors.
void LSEC_clearCalCompaction (LSEC_compaction *cpc)
 Clear away any CAL context from a previous cycle.
unsigned int * LSEC_copyUser (LSEC_compaction *cpc, unsigned int *buf)
 Copy datagram header information into the buffer.
void LSEC_deleteCompaction (LSEC_compaction *cpc)
 Free memory previously allocated with a call to LSEC_newCompaction.
unsigned int LSEC_eventSizeCal (const LSEC_calEvent *event)
 Get the size of a saved CAL event.
EBF_ctb * LSEC_gemContribCal (const LSEC_calEvent *event)
 Get the GEM contribution address from a saved CAL event.
void LSEC_histoCalMeans (LSEC_compaction *cpc)
 Calculate and histogram the mean values for the CAL log ends.
void LSEC_histogramCal (LSEC_compaction *cpc, LSEC_calEvent *event)
 Perform histogramming of the CAL data.
LSEC_compactionLSEC_newCompaction (unsigned cap, long long *times)
 Allocate memory for an LSEC_compaction structure and all the substructures.
unsigned LSEC_processCal (LSEC_compaction *cpc)
 Process the CAL compression structures.
void LSEC_reportCalCompaction (LSEC_compaction *cpc, FILE *fp)
 Write CAL compression table contents to an ASCII file.
void LSEC_setContext (LSEC_compaction *cpc, const LSEC_ctx *ctx)
 Set the context information pointer.
void LSEC_setMode (LSEC_compaction *cpc, unsigned mode)
 Set the calibration mode.
unsigned int LSEC_sizeofUser (LSEC_compaction *cpc)
 Calculate the number of 32-bit words required to hold the tables against which the contributions will be encoded.


Detailed Description

Compaction implementation.

Author:
James Swain & Owen Saxton
$Id: compact.c,v 1.20 2011/03/27 17:43:40 saxton Exp $

Function Documentation

void LSEC_accumCalMeans ( LSEC_compaction cpc,
unsigned int *  evt,
EBF_dir *  dir 
)

Accumulate the means of the CAL log end values.

This routine accumulates the CAL ADC values, keeping a separate sum for each log end.

Parameters:
cpc Compaction structure
evt Pointer to the event storage area
dir Pointer to the event to analyse

References LSEC_calCompaction::accum, _LSEC_compaction::cal, LSEC_calCompaction::count, FR_LENG, LM_LENG, LSEC_CAL_M_END, LSEC_CAL_P_END, LSEC_MAX_EVENT_SIZE, LSEC_N_CAL_COL, LSEC_N_CAL_LAY, LSEC_N_LAYCNT_B, LSEC_N_TWR, LSEC_TIM_ACM, setBit(), setNib(), and _LSEC_compaction::times.

Referenced by LSEC_consEventCal().

unsigned LSEC_checkCalCompaction ( LSEC_compaction cpc  ) 

Check the CAL substructure for errors.

Parameters:
cpc Pointer to a compaction object
Returns:
The last error from the first substrcture to be found in error or LSEC_SUCCESS if there are no errors.

References _LSEC_compaction::cal, LSEC_calCompaction::logs, LSEC_checkCompression(), LSEC_N_CAL_RNG, LSEC_TIM_CLR, LSEC_calCompaction::means, and _LSEC_compaction::times.

void LSEC_clearCalCompaction ( LSEC_compaction cpc  ) 

unsigned int* LSEC_copyUser ( LSEC_compaction cpc,
unsigned int *  buf 
)

Copy datagram header information into the buffer.

Parameters:
buf Pointer to the buffer where the context should be placed
cpc Pointer to the structure containing the tables (a compaction)
Returns:
Pointer to the next output location to be filled.

References _LSEC_compaction::copyUser.

void LSEC_deleteCompaction ( LSEC_compaction cpc  ) 

Free memory previously allocated with a call to LSEC_newCompaction.

Parameters:
cpc Pointer to a compaction structure previously created by a call to LSEC_newCompaction

References _LSEC_compaction::cal, LSEC_calCompaction::cData, LSEC_calCompaction::logs, LSEC_deleteCompression(), LSEC_N_CAL_RNG, and LSEC_calCompaction::means.

Referenced by LSEC_newCompaction(), and LSEC_terminate().

unsigned int LSEC_eventSizeCal ( const LSEC_calEvent event  ) 

Get the size of a saved CAL event.

Parameters:
event Pointer to a CAL event data structure.
Returns:
The size, in words, of the saved event. A non-zero value means that the event is in raw format. A zero value means that the event has been expanded and its final size is not known.

EBF_ctb* LSEC_gemContribCal ( const LSEC_calEvent event  ) 

Get the GEM contribution address from a saved CAL event.

Parameters:
event Pointer to a CAL event data structure.
Returns:
The address of the saved GEM contribution.

void LSEC_histoCalMeans ( LSEC_compaction cpc  ) 

Calculate and histogram the mean values for the CAL log ends.

The mean ADC values for each CAL log end are calculated and histogrammed, one histogram per range, ready for being encoded.

Parameters:
cpc Pointer to an LSEC_compaction structure

References LSEC_calCompaction::accum, _LSEC_compaction::cal, LSEC_calCompaction::count, LSEC_histogram(), LSEC_N_CAL_COL, LSEC_N_CAL_END, LSEC_N_CAL_LAY, LSEC_N_CAL_RNG, LSEC_N_TWR, LSEC_TIM_HST, LSEC_calCompaction::means, and _LSEC_compaction::times.

void LSEC_histogramCal ( LSEC_compaction cpc,
LSEC_calEvent event 
)

Perform histogramming of the CAL data.

Several quantities associated with the CAL are histogrammed in preparation for being encoded. These include: the tower map; the mean-subtracted ADC values, offset to be positive, and grouped by range; the diagnostic tower map; and the diagnostic data.

Parameters:
cpc Compaction structure
event Pointer to the stored event

References LSEC_calCompaction::accum, _LSEC_compaction::cal, FR_LENG, getBit(), getNib(), LM_LENG, LSEC_calCompaction::logs, LSEC_CAL_M_END, LSEC_CAL_P_END, LSEC_histogramH(), LSEC_N_CAL_COL, LSEC_N_CAL_LAY, LSEC_N_TWR, LSEC_TIM_HST, _LSEC_calEvent::size, _LSEC_compaction::times, and _LSEC_calEvent::twrMap.

LSEC_compaction* LSEC_newCompaction ( unsigned  cap,
long long *  times 
)

Allocate memory for an LSEC_compaction structure and all the substructures.

Parameters:
cap Capacity of the calibration task, the maximum number of events that can be collected each cycle
times Pointer to the array of processing times.
Returns:
Pointer to an allocated, initialise, LSEC_compaction structure

References _LSEC_compaction::cal, LSEC_calCompaction::cData, LSEC_calCompaction::cMax, LSEC_calCompaction::logs, LSEC_deleteCompaction(), LSEC_MAX_EVENT_SIZE, LSEC_N_CAL_RNG, LSEC_N_LOG_BITS, LSEC_newCompression(), LSEC_newCompressionH(), LSEC_calCompaction::means, and _LSEC_compaction::times.

Referenced by LSEC_initialize().

unsigned LSEC_processCal ( LSEC_compaction cpc  ) 

Process the CAL compression structures.

Parameters:
cpc Pointer to an LSEC_compaction structure

References _LSEC_compaction::cal, LSEC_calCompaction::logs, LSEC_process(), LSEC_TIM_HST, LSEC_calCompaction::means, and _LSEC_compaction::times.

void LSEC_reportCalCompaction ( LSEC_compaction cpc,
FILE *  fp 
)

Write CAL compression table contents to an ASCII file.

Parameters:
cpc Pointer to a compaction object
fp Pointer to the destination file

References _LSEC_compaction::cal, LSEC_calCompaction::logs, LSEC_N_CAL_RNG, LSEC_reportCompression(), and LSEC_calCompaction::means.

void LSEC_setContext ( LSEC_compaction cpc,
const LSEC_ctx ctx 
)

Set the context information pointer.

Parameters:
cpc Pointer to a compaction structure
ctx Pointer to the context block

References _LSEC_compaction::ctx.

Referenced by LSEC_initialize().

void LSEC_setMode ( LSEC_compaction cpc,
unsigned  mode 
)

Set the calibration mode.

Parameters:
cpc Pointer to a compaction structure
mode The calibration mode

References _LSEC_compaction::copyUser, and _LSEC_compaction::sizeUser.

Referenced by LSEC_initRun().

unsigned int LSEC_sizeofUser ( LSEC_compaction cpc  ) 

Calculate the number of 32-bit words required to hold the tables against which the contributions will be encoded.

Parameters:
cpc Pointer to the compaction structure
Returns:
Number of 32-bit words required to hold the packed tables used to encode the contribution

References _LSEC_compaction::sizeUser.


Generated on Mon Mar 28 10:58:03 2011 by  doxygen 1.5.8