GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-0-1 > lsew / sun-gcc
#include "LSE/CDF_cal.h"
#include "LSE/CDF_cal_ped.h"
#include "CDF_cal_def.h"
#include "dprintf.h"
#include "EDS/EBF_dir.h"
#include "EDS/EBF_cid.h"
#include "EDS/EBF_cal.h"
#include "EDS/ECR_cal.h"
#include "LDT/BFP.h"
#include "LDT/APE.h"
#include "LDT/HUFF.h"
#include "LDT/HDE.h"
#include "EDS/FFS.h"
#include <stdio.h>
Classes | |
struct | _HistLimits |
Min and Max indices of a histogram. More... | |
Defines | |
#define | RNGS_COMPOSE(_beg) |
Composes an array of 2 bit range values in the order specified. For example, specifying RNG_COMPOSE(0) means that one expects the four range readout to occur in the order range 0,1,2,3, while specifying RNG_COMPOSE(1) results in an expected order of range 1,2,3,0. This is used to predict the range when processing the layer pairs in the four range readout order. | |
#define | LYR_OFFSETS(_lyr, _rng) |
Computes the offsets to the specified layer and range when all the logs in a tower are struck. | |
#define | RNG_OFFSETS(_rng) |
Creates a comma separated list of the offsets to the 8 layers for the specified range when all the logs in a tower are struck. | |
Typedefs | |
typedef struct _HistLimits | HistLimits |
Typedef for struct _HistLimits. | |
Functions | |
static __inline unsigned int | cal_ped1_evaluate (const EBF_dir *dir, int *rngP) |
Evaluates the CAL data to see if it is in a form that the compression routines understand. | |
static __inline unsigned int | cal_ped1_evaluate_layer (const EBF_calLogData *logs, int cnt, int twr, int lyr, int rng) |
Checks that the column numbers are as expected and that all the ranges are 0. | |
static __inline int | cal_ped1_process (short int *cidx, unsigned short int *hist, const EBF_dir *dir, const ECR_cal *clb) |
Creates the histograms and the array of pedestal subtracted indices used to compress the CAL portion of the event that is specific to single-range readout. | |
static __inline const unsigned int * | cal_ped1_process_layer (short int *cidx, unsigned short int *hist, const ECR_calLayer *clyr, const unsigned int *logs, int cnt, int twr, int lyr) |
Accumulates the histograms used in compressing the CAL data for one layer. | |
static __inline unsigned int | cal_ped1_compress (CDF_cal *cdf, unsigned int *buf, unsigned int pos, const EBF_dir *dir, const ECR_cal *clb) |
Makes a compressed copy of the CAL data when it is single range, non-zero suppressed. | |
static __inline unsigned int | cal_ped4_evaluate (const EBF_dir *dir, int *rngP) |
Evaluates the 4-range CAL data to see if it is in a form that the compression routines understand. | |
static __inline unsigned int | cal_ped4_evaluate_layer (const EBF_calLogData *logs, int cnt, int twr, int lyr, int rng) |
Checks 4-range CAL data for
| |
static __inline unsigned int | cal_ped4_compress (CDF_cal *cdf, unsigned int *buf, unsigned int pos, const EBF_dir *dir, const ECR_cal *clb) |
Makes a compressed copy of the CAL data when it is four-range, non-zero suppressed. | |
static __inline int | cal_ped4_process (short int *cidx, unsigned short int *hist, const EBF_dir *dir, const ECR_cal *clb, int rng) |
Creates the histograms and the array of pedestal subtracted indices used to compress the CAL portion of the event that is specific to single-range readout. | |
static __inline unsigned int | cdf_cal_ped_copy (CDF_cal *cdf, unsigned int *buf, unsigned int pos, const EBF_dir *dir) |
Puts out a copy of the CAL data, prefacing it with a style header and tower map. | |
static unsigned int | cal_ped_hdr_encode (unsigned int *buf, unsigned int pos, unsigned int fmt, unsigned int map) |
Encodes the CAL pedestal header information. This consists of a formatting style (currently 0 = copy, 1 = compress) plus the map of towers that have a CAL contribution. | |
unsigned int | CDF_cal_ped_compress (CDF_cal *cdf, unsigned int *buf, unsigned int pos, const EBF_dir *dir, const ECR_cal *clb, const CDF_err *err) |
Makes a compressed copy of the CAL data if the data is in a form that this routine understands. If not, a straight copy of the data is made. |
CVS $Id: CDF_cal_ped.c,v 1.5 2009/04/30 18:38:19 russell Exp $
The encoding for the CAL pedestal data is
Object Number of Bits Description Format 2 0 = copy, 1 = standard compress
ADC = encoded_value - this_offset + pedestal
1 2 0 3 4 5 0 0 7 6 5
The longest run length is 3. This takes 2 bits to hold so this distribution would be encoded 10b, 01b, 11b, 10b, 11b, 00b.
#define LYR_OFFSETS | ( | _lyr, | |||
_rng | ) |
Value:
(((_lyr) >> 1) * EDA_CAL_K_LOGS_PER_TOWER + \ ((_lyr) & 0x1) * EDA_CAL_K_LOGS_PER_LAYER + \ (_rng) * EDA_CAL_K_LOGS_PER_LAYER * 2)
_lyr | The layer number | |
_rng | The range |
#define RNG_OFFSETS | ( | _rng | ) |
Value:
LYR_OFFSETS(0, _rng), \ LYR_OFFSETS(1, _rng), \ LYR_OFFSETS(2, _rng), \ LYR_OFFSETS(3, _rng), \ LYR_OFFSETS(4, _rng), \ LYR_OFFSETS(5, _rng), \ LYR_OFFSETS(6, _rng), \ LYR_OFFSETS(7, _rng)
_rng | The range to compute the offsets for |
#define RNGS_COMPOSE | ( | _beg | ) |
Value:
( ((((_beg) + 3) & 3) << 14) | ((((_beg) + 3) & 3) << 12) | \ ((((_beg) + 2) & 3) << 10) | ((((_beg) + 2) & 3) << 8) | \ ((((_beg) + 1) & 3) << 6) | ((((_beg) + 1) & 3) << 4) | \ ((((_beg) + 0) & 3) << 2) | ((((_beg) + 0) & 3) << 0) )
static __inline unsigned int cal_ped1_compress | ( | CDF_cal * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_dir * | dir, | |||
const ECR_cal * | clb | |||
) | [static] |
Makes a compressed copy of the CAL data when it is single range, non-zero suppressed.
cdf | The CAL compression data formatting handle | |
buf | The output buffer | |
pos | The position of the next bit to fill | |
dir | The directory describing the event to be formatted | |
clb | The CAL pedestals and gains |
static __inline unsigned int cal_ped1_evaluate | ( | const EBF_dir * | dir, | |
int * | rngP | |||
) | [static] |
Evaluates the CAL data to see if it is in a form that the compression routines understand.
dir | The directory of the event to be evaluated | |
rngP | Returned as the range for the event. |
static __inline unsigned int cal_ped1_evaluate_layer | ( | const EBF_calLogData * | logs, | |
int | cnt, | |||
int | twr, | |||
int | lyr, | |||
int | rng | |||
) | [static] |
Checks that the column numbers are as expected and that all the ranges are 0.
logs | The logs for this layer | |
cnt | The number of logs for this layer (likely 12) | |
twr | The tower number for this layer | |
lyr | The layer number for this layer (for debugging only) | |
rng | The 'standard' range. Anything not matching this is considered an exception. |
static __inline int cal_ped1_process | ( | short int * | cidx, | |
unsigned short int * | hist, | |||
const EBF_dir * | dir, | |||
const ECR_cal * | clb | |||
) | [static] |
Creates the histograms and the array of pedestal subtracted indices used to compress the CAL portion of the event that is specific to single-range readout.
cidx | The pedestal subtracted ADCs | |
hist | The histogram to fill | |
dir | The directory for this event | |
clb | The calibration constants |
static __inline const unsigned int * cal_ped1_process_layer | ( | short int * | cidx, | |
unsigned short int * | hist, | |||
const ECR_calLayer * | clyr, | |||
const unsigned int * | logs, | |||
int | cnt, | |||
int | twr, | |||
int | lyr | |||
) | [static] |
Accumulates the histograms used in compressing the CAL data for one layer.
cidx | The pedestal subtracted ADCs | |
hist | The histogram to fill | |
clyr | The calibration constants for this layer (holds the pedestals) | |
logs | The array of CAL logs for this layer | |
cnt | The number of logs in this layer | |
twr | The tower number of this layer, debugging only | |
lyr | The layer number of this layer, debugging only |
static __inline unsigned int cal_ped4_compress | ( | CDF_cal * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_dir * | dir, | |||
const ECR_cal * | clb | |||
) | [static] |
Makes a compressed copy of the CAL data when it is four-range, non-zero suppressed.
cdf | The CAL compression data formatting handle | |
buf | The output buffer | |
pos | The position of the next bit to fill | |
dir | The directory describing the event to be formatted | |
clb | The CAL pedestals and gains |
static __inline unsigned int cal_ped4_evaluate | ( | const EBF_dir * | dir, | |
int * | rngP | |||
) | [static] |
Evaluates the 4-range CAL data to see if it is in a form that the compression routines understand.
dir | The directory of the event to be evaluated | |
rngP | Returned as the range for the event. |
static __inline unsigned int cal_ped4_evaluate_layer | ( | const EBF_calLogData * | logs, | |
int | cnt, | |||
int | twr, | |||
int | lyr, | |||
int | rng | |||
) | [static] |
Checks 4-range CAL data for
logs | The logs for this layer | |
cnt | The number of logs for this layer (likely 12) | |
twr | The tower number for this layer | |
lyr | The layer number for this layer (for debugging only) | |
rng | The expected range |
static __inline int cal_ped4_process | ( | short int * | cidx, | |
unsigned short int * | hist, | |||
const EBF_dir * | dir, | |||
const ECR_cal * | clb, | |||
int | rng | |||
) | [static] |
Creates the histograms and the array of pedestal subtracted indices used to compress the CAL portion of the event that is specific to single-range readout.
cidx | The pedestal subtracted ADCs | |
hist | The histogram to fill | |
dir | The directory for this event | |
clb | The calibration constants | |
rng | The range to process |
const unsigned short int off_buf[8];
static unsigned int cal_ped_hdr_encode | ( | unsigned int * | buf, | |
unsigned int | pos, | |||
unsigned int | fmt, | |||
unsigned int | map | |||
) | [static] |
Encodes the CAL pedestal header information. This consists of a formatting style (currently 0 = copy, 1 = compress) plus the map of towers that have a CAL contribution.
buf | The output buffer | |
pos | The position of the next bit to fill | |
fmt | The format style | |
map | The map of towers with CAL data |
unsigned int CDF_cal_ped_compress | ( | CDF_cal * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_dir * | dir, | |||
const ECR_cal * | clb, | |||
const CDF_err * | err | |||
) |
Makes a compressed copy of the CAL data if the data is in a form that this routine understands. If not, a straight copy of the data is made.
cdf | The CAL compression data formatting handle | |
buf | The output buffer | |
pos | The position of the next bit to fill | |
dir | The directory describing the event to be formatted | |
clb | The CAL pedestals and gains | |
err | The error context block |
static __inline unsigned int cdf_cal_ped_copy | ( | CDF_cal * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos, | |||
const EBF_dir * | dir | |||
) | [static] |
Puts out a copy of the CAL data, prefacing it with a style header and tower map.
cdf | The CAL compression data formatting handle | |
buf | The output buffer | |
pos | The position of the next bit to fill | |
dir | The directory describing the event to be formatted |