GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EDS / V2-12-1 > eds / rhel6-32


Interface   Data Structures   File List   Data Fields   Globals  

EBF_calEnergy.c File Reference

Does a simple sum of the total CAL energy in the CAL. More...

#include <EDS/EBF_calEnergy.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_evt.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_ctb.h>
#include <EDS/EBF_cal.h>
#include <EDS/EDA_cal.h>
#include <EDS/ECR_cal.h>
#include <PBI/FFS.ih>

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 getEnergy (unsigned int data, const ECR_calTower *calTower, int logBeg)
 Converts the calorimeter data word in a energy.
static __inline int sumTower4 (int *elayer, unsigned int counts, const unsigned int *data, const ECR_calTower *calTower)
 Sums the energies one a layer-by-layer basis and computes the total energy assuming the tower is in 4 range readout mode.
static __inline int sumTower (int *elayer, unsigned int counts, const unsigned int *data, const ECR_calTower *calTower)
 Sums the energies one a layer-by-layer basis and computes the total energy.
int EBF_calEnergyDirSum (int elayers[EDA_CAL_K_LAYERS_PER_LAT], const EBF_dir *dir, const ECR_cal *constants)
 Sums the energy in each struck CAL log in the LAT.
int EBF_calEnergyEvtSum (int elayers[EDA_CAL_K_LAYERS_PER_LAT], int nbytes, const EBF_evt *evt, const ECR_cal *constants)
 Sums the energy in each struck CAL log in the LAT.


Detailed Description

Does a simple sum of the total CAL energy in the CAL.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: EBF_calEnergy.c,v 1.6 2011/03/25 22:16:56 russell Exp $

These routines do a simple sum of the total CAL energy in the CAL starting either from the bare event (must a single packet event) or from an event directory. The are meant to be as fast as possible in producing a minimal set of information deemed useful to the trigger.

Function Documentation

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.

Returns:
The energy, in LEUs.
Parameters:
val The ADC value to convert
cal The calibration values for one log end
A simple linear conversion is used and a scaling factor is applied to convert an ADC value to an energy in LEUs (at one time 1 LEU = 1/4 MEV).

References _ECR_calLogEnd::bf, _ECR_calLogEnd_bf::gain, _ECR_calLogEnd_bf::pedestal, _ECR_calLogEnd_bf::shift, and _ECR_calLogEnd::ui.

Referenced by getEnergy(), unpackLayer4(), and unpackTower().

int EBF_calEnergyDirSum ( int  elayers[EDA_CAL_K_LAYERS_PER_LAT],
const EBF_dir dir,
const ECR_cal constants 
)

Sums the energy in each struck CAL log in the LAT.

Parameters:
elayers Array filled in with the layer-by-layer energy sum
dir The event directory
constants The array of gains and pedestals for the CAL
Returns:
The amount the total energy in the LAT in LEUs

References _EBF_esw::bf, _EBF_dirCtbDsc::ctb, _EBF_dir::ctbs, _EBF_dirRedux::ctids, EBF__dirCtbCalLocate(), EBF_DIR_TEMS_CAL, _EBF_ctbHdr::esw, _EBF_ctb::hdr, _EBF_esw_bf::range, _EBF_dir::redux, sumTower(), sumTower4(), and _ECR_cal::twrs.

int EBF_calEnergyEvtSum ( int  elayers[EDA_CAL_K_LAYERS_PER_LAT],
int  nbytes,
const EBF_evt evt,
const ECR_cal constants 
)

Sums the energy in each struck CAL log in the LAT.

Parameters:
elayers Array filled in with the layer-by-layer energy sum
nbytes The size, in bytes, of the event
evt Pointer to the event
constants The array of gains and pedestals for the CAL
Returns:
The total energy in the calorimeter

References _EBF_CID_IS_TEM, _EBF_esw::bf, _EBF_ebw::bf, _EBF_evt::ctb, _EBF_ctb::dat, EBF__ctbAdvance(), EBF_CID_K_TEM, EBF_EBW_LEN_TO_BYTES, _EBF_ctbHdr::ebw, _EBF_ctbHdr::esw, _EBF_ctb::hdr, _EBF_esw_bf::range, sumTower(), sumTower4(), _ECR_cal::twrs, and _EBF_ebw::ui.

static __inline int getEnergy ( unsigned int  data,
const ECR_calTower calTower,
int  logBeg 
) [static]

Converts the calorimeter data word in a energy.

Returns:
The energy of both ends.
Parameters:
data The calorimeter data word for one log.
calTower The calorimeter constants for this tower
logBeg The beginning log number for this layer

References _EBF_calLogData::bf, _EBF_calLogData_bf::col, convert(), _ECR_calTower::logs, _ECR_calLog::n, _ECR_calLog::p, _EBF_calLogData_bf::rngN, _EBF_calLogData_bf::rngP, _EBF_calLogData::ui, _EBF_calLogData_bf::valN, and _EBF_calLogData_bf::valP.

Referenced by sumTower(), and sumTower4().

static __inline int sumTower ( int *  elayer,
unsigned int  counts,
const unsigned int *  data,
const ECR_calTower calTower 
) [static]

Sums the energies one a layer-by-layer basis and computes the total energy.

Returns:
The total energy in this tower
Parameters:
elayer The array of eight tower energies to sum into
counts The layer counts. This must be guaranteed to be non-zero
data Pointer to the data for this tower (first PHA value)
calTower The calibration constants for this tower

References EDA_CAL_K_LOGS_PER_LAYER, and getEnergy().

Referenced by EBF_calEnergyDirSum(), and EBF_calEnergyEvtSum().

static __inline int sumTower4 ( int *  elayer,
unsigned int  counts,
const unsigned int *  data,
const ECR_calTower calTower 
) [static]

Sums the energies one a layer-by-layer basis and computes the total energy assuming the tower is in 4 range readout mode.

Returns:
The total energy in this tower
Parameters:
elayer The array of eight tower energies to sum into
counts The layer counts
data Pointer to the data for this tower (first PHA value)
calTower The calibration constants for this tower

References EDA_CAL_K_LOGS_PER_LAYER, getEnergy(), and _EBF_calLogData::ui.

Referenced by EBF_calEnergyDirSum(), and EBF_calEnergyEvtSum().


Generated on Thu Sep 27 13:51:01 2012 by  doxygen 1.5.8