GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-0-4 > lsew / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

CDF_cal_prd_model.h File Reference

Interface to the CAL range predictor functions. In particular this is the prediction model that must be in common between the encode and decode sides. More...

#include "EDS/ECR_cal.h"
#include "EDS/EDS_endianness.h"
#include "EDS/FFS.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)


Detailed Description

Interface to the CAL range predictor functions. In particular this is the prediction model that must be in common between the encode and decode sides.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: CDF_cal_prd_model.h,v 1.4 2010/07/26 18:09:17 russell Exp $

Define Documentation

#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))


Typedef Documentation

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)

Returns:
The prediction constants
Parameters:
pred The calibration constants for the predicted range/end
base The calibration constants for the base range/end

CDF_cal_prd_log_end_bf

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


Function Documentation

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.

Returns:
The predicted value
Parameters:
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.

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.

Parameters:
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)


Generated on Thu Sep 2 12:33:40 2010 by  doxygen 1.5.3