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 00011 __facility__ = "Online" 00012 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes" 00013 __author__ = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T" 00014 __date__ = "2/14/04" 00015 __version__ = "$Revision: 1.3 $" 00016 __release__ = "$Name: R04-12-00 $" 00017 __credits__ = "SLAC" 00018 00019 import LATTE.copyright_SLAC 00020 00021 # This class uses 00022 from LATTE.trigger.TrgUsingTiles import TrgUsingTiles 00023 from LATTE.trigger.NullObjects import NoInputsEnabled 00024 from LATTE.trigger.rcTrgFunctions import rcTrgEngines 00025 from LATTE.trigger.TrgEngines import * 00026 from LATTE.trigger.rcTrgMiniGLT import rcTrgMiniGLT 00027 from LATTE.trigger.TrgMiniGLT import MiniGLTTrgConditionsValue 00028 00029 """\brief Interface for Coincidence based Trigger System""" 00030 00031 class MiniGLTExample(rcTrgMiniGLT): 00032 """\brief MiniTower example interface to MiniGLT 00033 """ 00034 def __init__(self): 00035 """\brief AcdTriggerExample constructor 00036 """ 00037 rcTrgMiniGLT.__init__(self) 00038 self.__engines = MiniGLTTrgEngines() 00039 self.__conditions = MiniGLTSolicitedCondition() 00040 00041 def engines(self): 00042 """\brief Implementation of engines 'pure virtual' method from TrgAbstract 00043 """ 00044 return self.__engines 00045 00046 def conditions(self): 00047 """\brief Implementation of conditions 'pure virtual' method from TrgAbstract 00048 """ 00049 return self.__conditions 00050 00051 # implementaions of user-level trigger classes 00052 class MiniGLTTrgEngines(rcTrgEngines): 00053 def __init__(self): 00054 rcTrgEngines.__init__(self) 00055 # There are two engines in the MiniGLT. 00056 # 0) User defined engine 00057 # 15) Marker engine 00058 00059 eng = MiniGLTSolicitedEngine() 00060 self.replaceEngine(0,eng) 00061 00062 class MiniGLTSolicitedEngine(TrgEngine): 00063 """This class defines an engine which reads out the detector 00064 whenever there is a solicited trigger. 00065 This engine is not prescaled. 00066 """ 00067 def __init__(self): 00068 TrgEngine.__init__(self) 00069 self.__request = ZsupTrgReadout() 00070 def participate(self,conditionsValue): 00071 # This function relies on the programmer's knowledge that the 00072 # conditionsValue is a bitfield. 00073 cond = MiniGLTSolicitedCondition() 00074 condValue = cond.value() 00075 if conditionsValue & condValue: 00076 return True 00077 return False 00078 def prescale(self): 00079 return 0 00080 def request(self): 00081 return self.__request 00082 00083 class MiniGLTSolicitedCondition(MiniGLTTrgConditionsValue): 00084 """ Define a condition where only the CNO trigger is asserted 00085 """ 00086 def __init__(self): 00087 MiniGLTTrgConditionsValue.__init__(self) 00088 def solicited(self): 00089 return True 00090 00091 class ZsupTrgReadout(TrgReadout): 00092 """\brief ZsupTrgReadout class definition 00093 00094 Directs a module to send to its Front-End Electronics a command sequence 00095 which is composed only of the TACK command. This command will trigger 00096 a readout of the module's Front-End Electronics. 00097 Zero suppression is turned on. 00098 """ 00099 def __init__(self): 00100 """\brief TrgReadout constructor 00101 """ 00102 TrgReadout.__init__(self) 00103 00104 def zeroSuppress(self): 00105 return True 00106