GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > GRBP / V0-4-2

Constituent: grbpsiu     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

GRBP_window.c File Reference

Maintains a list of gammas used in the localization process. More...

#include "GRBP_window.h"
#include "GRBP_locate.h"
#include "GRBP_gammaList.h"
#include "GRBP_messageSchedule.h"
#include "GRBP_locationSchedule.h"
#include "GRBP_cache.h"
#include "GRBP_cluster.h"
#include "GRBP_probCalculate.h"
#include "wrap.h"
#include "GRBP_DB/GRBP_DB_window.h"
#include <math.h>

Include dependency graph for GRBP_window.c:


Defines

#define NULL   ((void *)0)
#define NO_GUESS   NULL
#define report_prms(_min_idx,_max_idx,_cnt,_hi_cnt,_lo_cnt,_pdists,_hi_pdists, _lo_pdists, _pdts,_hi_pdts,_lo_pdts)
#define report_masks(_title, _masks, _nmasks)
#define report_window_range(_min_idx, _max_idx, _nrange)
#define report_window_parameters(_nrange, _contrast, _threshold)

Functions

static __inline int windowTier1Sizeof (const GRBP_DB_windowTier1 *cfg)
 Returns the size, in bytes, of the GRBP_windowTier1 data structure of the specified configuration.
static __inline unsigned char * windowTier1Construct (GRBP_windowTier1 *tier1, const GRBP_DB_windowTier1 *cfg, unsigned char *ptr)
 Constructs the data structures used to control tier1 window stage.
static void __inline windowTier1Reset (GRBP_windowTier1 *tier1)
 Resets the tier 1 window structure.
static __inline int windowTier2Sizeof (const GRBP_DB_windowTier2 *cfg)
 Returns the size, in bytes, of the GRBP_windowTier2 data structure of the specified configuration.
static __inline unsigned char * windowTier2Construct (GRBP_windowTier2 *tier2, const GRBP_DB_windowTier2 *cfg, unsigned char *ptr)
 Constructs the data structures used to control admittance to the GRB window stage.
static __inline GRBP_windowState windowTier2Seed (GRBP_window *window, const GRBP_cache *cache, double dx0, double dy0, double dz0, double time)
 Seeds the tier2 list of gammas from from the cache of input photons.
static void __inline windowTier2Reset (GRBP_windowTier2 *tier2)
 Resets the tier 2 window structure.
static __inline int windowGrbSizeof (const GRBP_DB_windowGrb *cfg)
 Returns the size, in bytes, of the GRBP_windowGrb data structure of the specified configuration.
static __inline unsigned char * windowGrbConstruct (GRBP_windowGrb *grb, const GRBP_DB_windowGrb *cfg, unsigned char *ptr)
 Constructs the data structures used to control admittance to the GRB gamma list after a GRB has been detected.
static void __inline windowGrbReset (GRBP_windowGrb *grb)
 Resets the GRB window structure.
static __inline GRBP_windowState windowStateCheck (GRBP_window *window)
 Checks if one should declare a GRB.
int GRBP_windowSizeof (const GRBP_DB_window *cfg)
 Computes the number of bytes needed for a window list of cnt elements.
unsigned char * GRBP_windowConstruct (GRBP_window *window, const GRBP_DB_window *cfg)
 Constructs the list used in the localization process.
GRBP_windowState GRBP_windowTier1LatUpdate (GRBP_window *window, GRBP_cache *cache)
 Adds any new photons that are in clusters that pass the selection criteria, merges them onto the list maintained by this window and, if necessary, performs a localization on these photons.
GRBP_windowState GRBP_windowTier2GbmSeed (GRBP_window *window, const GRBP_cache *cache, double dx0, double dy0, double dz0, double time)
 Based on the location from the GBM, this seeds the tier 2 list of gammas from the input photon cache.
GRBP_windowState GRBP_windowTier2Update (GRBP_window *window, GRBP_cache *cache)
 Check to see if the newest photon in the cache of input photons should be added to this tier 2 window.
void GRBP_windowReset (GRBP_window *window)
 Resets the window context.
void GRBP_windowCheck (const GRBP_window *window, const GRBP_cache *cache)
 Performs a diagnostic check of the clusters associated with this window. Specifically it checks whether the more sophisticated update method agrees with the much simpler straigthforward method. This code should never be included in production builds.

Detailed Description

Maintains a list of gammas used in the localization process.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: GRBP_window.c,v 1.6 2007/08/10 20:47:54 russell Exp $

Function Documentation

void GRBP_windowCheck const GRBP_window window,
const GRBP_cache cache
 

Performs a diagnostic check of the clusters associated with this window. Specifically it checks whether the more sophisticated update method agrees with the much simpler straigthforward method. This code should never be included in production builds.

Parameters:
window The window to check
cache The cache of input photons

unsigned char* GRBP_windowConstruct GRBP_window window,
const GRBP_DB_window *  cfg
 

Constructs the list used in the localization process.

Returns:
The new memory pointer
Parameters:
window The window to construct
cfg The configuration for the window list

void GRBP_windowReset GRBP_window window  ) 
 

Resets the window context.

Parameters:
window The window to be reset
This routine is generally called after a GRB has been declared over. It clears out any stale context, readying the window context for the next detection round.

int GRBP_windowSizeof const GRBP_DB_window *  cfg  ) 
 

Computes the number of bytes needed for a window list of cnt elements.

Returns:
The number of bytes needed for a window specified by cfg
Parameters:
cfg The window configuration values

GRBP_windowState GRBP_windowTier1LatUpdate GRBP_window window,
GRBP_cache cache
 

Adds any new photons that are in clusters that pass the selection criteria, merges them onto the list maintained by this window and, if necessary, performs a localization on these photons.

Returns:
The window state
Parameters:
window The window context
cache The input photon cache

GRBP_windowState GRBP_windowTier2GbmSeed GRBP_window window,
const GRBP_cache cache,
double  dx0,
double  dy0,
double  dz0,
double  time
 

Based on the location from the GBM, this seeds the tier 2 list of gammas from the input photon cache.

Returns:
The window state
Parameters:
window The window context
cache The master list of photons
dx0 The normalized X direction cosine of the GRB location
dy0 The normalized Y direction cosine of the GRB location
dz0 The normalized Y direction cosine of the GRB location
time The time that this was declared, (Really the time of the GBM calculation message.)

GRBP_windowState GRBP_windowTier2Update GRBP_window window,
GRBP_cache cache
 

Check to see if the newest photon in the cache of input photons should be added to this tier 2 window.

Returns:
The window state
Parameters:
window The window context
cache The input photon cache

static __inline unsigned char * windowGrbConstruct GRBP_windowGrb grb,
const GRBP_DB_windowGrb *  cfg,
unsigned char *  ptr
[static]
 

Constructs the data structures used to control admittance to the GRB gamma list after a GRB has been detected.

Returns:
The new memory pointer
Parameters:
grb The GRB window specific data structure to construct
cfg The configuraion block
ptr The memory to carve the variable length structures from

static __inline void windowGrbReset GRBP_windowGrb grb  )  [static]
 

Resets the GRB window structure.

Parameters:
grb The GRB window structure to reset

static __inline int windowGrbSizeof const GRBP_DB_windowGrb *  cfg  )  [static]
 

Returns the size, in bytes, of the GRBP_windowGrb data structure of the specified configuration.

Returns:
The size, in bytes
Parameters:
cfg The GRB window specific configuration specification

static __inline GRBP_windowState windowStateCheck GRBP_window window  )  [static]
 

Checks if one should declare a GRB.

Returns:
The new window state
Parameters:
window The window to check

static __inline unsigned char * windowTier1Construct GRBP_windowTier1 tier1,
const GRBP_DB_windowTier1 *  cfg,
unsigned char *  ptr
[static]
 

Constructs the data structures used to control tier1 window stage.

Returns:
The new memory pointer
Parameters:
tier1 The tier 1 window data structure to construct
cfg The configuraion block
ptr The memory to carve the variable length structures from

static void __inline windowTier1Reset GRBP_windowTier1 tier1  )  [static]
 

Resets the tier 1 window structure.

Parameters:
tier1 The tier 1 window structure to reset

static __inline int windowTier1Sizeof const GRBP_DB_windowTier1 *  cfg  )  [static]
 

Returns the size, in bytes, of the GRBP_windowTier1 data structure of the specified configuration.

Returns:
The size, in bytes
Parameters:
cfg The GRB window tier 1 configuration specification
There is one variable-sized piece of a tier1 window, the bit list used to gather the photons from the clusters over threshold. Its basic size, in terms of 32-bit words is the window width divided by 32 bits, but one has to be very careful about the edge conditions.

The array of bits is carved from the most recent window width bits of the cluster bit array. There is certainly no guarantee that this collection of bits is aligned on a 32-bit boundary, so the trick is to calculate how many extra words these misaligned bits can absorb.

Take a simple example of a window width of 20. These 20 bits can span 1 or 2 32-bit words. But, as they say on TV, wait there is more. There is no guarantee that the last word of the cluster array contains a full 32-bits. Worst case, the cluster array only uses 1 bit in the last 32-bit word. Therefore, even with a window of 20 bits, there could be 18 bits in the next to the last cluster array word, 1 bit in the last cluster array word and 1 bit in the first cluster array word. Effectively this means that one must always reserve 2 32-bit words for this worst case scenerio. (If one had the cluster width available, a more precise calcuation could save 1 32-bit word in certain circumstances, but it is not worth it.)

static __inline unsigned char * windowTier2Construct GRBP_windowTier2 tier2,
const GRBP_DB_windowTier2 *  cfg,
unsigned char *  ptr
[static]
 

Constructs the data structures used to control admittance to the GRB window stage.

Returns:
The new memory pointer
Parameters:
tier2 The tier 2 window data structure to construct
cfg The configuraion block
ptr The memory to carve the variable length structures from

static void __inline windowTier2Reset GRBP_windowTier2 tier2  )  [static]
 

Resets the tier 2 window structure.

Parameters:
tier2 The tier 2 window structure to reset

static __inline GRBP_windowState windowTier2Seed GRBP_window window,
const GRBP_cache cache,
double  dx0,
double  dy0,
double  dz0,
double  time
[static]
 

Seeds the tier2 list of gammas from from the cache of input photons.

Returns:
The window state
Parameters:
window The window context
cache The master of input photons
dx0 The normalized X direction cosine of the GRB location
dy0 The normalized Y direction cosine of the GRB location
dz0 The normalized Y direction cosine of the GRB location
time The time to use as the earliest time

static __inline int windowTier2Sizeof const GRBP_DB_windowTier2 *  cfg  )  [static]
 

Returns the size, in bytes, of the GRBP_windowTier2 data structure of the specified configuration.

Returns:
The size, in bytes
Parameters:
cfg The GRB window tier 2 configuration specification


Generated on Mon Oct 29 03:04:49 2007 by  doxygen 1.4.4