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__ = "GLAST LAT Coincidence based Trigger System Interface classes" 00012 __author__ = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T" 00013 __date__ = "2/14/04" 00014 __version__ = "$Revision: 2.2 $" 00015 __release__ = "$Name: R04-12-00 $" 00016 __credits__ = "SLAC" 00017 00018 import LATTE.copyright_SLAC 00019 00020 # This class uses 00021 from TrgUsingTiles import TrgUsingTiles 00022 from TrgMiniGLT import MiniGLTTrgConditionsValue 00023 from rcTrgMiniGLT import rcTrgMiniGLT 00024 from rcTrgFunctions import rcTrgEngines 00025 from TrgEngines import TrgEngine 00026 from TrgEngines import TrgReadout 00027 from NullObjects import NoInputsEnabled 00028 from TrgConditionsValue import TrgConditionsValue 00029 00030 class rcGEMDefaultTrigger(TrgUsingTiles): 00031 """\brief rcGEMDefaultTrigger 00032 """ 00033 def __init__(self): 00034 """\brief rcGEMDefaultTrigger constructor 00035 """ 00036 TrgUsingTiles.__init__(self) 00037 self.__inputEnables = NoInputsEnabled() 00038 self.__engines = rcGEMTrgEngines() 00039 self.__conditions = rcSolicitedCondition() 00040 00041 # Pure Virtual function implementation 00042 def conditions(self): 00043 return self.__conditions 00044 00045 def coincidences(self): 00046 """\brief Implementation of coincdences 'pure virtual' method from TrgUsingTiles 00047 """ 00048 # it just so happens that the roi is exactly the same as the coincidences object 00049 return self.roi() 00050 00051 def inputEnables(self): 00052 """\brief Implementation of inputEnables 'pure virtual' method from TrgAbstract 00053 """ 00054 return self.__inputEnables 00055 00056 def engines(self): 00057 """\brief Implementation of engines 'pure virtual' method from TrgAbstract 00058 """ 00059 return self.__engines 00060 00061 def useAcdAsTrigger(self): 00062 """Don't use ACD as a trigger source. 00063 """ 00064 return False 00065 00066 def sweepOnShut(self): 00067 return False 00068 00069 def shut(self, sweepEvent=None, progress=None): 00070 pass 00071 00072 class rcMiniGLTDefaultTrigger(rcTrgMiniGLT): 00073 """\brief rcMiniGLTDefaultTrigger 00074 """ 00075 def __init__(self): 00076 rcTrgMiniGLT.__init__(self) 00077 self.__engines = rcMiniGLTTrgEngines() 00078 self.__conditions = rcMiniGLTSolicitedCondition() 00079 00080 def engines(self): 00081 """\brief Implementation of engines 'pure virtual' method from TrgAbstract 00082 """ 00083 return self.__engines 00084 00085 def conditions(self): 00086 """\brief Implementation of conditions 'pure virtual' method from TrgAbstract 00087 """ 00088 return self.__conditions 00089 00090 def sweepOnShut(self): 00091 return False 00092 00093 def shut(self, sweepEvent=None, progress=None): 00094 pass 00095 00096 # implementaions of user-level trigger classes 00097 00098 class rcGEMTrgEngines(rcTrgEngines): 00099 """Class rcGEMTrgEngines: 00100 Initialize the trigger engines list class. 00101 """ 00102 def __init__(self): 00103 rcTrgEngines.__init__(self) 00104 eng1 = rcSolicitedEngine() 00105 self.replaceEngine(0,eng1) 00106 00107 class rcSolicitedEngine(TrgEngine): 00108 """This class defines an engine which reads out the detector 00109 whenever there is a solicited trigger. 00110 This engine is not prescaled. 00111 """ 00112 def __init__(self): 00113 TrgEngine.__init__(self) 00114 self.__request = TrgReadout() 00115 def participate(self,conditionsValue): 00116 # This function relies on the programmer's knowledge that the 00117 # conditionsValue is a bitfield. 00118 cond = rcSolicitedCondition() 00119 if conditionsValue & cond.value(): 00120 return True 00121 return False 00122 def prescale(self): 00123 return 0 00124 def request(self): 00125 return self.__request 00126 00127 class rcSolicitedCondition(TrgConditionsValue): 00128 """ Define a condition where only the solicited trigger is asserted 00129 """ 00130 def __init__(self): 00131 TrgConditionsValue.__init__(self) 00132 def solicited(self): 00133 return True 00134 00135 # implementaions of user-level trigger classes 00136 class rcMiniGLTTrgEngines(rcTrgEngines): 00137 def __init__(self): 00138 rcTrgEngines.__init__(self) 00139 # There are two engines in the MiniGLT. 00140 # 0) User defined engine 00141 # 15) Marker engine 00142 eng = rcMiniGLTSolicitedEngine() 00143 self.replaceEngine(0,eng) 00144 00145 class rcMiniGLTSolicitedEngine(TrgEngine): 00146 """This class defines an engine which reads out the detector 00147 whenever there is a solicited trigger. 00148 This engine is not prescaled. 00149 """ 00150 def __init__(self): 00151 TrgEngine.__init__(self) 00152 self.__request = TrgReadout() 00153 def participate(self,conditionsValue): 00154 # This function relies on the programmer's knowledge that the 00155 # conditionsValue is a bitfield. 00156 cond = rcMiniGLTSolicitedCondition() 00157 condValue = cond.value() 00158 if conditionsValue & condValue: 00159 return True 00160 return False 00161 def prescale(self): 00162 return 0 00163 def request(self): 00164 return self.__request 00165 00166 class rcMiniGLTSolicitedCondition(MiniGLTTrgConditionsValue): 00167 """ Define a condition where only the CNO trigger is asserted 00168 """ 00169 def __init__(self): 00170 TrgConditionsValue.__init__(self) 00171 def solicited(self): 00172 return True 00173 00174