GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-1-0 > lsew / linux-gcc
#include <EDS/ECR_cal.h>
#include <PBI/FFS.ih>
#include <PBI/Endianness.h>
Classes | |
struct | _CDF_cal_prd_log_end_bf |
The prediction constants, bit field representation. More... | |
union | _CDF_cal_prd_log_end |
The prediction constants, union of 32-bit representation and the bit field representation. More... | |
Defines | |
#define | CDF_CAL_PRD_ENCODE_TABLE_ENTRY(_range, _base, _target) |
#define | CDF_CAL_PRD_ENCODE_TABLE_RANGE(_rng,_base0, _d0, _target0,_base1, _d1, _target1,_base2, _d2, _target2) |
#define | CDF_CAL_PRD_ENCODE_TABLE |
#define | CDF_CAL_PRD_ENCODE_TABLE_EXTRACT_INDEX(_tbs) ((_tbs >> 0) & 0x7) |
#define | CDF_CAL_PRD_ENCODE_TABLE_EXTRACT_BASE(_tbs) ((_tbs >> 3) & 0x3) |
#define | CDF_CAL_PRD_ENCODE_TABLE_ADVANCE(_tbs) (_tbs >> 5) |
Typedefs | |
typedef struct _CDF_cal_prd | CDF_cal_prd |
typedef struct _ECR_cal | ECR_cal |
typedef struct _CDF_cal_prd_log_end_bf | CDF_cal_prd_log_end_bf |
Typedef for struct _CDF_cal_prd_log_end_bf. | |
typedef union _CDF_cal_prd_log_end | CDF_cal_prd_log_end |
Typedef for union _CDF_cal_prd_log_end_range. | |
Enumerations | |
enum | CDF_CAL_PRD_TARGETS { CDF_CAL_PRD_TARGET_01 = 0, CDF_CAL_PRD_TARGET_02 = 1, CDF_CAL_PRD_TARGET_23 = 2, CDF_CAL_PRD_TARGET_12 = 3, CDF_CAL_PRD_TARGET_10 = 4, CDF_CAL_PRD_TARGET_21 = 5, CDF_CAL_PRD_TARGET_32 = 6 } |
enum | CDF_CAL_PRD_RNG { CDF_CAL_PRD_RNG_0 = 0, CDF_CAL_PRD_RNG_1 = 1, CDF_CAL_PRD_RNG_2 = 2, CDF_CAL_PRD_RNG_3 = 3 } |
Functions | |
static void | cdf_cal_prd_report (unsigned int base_pedestal, unsigned int pred_pedestal, int pedestal, unsigned int base_gain, unsigned int pred_gain, unsigned int gain, unsigned int base_shift, unsigned int pred_shift, int shift) |
Debugging function when generating the constants. | |
static __inline int | CDF__cal_prd_predict (unsigned short int base, unsigned char shift, unsigned short int gain, signed short int pedestal) |
Predicts the value of a different range from the value of a specified range (range) using linear parameters found in ple. | |
static __inline CDF_cal_prd_log_end | CDF__cal_prd_compose (ECR_calLogEnd pred, ECR_calLogEnd base) |
CVS $Id: CDF_cal_prd_model.h,v 1.5 2011/03/26 17:35:23 russell Exp $
#define CDF_CAL_PRD_ENCODE_TABLE |
Value:
CDF_CAL_PRD_ENCODE_TABLE_RANGE (RNG_0, 0, -->, 1, 0, -->, 2, 2, -->, 3), \ CDF_CAL_PRD_ENCODE_TABLE_RANGE (RNG_1, 1, -->, 2, 2, -->, 3, 1, -->, 0), \ CDF_CAL_PRD_ENCODE_TABLE_RANGE (RNG_2, 2, -->, 3, 1, -->, 0, 2, -->, 1), \ CDF_CAL_PRD_ENCODE_TABLE_RANGE (RNG_3, 1, -->, 0, 2, -->, 1, 3, -->, 2)
#define CDF_CAL_PRD_ENCODE_TABLE_ENTRY | ( | _range, | |||
_base, | |||||
_target | ) |
Value:
( ((((_base) - (CDF_CAL_PRD_ ## _range)) & 0x3) << 3) | \ CDF_CAL_PRD_TARGET_ ## _base ## _target)
#define CDF_CAL_PRD_ENCODE_TABLE_RANGE | ( | _rng, | |||
_base0, | |||||
_d0, | |||||
_target0, | |||||
_base1, | |||||
_d1, | |||||
_target1, | |||||
_base2, | |||||
_d2, | |||||
_target2 | ) |
Value:
((CDF_CAL_PRD_ENCODE_TABLE_ENTRY(_rng, _base0, _target0)<<0) | \ (CDF_CAL_PRD_ENCODE_TABLE_ENTRY(_rng, _base1, _target1)<<5) | \ (CDF_CAL_PRD_ENCODE_TABLE_ENTRY(_rng, _base2, _target2)<<10))
static __inline CDF_cal_prd_log_end |
Typedef for union _CDF_cal_prd_log_end_range.
Composes the prediction constants for one log end.
CDF__cal_prd_compose (ECR_calLogEnd pred, ECR_calLogEnd base)
pred | The calibration constants for the predicted range/end | |
base | The calibration constants for the base range/end |
Typedef for struct _CDF_cal_prd_log_end_bf.
These constants are used when in 4-range readout mode to predict one range from another. The math is
residual = (v - pp) - (vb - pb) * gb / gp = v - [ vb * gb/gp - (pb * gb/gp - pp)] = v - vp where vp = predicted value = vb * g + p and g = gb/gp, the relative gain p = pb * g - pp, the effective pedestal
One must be careful with the scaling factors in order not to overflow the arithmetic and the available number of bits used to store the relative gain and effective pedestal.
The effective pedestal is the hardest. pb and pp can be up to a 12-bit number. So even if the relative gain is <=1, i.e. gb <= gp, p will can be a 13-bit signed number. If gb > gp, then this result can be larger than 13-bits. In this case one can rewrite the equation
vp = (vb - (pb - pp / g)) * g
static __inline int CDF__cal_prd_predict | ( | unsigned short int | base, | |
unsigned char | shift, | |||
unsigned short int | gain, | |||
signed short int | pedestal | |||
) | [static] |
Predicts the value of a different range from the value of a specified range (range) using linear parameters found in ple.
base | The base range value | |
shift | The exponent of relative gains between the base range and the range to be predicted. | |
gain | The normalized manitissa of the relative gain between the base range and the range to be predicted | |
pedestal | The pedestal or offset between the two ranges, in units of the predicted range. Note that this is a signed quantity. |
Referenced by pha_compute_dif3().
static void cdf_cal_prd_report | ( | unsigned int | base_pedestal, | |
unsigned int | pred_pedestal, | |||
int | pedestal, | |||
unsigned int | base_gain, | |||
unsigned int | pred_gain, | |||
unsigned int | gain, | |||
unsigned int | base_shift, | |||
unsigned int | pred_shift, | |||
int | shift | |||
) | [static] |
Debugging function when generating the constants.
base_pedestal | The pedestal of the value used in doing the prediction | |
pred_pedestal | The pedestal of the value being predicted | |
pedestal | The pedestal | |
base_gain | The gain of the value used in doing the prediction | |
pred_gain | The gain of the value being predicted | |
gain | The gain factor | |
base_shift | The scaling shift of the value used in doing the prediction | |
pred_shift | The scaling shift of the value being predicted | |
shift | The overall scale factor (biased by 8) |