00001 #!/usr/local/bin/python 00002 # 00003 # Copyright 2004 00004 # by 00005 # The Board of Trustees of the 00006 # Leland Stanford Junior University. 00007 # All rights reserved. 00008 # 00009 00010 __facility__ = "Online" 00011 __abstract__ = "Example custom event client class" 00012 __author__ = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online" 00013 __date__ = ("$Date: 2004/09/14 02:14:44 $").split(' ')[1] 00014 __version__ = "$Revision: 1.3 $" 00015 __release__ = "$Name: R04-12-00 $" 00016 __credits__ = "SLAC" 00017 00018 import LATTE.copyright_SLAC 00019 00020 # History: 00021 # $Log: testEvtCli.py,v $ 00022 # Revision 1.3 2004/09/14 02:14:44 stuvi 00023 # evtCli.read() now returns a 6 word header tuple and the event data as a two item tuple. 00024 # 00025 # Revision 1.2 2004/08/06 03:33:57 stuvi 00026 # Added custom event client support. 00027 # 00028 # Revision 1.1 2004/07/28 21:24:00 stuvi 00029 # Added testAppCal and its supporting classes. 00030 # 00031 # Revision 1.1 2004/02/20 00:34:37 stuvi 00032 # Sample custom event client implementation and test app 00033 # 00034 # 00035 00036 from LATTE.client.gEvtCli import * 00037 00038 class testEvtCli(EvtCli): 00039 def __init__(self, debug=0): 00040 EvtCli.__init__(self, debug) 00041 00042 def readEvent(self, dat=None): 00043 self.evt.clearEvent() 00044 (header, self.dat) = self.read() 00045 self._EvtCli__gglt_status = header[0] 00046 self.__version_info = header[3] 00047 self.__evt_status = header[4] >> 16 00048 self.__evt_size = header[4] & 0xFFFF 00049 if self._EvtCli__gglt_status != 0: 00050 self._EvtCli__online_status |= EvtCli.GGLT_STATUS_ERROR 00051 print "GGLT status=", self._EvtCli__gglt_status 00052 return self._EvtCli__online_status 00053 self.evt.cont_offset = EvtCli.FIRST_CONTRIBUTION_OFFSET 00054 # Get the summary word stored in the OSW contribution 00055 # to determine if the event has error. 00056 self.evt.summary = evSummary(self.getDWord(self.evGetSummary())) 00057 self._EvtCli__evt_error = self.evt.summary.error 00058 self.evt.cont_offset += ((header[5] & 0xFFFF) << 2) 00059 #self.evt.cont_cellHeader = evCellHeader(self.getDWord(self.evt.cont_offset) >> 16) 00060 #self.evt.contributor = self.evt.cont_cellHeader.source 00061 self.evt.cont_size = (self.getDWord(self.evt.cont_offset) & 0xFFFF) << 4 00062 self.evt.cont_end = (self.evt.cont_offset << 2) + self.evt.cont_size 00063 return self._EvtCli__online_status