def getChainsWithL1seed(connection, smk): '''copy of getChains but retrieving also the L1 seed and assuming always run2 https://gitlab.cern.ch/atlas/athena/blob/master/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcUtils.py#L611 ''' from TrigConfigSvc.TrigConfigSvcUtils import getTriggerDBCursor, executeQuery cursor,schemaname = getTriggerDBCursor(connection) output = ['TC.HTC_ID', 'TC.HTC_CHAIN_COUNTER', 'TC.HTC_NAME', 'TC.HTC_LOWER_CHAIN_NAME'] tables = {} tables['SM'] = 'SUPER_MASTER_TABLE' tables['M2C'] = 'HLT_TM_TO_TC' tables['TC'] = 'HLT_TRIGGER_CHAIN' tables['MT'] = 'HLT_MASTER_TABLE' condition = [ "SM.SMT_ID = :smk", 'SM.SMT_HLT_MASTER_TABLE_ID = MT.HMT_ID', 'MT.HMT_TRIGGER_MENU_ID = M2C.HTM2TC_TRIGGER_MENU_ID', 'M2C.HTM2TC_TRIGGER_CHAIN_ID = TC.HTC_ID' ] bindvars = { "smk": smk } res = executeQuery(cursor, output, condition, schemaname, tables, bindvars) chainsef = {} for x in res: if len(x)!=4: continue #protect against HLT_noalg_bkg_L1Bkg and similars chainsef[x[1]] = (x[2],x[3]) return chainsef
def main(): connectString = "TRIGGERDBREPR" if len(sys.argv) > 1: connectString = sys.argv[1] if connectString == None: return 0 (ALL, VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL) = range(7) from AthenaCommon.Logging import logging log = logging.getLogger("TrigConfigSvcUtils.py") log.setLevel(VERBOSE) log = logging.getLogger("TrigConfFrontier.py") log.setLevel(VERBOSE) from TrigConfigSvc.TrigConfigSvcUtils import getTriggerDBCursor, executeQuery cursor, schemaname = getTriggerDBCursor(connectString) output = [ "SM.SMT_ID", "SM.SMT_NAME", "SM.SMT_VERSION", "SM.SMT_COMMENT", "SM.SMT_ORIGIN", "SM.SMT_USERNAME", "SM.SMT_STATUS" ] condition = [] tables = {'SM': 'SUPER_MASTER_TABLE'} result = executeQuery(cursor, output, condition, schemaname, tables) print "TEST result:\n============" for r in sorted(result): print r return 0
def getTriggerNames(smks, pattern=None): if type(smks) == int: smks = set([smks]) if type(smks) == list: smks = set(smks) from TrigConfigSvc.TrigConfigSvcUtils import getTriggerDBCursor cursor, schemaname = getTriggerDBCursor("TRIGGERDB") if not '.' in schemaname: schemaname += '.' tn = {} tables = { 'SM': 'SUPER_MASTER_TABLE', 'HM': 'HLT_MASTER_TABLE', 'TM': 'HLT_TRIGGER_MENU', 'M2C': 'HLT_TM_TO_TC', 'TC': 'HLT_TRIGGER_CHAIN' } condition = [ 'SM.SMT_ID = :smk', 'SM.SMT_HLT_MASTER_TABLE_ID = HM.HMT_ID', 'HM.HMT_TRIGGER_MENU_ID = M2C.HTM2TC_TRIGGER_MENU_ID', 'M2C.HTM2TC_TRIGGER_CHAIN_ID = TC.HTC_ID' ] if pattern: condition += ["TC.HTC_NAME like '%%%s%%'" % pattern] output = ['TC.HTC_NAME', 'TC.HTC_L2_OR_EF', 'TC.HTC_CHAIN_COUNTER'] order = 'TC.HTC_L2_OR_EF desc, TC.HTC_NAME' TC = namedtuple('TC', 'name level counter') for smk in smks: bindvars = {"smk": smk} res = executeQuery(cursor, output, condition, schemaname, tables, bindvars, order) tn[smk] = [TC._make(r) for r in res] return tn
def queryHLTPrescaleTableRun2(connection,psk): from TrigConfigSvc.TrigConfigSvcUtils import getTriggerDBCursor, executeQuery global cursor, schemaname cursor,schemaname = getTriggerDBCursor(connection) output = [ "PS.HPR_CHAIN_COUNTER", "PS.HPR_TYPE", "PS.HPR_CONDITION" , "PS.HPR_VALUE"] tables = {} tables['PS'] = 'HLT_PRESCALE' condition = [ "PS.HPR_PRESCALE_SET_ID = :psk" ] bindvars = { "psk": psk } res = executeQuery(cursor, output, condition, schemaname, tables, bindvars) return res