GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> GRBP / V1-0-4 > grbpsiu / rhel6-64
#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>
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 earliest_time, double timeout_base) |
Seeds the tier2 list of gammas 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, int cnt, double time) |
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. |
CVS $Id: GRBP_window.c,v 1.8 2011/03/30 22:11:51 russell Exp $
unsigned char* GRBP_windowConstruct | ( | GRBP_window * | window, | |
const GRBP_DB_window * | cfg | |||
) |
Constructs the list used in the localization process.
window | The window to construct | |
cfg | The configuration for the window list |
References _GRBP_window::grb, _GRBP_window::name, _GRBP_window::rsvd, _GRBP_window::tier1, _GRBP_window::tier2, _GRBP_window::type, windowGrbConstruct(), windowTier1Construct(), and windowTier2Construct().
Referenced by GRBP_windowListConstruct().
void GRBP_windowReset | ( | GRBP_window * | window | ) |
Resets the window context.
window | The window to be reset |
References _GRBP_window::grb, GRBP_WINDOWSTATE_K_TIER1, _GRBP_window::state, _GRBP_window::tier1, _GRBP_window::tier2, windowGrbReset(), windowTier1Reset(), and windowTier2Reset().
Referenced by windowListReset(), and windowStateCheck().
int GRBP_windowSizeof | ( | const GRBP_DB_window * | cfg | ) |
Computes the number of bytes needed for a window list of cnt elements.
cfg | The window configuration values |
References windowGrbSizeof(), windowTier1Sizeof(), and windowTier2Sizeof().
Referenced by GRBP_windowListSizeof().
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.
window | The window context | |
cache | The input photon cache |
References _GRBP_cache::clusterList, _GRBP_windowTier1::clusterPlogs, _GRBP_clusterList::clusters, _GRBP_clusterUpdateList::cnt, _GRBP_clusterList::cnt, _GRBP_clusterList::cur, _GRBP_location::dx0, _GRBP_location::dy0, _GRBP_location::dz0, _GRBP_windowTier1::gammas, _GRBP_gammaList::gammas_aux, GRBP_clusterGammasGather(), GRBP_gammaListAdd(), GRBP_locateAll(), GRBP_WINDOWSTATE_K_TIER1, _GRBP_windowTier2::list, _GRBP_clusterUpdateList::list, _GRBP_windowTier2::location, _GRBP_clusterList::max, _GRBP_windowTier1Prms::nrange, _GRBP_photonList::pcur, _GRBP_cache::photonList, _GRBP_windowTier1::prms, _GRBP_windowTier1Prms::temporal_contrast, _GRBP_windowTier1Prms::threshold, _GRBP_window::tier1, _GRBP_window::tier2, _GRBP_photon::time, _GRBP_gammaAux::time, _GRBP_clusterList::upd, windowTier2Seed(), and wrap_lo().
Referenced by windowListTier1LatUpdate().
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.
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.) |
References _GRBP_location::dx0, _GRBP_location::dy0, _GRBP_location::dz0, _GRBP_windowTier2::location, _GRBP_window::tier2, and windowTier2Seed().
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.
window | The window context | |
cache | The input photon cache |
References _GRBP_gammaList::cnt, _GRBP_windowTier2Prms::distance, _GRBP_gamma::dx, _GRBP_photon::dx, _GRBP_location::dx0, _GRBP_gamma::dy, _GRBP_photon::dy, _GRBP_location::dy0, _GRBP_gamma::dz, _GRBP_photon::dz, _GRBP_location::dz0, _GRBP_gammaList::end, _GRBP_gammaAux::energy, _GRBP_photon::energy, _GRBP_gammaList::gammas, _GRBP_gammaList::gammas_aux, GRBP_probSpatialCalculate(), GRBP_probTemporalCalculate(), _GRBP_windowTier2::list, _GRBP_windowTier2::location, _GRBP_gamma::nxt, _GRBP_photonList::pcur, _GRBP_cache::photonList, _GRBP_windowTier2::plog, _GRBP_windowTier2::prms, _GRBP_windowTier2Prms::probability, _GRBP_probabilityPrms::psc, _GRBP_probabilityPrms::ptc, _GRBP_probabilityLogs::spatial, _GRBP_window::state, _GRBP_probabilityLogs::temporal, _GRBP_window::tier2, _GRBP_gammaAux::time, _GRBP_photon::time, and windowStateCheck().
Referenced by windowListTier2Update().
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.
grb | The GRB window specific data structure to construct | |
cfg | The configuraion block | |
ptr | The memory to carve the variable length structures from |
References _GRBP_windowGrb::locationSchedule, _GRBP_windowGrb::messageSchedule, and _GRBP_windowGrb::prms.
Referenced by GRBP_windowConstruct().
static __inline void windowGrbReset | ( | GRBP_windowGrb * | grb | ) | [static] |
Resets the GRB window structure.
grb | The GRB window structure to reset |
References GRBP_messageScheduleReset(), _GRBP_windowGrb::locationSchedule, and _GRBP_windowGrb::messageSchedule.
Referenced by GRBP_windowReset().
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.
cfg | The GRB window specific configuration specification |
References GRBP_locationScheduleSizeof().
Referenced by GRBP_windowSizeof().
static __inline GRBP_windowState windowStateCheck | ( | GRBP_window * | window, | |
int | cnt, | |||
double | time | |||
) | [static] |
Checks if one should declare a GRB.
window | The window to check | |
cnt | The number of photons on the tier2 list. This is kind of an unnecessary parameter, it is window->tier2.list.max, but every calling routine has this value available, to this saves a memory reference | |
time | The current time. |
References _GRBP_windowTier2Prms::grb_threshold, GRBP_windowReset(), GRBP_WINDOWSTATE_K_GRB, GRBP_WINDOWSTATE_K_TIER1, GRBP_WINDOWSTATE_K_TIER2, _GRBP_windowTier2::plog, _GRBP_windowTier2::prms, _GRBP_probabilityLogs::spatial, _GRBP_probabilityLogs::temporal, _GRBP_windowTier2Prms::temporal_contrast, and _GRBP_window::tier2.
Referenced by GRBP_windowTier2Update(), and windowTier2Seed().
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.
tier1 | The tier 1 window data structure to construct | |
cfg | The configuraion block | |
ptr | The memory to carve the variable length structures from |
References _GRBP_windowTier1::gammas, _GRBP_windowTier1Prms::nrange, _GRBP_windowTier1::prms, _GRBP_windowTier1Prms::temporal_contrast, _GRBP_windowTier1Prms::threshold, and windowTier1Sizeof().
Referenced by GRBP_windowConstruct().
static void __inline windowTier1Reset | ( | GRBP_windowTier1 * | tier1 | ) | [static] |
Resets the tier 1 window structure.
tier1 | The tier 1 window structure to reset |
Referenced by GRBP_windowReset().
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.
cfg | The GRB window tier 1 configuration specification |
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.)
Referenced by GRBP_windowSizeof(), and windowTier1Construct().
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.
tier2 | The tier 2 window data structure to construct | |
cfg | The configuraion block | |
ptr | The memory to carve the variable length structures from |
References _GRBP_windowTier2Prms::distance, _GRBP_windowTier2Prms::grb_threshold, GRBP_gammaListConstruct(), GRBP_probabilityPrmsSet(), _GRBP_windowTier2::list, _GRBP_windowTier2Prms::nhistory, _GRBP_windowTier2::prms, _GRBP_windowTier2Prms::probability, _GRBP_windowTier2Prms::temporal_contrast, and _GRBP_windowTier2Prms::timeout.
Referenced by GRBP_windowConstruct().
static void __inline windowTier2Reset | ( | GRBP_windowTier2 * | tier2 | ) | [static] |
Resets the tier 2 window structure.
tier2 | The tier 2 window structure to reset |
References GRBP_gammaListReset(), and _GRBP_windowTier2::list.
Referenced by GRBP_windowReset().
static __inline GRBP_windowState windowTier2Seed | ( | GRBP_window * | window, | |
const GRBP_cache * | cache, | |||
double | dx0, | |||
double | dy0, | |||
double | dz0, | |||
double | earliest_time, | |||
double | timeout_base | |||
) | [static] |
Seeds the tier2 list of gammas from the cache of input photons.
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 | |
earliest_time | The time to use as the earliest time | |
timeout_base | The time to use as the start of the tier2 timeout |
References _GRBP_gammaList::cnt, _GRBP_windowTier2Prms::distance, _GRBP_windowTier2::earliest_time, GRBP_gammaListSeed(), _GRBP_windowTier2::list, _GRBP_photonList::max, _GRBP_windowTier2Prms::nhistory, _GRBP_photonList::pbeg, _GRBP_photonList::pcur, _GRBP_photonList::photon_end, _GRBP_cache::photonList, _GRBP_photonList::photons, _GRBP_windowTier2::plog, _GRBP_windowTier2::prms, _GRBP_windowTier2Prms::probability, _GRBP_window::state, _GRBP_window::tier2, _GRBP_windowTier2Prms::timeout, _GRBP_windowTier2::timeout_time, and windowStateCheck().
Referenced by GRBP_windowTier1LatUpdate(), and GRBP_windowTier2GbmSeed().
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.
cfg | The GRB window tier 2 configuration specification |
References GRBP_gammaListSizeof().
Referenced by GRBP_windowSizeof().