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 Object class" 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: P04-06-05 $" 00016 __credits__ = "SLAC" 00017 00018 import LATTE.copyright_SLAC 00019 00020 import LDF 00021 00022 """TrgGemRegisterGeometry: Define the mapping between tile number and tile name""" 00023 00024 00025 class ACDmap(LDF.ACDmap): 00026 """An implementation of LDF.ACDmap that forces a particular LATtypeId() 00027 """ 00028 def __init__(self, gemVersion = None): 00029 LDF.ACDmap.__init__(self) 00030 self.__setLatId(gemVersion) 00031 00032 def __setLatId(self, gemVersion): 00033 if gemVersion is None: # Take the most recent one 00034 self.__latId = LDF.LATtypeId(LDF.EBFevent.ID) 00035 else: # have a gemVersion, parse it. 00036 (type, board) = self.__parseGemVersion(gemVersion) 00037 if board == 0: # Original, screwy board. 00038 self.__latId = LDF.LATtypeId(LDF.EBFevent.ID_3) 00039 else: 00040 self.__latId = LDF.LATtypeId(LDF.EBFevent.ID) 00041 return 00042 00043 def __parseGemVersion(self, gemVersion): 00044 board = ( gemVersion >> (16 + 12) ) & 0x3 00045 type = ( gemVersion >> (16 + 14) ) & 0x3 00046 return (type, board) 00047 00048 def lookup(self, cable, channel): 00049 return LDF.ACDmap.lookup(self, self.__latId, cable, channel) 00050 00051 def freeName(self, cable): 00052 return LDF.ACDmap.freeName(self, self.__latId, cable) 00053 00054 00055 00056 00057 00058 AcdTileNumbering = {# "TileName" : TileNumber(hex) 00059 "000" : 0x00, "001" : 0x01, "002" : 0x02, "003" : 0x03, 00060 "004" : 0x04, "010" : 0x05, "011" : 0x06, "012" : 0x07, 00061 "013" : 0x08, "014" : 0x09, "020" : 0x0A, "021" : 0x0B, 00062 "022" : 0x0C, "023" : 0x0D, "024" : 0x0E, "030" : 0x0F, 00063 "031" : 0x10, "032" : 0x11, "033" : 0x12, "034" : 0x13, 00064 "040" : 0x14, "041" : 0x15, "042" : 0x16, "043" : 0x17, 00065 "044" : 0x18, "NA2" : 0x19, "NA3" : 0x1A, "100" : 0x1B, 00066 "101" : 0x1C, "102" : 0x1D, "103" : 0x1E, "104" : 0x1F, 00067 "110" : 0x20, "111" : 0x21, "112" : 0x22, "113" : 0x23, 00068 "114" : 0x24, "120" : 0x25, "121" : 0x26, "122" : 0x27, 00069 "123" : 0x28, "124" : 0x29, "130" : 0x2A, "NA4" : 0x2B, 00070 "NA5" : 0x2C, "200" : 0x2D, "201" : 0x2E, "202" : 0x2F, 00071 "203" : 0x30, "204" : 0x31, "210" : 0x32, "211" : 0x33, 00072 "212" : 0x34, "213" : 0x35, "214" : 0x36, "220" : 0x37, 00073 "221" : 0x38, "222" : 0x39, "223" : 0x3A, "224" : 0x3B, 00074 "230" : 0x3C, "NA6" : 0x3D, "NA7" : 0x3E, "300" : 0x3F, 00075 "301" : 0x40, "302" : 0x41, "303" : 0x42, "304" : 0x43, 00076 "310" : 0x44, "311" : 0x45, "312" : 0x46, "313" : 0x47, 00077 "314" : 0x48, "320" : 0x49, "321" : 0x4A, "322" : 0x4B, 00078 "323" : 0x4C, "324" : 0x4D, "330" : 0x4E, "NA8" : 0x4F, 00079 "NA9" : 0x50, "400" : 0x51, "401" : 0x52, "402" : 0x53, 00080 "403" : 0x54, "404" : 0x55, "410" : 0x56, "411" : 0x57, 00081 "412" : 0x58, "413" : 0x59, "414" : 0x5A, "420" : 0x5B, 00082 "421" : 0x5C, "422" : 0x5D, "423" : 0x5E, "424" : 0x5F, 00083 "430" : 0x60, "NA0" : 0x61, "NA1" : 0x62, "500" : 0x63, 00084 "501" : 0x64, "502" : 0x65, "503" : 0x66, "600" : 0x67, 00085 "601" : 0x68, "602" : 0x69, "603" : 0x6A, "NA10" : 0x6B 00086 } 00087 00088 RoiRegisterMap = { # address : [ "tileName0", "tileName1" ] 00089 0 : [ "000", "001" ], 1 : [ "002", "003" ], 00090 2 : [ "004", "010" ], 3 : [ "011", "012" ], 00091 4 : [ "013", "014" ], 5 : [ "020", "021" ], 00092 6 : [ "022", "023" ], 7 : [ "024", "030" ], 00093 8 : [ "031", "032" ], 9 : [ "033", "034" ], 00094 10 : [ "040", "041" ], 11 : [ "042", "043" ], 00095 12 : [ "044", "NA2" ], 13 : [ "NA3", "100" ], 00096 14 : [ "101", "102" ], 15 : [ "103", "104" ], 00097 16 : [ "110", "111" ], 17 : [ "112", "113" ], 00098 18 : [ "114", "120" ], 19 : [ "121", "122" ], 00099 20 : [ "123", "124" ], 21 : [ "130", "NA4" ], 00100 22 : [ "NA5", "200" ], 23 : [ "201", "202" ], 00101 24 : [ "203", "204" ], 25 : [ "210", "211" ], 00102 26 : [ "212", "213" ], 27 : [ "214", "220" ], 00103 28 : [ "221", "222" ], 29 : [ "223", "224" ], 00104 30 : [ "230", "NA6" ], 31 : [ "NA7", "300" ], 00105 32 : [ "301", "302" ], 33 : [ "303", "304" ], 00106 34 : [ "310", "311" ], 35 : [ "312", "313" ], 00107 36 : [ "314", "320" ], 37 : [ "321", "322" ], 00108 38 : [ "323", "324" ], 39 : [ "330", "NA8" ], 00109 40 : [ "NA9", "400" ], 41 : [ "401", "402" ], 00110 42 : [ "403", "404" ], 43 : [ "410", "411" ], 00111 44 : [ "412", "413" ], 45 : [ "414", "420" ], 00112 46 : [ "421", "422" ], 47 : [ "423", "424" ], 00113 48 : [ "430", "NA0" ], 49 : [ "NA1", "500" ], 00114 50 : [ "501", "502" ], 51 : [ "503", "600" ], 00115 52 : [ "601", "602" ], 53 : [ "603", "NA10"] 00116 }