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


Interface   Data Structures   File List   Data Fields   Globals  

GRBP_client.c File Reference

The client side (SIU) of the GRB algorithm. More...

#include <GRBP/GRBP_client.h>
#include <GRBP_msgdef.h>
#include <GRBP_cache.h>
#include <GRBP_probability.h>
#include <GRBP_window.h>
#include <GRBP_message.h>
#include <GRBP_grb.h>
#include <GRBP_windowList.h>
#include <GRBP_windowState.h>
#include <GRBP_gbmMsg.h>
#include <GRBP_gbmRepoint.h>
#include <round.h>
#include <tmr.h>
#include <GRBP_DB/GRBP_DB_clientSchema.h>
#include <GRB/GRB_siu.h>
#include <GRB/GRB_gbmMsg.h>
#include <ATT/ATT.h>
#include <MSG/MSG_macdefs.h>
#include <string.h>
#include <stdio.h>

Classes

struct  _GRBP_clientStats
 Statistics gathered. More...
struct  _GRBP_clientSequence
 Summarizes the current message sequence activity. More...
struct  _GRBP_client
 The client for the SIU side of the GRB algorithm. More...

Typedefs

typedef enum _GRBP_clientState GRBP_clientState
 Typedef for enum _GRBP_clientState.
typedef struct _GRBP_clientStats GRBP_clientStats
 Typedef for struct _GRBP_clientStats.
typedef enum _GRBP_clientSequence_k GRBP_clientSequence_k
typedef enum _GRBP_clientSequence_m GRBP_clientSequence_m
 Typedef for enum _GRBP_clientSequence_m.
typedef struct _GRBP_clientSequence GRBP_clientSequence
 Typedef for enum _GRBP_clientSequence.
typedef struct _GRBP_client GRBP_client
 Typedef for struct _GRBP_client.

Enumerations

enum  _GRBP_clientState {
  GRBP_CLIENTSTATE_K_INACTIVE = -1,
  GRBP_CLIENTSTATE_K_GRB_LAT = 0,
  GRBP_CLIENTSTATE_K_GRB_GBM = 1
}
 Captures the processing state. This is applies only to the type of GRBP window being processed, not the type of message sequence that may be in progress
  1. No GRB active, just entering photons looking for one
  2. LAT GRB active, a LAT triggered GRB is active
  3. GBM GRB active, a GBM triggered GRB is active.
More...
enum  _GRBP_clientSequence_k {
  GRBP_CLIENTSEQUENCE_K_LAT = 0,
  GRBP_CLIENTSEQUENCE_K_GBM = 1
}
 Enumerates the types of message sequences
  1. LAT GRB message sequence
  2. GBM GRB message sequence.
More...
enum  _GRBP_clientSequence_m {
  GRBP_CLIENTSEQUENCE_M_LAT = 1 << GRBP_CLIENTSEQUENCE_K_LAT,
  GRBP_CLIENTSEQUENCE_M_GBM = 1 << GRBP_CLIENTSEQUENCE_K_GBM
}
 Enumerates the types of message sequences as bit masks
  1. LAT GRB message sequence
  2. GBM GRB message sequence.
More...

Functions

void GRBP_clientConstruct (GRBP_client *client, const GRBP_DB_clientSchema *cfg)
 Constructs a GRBP client-side (SIU) context using the parameters specified in the configuration, cfg. It is assumed that the user has called GRBP_clientSizeof using the same configuration structure to determine the number of bytes needed to support the specified configuration and that the user has allocated those bytes in the memory pointed to by client.
void GRBP_clientProcess (GRBP_client *client, unsigned long long int id, unsigned long long int time, unsigned int energy, int dx, int dy, int dz)
 Driver function used to detect a GRB.
void GRBP_clientMsgProcess (GRBP_client *client, const GRBP_msg *msg)
 Driver function used to detect a GRB.
static __inline void statsReset (GRBP_clientStats *stats)
 Resets the client statistics block. This routine is generally cleared after a GRB closeout has been issued.
static __inline void latReset (GRBP_client *client)
 Resets the LAT portion of the client context. This routine is generally called after a LAT GRB closeout has been issued, thus preparing it for a new round of detection.
static __inline void reset (GRBP_client *client)
 Resets the client context. This routine is generally called after a GRB closeout has been issued, thus preparing it for a new round of detection.
static void start (GRBP_client *client)
 Called when GRB processing is started.
static void stop (GRBP_client *client)
 Called when GRB processing is stopped.
static __inline unsigned int xform (ATT_Control *att, unsigned long long int time, int dx, int dy, int dz, double q[4], double dsky[3])
 Does the LAT relative to absolute coordinate transformation.
static __inline void grbDeclare (GRBP_client *client, GRBP_window *window, double current_time)
 Checks, if a GRB suspected message should be declared and if, so, delivers one.
static __inline int confirmCheck (GRBP_client *client)
 Checks, if a GRB confirmation message should be declared and if, so, delivers one.
static __inline int updateCheck (GRBP_client *client, int added, double current_time)
 Checks if an update or closeout message needs to be issued. If so, one is issued.
static void gbmRepointHandler (GRBP_client *client, GRB_gbmRptMsg *msg)
 Function to handle an incoming GBM repoint message.
static void gbmInterruptHandler (GRBP_client *client)
 Function to handle an incoming GBM interrupt signal.
static void gbmCalculateHandler (GRBP_client *client, GRB_gbmCalcMsg *msg)
 Function to handle an incoming GBM interrupt signal.
static int gbmCloseoutHandler (GRBP_client *client, GRB_gbmCloseMsg *msg)
 Function to handle an incoming GBM closeout message.
static __inline void sequenceReset (GRBP_clientSequence *sequence)
 Resets the sequence state information.
static __inline int sequenceCloseout (GRBP_clientSequence *sequence, unsigned int which)
 Updates the sequence information for a closeout occuring on the indicate message sequence, which.
int GRBP_clientSizeof (const GRBP_DB_clientSchema *cfg)
 Computes the number of bytes needed to support the specified configuration, cfg.
const GRB_siuServices * GRBP_clientServicesGet (GRBP_client *client, GRBP_DB_clientSchema *schema, const GRB_latMsgServices *msgServices)
 Constructs the client context and returns the services table.


Detailed Description

The client side (SIU) of the GRB algorithm.

Author:
JJRussell - russell@slac.stanford.edu

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

Typedef Documentation

Typedef for enum _GRBP_clientSequence.

Typedef for struct _GRBP_clientSequence.


Enumeration Type Documentation

Enumerates the types of message sequences

  1. LAT GRB message sequence
  2. GBM GRB message sequence.

Enumerator:
GRBP_CLIENTSEQUENCE_K_LAT  LAT message sequence
GRBP_CLIENTSEQUENCE_K_GBM  GBM message sequence

Enumerates the types of message sequences as bit masks

  1. LAT GRB message sequence
  2. GBM GRB message sequence.

Enumerator:
GRBP_CLIENTSEQUENCE_M_LAT  LAT message sequence
GRBP_CLIENTSEQUENCE_M_GBM  GBM message sequence

Captures the processing state. This is applies only to the type of GRBP window being processed, not the type of message sequence that may be in progress

  1. No GRB active, just entering photons looking for one
  2. LAT GRB active, a LAT triggered GRB is active
  3. GBM GRB active, a GBM triggered GRB is active.

Enumerator:
GRBP_CLIENTSTATE_K_INACTIVE  No GRB active
GRBP_CLIENTSTATE_K_GRB_LAT  LAT GRB active
GRBP_CLIENTSTATE_K_GRB_GBM  GBM GRB active


Function Documentation

static __inline int confirmCheck ( GRBP_client client  )  [static]

static void gbmCalculateHandler ( GRBP_client client,
GRB_gbmCalcMsg *  msg 
) [static]

Function to handle an incoming GBM interrupt signal.

Parameters:
client The GRBP client context
msg The GBM calculate message

References _GRBP_client::cache, grbDeclare(), GRBP__gbmMsgToPhiDouble(), GRBP__gbmMsgToThetaDouble(), GRBP__gbmMsgToTimeDouble(), GRBP_CLIENTSTATE_K_INACTIVE, _GRBP_client::state, and _GRBP_client::windowList.

Referenced by GRBP_clientServicesGet().

static int gbmCloseoutHandler ( GRBP_client client,
GRB_gbmCloseMsg *  msg 
) [static]

Function to handle an incoming GBM closeout message.

Return values:
==0,GRBP is not requesting a FINISH message to be issued
!=0,GRBP is requesting a FINISH message to be issued
Parameters:
client The GRBP client context
msg The GBM closeout message

References _GRBP_client::gbmRepoint, GRBP__gbmRepointCancelGet(), GRBP__gbmRepointCancelSet(), GRBP_CLIENTSEQUENCE_M_GBM, GRBP_windowListGbmCloseout(), _GRBP_client::sequence, sequenceCloseout(), and _GRBP_client::windowList.

Referenced by GRBP_clientServicesGet().

static void gbmInterruptHandler ( GRBP_client client  )  [static]

Function to handle an incoming GBM interrupt signal.

Parameters:
client The GRBP client context

References _GRBP_clientSequence::active, GRBP_CLIENTSEQUENCE_M_GBM, and _GRBP_client::sequence.

Referenced by GRBP_clientServicesGet().

static void gbmRepointHandler ( GRBP_client client,
GRB_gbmRptMsg *  msg 
) [static]

static __inline void grbDeclare ( GRBP_client client,
GRBP_window window,
double  current_time 
) [static]

Checks, if a GRB suspected message should be declared and if, so, delivers one.

Parameters:
client The client context
window The GRB window
current_time The current time, as determined by the most recent photon

printf ("Start:Current time: %f:%f\n", start_time, current_time);

References _GRBP_clientSequence::active, _GRBP_gammaList::beg, _GRBP_gammaList::cnt, _GRBP_gammaList::gammas_aux, _GRBP_window::grb, _GRBP_client::grb, GRBP__messageSuspectDeliver(), GRBP_CLIENTSEQUENCE_M_LAT, GRBP_CLIENTSTATE_K_GRB_LAT, GRBP_grbSeed(), GRBP_messageCapture(), GRBP_messageEarliestTimeFormat(), GRBP_messageFormat(), GRBP_messageScheduleInitiate(), _GRBP_grb::list, _GRBP_client::message, _GRBP_windowGrb::messageSchedule, _GRBP_client::sequence, _GRBP_client::state, and _GRBP_gammaAux::time.

Referenced by gbmCalculateHandler(), and GRBP_clientProcess().

void GRBP_clientConstruct ( GRBP_client client,
const GRBP_DB_clientSchema *  cfg 
)

Constructs a GRBP client-side (SIU) context using the parameters specified in the configuration, cfg. It is assumed that the user has called GRBP_clientSizeof using the same configuration structure to determine the number of bytes needed to support the specified configuration and that the user has allocated those bytes in the memory pointed to by client.

Parameters:
client The client-side context handle to fill
cfg The configuration

References _GRBP_client::att, _GRBP_client::cache, _GRBP_client::gbmRepoint, _GRBP_client::grb, GRBP_cacheConstruct(), GRBP_CLIENTSTATE_K_INACTIVE, GRBP_gbmRepointConstruct(), GRBP_grbConstruct(), GRBP_probabilityPrmsEstablish(), GRBP_windowListConstruct(), _GRBP_client::sequence, sequenceReset(), _GRBP_client::state, _GRBP_client::stats, statsReset(), and _GRBP_client::windowList.

Referenced by GRBP_clientServicesGet().

void GRBP_clientMsgProcess ( GRBP_client client,
const GRBP_msg msg 
)

Driver function used to detect a GRB.

Parameters:
client The GRBP client side context
msg The message containing the information about the new photon

References _GRBP_msg::bdy, _GRBP_msgBdy::dx, _GRBP_msgBdy::dy, _GRBP_msgBdy::dz, _GRBP_msgBdy::energy, GRBP__msgKey(), GRBP__msgTime(), and GRBP_clientProcess().

Referenced by GRBP_clientServicesGet().

void GRBP_clientProcess ( GRBP_client client,
unsigned long long int  id,
unsigned long long int  time,
unsigned int  energy,
int  dx,
int  dy,
int  dz 
)

Driver function used to detect a GRB.

Parameters:
client The GRBP client side context
id The event sequence number of the photon to be added
time The time of the photon to be added
energy The energy, in Mev, of the photon to be added
dx The unnormalized x direction cosine
dy The unnormalized y direction cosine
dz The unnormalized z direction cosine
This routine is called each time a new photon is added. The parameters are those used by the GRB algorithm to define a photon, basically its time of arrival, energy and direction. An unique, but arbitrary, integer, is used to identify the photon.

References _GRBP_client::att, _GRBP_client::cache, _GRBP_gammaList::cnt, confirmCheck(), _GRBP_client::gbmRepoint, _GRBP_window::grb, _GRBP_client::grb, grbDeclare(), GRBP__gbmRepointCheck(), GRBP_cacheAdd(), GRBP_CLIENTSTATE_K_GRB_LAT, GRBP_CLIENTSTATE_K_INACTIVE, GRBP_grbAdd(), GRBP_grbSeedLocate(), GRBP_windowListUpdate(), latReset(), _GRBP_grb::list, _GRBP_windowGrb::locationSchedule, _GRBP_client::message, _GRBP_clientStats::nphotons, _GRBP_clientStats::nreceived, _GRBP_clientStats::nxforms, _GRBP_grb::quaternion, _GRBP_message::services, _GRBP_client::state, _GRBP_client::stats, updateCheck(), _GRBP_grb::window, _GRBP_client::windowList, and xform().

Referenced by GRBP_clientMsgProcess().

const GRB_siuServices * GRBP_clientServicesGet ( GRBP_client client,
GRBP_DB_clientSchema *  schema,
const GRB_latMsgServices *  msgServices 
)

Constructs the client context and returns the services table.

Parameters:
client The client-side context to construct
schema The configuration block
msgServices The routines to call to deliver an alert message

References gbmCalculateHandler(), gbmCloseoutHandler(), gbmInterruptHandler(), gbmRepointHandler(), GRBP_clientConstruct(), GRBP_clientMsgProcess(), _GRBP_client::message, _GRBP_message::services, start(), and stop().

int GRBP_clientSizeof ( const GRBP_DB_clientSchema *  cfg  ) 

Computes the number of bytes needed to support the specified configuration, cfg.

Returns:
The number of bytes needed to support the specified configuration
Parameters:
cfg The configuration

References GRBP_cacheSizeof(), GRBP_grbSizeof(), and GRBP_windowListSizeof().

static __inline void latReset ( GRBP_client client  )  [static]

Resets the LAT portion of the client context. This routine is generally called after a LAT GRB closeout has been issued, thus preparing it for a new round of detection.

Parameters:
client The client context to clear

References _GRBP_client::cache, _GRBP_client::grb, GRBP_cacheReset(), GRBP_CLIENTSTATE_K_INACTIVE, GRBP_grbReset(), GRBP_windowListReset(), _GRBP_client::state, _GRBP_client::stats, statsReset(), and _GRBP_client::windowList.

Referenced by GRBP_clientProcess(), and reset().

static __inline void reset ( GRBP_client client  )  [static]

Resets the client context. This routine is generally called after a GRB closeout has been issued, thus preparing it for a new round of detection.

Parameters:
client The client context to clear

References latReset(), _GRBP_client::sequence, and sequenceReset().

Referenced by stop().

static __inline int sequenceCloseout ( GRBP_clientSequence sequence,
unsigned int  which 
) [static]

Updates the sequence information for a closeout occuring on the indicate message sequence, which.

Returns:
A flag indicating whether the receiver of the closeout message should inhibit the sending of a FINISH message
Parameters:
sequence The sequence structure to update
which The sequence, in the form of a right justified bit mask to closeout.

References _GRBP_clientSequence::active, and _GRBP_clientSequence::arr_issued.

Referenced by gbmCloseoutHandler(), stop(), and updateCheck().

static __inline void sequenceReset ( GRBP_clientSequence sequence  )  [static]

Resets the sequence state information.

Parameters:
sequence The sequence structure to reset

References _GRBP_clientSequence::active, and _GRBP_clientSequence::arr_issued.

Referenced by GRBP_clientConstruct(), and reset().

static void start ( GRBP_client client  )  [static]

Called when GRB processing is started.

Parameters:
client The client to start

References _GRBP_client::gbmRepoint, GRBP_gbmRepointReady(), GRBP_windowListReady(), and _GRBP_client::windowList.

Referenced by GRBP_clientServicesGet().

static __inline void statsReset ( GRBP_clientStats stats  )  [static]

Resets the client statistics block. This routine is generally cleared after a GRB closeout has been issued.

Parameters:
stats The statistics block to reset

Referenced by GRBP_clientConstruct(), and latReset().

static void stop ( GRBP_client client  )  [static]

static __inline int updateCheck ( GRBP_client client,
int  added,
double  current_time 
) [static]

Checks if an update or closeout message needs to be issued. If so, one is issued.

Returns:
1, If GRB is still active

0, If GRB is now inactive

Parameters:
client The client context
added The number of photons added this time
current_time The current time, as determined by the most recent photon

printf ("updateCheck time: %f\n", current_time);

References _GRBP_windowTier1::clusterPlogs, _GRBP_window::grb, _GRBP_client::grb, GRBP__messageCloseoutDeliver(), GRBP__messageScheduleActive(), GRBP__messageScheduleUpdate(), GRBP__messageUpdateDeliver(), GRBP_CLIENTSEQUENCE_M_LAT, GRBP_grbMessageLocate(), GRBP_messageFormat(), GRBP_messagePlogsFormat(), GRBP_messageScheduleUpdateCheck(), _GRBP_client::message, _GRBP_windowGrb::messageSchedule, _GRBP_client::sequence, sequenceCloseout(), _GRBP_client::state, _GRBP_window::tier1, and _GRBP_grb::window.

Referenced by GRBP_clientProcess().

static __inline unsigned int xform ( ATT_Control *  att,
unsigned long long int  time,
int  dx,
int  dy,
int  dz,
double  q[4],
double  dsky[3] 
) [static]

Does the LAT relative to absolute coordinate transformation.

Return values:
Message code
Parameters:
att The attitude history control handle, i.e. the source of the transformations
time The WCT time of the event
dx The LAT relative unnormalized X direction cosine
dy The LAT relative unnormalized Y direction cosine
dz The LAT relative unnormalized Y direction cosine
q The quarternion used in the transformation
dsky Returned as the normalized sky coordination direction cosines

Referenced by GRBP_clientProcess().


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