GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> GRBP / dev > grbpsiu / rhel5-32


Interface   Data Structures   File List   Data Fields   Globals  

GRBP_cache.c File Reference

Implementation of the routines that maintain and access the cache of input photons. More...

#include <GRBP_cache.h>
#include <GRBP_photon.h>
#include <GRBP_DB/GRBP_DB_cache.h>
#include <round.h>
#include <math.h>

Defines

#define report_prms(_costwosigdist)

Functions

static __inline void clusterPrmsPrepare (GRBP_clusterPrms *prms, const GRBP_DB_cluster *cfg)
 Fills the prms with the derived constants used to add a photon to the candidate list.
int GRBP_cacheSizeof (const GRBP_DB_cache *cfg)
 Determines the sizeof of a photon cache specified by cfg.
unsigned char * GRBP_cacheConstruct (GRBP_cache *cache, const GRBP_DB_cache *cfg, unsigned char *ptr)
 Constructs the input photon cache.
void GRBP_cacheReset (GRBP_cache *cache)
 Resets the photon cache. This routine is generally called after a GRB has been detected, clearing the cache and thus making it ready for a new round of detection.
void GRBP_cacheAdd (GRBP_cache *cache, unsigned int lid, double time, double energy, double dx, double dy, double dz)
 Adds the photon to the cache and updates all the data structures associated with adding this new photon and, potentially, retiring old photons.


Detailed Description

Implementation of the routines that maintain and access the cache of input photons.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: GRBP_cache.c,v 1.3 2011/03/30 22:11:50 russell Exp $

This is mainly a set of convenience routines, packaging all the calls needed to maintain the input set of photons. There are two different data structures that are involved in with the input photons

  1. The GRBP_photonList. This data structue acts as a history buffer capturing the relevant information for each newly arrived photon. It acts as a database for other routines wishing to access this information without the overhead of each routine capturing this information separately

  1. The GRBP_clusterList. This data structure maintains clustering information for each photon. The neighbors of each photon are kept along with the parameters indicating how close each photon is to its neighbor. The cluster data structure is setup so that the same data structure can be used to described any arbitrary number of neighbors up to some maximum. For example, typically the maximum is around 100. Using the GRBP_clusterList, one can easily describe a cluster of the 20,40,60 or any number of neighbors up to 100. This saves both memory space and CPU cycles.

The criteria to become a neighbor of a parent photon is captured by the GRBP_clusterPrms data structure. It is write-once structure that contains the various cuts. In this way, it acts as the gate-keeper between the raw photons maintained by GRBP_photonList and the clusters, maintained by GRBP_clusterList.


Function Documentation

static __inline void clusterPrmsPrepare ( GRBP_clusterPrms prms,
const GRBP_DB_cluster *  cfg 
) [static]

Fills the prms with the derived constants used to add a photon to the candidate list.

Parameters:
prms The parameter block to prepare
cfg The configuration structure to use as the source information

References _GRBP_clusterPrms::costwosigdist, GRBP_probabilityPrmsSet(), and _GRBP_clusterPrms::probability.

Referenced by GRBP_cacheConstruct().

void GRBP_cacheAdd ( GRBP_cache cache,
unsigned int  lid,
double  time,
double  energy,
double  dx,
double  dy,
double  dz 
)

Adds the photon to the cache and updates all the data structures associated with adding this new photon and, potentially, retiring old photons.

Parameters:
cache The photon cache to add the new photon to
lid The photon's local index. This is the count of photons received
time The time associated with the photon
energy The energy, in Mev, of the photon
dx The x direction cosine
dy The y direction cosine
dz The y direction cosine

References _GRBP_cache::clusterList, GRBP__photonListAdd(), GRBP_clusterListAdd(), _GRBP_cache::photonList, and _GRBP_cache::prms.

Referenced by GRBP_clientProcess().

unsigned char * GRBP_cacheConstruct ( GRBP_cache cache,
const GRBP_DB_cache *  cfg,
unsigned char *  ptr 
)

Constructs the input photon cache.

Returns:
Pointer to the next available memory address
Parameters:
cache The photon cache to construct
cfg The photon cache configuration
ptr The pointer to the memory to carve the dynamically allcated arrays from.

References _GRBP_cache::clusterList, clusterPrmsPrepare(), GRBP_clusterListConstruct(), GRBP_photonListConstruct(), _GRBP_cache::photonList, and _GRBP_cache::prms.

Referenced by GRBP_clientConstruct().

void GRBP_cacheReset ( GRBP_cache cache  ) 

Resets the photon cache. This routine is generally called after a GRB has been detected, clearing the cache and thus making it ready for a new round of detection.

Parameters:
cache The photon cache to reset

References _GRBP_cache::clusterList, GRBP_clusterListReset(), GRBP_photonListReset(), and _GRBP_cache::photonList.

Referenced by latReset().

int GRBP_cacheSizeof ( const GRBP_DB_cache *  cfg  ) 

Determines the sizeof of a photon cache specified by cfg.

Returns:
The size, in bytes, of the photon cache specified by cfg
Parameters:
cfg The photon cache configuration

References GRBP_clusterListSizeof(), and GRBP_photonListSizeof().

Referenced by GRBP_clientSizeof().


Generated on Wed Sep 28 09:49:29 2011 by  doxygen 1.5.8