GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-0-2 > lsew / rad750
#include "dprintf.h"
#include "LSE/CDF_gem.h"
#include "LSE/CDF_gemdef.h"
#include "CDF_gem_def.h"
#include "LSE/LSEW_dgmFw.h"
#include "LSE/LSEW_ctxPub.h"
#include "EDS/EBF_gem.h"
#include "EDS/FFS.h"
#include "LDT/BFP.h"
#include "LSE/cdf_buf_print.h"
#include <string.h>
Classes | |
struct | _CDF_gemCfg |
Static GEM configuration, this is passed into construction routines and the information is transferred into CDF_gem_cfg. More... | |
Defines | |
#define | DEFAULT_MIN_DEADTIME 529 |
Defines the default minimum deadtime. | |
Typedefs | |
typedef struct _CDF_gemCfg | CDF_gemCfg |
Typedef for struct _CDF_gemCfg. | |
typedef enum _Method | Method |
Typedef for enum _Method. | |
Enumerations | |
enum | _Method { STD = 0, PED = 1 } |
Indicates the packing method, either for standard physics events or for pedestal events. More... | |
Functions | |
static __inline void | gem_reset (CDF_gem *cdf) |
Clears stale context from the GEM compression data format handle. | |
static unsigned int | gem_assess (CDF_gem *cdf, const EBF_gem *gem) |
Constructs a status word consisting of the trigger condition byte and its consistency with both the primitives that set the various bits and trigger condition bit. For those trigger condition primitives that are absent, it records whether the condition arrival time is 0x1f. | |
static unsigned int | gem_pps_pack (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int not_std, unsigned int status) |
Adds the introductory bits + PPS if necessary. | |
static unsigned int | gem_std_pack (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int seq, unsigned int status) |
Adds the GEM record. | |
static __inline unsigned int | gem_ped_pack (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int seq, unsigned int status) |
Compresses the GEM data when zero suppression has been disabled. | |
static __inline unsigned int | gem_psbcat_set (unsigned int status, unsigned int primitive, unsigned int condtime, unsigned int psb_msk, unsigned int cat_msk) |
Sets the Primitive nd Condition Arrival Time status bits. | |
static __inline unsigned int | gem_pack_primitives (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int status) |
Packs the trigger primitives status byte plus any non-0 values. | |
static __inline unsigned int | gem_pack_conditions (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int status) |
Packs the trigger condition status. | |
static __inline unsigned int | gem_pack_condtimes (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int status) |
static __inline unsigned int | gem_pack_deadzone (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int status) |
Packs the deadzone counter value. | |
static __inline unsigned int | gem_pack_times (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int seq) |
Packs the trigger and livetime counter values. | |
static __inline unsigned int | gem_pack_prescaled (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem) |
Packs the prescale counter. | |
static __inline unsigned int | gem_pack_discarded (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem) |
Packs the discard counter. | |
static __inline unsigned int | gem_pack_dwinevt (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem) |
Packs the delta Window and Event times. | |
static __inline unsigned int | gem_pack_acd (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int status) |
Adds the GEM ACD information. Since one does not expect many hits, these are packed as a list of bit addresses. | |
int | CDF_gemCfg_sizeof (int level) |
Returns the size, in bytes of the GEM compression configuration needed to support the specified level. | |
int | CDF_gemCfg_construct (CDF_gemCfg *cfg, int level, void **mem) |
Constructs the CDF_gemCfg compression configuration. | |
unsigned int | CDF_gemCfg_def_min_deadtime (void) |
Returns the default the minimum deadtime. | |
void | CDF_gemCfg_set_min_deadtime (CDF_gemCfg *cfg, int min_deadtime) |
Sets the minimum deadtime. | |
int | CDF_gem_sizeof (int level, const CDF_gemCfg *cfg) |
Returns the size, in bytes of the GEM compression structure needed to support the specified level. | |
int | CDF_gem_construct (CDF_gem *cdf, int level, const CDF_gemCfg *cfg, const LSEW_dgmFw *dgmFw, void **mem) |
Constructs the CDF_gem compression context. | |
void | CDF_gem_begin (CDF_gem *cdf, CDF_gemBdy *bdy) |
Fills int the GEM portion of the datagram contribution used in when decoding an GEM event. | |
unsigned int | CDF_gem_std_compress (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int seq) |
Compresses the GEM for standard zero suppressed data. | |
unsigned int | CDF_gem_ped_compress (CDF_gem *cdf, unsigned int *buf, unsigned int pos, const EBF_gem *gem, unsigned int seq) |
Compresses the GEM data when zero suppression has been disabled. | |
void | CDF_gem_update (CDF_gem *cdf, const EBF_gem *gem, unsigned int seq) |
Updates any running context. |
CVS $Id: CDF_gem.c,v 1.9 2009/04/30 22:41:45 russell Exp $
enum _Method |
void CDF_gem_begin | ( | CDF_gem * | cdf, | |
CDF_gemBdy * | bdy | |||
) |
Fills int the GEM portion of the datagram contribution used in when decoding an GEM event.
cdf | The CDF_gem compress context structure | |
bdy | The CDF_gemBdy structure to fill |
int CDF_gem_construct | ( | CDF_gem * | cdf, | |
int | level, | |||
const CDF_gemCfg * | cfg, | |||
const LSEW_dgmFw * | dgmFw, | |||
void ** | mem | |||
) |
Constructs the CDF_gem compression context.
Status |
cdf | The CDF_gem compression context structure to fill | |
level | The maximum compression level that needs to be supported | |
cfg | Target specific configuration parameter | |
dgmFw | The datagram framework handle | |
mem | Pointer to free memory pointer, return as the the updated pointer. If cdf is equal to the current contents of mem, then mem will be advanced by the size of CDF_gem, else this routine will believe that the only the variable allocation of cdf needs to be allocated. |
unsigned int CDF_gem_ped_compress | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | seq | |||
) |
Compresses the GEM data when zero suppression has been disabled.
cdf | The GEM compressed data format context | |
buf | The output buffer | |
pos | The current bit offset into the output buffer buf | |
gem | The GEM contribution | |
seq | The event sequence number |
int CDF_gem_sizeof | ( | int | level, | |
const CDF_gemCfg * | cfg | |||
) |
Returns the size, in bytes of the GEM compression structure needed to support the specified level.
level | The maximum compression level to support | |
cfg | Target specific configuration |
unsigned int CDF_gem_std_compress | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | seq | |||
) |
Compresses the GEM for standard zero suppressed data.
cdf | The GEM's Compressed Data Format context | |
buf | The output buffer | |
pos | The current bit offset into the output buffer buf | |
gem | The GEM contribution | |
seq | The event sequence number |
void CDF_gem_update | ( | CDF_gem * | cdf, | |
const EBF_gem * | gem, | |||
unsigned int | seq | |||
) |
Updates any running context.
cdf | The GEM's Compressed Data Format context | |
gem | The GEM contribution | |
seq | The event sequence number |
int CDF_gemCfg_construct | ( | CDF_gemCfg * | cfg, | |
int | level, | |||
void ** | mem | |||
) |
Constructs the CDF_gemCfg compression configuration.
Status |
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_gemCfg, else this routine will believe that the only the variable allocation of cdf needs to be allocated. |
void CDF_gemCfg_set_min_deadtime | ( | CDF_gemCfg * | cfg, | |
int | min_deadtime | |||
) |
Sets the minimum deadtime.
cfg | The GEM configuration parameter block | |
min_deadtime | The minimum deadtime. For data taken off the instrument, this will be 529. Typical value for GLEAM Monte Carlo is 400 |
int CDF_gemCfg_sizeof | ( | int | level | ) |
Returns the size, in bytes of the GEM compression configuration needed to support the specified level.
level | The maximum compression level to support |
static unsigned int gem_assess | ( | CDF_gem * | cdf, | |
const EBF_gem * | gem | |||
) | [static] |
Constructs a status word consisting of the trigger condition byte and its consistency with both the primitives that set the various bits and trigger condition bit. For those trigger condition primitives that are absent, it records whether the condition arrival time is 0x1f.
cdf | The GEM's Compression Data Formatting handle | |
gem | The GEM data |
static __inline unsigned int gem_pack_acd | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | status | |||
) | [static] |
Adds the GEM ACD information. Since one does not expect many hits, these are packed as a list of bit addresses.
cdf | The GEM's Compressed Data Format context | |
buf | The output buffer | |
pos | The current bit offset into the output buffer buf | |
gem | The GEM contribution | |
status | The status from gem_assess |
static __inline unsigned int gem_pack_conditions | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | status | |||
) | [static] |
Packs the trigger condition status.
Packs the condition arrival time information.
cdf | The GEM's compress data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
gem | The input EBF_gem record | |
status | The result of the GEM assess (basically a summary status) |
static __inline unsigned int gem_pack_deadzone | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | status | |||
) | [static] |
Packs the deadzone counter value.
cdf | The GEM's compress data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
gem | The input EBF_gem record | |
status | The result of the GEM assess (basically a summary status) |
static __inline unsigned int gem_pack_discarded | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem | |||
) | [static] |
Packs the discard counter.
cdf | The GEM's compress data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
gem | The input EBF_gem record |
static __inline unsigned int gem_pack_dwinevt | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem | |||
) | [static] |
Packs the delta Window and Event times.
cdf | The GEM's compress data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
gem | The input EBF_gem record |
static __inline unsigned int gem_pack_prescaled | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem | |||
) | [static] |
Packs the prescale counter.
cdf | The GEM's compress data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
gem | The input EBF_gem record |
static __inline unsigned int gem_pack_primitives | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | status | |||
) | [static] |
Packs the trigger primitives status byte plus any non-0 values.
cdf | The GEM's compress data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
gem | The input EBF_gem record | |
status | The result of the GEM assess (basically a summary status) |
static __inline unsigned int gem_pack_times | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | seq | |||
) | [static] |
Packs the trigger and livetime counter values.
cdf | The GEM's compress data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
gem | The input EBF_gem record | |
seq | The current event sequence number |
However, because this code assumes nothing that would invalid the encoding, one must be prepared to handle the case that the adjusted deadtime might be negative. In practice, the only place that this should happen is with Monte Carlo data where the fixed deadtime was not specified to be 529.
static __inline unsigned int gem_ped_pack | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | seq, | |||
unsigned int | status | |||
) | [static] |
Compresses the GEM data when zero suppression has been disabled.
cdf | The GEM's Compressed Data Format context | |
buf | The output buffer | |
pos | The current bit offset into the output buffer buf | |
gem | The GEM contribution | |
seq | The event sequence number | |
status | The status from CDF_gem_assess |
static unsigned int gem_pps_pack | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | not_std, | |||
unsigned int | status | |||
) | [static] |
Adds the introductory bits + PPS if necessary.
cdf | The GEM's compress data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
gem | The input EBF_gem record | |
not_std | If true, the not standard packing | |
status | The status from gem_assess |
static __inline unsigned gem_psbcat_set | ( | unsigned int | status, | |
unsigned int | primitive, | |||
unsigned int | condtime, | |||
unsigned int | psb_msk, | |||
unsigned int | cat_msk | |||
) | [static] |
Sets the Primitive nd Condition Arrival Time status bits.
status | The current status word | |
primitive | The value of the trigger primitive. All that really counts is whether it is 0 or non-zero | |
condtime | The condition arrival time for this primitive | |
psb_msk | The primitive status bit mask | |
cat_msk | The condition arrival time bit mask |
static __inline void gem_reset | ( | CDF_gem * | cdf | ) | [static] |
Clears stale context from the GEM compression data format handle.
cdf | The GEM compressed data format context |
static unsigned int gem_std_pack | ( | CDF_gem * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_gem * | gem, | |||
unsigned int | seq, | |||
unsigned int | status | |||
) | [static] |
Adds the GEM record.
cdf | The GEM's compress data formatting handle | |
buf | The output buffer | |
pos | The current bit offset | |
gem | The input EBF_gem record | |
seq | The event sequence number | |
status | The status from gem_assess |