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 Trigger Tower Interface classes" 00012 __author__ = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T" 00013 __date__ = "2/14/04" 00014 __version__ = "$Revision: 2.3 $" 00015 __release__ = "$Name: R04-12-00 $" 00016 __credits__ = "SLAC" 00017 00018 import LATTE.copyright_SLAC 00019 00020 00021 from TrgTower import TrgTower 00022 from TrgTower import TrgCalorimeter 00023 from TrgTower import TrgTracker 00024 00025 from TrgInputEnables import TrgInputEnables 00026 from TrgInputEnables import TrgTowerEnables 00027 from TrgInputEnables import TrgTileEnables 00028 from TrgInputEnables import TrgCnoEnables 00029 from TrgInputEnables import TrgTowerBusyEnables 00030 from TrgInputEnables import TrgExtEnables 00031 00032 from TrgCoincidences import TrgRoi 00033 from TrgCoincidences import TrgCoincidence 00034 00035 from TrgEngines import TrgEngine 00036 from TrgEngines import TrgEngineRequest 00037 from TrgEngines import TrgReadout 00038 00039 """NullObjects: Interfaces for when there are no objects in the system""" 00040 00041 ### Tower system 00042 00043 class NullTower(TrgTower): 00044 """NullTower class: 00045 Class defines a tower with no calorimeter active and no tracker active. 00046 """ 00047 def __init__(self): 00048 TrgTower.__init__(self) 00049 self.__cal = NullCal() 00050 self.__tkr = NullTkr() 00051 def calorimeter(self): 00052 return self.__cal 00053 def tracker(self): 00054 return self.__tkr 00055 00056 class NullCal(TrgCalorimeter): 00057 """NullCal class: 00058 Class defines a calorimeter which is inactive. 00059 Used by NullTower 00060 """ 00061 def __init__(self): 00062 TrgCalorimeter.__init__(self) 00063 def useHighEnergy(self): 00064 return False 00065 def useLowEnergy(self): 00066 return False 00067 00068 class NullTkr(TrgTracker): 00069 """NullTkr class: 00070 Class defines a tracker which is inactive. 00071 Used by NullTower 00072 """ 00073 def __init__(self): 00074 TrgTracker.__init__(self) 00075 def use(self): 00076 return False 00077 00078 00079 ### Input Enables 00080 00081 class NoTowersEnabled(TrgTowerEnables): 00082 def __init__(self): 00083 TrgTowerEnables.__init__(self) 00084 self.__null = NullTower() 00085 def tower(self,towerNumber): 00086 return self.__null 00087 00088 class NoTilesEnabled(TrgTileEnables): 00089 """NoTilesEnabled class: 00090 Class defining a system where no tiles are enabled. 00091 """ 00092 def __init__(self): 00093 TrgTileEnables.__init__(self) 00094 def tile(self,tileNumber): 00095 return 0 00096 00097 class NoCnoEnabled(TrgCnoEnables): 00098 """NoCnoEnabled class: 00099 Class defining a system where all CNO inputs are disabled. 00100 """ 00101 def __init__(self): 00102 TrgCnoEnables.__init__(self) 00103 #Do nothing else. Default is all disabled. 00104 00105 class NoTowersBusy(TrgTowerBusyEnables): 00106 """NoTowersBusy class: 00107 Class defining a system where no tower busy bits are enabled. 00108 """ 00109 def __init__(self): 00110 TrgTowerBusyEnables.__init__(self) 00111 def tower(self, towerNumber): 00112 return False 00113 00114 class NoExternal(TrgExtEnables): 00115 """NoExternal class: 00116 Class defining a system where no trigger is enabled. 00117 """ 00118 def __init__(self): 00119 TrgExtEnables.__init__(self) 00120 def external(self): 00121 return False 00122 00123 class NoInputsEnabled(TrgInputEnables): 00124 """NoInputsEnabled class: 00125 Class defining a system where no inputs are enabled. 00126 """ 00127 def __init__(self): 00128 TrgInputEnables.__init__(self) 00129 self.__towers = NoTowersEnabled() 00130 self.__tiles = NoTilesEnabled() 00131 self.__cno = NoCnoEnabled() 00132 self.__twrBusy = NoTowersBusy() 00133 self.__ext = NoExternal() 00134 00135 def towers(self): return self.__towers 00136 def tiles(self): return self.__tiles 00137 def cno(self): return self.__cno 00138 def towerBusy(self): return self.__twrBusy 00139 def external(self): return self.__ext 00140 00141 ### Coincidence system 00142 00143 class NullRoi(TrgRoi): 00144 """NullRoi class: 00145 Class defining a system where the ROI contains no tiles. 00146 """ 00147 def __init__(self): 00148 TrgRoi.__init__(self) 00149 def tile(self, tileNumber): 00150 return False 00151 00152 class NullCoincidence(TrgCoincidence): 00153 """NullCoincidence class: 00154 Class defining a coincidence set that is all null. 00155 """ 00156 def __init__(self): 00157 TrgCoincidence.__init__(self) 00158 00159 def inCoincidence(self,tileNumber): 00160 return -1 # Tile not in coincidence List 00161 00162 # TrgEngines 00163 00164 class NullEngine(TrgEngine): 00165 """NullEngine class: 00166 This class defines an engine doesn't do anything. 00167 Prescale is set to -1 to prevent engine from firing. 00168 """ 00169 def __init__(self): 00170 TrgEngine.__init__(self) 00171 self.__request = NullRequest() 00172 def participate(self,conditionsValue): 00173 return False 00174 def prescale(self): 00175 return -1 00176 def request(self): 00177 return self.__request 00178 00179 class NullRequest(TrgEngineRequest): 00180 """NullRequest class: 00181 This class defines an engineRequest that doesn't do anything 00182 However sequence must be set, so the detector will be read out. 00183 """ 00184 def __init__(self): 00185 """\brief constructor 00186 """ 00187 TrgEngineRequest.__init__(self) 00188 def sequence(self): 00189 return 2 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208