GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSEC / V3-3-1 > qsec_wb / linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

QSEC.c File Reference

Manages the updating of the calibration event context. More...

#include "QSEC_p.h"
#include "decode.h"
#include "expand.h"
#include "QSEC/QSEC.h"
#include "QSEC/QSEC_ctx.h"
#include "QSE/QSE_ctx.h"
#include "QSE/QSE_ctxUpdate.h"
#include "LSE/LSE_stdCtb.h"
#include "LSF/LSF_scan.h"
#include "LSEC/enums.h"
#include "EDS/EBF_gem.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Enumerations

enum  { QSEC_MAX_N_EVENTS = 100 }

Functions

static LSF_scanRecordHandler root_update (QSEC *qsec, const LSF_contribution *ctb)
QSEC * QSEC_alloc (void)
 Allocate and construct the QSEC handle.
unsigned int QSEC_sizeof (void *prm)
 Get the size of the area needed to hold the event meta-information.
QSEC * QSEC_construct (QSEC *qsec, void *prm)
 Construct (initializes) the handle for updating the standard event meta-information.
void QSEC_destruct (QSEC *qsec)
 Destroy the QSEC handle.
void QSEC_updateAtDatagram (void *qsec, const LSF_datagram *dgm)
 Update the run oriented information in the event context using the information from the event datagram.
void QSEC_updateAtContribution (void *qsec, const LSF_contribution *ctb)
 Update the context based on the contribution.
int QSEC_updateAtRecord (void *qsec, const LSF_record *rec)
 Update the context based on the record.
int QSEC_expand (QSEC *qsec, const LSF_record *rec, QSE_ebfEvt *ebf, int ebf_size, int *ret_size)
 Expand the event into EBF format.
const QSEC_ctxQSEC_appCtxGet (const QSEC *qsec)
 Return a pointer to the public QSEC application specific context block.
const QSE_ctx * QSEC_stdCtxGet (const QSEC *qsec)
 Return a pointer to the standard QSE context block.
const EBF_gem * QSEC_gemGet (const QSEC *qsec)
 Return a pointer to the expanded GEM data.
void QSEC_reportExpand (const QSEC *qsec, FILE *fp, unsigned int optns)
 Report the contents of an expansion.
void QSEC_reportExp (const QSEC *qsec, FILE *fp)
 Report the contents of an expansion context.


Detailed Description

Manages the updating of the calibration event context.

Author:
James Swain & Owen Saxton
Id
QSEC.c,v 1.14 2010/08/10 18:31:47 saxton Exp

Function Documentation

QSEC* QSEC_alloc ( void   ) 

Allocate and construct the QSEC handle.

Returns:
A pointer to the allocated and constructed QSEC handle

References QSEC_construct().

const QSEC_ctx* QSEC_appCtxGet ( const QSEC *  qsec  ) 

Return a pointer to the public QSEC application specific context block.

This routine is just an accessor to keep the structure of QSEC private.

Parameters:
qsec The calibration event handle
Returns:
A pointer to the QSEC application specific context block

QSEC* QSEC_construct ( QSEC *  qsec,
void *  prm 
)

Construct (initializes) the handle for updating the standard event meta-information.

Parameters:
qsec The handle to initialize, if specified as NULL, one will be allocated
prm A run-time set parameter used to stylize the configuration
Returns:
The QSEC context structure

References QSEC_constructCtx(), QSEC_constructExpansion(), and QSEC_sizeof().

Referenced by QSEC_alloc().

void QSEC_destruct ( QSEC *  qsec  ) 

Destroy the QSEC handle.

Parameters:
qsec Pointer to the QSEC handle to delete.

int QSEC_expand ( QSEC *  qsec,
const LSF_record *  rec,
QSE_ebfEvt *  ebf,
int  ebf_size,
int *  ret_size 
)

Expand the event into EBF format.

This just launders the call

Parameters:
qsec The calibration event handle
rec The LSF record containing the event
ebf The ebf buffer to expand the event into, this pointer must be 32-bit aligned
ebf_size The size, in bytes, of the buffer
ret_size Returned as the size of the expanded event
Return values:
0 Successful expand
<0 Failure, see the enumeration QSEC_STATUS_K for the reasons

References QSEC_decode(), QSEC_ID_CALIB_RAW_EVT, QSEC_STATUS_K_DECODE, and QSEC_STATUS_K_TOO_SMALL.

const EBF_gem* QSEC_gemGet ( const QSEC *  qsec  ) 

Return a pointer to the expanded GEM data.

This routine is just an accessor to keep the structure of QSEC private.

Parameters:
qsec The calibration event handle
Returns:
A pointer to the expanded GEM record

void QSEC_reportExp ( const QSEC *  qsec,
FILE *  fp 
)

Report the contents of an expansion context.

Parameters:
qsec The calibration event handle
fp Pointer to the destination file

References QSEC_reportExpCtx().

void QSEC_reportExpand ( const QSEC *  qsec,
FILE *  fp,
unsigned int  optns 
)

Report the contents of an expansion.

Parameters:
qsec The calibration event handle
fp Pointer to the destination file
optns Options controlling the report (not used)

References QSEC_reportExpansion().

unsigned int QSEC_sizeof ( void *  prm  ) 

Get the size of the area needed to hold the event meta-information.

Parameters:
prm A run-time set parameter used to stylize the configuration
Returns:
The size, in bytes, of the area needed to hold the event meta-information

References QSEC_sizeofExpansion().

Referenced by QSEC_construct().

const QSE_ctx* QSEC_stdCtxGet ( const QSEC *  qsec  ) 

Return a pointer to the standard QSE context block.

This routine is just an accessor to keep the structure of QSEC private.

Parameters:
qsec The calibration event handle
Returns:
A pointer to the QSE context block

void QSEC_updateAtContribution ( void *  qsec,
const LSF_contribution *  ctb 
)

Update the context based on the contribution.

Parameters:
qsec The calibration event handle to update
ctb The contribution

References QSEC_ID_CALIB_ACD_CTX, QSEC_ID_CALIB_CAL_CTX, QSEC_ID_CALIB_TKR_CTX, QSEC_recoverCtx(), QSEC_recoverUser(), and QSEC_setMode().

void QSEC_updateAtDatagram ( void *  qsec,
const LSF_datagram *  dgm 
)

Update the run oriented information in the event context using the information from the event datagram.

Parameters:
qsec The calibration event handle
dgm The event datagram
Note:
The root contribution is opaque to the caller, so QSEC must handle the contributions within the root. There are two strategies one could use
  1. Call LSF_scanContribtions and let it parse through them and invoke a user call back routine
  2. Do the scan by hand.
Initially I have opted for strategy #1, but the second strategy makes detailed error checking easier. For example, if the sequence of the contributions is fixed, it is likely easier to do this when doing the scan by hand.

int QSEC_updateAtRecord ( void *  qsec,
const LSF_record *  rec 
)

Update the context based on the record.

Parameters:
qsec The calibration event handle to update
rec The event record
Return values:
>0 If successful update to an event record
<0 If unsuccessful update to an event record
0 If this was not an event record

References QSEC_update().


Generated on Thu Jan 27 12:57:36 2011 by  doxygen 1.5.8