GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> GRBP / V1-0-4 > grbpsiu / rhel6-64


Interface   Data Structures   File List   Data Fields   Globals  

GRBP_message.c File Reference

Utilize to handle the GRB alert messages. More...

#include <GRBP_message.h>
#include <GRBP_window.h>
#include <GRBP_grb.h>
#include <GRBP_gammaList.h>
#include <GRBP_math.h>
#include <wrap.h>
#include <PBI/Endianness.h>
#include <PBI/Check.h>

Defines

#define LOG_PROBABILITY_K_SCALE_FACTOR   4
 Sets the scaling factor used to convert the floating point log of the spatial and temporal probabilities to a 16-bit unsigned integer.
#define round(_x)   ceil(_x)
#define MAX_PROB   ((1<<16) - 1)
#define QSCALE   (1<<14)

Functions

 CHECK (CheckWindowType, GRBP_WINDOW_TYPE_K_LAT==GRB_LATALERTMSG_TRIGGERTYPE_LAT &&GRBP_WINDOW_TYPE_K_GBM==GRB_LATALERTMSG_TRIGGERTYPE_GBM)
static __inline void gam_cnts_clear (unsigned short int cnts[4])
 Clears the little 4 word 16-bit histogram.
static __inline void gam_cnts_update (unsigned short int cnts[4], const GRBP_gammaAux *gammas, int beg, int end, int max)
 Updates the little 4 bin histogram with energy of the gammas from index beg to end.
static __inline GRB_latAlertMsgTime to_time (double time)
 Converts time to seconds and microsecnds, i.e. a GRB_latAlerMsgTime.
static __inline unsigned int to_usecs (double fraction_of_seconds)
 Converts fractions of a second to micro seconds.
static __inline unsigned short to_arcmins (double radians)
 Converts radians to a arcmins, unsigned.
static __inline unsigned short to_probability (double log_probability)
 Converts the log of the spatial or temporal probability into format used in the alert message.
static __inline unsigned int format_class (GRB_latAlertMsgTriggerType type, GRB_latAlertMsgLocMethod method, unsigned short int window_size)
 Formats the burst classification word.
static __inline void format_quaternion (unsigned short int dst[4], const double src[4])
 Formats the quaternion for the alert message.
void GRBP_messageCapture (GRBP_message *msg, const GRBP_grb *grb, double current_time)
 Captures the set of parameters that are defined when the GRB suspect message is issued.
void GRBP_messageFormat (GRBP_message *msg, const GRBP_grb *grb)
 Formats the part of the alert message that gets continually updated.
void GRBP_messagePlogsFormat (GRBP_message *msg, const GRBP_probabilityLogs *plogs)
 Formats the specified logs of the spatial and temporal probabilities into the working copy of the message.
void GRBP_messageEarliestTimeFormat (GRBP_message *msg, double earliest_time)
 Sets the time of the earliest photon.


Detailed Description

Utilize to handle the GRB alert messages.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: GRBP_message.c,v 1.7 2011/03/30 22:11:51 russell Exp $

Define Documentation

#define LOG_PROBABILITY_K_SCALE_FACTOR   4

Sets the scaling factor used to convert the floating point log of the spatial and temporal probabilities to a 16-bit unsigned integer.

The original choice of 256 was not a good one. It had too much precision and not enough range. This may be too far into the range category (16K), but do not see a lot of reason for any more the 1/4 unit of precision. All threshold values so far have been specified as whole numbers.

Referenced by to_probability().


Function Documentation

static __inline unsigned int format_class ( GRB_latAlertMsgTriggerType  type,
GRB_latAlertMsgLocMethod  method,
unsigned short int  window_size 
) [static]

Formats the burst classification word.

Returns:
The formatted 32-bit burst classification word
Parameters:
type The GRB trigger type (LAT or GBM)
method The location method
window_size The size of the triggering window

Referenced by GRBP_messageCapture().

static __inline void format_quaternion ( unsigned short int  dst[4],
const double  src[4] 
) [static]

Formats the quaternion for the alert message.

Parameters:
dst The destination quaternion
src The source quaternion

Referenced by GRBP_messageFormat().

static __inline void gam_cnts_clear ( unsigned short int  gam_cnts[4]  )  [static]

Clears the little 4 word 16-bit histogram.

Parameters:
gam_cnts The storage to clear

Referenced by GRBP_messageCapture().

static __inline void gam_cnts_update ( unsigned short int  cnts[4],
const GRBP_gammaAux gammas,
int  beg,
int  end,
int  max 
) [static]

Updates the little 4 bin histogram with energy of the gammas from index beg to end.

Parameters:
cnts The counts of the histogram to update
gammas The array of gammas to histogram
beg The index of the first gamma to use in the update
end The index of the last gamma to use in the update
max The maximum gamma index (the gammas are stored in wrap-around fashion in a circular list

References _GRBP_gammaAux::energy.

Referenced by GRBP_messageFormat().

void GRBP_messageCapture ( GRBP_message msg,
const GRBP_grb grb,
double  current_time 
)

Captures the set of parameters that are defined when the GRB suspect message is issued.

Parameters:
msg The message context
grb The GRB context
current_time The time of the gamma entered which caused the the suspect message to be issued

References _GRBP_message::alert, _GRBP_gammaList::beg, _GRBP_message::beg, _GRBP_windowTier2::earliest_time, format_class(), gam_cnts_clear(), _GRBP_grb::list, _GRBP_grb::location, _GRBP_grbLocations::method, _GRBP_windowTier1Prms::nrange, _GRBP_windowTier2::plog, _GRBP_windowTier1::prms, _GRBP_probabilityLogs::spatial, _GRBP_probabilityLogs::temporal, _GRBP_window::tier1, _GRBP_window::tier2, to_probability(), to_time(), _GRBP_window::type, and _GRBP_grb::window.

Referenced by grbDeclare().

void GRBP_messageEarliestTimeFormat ( GRBP_message msg,
double  earliest_time 
)

Sets the time of the earliest photon.

Parameters:
msg The message context
earliest_time The earliest time
On the SUSPECT message the earliest time is defined as the time of the earliest photon in the cluster. On subsequent messages it is redefined to be the time of earliest photon in the tier 2 list This routine allows one to reset the earliest time.after the initial message

References _GRBP_message::alert, and to_time().

Referenced by grbDeclare().

void GRBP_messageFormat ( GRBP_message msg,
const GRBP_grb grb 
)

void GRBP_messagePlogsFormat ( GRBP_message msg,
const GRBP_probabilityLogs plogs 
)

Formats the specified logs of the spatial and temporal probabilities into the working copy of the message.

Parameters:
msg The message context
plogs The logs of the spatial and temporal probabilities

References _GRBP_message::alert, _GRBP_probabilityLogs::spatial, _GRBP_probabilityLogs::temporal, and to_probability().

Referenced by stop(), and updateCheck().

static __inline unsigned short int to_arcmins ( double  radians  )  [static]

Converts radians to a arcmins, unsigned.

Returns:
The equivalent value in arc minutes
Parameters:
radians The value to convert
Warning:
This function rounds properly only for positive values of radians

Referenced by GRBP_messageFormat().

static __inline unsigned short to_probability ( double  log_probability  )  [static]

Converts the log of the spatial or temporal probability into format used in the alert message.

Returns:
The converted value.
Parameters:
log_probability The value to convert.

References LOG_PROBABILITY_K_SCALE_FACTOR.

Referenced by GRBP_messageCapture(), and GRBP_messagePlogsFormat().

static __inline GRB_latAlertMsgTime to_time ( double  time  )  [static]

Converts time to seconds and microsecnds, i.e. a GRB_latAlerMsgTime.

Returns:
The converted time
Parameters:
time The time to convert

References to_usecs().

Referenced by GRBP_messageCapture(), GRBP_messageEarliestTimeFormat(), and GRBP_messageFormat().

static __inline unsigned int to_usecs ( double  fraction_of_sec  )  [static]

Converts fractions of a second to micro seconds.

Returns:
The number of microseconds
Parameters:
fraction_of_sec The fraction of a second to convert. This value should be less than 1 second

Referenced by to_time().


Generated on Tue Nov 29 17:07:16 2011 by  doxygen 1.5.8