GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EFC / V4-5-5 > gdgfc / rhel6-32


Interface   Data Structures   File List   Data Fields   Globals  

GFC.c File Reference

Gamma Filter Code. More...

#include <EFC/EDM.h>
#include <EFC/EFC_edsFw.h>
#include <EFC/EFC.h>
#include <EFC/GFC.h>
#include <EFC/GFC_cfg.h>
#include <EFC/GFC_V3_status.h>
#include <EFC/AFC_splashMap.h>
#include <EFC/ATF_shadowedTowers.h>
#include <EFC/TFC_prjFind.h>
#include <EFC/TFC_prjDef.h>
#include <EFC/TFC_tolerances.h>
#include <EFC/TFC_geometry.h>
#include <EFC/TFC_geometryDef.h>
#include <EFC/GFC_def.h>
#include <GFC_resultDef.h>
#include <ATF_filter.h>
#include <ATF_shadowedTowers.ih>
#include <AFC_splash.h>
#include <CFC_ratio.h>
#include <TFC_tolerancesDef.h>
#include <TFC_triggerFill.h>
#include <TFC_triggerForm.h>
#include <TFC_triggerSortedForm.h>
#include <TFC_acd.h>
#include <TFC_skirt.h>
#include <EDS/EDS_fw.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_acd.h>
#include <EDS/EBF_gem.h>
#include <EDS/EBF_tkr.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_err.h>
#include <EDS/EBF_calEnergy.h>
#include <EDS/EBF_gemLocate.h>
#include <EDS/ECR_cal.h>
#include <EDS/EDR_cal.h>
#include <EDS/EDR_tkr.h>
#include <EDS/EDR_calUnpack.h>
#include <EDS/EDR_tkrUnpack.h>
#include <GEO_DB/GEO_DB_schema.h>
#include <GFC_DB/GFC_DB_V3_schema.h>
#include <CDM/CDM_pubdefs.h>
#include <PBI/FFS.ih>
#include <string.h>

Classes

struct  _TkrMap
 Structure to store the augment X and Y tracker layer maps. More...

Defines

#define _MOVE_BIT(_w, _from, _to)   (((_w >> _from) & 1) << _to)
 Moves a bit from one location to another.
#define MASK0_4_OF_6
 A bit mask to be ordered with the dynamic 4/6 coincidence mask. Only patterns with 4/6 layers set are selected by this mask. This is the first of 2 32-bit words, representing patterns 0-0x1f.
#define MASK1_4_OF_6
 A bit mask to be ordered with the dynamic 4/6 coincidence mask. Only patterns with 4/6 layers set are selected by this mask. This is the second of 2 32-bit words, representing patterns 0x20-0x3f.
#define PRJ_CNT   (sizeof (((TFC_prjs *)(4))->prjs) / sizeof (TFC_prj))
#define LIMIT_PRJ_CNT(_cnt)   ((_cnt < PRJ_CNT) ? _cnt : PRJ_CNT)

Typedefs

typedef enum _ACD_SIDE_TILES_M ACD_SIDE_TILES_M
 Typedef for enum _ACD_SIDE_TILES_M.
typedef struct _TkrMap TkrMap
 Typedef for struct _TkrMap.

Enumerations

enum  _ACD_SIDE_TILES_M {
  ACD_SIDE_TILES_M_ROW = (0x1f << 16) | (0x1f),
  ACD_SIDE_TILES_M_ROW0 = ACD_SIDE_TILES_M_ROW<<(0*5),
  ACD_SIDE_TILES_M_ROW1 = ACD_SIDE_TILES_M_ROW<<(1*5),
  ACD_SIDE_TILES_M_ROW2 = ACD_SIDE_TILES_M_ROW<<(2*5),
  ACD_SIDE_TILES_M_ROW01 = ACD_SIDE_TILES_M_ROW0 | ACD_SIDE_TILES_M_ROW1,
  ACD_SIDE_TILES_M_ROW3 = 0x80008000
}
 Enumerates the bit masks used to extract the struck tiles in various rows for both the + and - ACD side tile planes. More...

Functions

static __inline int isVetoed (unsigned int status, unsigned int vetoes)
 Checks whether any of the veto bits are up.
static __inline unsigned int cntBits (unsigned int word)
 Counts the bits in the specified word.
static __inline int evaluateAcd (const GammaCfgAcd *cfg, int status, unsigned int vetoes, int energy, unsigned int acd_x, unsigned int acd_y, unsigned int acd_z, unsigned int acd_cnt)
 Rejects events based on CAL energy and ACD info.
static __inline int evaluateZbottom (const GammaCfgZbottom *cfg, int energy, TkrMap *tkrMap, const EBF_dir *dir)
 Makes a quick test to see if there is energy in the CAL without the possibility of a track pointing into it.
static __inline int evaluateAtf (const GammaCfgAtf *cfg, int status, unsigned int vetoes, int energy, unsigned int acd_x, unsigned int acd_y, unsigned int acd_z, unsigned int tmsk, unsigned int omsk, TkrMap *tkr_map, const EBF_dirCtbDsc *contributor)
 Evaluates whether any tower with a track trigger is in coincidence with a shadowing ACD tile.
static __inline int classifyAcd (unsigned int acd_x, unsigned int acd_y, unsigned int acd_z)
 Sets status bits indicating which part of the ACD has hits. return A status mask indicating those parts of the ACD which have hits.
static __inline unsigned int(* form_map (TkrMap *tkr_map, int tid, const EBF_tkr *tkr, const EBF_err *err))[2]
 Computes or returns the augmented x and y tracker layer maps for the specified tower.
static __inline int nominateTowers (const EBF_dir *dir)
 Creates a list of towers with the potential for finding tracks in.
static __inline int constrainEnergy (int energy)
 Limits the absolute value of the energy to be < 23 bits.
static __inline void tkrComplete (EBF_dir *dir, int pktBytes, EBF_pkt *pkt, EBF_siv siv, GFC_result *result, int status, int energy, EDS_fwIxb *ixb, const GammaCfgTkr *cfg, unsigned int ctids)
 Kludge version to do the tracking for the events that pass the energy condition.
static unsigned int tkrFilter (const GammaCfgTkr *cfg, int status, unsigned int vetoes, int energy, unsigned int acd_x, unsigned int acd_y, unsigned int acd_z, EDR_tkr *tlr, TFC_prjs *prjs)
 Performs the most computationally intensive portions of the filtering. This involves TKR pattern recognition and matching to the ACD, skirt region and CAL.
static __inline unsigned int tkrSetPrjCount (const GammaCfgTkr *cfg, int energy, int prjCnt)
 Completes tracker status, by evaluating the projection count.
static __inline int evaluateTkr (const GammaCfgTkr *cfg, int status, unsigned int vetoes, int energy, unsigned int acd_x, unsigned int acd_y, unsigned int acd_z, EBF_dir *dir, EDR_tkr *tkr, TFC_prjs *prjs)
 Does the projection finding and evaluates all the cuts based on the found projections.
static __inline int gammaFilter (GFC *gfc, unsigned int pktBytes, EBF_pkt *pkt, EBF_siv siv, EDS_fwIxb *ixb, unsigned int vetoes, GFC_result *result)
 Determines the fate of 1 event.
static __inline unsigned int not_only_tkr_fifo_overflow (EBF_dir *dir)
 Checks if there any error contributions that are not due to TKR FIFO overflows.
static int compileCfgPrms (GammaCfgPrms *cfg, const GFC_DB_V3_prms *prms)
 Compiles/commits the set of user defined parameters into the the configuration block.
int GFC_sizeof (int cnt)
 Sizes the gamma filtering control structure.
int GFC_cfgSizeof (void)
 Sizes the gamma filtering configuration as it is used in the actual filtering progam.
int GFC_resultSizeof (const GFC *gfc)
 Returns the size, in bytes, of one result vector.
int GFC_cfgCompile (GFC_cfg *cfg, const GFC_DB_V3_prms *prms)
 Implements the transformation of the configuration parameters as specified by the user, cfg, into the internal form, ctlCfg.
int GFC_cfgSchemaCompile (GFC_cfg *cfg, const GFC_DB_V3_schema *schema)
 Implements the transformation of the configuration parameters as specified by the user, cfg, into the internal form, ctlCfg.
GFC_cfgGFC_cfgSet (GFC *gfc, GFC_cfg *cfg)
 Makes the specified internal representation of the configuration parameters the current active one.
int GFC_filter (GFC *gfc, unsigned int pktBytes, EBF_pkt *pkt, EBF_siv siv, EDS_fwIxb *ixb, unsigned int vetoes, GFC_result *result)
 Determines the fate of 1 event.
unsigned int GFC_fwNeeds (void)
 Returns a bit mask of the EDS_fw needs.
unsigned int GFC_fwObjects (void)
 Returns a bit mask of the EDS_fw objects used by the gamma filter.


Detailed Description

Gamma Filter Code.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: GFC.c,v 1.20 2012/12/20 21:37:52 russell Exp $

Define Documentation

#define _MOVE_BIT ( _w,
_from,
_to   )     (((_w >> _from) & 1) << _to)

Moves a bit from one location to another.

Returns:
A new 32-bit word with the specified bit set to the value of the _from bit in the original word.
Parameters:
_w The word to move the bit from
_from The bit position (LSB = 0) to extract the bit from
_to The bit position (LSB = 0) to move the bit to

Referenced by evaluateZbottom().

#define MASK0_4_OF_6

Value:

((0 << 0x00) | (0 << 0x01) | (0 << 0x02) | (0 << 0x03) | \
  (0 << 0x04) | (0 << 0x05) | (0 << 0x06) | (0 << 0x07) | \
  (0 << 0x08) | (0 << 0x09) | (0 << 0x0a) | (0 << 0x0b) | \
  (0 << 0x0c) | (0 << 0x0d) | (0 << 0x0e) | (1 << 0x0f) | \
  (0 << 0x10) | (0 << 0x11) | (0 << 0x12) | (0 << 0x13) | \
  (0 << 0x14) | (0 << 0x15) | (0 << 0x16) | (1 << 0x17) | \
  (0 << 0x18) | (0 << 0x19) | (0 << 0x1a) | (1 << 0x1b) | \
  (0 << 0x1c) | (1 << 0x1d) | (1 << 0x1e) | (1 << 0x1f))
A bit mask to be ordered with the dynamic 4/6 coincidence mask. Only patterns with 4/6 layers set are selected by this mask. This is the first of 2 32-bit words, representing patterns 0-0x1f.

Referenced by evaluateZbottom().

#define MASK1_4_OF_6

Value:

((0 << 0x00) | (0 << 0x01) | (0 << 0x02) | (0 << 0x03) | \
  (0 << 0x04) | (0 << 0x05) | (0 << 0x06) | (1 << 0x07) | \
  (0 << 0x08) | (0 << 0x09) | (0 << 0x0a) | (1 << 0x0b) | \
  (0 << 0x0c) | (1 << 0x0d) | (1 << 0x0e) | (1 << 0x0f) | \
  (0 << 0x10) | (0 << 0x11) | (0 << 0x12) | (1 << 0x13) | \
  (0 << 0x14) | (1 << 0x15) | (1 << 0x16) | (1 << 0x17) | \
  (0 << 0x18) | (1 << 0x19) | (1 << 0x1a) | (1 << 0x1b) | \
  (1 << 0x1c) | (1 << 0x1d) | (1 << 0x1e) | (1 << 0x1f))
A bit mask to be ordered with the dynamic 4/6 coincidence mask. Only patterns with 4/6 layers set are selected by this mask. This is the second of 2 32-bit words, representing patterns 0x20-0x3f.

The bits representing the last 6 layers are extracted from the X/Y layer hit masks and placed in the low 6 bits or a new word. This word can take on the values 0x00 to 0x3f (0-63).

If the value of this word is less than 32, then MASK0_4_OF_6 is used. That is, of the low 5 bits, 4 must be set.

If the value of this word is greater than or equal to 32, then MASK1_4_OF_6 is used. That is, of the remaining low 5 bits, 3 must be set.

Referenced by evaluateZbottom().


Typedef Documentation

Typedef for struct _TkrMap.

With the hardware configured to allow the GTCC FIFOs to overflow the map of struck X and Y layers taken from the tracker data accept list are no longer complete. These maps must be augmented with the GTRCs that have overflowed.

This structure keeps track of

  • which TEMs have had there maps calculated
  • the X and Y layer maps


Enumeration Type Documentation

Enumerates the bit masks used to extract the struck tiles in various rows for both the + and - ACD side tile planes.

Enumerator:
ACD_SIDE_TILES_M_ROW  Primitive bit mask for 1 5 tile row of ACD side tiles
ACD_SIDE_TILES_M_ROW0  Row 0 ACD side tiles, bit mask
ACD_SIDE_TILES_M_ROW1  Row 1 ACD side tiles, bit mask
ACD_SIDE_TILES_M_ROW2  Row 2 ACD side tiles, bit mask
ACD_SIDE_TILES_M_ROW01  Rows 0 and 1 ACD side tiles, bit mask
ACD_SIDE_TILES_M_ROW3  Row 3 ACD side tiles, bit mask


Function Documentation

static __inline int classifyAcd ( unsigned int  acd_x,
unsigned int  acd_y,
unsigned int  acd_z 
) [static]

Sets status bits indicating which part of the ACD has hits. return A status mask indicating those parts of the ACD which have hits.

Parameters:
acd_x The struck tiles in the ACD X face.
acd_y The struck tiles in the ACD Y face.
acd_z The struck tiles in the ACD Z (top) face.
The ACD is considered to be 3 logical pieces. The top 25 tiles are consider one piece; all the rows of the side faces are another, and only the lower 2 rows of the side faces are the third. A bit is set for each of these three areas which have a hit. Note that these are not mutually exclusive.

References ACD_SIDE_TILES_M_ROW01, GFC_V3_STATUS_M_ACD_SIDE, GFC_V3_STATUS_M_ACD_SIDE_FILTER, and GFC_V3_STATUS_M_ACD_TOP.

Referenced by gammaFilter().

static __inline unsigned int cntBits ( unsigned int  word  )  [static]

Counts the bits in the specified word.

Returns:
The number of bits in the specified word.
Parameters:
word The word to count the bits in

Referenced by gammaFilter().

static int compileCfgPrms ( GammaCfgPrms cfg,
const GFC_DB_V3_prms *  prms 
) [static]

static __inline int constrainEnergy ( int  energy  )  [static]

Limits the absolute value of the energy to be < 23 bits.

Returns:
The constrained energy
Parameters:
energy The energy to constrain
The code is written such that the most common case, the energy between 0 and ~8192Leus (2048Gev), it is almost a noop. After that there is a small amount of code to constrain it to a 24 bit signed integer. The next most common case are the small number of negative energies.

References GFC_V3_STAGE_M_ENERGY.

Referenced by gammaFilter().

static __inline int evaluateAcd ( const GammaCfgAcd cfg,
int  status,
unsigned int  vetoes,
int  energy,
unsigned int  acd_x,
unsigned int  acd_y,
unsigned int  acd_z,
unsigned int  acd_cnt 
) [static]

Rejects events based on CAL energy and ACD info.

Returns:
The status, possibly augmented with the status indicating no energy in the CAL and a struck tile veto.
Parameters:
cfg The configuration constants for this routine
status The current status of this event.
vetoes the list of enabled vetoes
energy The total energy deposited in the CAL.
acd_x The ACD X side face tiles that are struck.
acd_y The ACD Y side face tiles that are struck.
acd_z The ACD Z TOP face tiles that are struck.
acd_cnt The count of struck ACD tiles.
Events that have no significant energy deposited in the CAL must be completely quiet in the ACD.

References AFC_splash(), EDM_INFOPRINTF, GFC_V3_STATUS_M_ACD_SIDE, GFC_V3_STATUS_M_ACD_SIDE_FILTER, GFC_V3_STATUS_M_ACD_TOP, GFC_V3_STATUS_M_E0_TILE, GFC_V3_STATUS_M_E350_FILTER_TILE, GFC_V3_STATUS_M_SPLASH_1, GFC_V3_STATUS_M_VETOED, GFC_V3_STATUS_V_SPLASH_1, isVetoed(), _GammaCfgAcd::splashCount, and _GammaCfgAcd::splashMap.

Referenced by gammaFilter().

static __inline int evaluateAtf ( const GammaCfgAtf cfg,
int  status,
unsigned int  vetoes,
int  energy,
unsigned int  acd_x,
unsigned int  acd_y,
unsigned int  acd_z,
unsigned int  tmsk,
unsigned int  omsk,
TkrMap tkr_map,
const EBF_dirCtbDsc *  contributor 
) [static]

Evaluates whether any tower with a track trigger is in coincidence with a shadowing ACD tile.

Returns:
Status bits
Parameters:
cfg The configuration parameters for this routine
status The current status of this event.
vetoes the list of enabled vetoes
energy The energy, in LEUs, of the event..
acd_x The bit mask of struck tiles in the X+/X- side face.
acd_y The bit mask of struck tiles in the Y+/Y- side face.
acd_z The bit mask of struck tiles in the Z top face.
tmsk Bit mask giving the towers with TKR hits (TWR 0 = MSB)
omsk Bit mask giving the towers with only tracker overflows
tkr_map The map of struck X and Y tracker layers. This structure will be used if the X and Y tracker layer map for a TEM is already filled in, otherwise it will be computed and committed to this structure.
contributor The array of tower contributors.

References ACD_SIDE_TILES_M_ROW01, ATF__filterSides(), ATF__filterTop(), ATF__shadowedTowersByTop(), ATF__shadowedTowersByXM(), ATF__shadowedTowersByXP(), ATF__shadowedTowersByYM(), ATF__shadowedTowersByYP(), _TFC_trigger::bf, _GammaCfgAtf::emax, form_map(), GFC_V3_STATUS_M_SIDE, GFC_V3_STATUS_M_TOP, GFC_V3_STATUS_M_VETOED, isVetoed(), _TFC_trigger_bf::length, _GammaCfgAtf::shadowed, _TFC_trigger::si, _TFC_trigger_bf::start, TFC__triggerForm(), TFC_K_TRIGGER_TYPE_4_OF_4, and _TFC_trigger_bf::type.

Referenced by gammaFilter().

static __inline int evaluateTkr ( const GammaCfgTkr cfg,
int  status,
unsigned int  vetoes,
int  energy,
unsigned int  acd_x,
unsigned int  acd_y,
unsigned int  acd_z,
EBF_dir *  dir,
EDR_tkr *  tkr,
TFC_prjs prjs 
) [static]

Does the projection finding and evaluates all the cuts based on the found projections.

Returns:
Status mask
Parameters:
cfg The tracker cut criteria
status The current status
vetoes A bit mask of the active veto conditions
energy The energy of the event
acd_x The struck tiles in the planes normal to the X axis
acd_y The struck tiles in the planes normal to the Y axis
acd_z The struck tiles in the planes normal to the Z axis better known as the top plane
dir The event directory
tkr The structure to hold the unpacked TKR data
prjs The structure to hold the found projections

References EDM_DEBUGPRINTF, GFC_V3_STATUS_M_TKR_EQ_0, GFC_V3_STATUS_M_VETOED, isVetoed(), nominateTowers(), and tkrFilter().

Referenced by gammaFilter().

static __inline int evaluateZbottom ( const GammaCfgZbottom cfg,
int  energy,
TkrMap tkr_map,
const EBF_dir *  dir 
) [static]

Makes a quick test to see if there is energy in the CAL without the possibility of a track pointing into it.

Return values:
0 If there is no energy in the calorimeter or there is a possibility of a track pointing at the energy
GFC_V3_STATUS_M_ZBOTTOM If there is energy in the calorimeter and there is no possibility of a track pointing at it.
Parameters:
cfg The configuration constants for this routine
energy The energy in the calorimeter
tkr_map The tracker x and y layer maps
dir The directory of event contributors
The check is deliberately crude so that it is extremely cheap. The bit masks of the hit layers for each tower are examined to see if there is even the remotest possibility of extending a track into the calorimeter. Currently 4 or the last 6 planes must have hits in them.

References _MOVE_BIT, EDM_DEBUGPRINTF, form_map(), GFC_V3_STATUS_M_ZBOTTOM, MASK0_4_OF_6, and MASK1_4_OF_6.

Referenced by gammaFilter().

static __inline unsigned int(* form_map ( TkrMap tkr_map,
int  tid,
const EBF_tkr *  tkr,
const EBF_err *  err 
) )[2] [static]

Computes or returns the augmented x and y tracker layer maps for the specified tower.

Parameters:
tkr_map The existing cache of tracker x and y layer maps
tid The target TEM
tkr The tracker data
err The error block, may be NULL

Referenced by evaluateAtf(), and evaluateZbottom().

static __inline int gammaFilter ( GFC gfc,
unsigned int  pktBytes,
EBF_pkt *  pkt,
EBF_siv  siv,
EDS_fwIxb *  ixb,
unsigned int  enabled,
GFC_result result 
) [static]

Determines the fate of 1 event.

Returns:
Status mask, if the
  • < 0, reject
  • = 0, no decision
  • > 0, accept
Parameters:
gfc The gamma filter control structure
pktBytes The number of bytes in pkt, includes the packet header
pkt The event data packet
siv The packet's state information vector
ixb The information exchange block
enabled The list of enabled vetoes and passes
result The filter result vector

References _GFC_result::acd, _GammaCfgPrms::acd, _GammaCtxRestart::acd_cnt, _GammaCtxRestart::acd_x, _GammaCtxRestart::acd_y, _GammaCtxRestart::acd_z, AFC_splash(), _GammaCfgPrms::atf, _GFC_result::atf, _GFC_result::beg, _GFC_result::cal, _GammaCfgPrms::cal, CFC__ratioLayerCheck(), _GFC::cfg, classifyAcd(), cntBits(), constrainEnergy(), _GFC_result::dir, EFC_EDS_FW_OBJ_K_TFC_PRJS, EFC_FATE_K_UNDECIDED, _GammaCfgCal::emin, _GammaCfgCal::epass, evaluateAcd(), evaluateAtf(), evaluateTkr(), evaluateZbottom(), _GFC_result::evtNum, _GFC_result::gem, GFC_V3_STAGE_M_ACD, GFC_V3_STAGE_M_ATF, GFC_V3_STAGE_M_CAL, GFC_V3_STAGE_M_DIR, GFC_V3_STAGE_M_MPKT, GFC_V3_STAGE_M_TKR, GFC_V3_STATUS_M_ACD_SIDE_FILTER, GFC_V3_STATUS_M_ACD_TOP, GFC_V3_STATUS_M_EL0_ETOT_HI, GFC_V3_STATUS_M_EL0_ETOT_LO, GFC_V3_STATUS_M_ERR_CTB, GFC_V3_STATUS_M_GEM_CALHI, GFC_V3_STATUS_M_GEM_CALLO, GFC_V3_STATUS_M_HI_ENERGY, GFC_V3_STATUS_M_LO_ENERGY, GFC_V3_STATUS_M_NOCALLO_FILTER_TILE, GFC_V3_STATUS_M_NON_PHYSICS, GFC_V3_STATUS_M_PASSES, GFC_V3_STATUS_M_SPLASH_0, GFC_V3_STATUS_M_VETOED, GFC_V3_STATUS_M_VETOES, GFC_V3_STATUS_V_SPLASH_0, ievt_store, isVetoed(), _GammaCfgCal::layer0RatioHi, _GammaCfgCal::layer0RatioLo, not_only_tkr_fifo_overflow(), _GFC_cfg::prms, _GFC::restart, _GammaCfgAcd::splashCount, _GammaCfgAcd::splashMap, _GFC_result::stageEnergy, _GFC_result::status, _GFC_result::tkr, _GammaCfgPrms::tkr, tkrComplete(), tmr_store, _TkrMap::valid, and _GammaCfgPrms::zbottom.

Referenced by GFC_filter().

int GFC_cfgCompile ( GFC_cfg cfg,
const GFC_DB_V3_prms *  prms 
)

Implements the transformation of the configuration parameters as specified by the user, cfg, into the internal form, ctlCfg.

Return values:
0 Successful
-1 Unrecognized or non-backwardly compatiable user configuration version number.
Parameters:
cfg Filled in with the internal form of the configuration parameters
prms The user form of the configuration parameters

References compileCfgPrms(), and _GFC_cfg::prms.

Referenced by GFC_cfgSchemaCompile().

int GFC_cfgSchemaCompile ( GFC_cfg cfg,
const GFC_DB_V3_schema *  schema 
)

Implements the transformation of the configuration parameters as specified by the user, cfg, into the internal form, ctlCfg.

Return values:
0 Successful
-1 Unrecognized or non-backwardly compatiable user configuration version number.
Parameters:
cfg Filled in with the internal form of the configuration parameters
schema The user form of the configuration schema

References GFC_cfgCompile(), and _GFC_cfg::prms.

GFC_cfg* GFC_cfgSet ( GFC gfc,
GFC_cfg cfg 
)

Makes the specified internal representation of the configuration parameters the current active one.

Returns:
Pointer to the current control configuration parameters
Parameters:
gfc The gamma filter control structure
cfg The internal representation of the configuration constants

References _GFC::cfg.

int GFC_cfgSizeof ( void   ) 

Sizes the gamma filtering configuration as it is used in the actual filtering progam.

Returns:
Returns the size of the gamma filtering configuration control structure
There are two different breeds of the filtering configuration structure. There are two reasons for this. The more familar is the configuration structure that the user fills in. This structure is meant to be convenient for the user, but not for the program. Some of the information in the user structure is transformed into data that the program will find more accessible.
The second reason is that by having a user configuration and an internal configuration, the two can evolve separately. If more parameters are added to the filter, they will find a home in the internal structure. At some time they may be exposed to the user. The correct course of action is to define a new version of the user configuration block. Since the version number is carried along with the configuration constants, the routine transforming the user configuration to its internal representation can evolve and can be made to handle older versions of the user configuration parameters with some degree of grace, at least giving some hope to backward compatibility.
The correct usage model is
       ctlCfg = malloc (GFC_cfgSizeof ());
       status = GFC_cfgCompile (cfg, usrPrms);
       GFC_cfgSet (gfc, cfg);
Note:
Because the 'set routine just seeds a pointer to the user configuration, in the control structure. the user is free to swap it out with any other pre-prepared configuration.

int GFC_filter ( GFC gfc,
unsigned int  pktBytes,
EBF_pkt *  pkt,
EBF_siv  siv,
EDS_fwIxb *  ixb,
unsigned int  vetoes,
GFC_result result 
)

Determines the fate of 1 event.

Return values:
< 0, rejected
==0,undecided 
> 0, accepted
Parameters:
gfc The gamma filter control structure
pktBytes The number of bytes in pkt, includes the packet header
pkt The event data packet
siv The packet's state information vector
ixb The information exchange block
vetoes The active vetoes
result The filter result vector
Overview
This acts as a wrapper of the actual filter. This is were the sampling logic is implemented by the use prescalers. A prescaler is defined by a pair of integers; one giving the current countdown value and the other giving the refresh value. When the countdown value reaches 0, the prescaler is said to expire.
Types of prescaling
There are two kinds of samplings allow.
  1. Pass-thru sampling
  2. Individual veto sampling

Pass-Thru Sampling
Conceptually this is the easiest to understand. When the pass-thru prescaler expires, instead of using the normal veto mask, a 0 is used, effectively causing the filter to evaluate all its cuts but not allowing an cut to veto the event. While easy to understand, the event sample leaked through by this technique will be dominated by events that would normally have been rejected by the very early cuts.
Individual Veto Sampling
This prescaler type allows to ignore the reject decision of each veto bit. While a bit harder to understand than the Pass-Thru Sampling, this technique allows one to tap a predetermined percentage of events failing at each cut. The hope is that one will be a statisitically meaningful sample of events that would have normally failed some of the later cuts in the filter.

References gammaFilter().

unsigned int GFC_fwNeeds ( void   ) 

Returns a bit mask of the EDS_fw needs.

Returns:
A bit mask of the EDS_fw needs
Use
This value should be passed to EDS_fwRegister when registering the filter.

Referenced by gfc_construct().

unsigned int GFC_fwObjects ( void   ) 

Returns a bit mask of the EDS_fw objects used by the gamma filter.

Returns:
A bit mask of the EDS_fw needs
Use
This value should be passed to EDS_fwRegister when registering the filter.

References EFC_EDS_FW_OBJ_M_TFC_PRJS.

Referenced by gfc_construct().

int GFC_resultSizeof ( const GFC gfc  ) 

Returns the size, in bytes, of one result vector.

Return values:
The size, in bytes, of one result vector
Parameters:
gfc The configuration control structure

int GFC_sizeof ( int  cnt  ) 

Sizes the gamma filtering control structure.

Returns:
Returns the size of the gamma filtering control structure
Parameters:
cnt Number of configurations to accommodate

static __inline int isVetoed ( unsigned int  status,
unsigned int  vetoes 
) [static]

Checks whether any of the veto bits are up.

Returns:
Non-zero if the status bits contain any of the veto bits.
Parameters:
status The current set of status bits
vetoes The set of veto bits

Referenced by evaluateAcd(), evaluateAtf(), evaluateTkr(), gammaFilter(), and tkrFilter().

static __inline int nominateTowers ( const EBF_dir *  dir  )  [static]

Creates a list of towers with the potential for finding tracks in.

Parameters:
dir The event directory
Returns:
The upper 16 bits contain a mask of the towers with at least a 6 fold coincidence, the lower 16 bits contain a mask of the towers with a 4 fold coincidence. They are exclusive, that is if the tower has a 6 fold coincidence, the 4 fold coincidence is not also set.

References EDM_DEBUGPRINTF.

Referenced by evaluateTkr().

static __inline unsigned int not_only_tkr_fifo_overflow ( EBF_dir *  dir  )  [static]

Checks if there any error contributions that are not due to TKR FIFO overflows.

Returns:
If non-zero, then there are errror contributions that are not due to TKR FIFO overflows.
Parameters:
[in,out] dir The event directory.

Referenced by gammaFilter().

static __inline void tkrComplete ( EBF_dir *  dir,
int  pktBytes,
EBF_pkt *  pkt,
EBF_siv  siv,
GFC_result result,
int  status,
int  energy,
EDS_fwIxb *  ixb,
const GammaCfgTkr cfg,
unsigned int  ctids 
) [static]

Kludge version to do the tracking for the events that pass the energy condition.

Returns:
status
Parameters:
dir The event directory
pktBytes The size, in bytes of the current event packet
pkt The event packet
siv The event state information vector
result The gamma filter result structure. The time of directory completion and tracker completion are stored in this structure + the setting of the corresponding completion stage bits.
status The current set of status bits
energy The energy of the event in LEUs
ixb The information exchange block
cfg The track configuration block
ctids The ids of the TEMs to do tracking on

References EDM_INFOPRINTF, EFC_EDS_FW_OBJ_K_TFC_PRJS, _GammaCfgTkr::geometry, GFC_V3_STAGE_M_TKR, _GammaCfgTkr::grbPrjMax, _GFC_result::stageEnergy, _GFC_result::tkr, _TFC_geometry::tkr, tmr_store, and _GammaCfgTkr::tolerancesAll.

Referenced by gammaFilter().

static unsigned int tkrFilter ( const GammaCfgTkr cfg,
int  status,
unsigned int  vetoes,
int  energy,
unsigned int  acd_x,
unsigned int  acd_y,
unsigned int  acd_z,
EDR_tkr *  tlr,
TFC_prjs prjs 
) [static]

Performs the most computationally intensive portions of the filtering. This involves TKR pattern recognition and matching to the ACD, skirt region and CAL.

Returns:
A summary status bit mask
Parameters:
cfg The tracker configuration and cut criteria
status The current status word.
vetoes The bit mask of vetoes. If, at any time in this routine a veto bit is added that matches in this word, the routine is aborted.
energy The total energy in the CAL
acd_x The bit pattern of struck tiles in the side X+/X- planes
acd_y The bit pattern of struck tiles in the side Y+/Y- planes
acd_z The bit pattern of struck tiles in the top Z plane
tlr The unpacked tracker data for the entire LAT
prjs Filled in with the projections for this event

References ACD_SIDE_TILES_M_ROW01, ACD_SIDE_TILES_M_ROW2, _TFC_prjFindStatus::bf, _TFC_prjs::curCnt, _TFC_prjs::dir, EDM_INFOPRINTF, _GammaCfgTkr::geometry, GFC_V3_STATUS_M_TKR_ROW01, GFC_V3_STATUS_M_TKR_ROW2, GFC_V3_STATUS_M_TKR_SKIRT, GFC_V3_STATUS_M_TKR_TOP, GFC_V3_STATUS_M_VETOED, _TFC_prjDir::idx, isVetoed(), _GammaCfgTkr::prjMax, _TFC_prjs::prjs, _GammaCfgTkr::row01Emax, _GammaCfgTkr::row2Emax, _TFC_prjFindStatus::si, _GammaCfgTkr::skirtEmax, TFC_acdProject(), TFC_acdProjectTemplate(), TFC_skirtProject(), _TFC_geometry::tkr, tkrSetPrjCount(), _GammaCfgTkr::tolerancesAll, _GammaCfgTkr::topEmax, _TFC_prjs::twrMsk, _TFC_prjDir::xCnt, and _TFC_prjDir::yCnt.

Referenced by evaluateTkr().

static __inline unsigned int tkrSetPrjCount ( const GammaCfgTkr cfg,
int  energy,
int  prjCnt 
) [static]

Completes tracker status, by evaluating the projection count.

Returns:
The contribution of this routine to the status mask
Parameters:
cfg The tracker configuration and cut criteria
energy The total energy in the CAL
prjCnt The count of projections

References GFC_V3_STATUS_M_TKR_EQ_0, GFC_V3_STATUS_M_TKR_EQ_1, GFC_V3_STATUS_M_TKR_GE_2, GFC_V3_STATUS_M_TKR_LT_2_ELO, and _GammaCfgTkr::zeroTkrEmin.

Referenced by tkrFilter().


Generated on Wed Jan 16 13:54:48 2013 by  doxygen 1.5.8