GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EDS / V2-11-5 > eds / mv2304
#include <string.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_cal.h>
#include <EDS/EBF_ctb.h>
#include <EDS/EDR_calUnpack.h>
#include <EDS/EDA_cal.h>
#include <EDS/EDR_cal.h>
#include <EDS/ECR_cal.h>
#include <PBI/FFS.ih>
Defines | |
#define | SATURATION (7 * (1 << 12)/8) |
This defines the saturation point of an ADC as anything over 7/8 of full range. | |
Functions | |
static __inline int | convert (int val, const ECR_calLogEnd *cal) |
Converts ADC value into standard units (Log Energy Units). LEUs are the standard unit internally used by the filter code. | |
static __inline int * | unpackTower (EDR_cal *clr, EDR_calTower *ctr, int tower, int *dst, const EBF_dirCtbDsc *contributor, const ECR_calTower *calTower) |
Unpacks the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes auto (single) range readout. | |
static __inline int | mapTower (EDR_calTower *ctr, int tower, const EBF_dirCtbDsc *contributor) |
Creates the address map for the specified tower. | |
static __inline int | unpackLayer4 (int *dst, EDR_calColumnMap *colMapP, int nlogs, const unsigned int *data, int increment, const ECR_calTower *calTower, int layer) |
Handles the decoding/autoranging of 1 layer. | |
static __inline int | mapTower4 (EDR_calTower *ctr, int tower, const EBF_dirCtbDsc *contributor) |
Maps the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes 4 range readout. | |
static __inline int * | unpackTower4 (EDR_cal *clr, EDR_calTower *ctr, int tower, int *dst, const EBF_dirCtbDsc *contributor, const ECR_calTower *calTower) |
Unpacks the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes 4 range readout. | |
int | EDR_calUnpack (EDR_cal *clr, const EBF_dir *dir, const ECR_cal *constants) |
Unpacks the CAL data for the whole LAT. | |
int | EDR_calMapUnpack (EDR_cal *clr, const EBF_dir *dir) |
Unpacks the CAL data for the whole LAT. | |
int | EDR_calUnpackInit (EDR_cal *cal) |
One-time initialization an EDR_cal structure. | |
void | EDR_calUnpackReset (EDR_cal *cal) |
Resets the EDR_cal structure, preparing it for a new event. | |
int | EDR_calUnpackSizeof (void) |
Returns the size, in bytes, of a CAL LAT record. |
CVS $Id: EDR_calUnpack.c,v 1.6 2011/03/25 22:16:56 russell Exp $
static __inline int convert | ( | int | val, | |
const ECR_calLogEnd * | cal | |||
) | [static] |
Converts ADC value into standard units (Log Energy Units). LEUs are the standard unit internally used by the filter code.
val | The ADC value to convert | |
cal | The calibration values for one log end |
References _ECR_calLogEnd::bf, _ECR_calLogEnd_bf::gain, _ECR_calLogEnd_bf::pedestal, and _ECR_calLogEnd_bf::shift.
Unpacks the CAL data for the whole LAT.
clr | The CAL LAT Record data structure to fill | |
dir | The directory structure for this event; used to locate the CAL data. |
References _EBF_dir::ctbs, _EBF_dirRedux::ctids, EBF_CID_K_TEM, EBF_DIR_TEMS_CAL, EDR_CAL_MAP_IS_VALID, EDR_CAL_VALID_M_MAP, _EBF_dirCtbDsc::logcnt, _EDR_cal::logCnt, mapTower(), mapTower4(), _EBF_dir::redux, _EBF_dirRedux::rng_ids, _EDR_cal::twrMap, _EDR_cal::twrs, and _EDR_cal::valid.
Unpacks the CAL data for the whole LAT.
clr | The CAL LAT Record data structure to fill | |
dir | The directory structure for this event; used to locate the CAL data. | |
constants | The CAL calibration constants (gains/pedestals) for this tower |
References _EBF_dir::ctbs, _EBF_dirRedux::ctids, EBF_CID_K_TEM, EBF_DIR_TEMS_CAL, EDR_CAL_MAP_ENERGY_ARE_VALID, EDR_CAL_VALID_M_ENERGY, EDR_CAL_VALID_M_MAP, _EDR_cal::energy, _EDR_cal::layerEnergies, _EDR_cal::logCnt, _EDR_cal::logEnds, _EBF_dir::redux, _EBF_dirRedux::rng_ids, _EDR_cal::twrMap, _ECR_cal::twrs, _EDR_cal::twrs, unpackTower(), unpackTower4(), and _EDR_cal::valid.
int EDR_calUnpackInit | ( | EDR_cal * | cal | ) |
One-time initialization an EDR_cal structure.
cal | The EDR_cal structure to initialize |
References _EDR_cal::valid.
Referenced by initIxbObjTbl().
void EDR_calUnpackReset | ( | EDR_cal * | cal | ) |
Resets the EDR_cal structure, preparing it for a new event.
cal | The EDR_cal structure to reset |
References _EDR_cal::valid.
Referenced by initIxbObjTbl().
int EDR_calUnpackSizeof | ( | void | ) |
Returns the size, in bytes, of a CAL LAT record.
After allocating an EDR_tkr structure, the structure should be initialized using EDR_calUnpackInit().
int mapTower | ( | EDR_calTower * | ctr, | |
int | tower, | |||
const EBF_dirCtbDsc * | contributor | |||
) | [static] |
Creates the address map for the specified tower.
ctr | The CTR data structure to fill | |
tower | The tower number | |
contributor | The CAL contributor descriptor |
References _EBF_calLogData::bf, _EBF_calLogData_bf::col, _EDR_calTower::colMap, _EBF_dirCtbDsc::ctb, _EBF_ctb::dat, _EDR_calTower::data, EDR_CAL_TOWER_COLMAP, EDR_CAL_TOWER_LAYERMAP_INIT, _EDR_calTower::flags, _EDR_calTower::layerCnts, _EDR_calTower::layerMap, _EBF_dirCtbDsc::logcnt, _EDR_calTower::logCnt, and _EDR_calTower::tower.
Referenced by EDR_calMapUnpack().
int mapTower4 | ( | EDR_calTower * | ctr, | |
int | tower, | |||
const EBF_dirCtbDsc * | contributor | |||
) | [static] |
Maps the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes 4 range readout.
ctr | The CAL tower data structure to fill | |
tower | The tower number | |
contributor | The CAL contributor descriptor |
References _EDR_calTower::colMap, _EDR_calTower::data, EBF__dirCtbCalLocate(), EDR_CAL_TOWER_COLMAP, EDR_CAL_TOWER_LAYERMAP_INIT, _EDR_calTower::flags, _EDR_calTower::layerCnts, _EDR_calTower::layerMap, _EBF_dirCtbDsc::logcnt, _EDR_calTower::logCnt, and _EDR_calTower::tower.
Referenced by EDR_calMapUnpack().
static __inline int unpackLayer4 | ( | int * | dst, | |
EDR_calColumnMap * | colMapP, | |||
int | nlogs, | |||
const unsigned int * | data, | |||
int | increment, | |||
const ECR_calTower * | calTower, | |||
int | layer | |||
) | [static] |
Handles the decoding/autoranging of 1 layer.
dst | The energy destination array. This is where the energy of each log end is stored | |
colMapP | Pointer to the column map for this layer | |
nlogs | The number logs in this layer | |
data | Pointer to the first data word | |
increment | The number of 32-words needed to advance from 1 range to the next | |
calTower | The calibration constants for this tower | |
layer | The target |
References _EBF_calLogData::bf, _EBF_calLogData_bf::col, _ECR_calLayer::columns, convert(), EDR_CAL_TOWER_COLMAP, _ECR_calRange::layers, _ECR_calLog::n, _ECR_calLog::p, _ECR_calTower::ranges, _EBF_calLogData_bf::rngN, _EBF_calLogData_bf::rngP, _EBF_calLogData::ui, _EBF_calLogData_bf::valN, and _EBF_calLogData_bf::valP.
Referenced by unpackTower4().
int * unpackTower | ( | EDR_cal * | clr, | |
EDR_calTower * | ctr, | |||
int | tower, | |||
int * | dst, | |||
const EBF_dirCtbDsc * | contributor, | |||
const ECR_calTower * | calTower | |||
) | [static] |
Unpacks the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes auto (single) range readout.
clr | The CAL LAT data structure to fill | |
ctr | The CAL tower data structure to fill | |
tower | The tower number | |
dst | The destination array for the CAL energies | |
contributor | The CAL contributor descriptor | |
calTower | The CAL calibration constants for this tower |
References _EBF_calLogData::bf, _EBF_calLogData_bf::col, _EDR_calTower::colMap, convert(), _EDR_calTower::data, EBF__dirCtbCalLocate(), EDA_CAL_K_LOGS_PER_LAYER, EDR_CAL_TOWER_COLMAP, EDR_CAL_TOWER_LAYERMAP, _EDR_cal::energy, _EDR_calTower::energy, _EDR_calTower::flags, _EDR_calTower::layerCnts, _EDR_cal::layerEnergies, _EDR_calTower::layerEnergies, _EDR_calTower::layerMap, _EBF_dirCtbDsc::logcnt, _EDR_calTower::logCnt, _EDR_calTower::logEnergies, _ECR_calRange::logs, _ECR_calLog::n, _ECR_calLog::p, _ECR_calTower::ranges, _EBF_calLogData_bf::rngN, _EBF_calLogData_bf::rngP, _EDR_calTower::tower, _EBF_calLogData::ui, _EBF_calLogData_bf::valN, and _EBF_calLogData_bf::valP.
Referenced by EDR_calUnpack().
int * unpackTower4 | ( | EDR_cal * | clr, | |
EDR_calTower * | ctr, | |||
int | tower, | |||
int * | dst, | |||
const EBF_dirCtbDsc * | contributor, | |||
const ECR_calTower * | constants | |||
) | [static] |
Unpacks the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes 4 range readout.
clr | The CAL LAT data structure to fill | |
ctr | The CAL tower data structure to fill | |
tower | The tower number | |
dst | The destination array for the CAL energies | |
contributor | The CAL contributor descriptor | |
constants | The CAL calibration constants for this tower |
References _EDR_calTower::colMap, _EDR_calTower::data, EBF__dirCtbCalLocate(), EDR_CAL_TOWER_LAYERMAP, _EDR_cal::energy, _EDR_calTower::energy, _EDR_calTower::flags, _EDR_calTower::layerCnts, _EDR_cal::layerEnergies, _EDR_calTower::layerEnergies, _EDR_calTower::layerMap, _EBF_dirCtbDsc::logcnt, _EDR_calTower::logCnt, _EDR_calTower::logEnergies, _EDR_calTower::tower, and unpackLayer4().
Referenced by EDR_calUnpack().