GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> FES / V6-5-0 > fes_ux / rhel4-32


Interface   Data Structures   File List   Data Fields   Globals  

fesDataFmt.c File Reference

Routines for formatting FES data. More...

#include <fesDataFmt.h>
#include <fesMsgs.h>
#include <EMSG/EMSG_pubdefs.h>
#include <stdlib.h>
#include <string.h>

Functions

int fesDataFmtAcdNrec (int id, const int *cables, int intvl, int pause, char *buff, int lBuff, int *nData)
 Format a complete null ACD transition record.
int fesDataFmtAcdPrec (int id, const int *cables, const fesAcdPedesData_t *peds, char *buff, int lBuff, int *nData)
 Format a complete ACD pedestal record.
int fesDataFmtAcdTrec (int versn, int id, const int *cables, const int *veto, int intvl, int pause, const int *nhit, const int *const *hits, char *buff, int lBuff, int *nData)
 Format a complete ACD transition record.
int fesDataFmtCalNrec (int id, int intvl, int pause, char *buff, int lBuff, int *nData)
 Format a complete null calorimeter transition record.
int fesDataFmtCalPrec (int id, const fesCalPedesData_t *peds, char *buff, int lBuff, int *nData)
 Format a complete calorimeter pedestal record.
int fesDataFmtCalTrec (int versn, int id, const int *treq, int intvl, int pause, const int *nhit, const fesCalHits_t *const *hits, char *buff, int lBuff, int *nData)
 Format a complete calorimeter transition record.
int fesDataFmtCalTrec4 (int versn, int id, const int *treq, int intvl, int pause, const int *nhit, const fesCalHits4_t *const *hits, char *buff, int lBuff, int *nData)
 Format a complete calorimeter transition record (four-range).
int fesDataFmtHrec (int dType, long long dMask, int nTran, int nEvent, const char *desc, fesFileHead_u_t *hRec)
 Format header record.
int fesDataFmtTkrNrec (int id, int intvl, int pause, char *buff, int lBuff, int *nData)
 Format a complete null tracker transition record.
int fesDataFmtTkrTrec (int versn, int id, const int *treq, int intvl, int pause, const int *nhit, const short *const *hits, char *buff, int lBuff, int *nData)
 Format a complete tracker transition record.
int fesDataFmtTrecTime (int intvl, int pause, char *recd)
 Format transition record time.


Detailed Description

Routines for formatting FES data.

Author:
Owen H Saxton
$Id: fesDataFmt.c,v 1.11 2011/03/29 23:06:45 saxton Exp $

Function Documentation

int fesDataFmtAcdNrec ( int  id,
const int *  cables,
int  intvl,
int  pause,
char *  buff,
int  lBuff,
int *  nData 
)

Format a complete null ACD transition record.

This routine formats the supplied data into a complete null transition record for one ACD board.

Parameters:
id The ID of the ACD board.
cables The array of up to four ACD cable numbers connected to the board. If there are fewer than four cables, the array is padded out with the value -1.
intvl The interval for this transition, in 50 nsec clock ticks. If non-negative, the transition is the main one of an event, and the interval is from this transition to the main one of the following event. If negative, the transition is subsidiary to the preceding main one, and is the negative of the interval from the main transition to this one.
pause If non-zero, the pause bit is set in the transition vector, causing a pause after the transition.
buff The address of a buffer to contain the formatted data.
lBuff An integer specifying the number of bytes available in the buffer.
nData The address of an integer to receive the number of bytes of data generated in the buffer.
Return values:
FES_SUCCESS Success
FES_BUFFSHRT The data buffer overflowed

References ACD_NCABLE, RTYP_ACD_TRAN, and RVER_NULL.

int fesDataFmtAcdPrec ( int  id,
const int *  cables,
const fesAcdPedesData_t peds,
char *  buff,
int  lBuff,
int *  nData 
)

Format a complete ACD pedestal record.

This routine formats the supplied data into a complete transition record for one ACD board.

Parameters:
id The ID of the ACD board.
cables The array of up to four ACD cable numbers connected to the board. If there are fewer than four cables, the array is padded out with the value -1.
peds The address of the array of ACD pedestal data.
buff The address of a buffer to contain the formatted data.
lBuff An integer specifying the number of bytes available in the buffer.
nData The address of an integer to receive the number of bytes of data generated in the buffer.
Return values:
FES_SUCCESS Success
FES_BUFFSHRT The data buffer overflowed

References ACD_NCABLE, ACD_NCHAN, ACD_NRANGE, fesTranRec_u_t::data, and RTYP_ACD_PED.

Referenced by fesDataGenPedes().

int fesDataFmtAcdTrec ( int  versn,
int  id,
const int *  cables,
const int *  veto,
int  intvl,
int  pause,
const int *  nhit,
const int *const *  hits,
char *  buff,
int  lBuff,
int *  nData 
)

Format a complete ACD transition record.

This routine formats the supplied data into a complete transition record for one ACD board.

Parameters:
versn The format version of the generated data. The value RVER_NULL may be used to generate a record containing no veto or hits data.
id The ID of the ACD board.
cables The array of up to four ACD cable numbers connected to the board. If there are fewer than four cables, the array is padded out with the value -1.
veto The address of the array of veto masks, one per cable present. If NULL, the masks are generated from the hit data. Ignored if versn is RVER_NULL.
intvl The interval for this transition, in 50 nsec clock ticks. If non-negative, the transition is the main one of an event, and the interval is from this transition to the main one of the following event. If negative, the transition is subsidiary to the preceding main one, and is the negative of the interval from the main transition to this one.
pause If non-zero, the pause bit is set in the transition vector, causing a pause after the transition.
nhit The address of the array of the number of hits on each cable present. Ignored if versn is RVER_NULL.
hits The address of the array of pointers to the arrays cantaining the hit data. There is one such array per cable present. Each data word contains the channel number (0 - 17) in the high order byte, and the hit value in the low order two bytes. The latter consists of the ADC value in bits 0 - 11, the range in bit 12, the hit map in bit 13, and the pedestal flag in bit 14. Ignored if versn is RVER_NULL.
buff The address of a buffer to contain the formatted data.
lBuff An integer specifying the number of bytes available in the buffer.
nData The address of an integer to receive the number of bytes of data generated in the buffer.
Return values:
FES_SUCCESS Success
FES_BUFFSHRT The data buffer overflowed

References ACD_DMEM_QUANTUM, ACD_LTVEC, ACD_NCABLE, RTYP_ACD_TRAN, RVER_CABLE, RVER_CBL_TIME, RVER_DET_TIME, and RVER_DETC.

int fesDataFmtCalNrec ( int  id,
int  intvl,
int  pause,
char *  buff,
int  lBuff,
int *  nData 
)

Format a complete null calorimeter transition record.

This routine formats the supplied data into a complete null transition record for one calorimeter board.

Parameters:
id The ID of the calorimeter board.
intvl The interval for this transition, in 50 nsec clock ticks. If non-negative, the transition is the main one of an event, and the interval is from this transition to the main one of the following event. If negative, the transition is subsidiary to the preceding main one, and is the negative of the interval from the main transition to this one.
pause If non-zero, the pause bit is set in the transition vector, causing a pause after the transition.
buff The address of a buffer to contain the formatted data.
lBuff An integer specifying the number of bytes available in the buffer.
nData The address of an integer to receive the number of bytes of data generated in the buffer.
Return values:
FES_SUCCESS Success
FES_BUFFSHRT The data buffer overflowed

References RTYP_CAL_TRAN, and RVER_NULL.

int fesDataFmtCalPrec ( int  id,
const fesCalPedesData_t peds,
char *  buff,
int  lBuff,
int *  nData 
)

Format a complete calorimeter pedestal record.

This routine formats the supplied data into a complete pedestal data record for one calorimeter board.

Parameters:
id The ID of the calorimeter board.
peds The address of the array of calorimeter pedestal data.
buff The address of a buffer to contain the formatted data.
lBuff An integer specifying the number of bytes available in the buffer.
nData The address of an integer to receive the number of bytes of data generated in the buffer.
Return values:
FES_SUCCESS Success
FES_BUFFSHRT The data buffer overflowed

References CAL_NCABLE, fesTranRec_u_t::data, and RTYP_CAL_PED.

Referenced by fesDataGenPedes().

int fesDataFmtCalTrec ( int  versn,
int  id,
const int *  treq,
int  intvl,
int  pause,
const int *  nhit,
const fesCalHits_t *const *  hits,
char *  buff,
int  lBuff,
int *  nData 
)

Format a complete calorimeter transition record.

This routine formats the supplied data into a complete transition record for one calorimeter board.

Parameters:
versn The format version of the generated data. The value RVER_NULL may be used to generate a record containing no trigger request or hits data.
id The ID of the calorimeter board.
treq The address of the array of trigger request line masks, one per cable. If NULL, the masks are generated from the hit data. Ignored if versn is RVER_NULL.
intvl The interval for this transition, in 50 nsec clock ticks. If non-negative, the transition is the main one of an event, and the interval is from this transition to the main one of the following event. If negative, the transition is subsidiary to the preceding main one, and is the negative of the interval from the main transition to this one.
pause If non-zero, the pause bit is set in the transition vector, causing a pause after the transition.
nhit The address of the array of the number of hits on each cable. Ignored if versn is RVER_NULL.
hits The address of the array of pointers to the arrays cantaining the hit data. There is one such array per cable. Each data array element contains: the log number (0 - 47), numbered so that logs 0 - 11 are those in layer 0, 12 - 23 in layer 1, etc.; some flags (use pedestals, log accept); the range; and the ADC value. Ignored if versn is RVER_NULL.
buff The address of a buffer to contain the formatted data.
lBuff An integer specifying the number of bytes available in the buffer.
nData The address of an integer to receive the number of bytes of data generated in the buffer.
Return values:
FES_SUCCESS Success
FES_BUFFSHRT The data buffer overflowed

References CAL_DMEM_QUANTUM, CAL_LTVEC, CAL_NCABLE, RTYP_CAL_TRAN, RVER_CABLE, RVER_CBL_TIME, RVER_DET_TIME, and RVER_DETC.

int fesDataFmtCalTrec4 ( int  versn,
int  id,
const int *  treq,
int  intvl,
int  pause,
const int *  nhit,
const fesCalHits4_t *const *  hits,
char *  buff,
int  lBuff,
int *  nData 
)

Format a complete calorimeter transition record (four-range).

This routine formats the supplied four-range data into a complete transition record for one calorimeter board.

Parameters:
versn The format version of the generated data. The value RVER_NULL may be used to generate a record containing no trigger request or hits data.
id The ID of the calorimeter board.
treq The address of the array of trigger request line masks, one per cable. If NULL, the masks are generated from the hit data. Ignored if versn is RVER_NULL.
intvl The interval for this transition, in 50 nsec clock ticks. If non-negative, the transition is the main one of an event, and the interval is from this transition to the main one of the following event. If negative, the transition is subsidiary to the preceding main one, and is the negative of the interval from the main transition to this one.
pause If non-zero, the pause bit is set in the transition vector, causing a pause after the transition.
nhit The address of the array of the number of hits on each cable. Ignored if versn is RVER_NULL.
hits The address of the array of pointers to the arrays cantaining the hit data. There is one such array per cable. Each data array element contains: the log number (0 - 47), numbered so that logs 0 - 11 are those in layer 0, 12 - 23 in layer 1, etc.; some flags (use pedestals, log accept, auto-range); the first range to be output; and the ADC values for each range, in range number order. Ignored if versn is RVER_NULL.
buff The address of a buffer to contain the formatted data.
lBuff An integer specifying the number of bytes available in the buffer.
nData The address of an integer to receive the number of bytes of data generated in the buffer.
Return values:
FES_SUCCESS Success
FES_BUFFSHRT The data buffer overflowed

References CAL_DMEM_QUANTUM, CAL_LTVEC, CAL_NCABLE, RTYP_CAL_TRAN, RVER_CABLE, RVER_CBL_TIME, RVER_DET_TIME, and RVER_DETC.

int fesDataFmtHrec ( int  dType,
long long  dMask,
int  nTran,
int  nEvent,
const char *  desc,
fesFileHead_u_t hRec 
)

Format header record.

This routine formats a complete data file header record using the supplied values.

Parameters:
dType The type of data in the file.
dMask A 40-bit mask containing a set bit for each of the detectors present in the file.
nTran The number of transition records in the file.
nEvent The number of event transition records in the file.
desc The address of a brief descriptive string, up to 80 bytes long.
hRec The address of the buffer to contain the formatted data.
Return values:
FES_SUCCESS Always success

References fesFileHead_u_t::dataType, fesFileHead_u_t::descrip, fesFileHead_u_t::detMask, fesFileHead_u_t::head, fesRecHead_u_t::leng, fesFileHead_u_t::nEvent, fesFileHead_u_t::nTran, RTYP_HEADER, fesRecHead_u_t::type, and fesRecHead_u_t::version.

Referenced by fesDataGen(), fesDataGenPedes(), and fesDataGenTrig().

int fesDataFmtTkrNrec ( int  id,
int  intvl,
int  pause,
char *  buff,
int  lBuff,
int *  nData 
)

Format a complete null tracker transition record.

This routine formats the supplied data into a complete null transition record for one tracker board.

Parameters:
id The ID of the tracker board.
intvl The interval for this transition, in 50 nsec clock ticks. If non-negative, the transition is the main one of an event, and the interval is from this transition to the main one of the following event. If negative, the transition is subsidiary to the preceding main one, and is the negative of the interval from the main transition to this one.
pause If non-zero, the pause bit is set in the transition vector, causing a pause after the transition.
buff The address of a buffer to contain the formatted data.
lBuff An integer specifying the number of bytes available in the buffer.
nData The address of an integer to receive the number of bytes of data generated in the buffer.
Return values:
FES_SUCCESS Success
FES_BUFFSHRT The data buffer overflowed

References RTYP_TKR_TRAN, and RVER_NULL.

int fesDataFmtTkrTrec ( int  versn,
int  id,
const int *  treq,
int  intvl,
int  pause,
const int *  nhit,
const short *const *  hits,
char *  buff,
int  lBuff,
int *  nData 
)

Format a complete tracker transition record.

This routine formats the supplied data into a complete transition record for one tracker board.

Parameters:
versn The format version of the generated data. The value RVER_NULL may be used to generate a record containing no trigger request or hits data.
id The ID of the tracker board.
treq The address of the array of trigger request line masks, one per cable, with two cables per board side. If NULL, the masks are generated from the hit data. Ignored if versn is RVER_NULL.
intvl The interval for this transition, in 50 nsec clock ticks. If non-negative, the transition is the main one of an event, and the interval is from this transition to the main one of the following event. If negative, the transition is subsidiary to the preceding main one, and is the negative of the interval from the main transition to this one.
pause If non-zero, the pause bit is set in the transition vector, causing a pause after the transition.
nhit The address of the array of the number of hits on each cable. Ignored if versn is RVER_NULL.
hits The address of the array of pointers to the arrays containing the hit and TOT data. There is one such array per cable. Each data word (16-bit) contains the layer number (0 - 8) in the high order 4 bits and the strip number (0 - 1535) or TOT value (0 - 1023) in the low order 12 bits. The data must be grouped by layer number, and the layers arranged in ascending order. Within each non-empty layer, the one TOT value comes last preceded by the hit strip numbers in numerical order. Ignored if versn is RVER_NULL.
buff The address of a buffer to contain the formatted data.
lBuff An integer specifying the number of bytes available in the buffer.
nData The address of an integer to receive the number of bytes of data generated in the buffer.
Return values:
FES_SUCCESS Success
FES_BUFFSHRT The data buffer overflowed
FES_INVTKRDT The data is invalid

References RTYP_TKR_TRAN, RVER_CABLE, RVER_CBL_TIME, RVER_DET_TIME, RVER_DETC, TKR_DMEM_QUANTUM, TKR_LTVEC, and TKR_NCABLE.

int fesDataFmtTrecTime ( int  intvl,
int  pause,
char *  recd 
)

Format transition record time.

This routine updates the time field of a transition record using the supplied values. The record header must have previously been formatted correctly.

Parameters:
intvl The time interval for this transition, in 50 nsec clock ticks. If non-negative, the transition is the main one of an event, and the interval is from this transition to the main one of the following event. If negative, the transition is subsidiary to the preceding main one, and intvl is the negative of the interval from the main transition to this one.
pause If non-zero, the pause bit is set in the time field.
recd Address of the transition record to be updated.
Returns:
Always 0.

References ACD_NCABLE, fesTranRec_u_t::data, fesTranRec_u_t::head, RTYP_ACD_TRAN, fesRecHead_u_t::type, and fesRecHead_u_t::version.


Generated on Sat Apr 9 19:57:47 2011 by  doxygen 1.5.8