def calcSlotAndConnector(self): cableAssign = self.getCTPINCableAssignment(self.thrtype) from TriggerMenu.l1.Lvl1Flags import Lvl1Flags run1 = Lvl1Flags.CTPVersion() <= 3 if run1 and self.thrtype == "EM": cableAssign += self.getCTPINCableAssignment("TAU") offset = self.mapping for (slot, connector, start, stop, bitnum) in cableAssign: self.bitnum = bitnum delta = (stop - start + 1) / self.bitnum log.debug( 'Cable SLOT%i / CON%i has room for %i thresholds of type %s' % (slot, connector, delta, self.thrtype)) if offset >= delta: # does not fit on this connector (only 0 to offset-1 will fit) offset -= delta # move to the next cable for checking continue self.slot = "SLOT%i" % slot self.connector = "CON%i" % connector self.range_begin = start + offset * self.bitnum self.range_end = self.range_begin + self.bitnum - 1 break if not self.connector: print "Cable mapping ERROR ", cableAssign raise RuntimeError( "No cable has been assigned to threshold type '%s' with mapping %i" % (self.thrtype, self.mapping))
def getCableName(thrtype, mapping): from TriggerMenu.l1.Lvl1Flags import Lvl1Flags run1 = Lvl1Flags.CTPVersion() <= 3 if run1: type2cablename = { 'MUON': [(0, 6, 'MUCTPI')], 'EM': [(0, 8, 'EM1'), (8, 16, 'EM2')], 'TAU': [(0, 8, 'TAU1'), (8, 16, 'TAU2')], 'JET': [(0, 10, 'JET1'), (10, 25, 'JET2')], 'TE': [(0, 8, 'EN1')], 'XE': [(0, 8, 'EN1')], 'XS': [(0, 8, 'EN1')], 'MBTSSI': [(0, 16, 'NIM1'), (16, 32, 'NIM2')], 'MBTS': [(0, 1, 'NIM1'), (1, 2, 'NIM2')], 'LUCID': [(0, 6, 'CTPCAL')], 'ZDC': [(0, 3, 'CTPCAL')], 'CALREQ': [(0, 3, 'CTPCAL')], 'TOPO': [(0, 64, 'TOPO1'), (64, 128, 'TOPO2')], 'ALFA': [(0, 64, 'ALFA')], 'BCM': [(0, 3, 'CTPCAL')], 'BCMCMB': [(0, 3, 'CTPCAL')], 'NIM': [(0, 30, 'NIM1'), (30, 60, 'NIM2')], 'JF': [(0, 4, 'JET1')], 'JB': [(0, 4, 'JET1')], 'JE': [(0, 4, 'JET2')], } else: type2cablename = { 'MUON': [(0, 6, 'MUCTPI')], 'EM': [(0, 8, 'EM1'), (8, 16, 'EM2')], 'TAU': [(0, 8, 'TAU1'), (8, 16, 'TAU2')], 'JET': [(0, 10, 'JET1'), (10, 25, 'JET2')], 'TE': [(0, 8, 'EN1'), (8, 16, 'EN2')], 'XE': [(0, 8, 'EN1'), (8, 16, 'EN2')], 'XS': [(0, 8, 'EN1')], 'MBTSSI': [(0, 16, 'NIM1'), (16, 32, 'NIM2')], 'MBTS': [(0, 1, 'NIM1'), (1, 2, 'NIM2')], 'LUCID': [(0, 6, 'CTPCAL')], 'ZDC': [(0, 3, 'CTPCAL')], 'CALREQ': [(0, 3, 'CTPCAL')], 'TOPO': [(0, 64, 'TOPO1'), (64, 128, 'TOPO2')], 'ALFA': [(0, 64, 'ALFA')], 'BCM': [(0, 3, 'CTPCAL')], 'BCMCMB': [(0, 1, 'CTPCAL')], 'BPTX': [(0, 2, 'CTPCAL')], 'DBM': [(0, 8, 'CTPCAL')], 'NIM': [(0, 12, 'NIM1'), (12, 24, 'NIM2')], 'JF': [(0, 4, 'JET1')], 'JB': [(0, 4, 'JET1')], 'JE': [(0, 4, 'JET2')], } x = type2cablename[thrtype] for (minthr, maxthr, name) in x: #print "BETTA ",mapping, minthr, maxthr, name if mapping >= minthr and mapping < maxthr: return name raise RuntimeError("Threshold type %s has no cable for mapping '%i'" % (thrtype, mapping))