def get_signature(cursor, htm_id, hps_id): sigItems = get_signature_record("string") columns = ", \n\t".join(sigItems) tables = ("\t HLT_TRIGGER_MENU AS TM, \n" "\t HLT_TM_TO_TC AS M2C, \n" "\t HLT_TRIGGER_CHAIN AS TC, \n" "\t HLT_TC_TO_TS AS TC2TS, \n" "\t HLT_TRIGGER_SIGNATURE AS TS, \n" "\t HLT_TS_TO_TE AS S2TE, \n" "\t HLT_TRIGGER_ELEMENT AS TE, \n" "\t HLT_PRESCALE_SET AS PS, \n" "\t HLT_PRESCALE AS PR \n") conditions = ( "\t TM.HTM_ID = '%i' AND \n" "\t PS.HPS_ID = '%i' AND \n" "\t TM.HTM_ID = M2C.HTM2TC_TRIGGER_MENU_ID AND TC.HTC_ID = M2C.HTM2TC_TRIGGER_CHAIN_ID AND \n" "\t TC.HTC_ID = TC2TS.HTC2TS_TRIGGER_CHAIN_ID AND TS.HTS_ID = TC2TS.HTC2TS_TRIGGER_SIGNATURE_ID AND \n" "\t TS.HTS_ID = S2TE.HTS2TE_TRIGGER_SIGNATURE_ID AND TE.HTE_ID = S2TE.HTS2TE_TRIGGER_ELEMENT_ID AND \n" "\t TM.HTM_ID = PS.HPS_TRIGGER_MENU_ID AND PS.HPS_ID = PR.HPR_PRESCALE_SET_ID AND \n" "\t PR.HPR_CHAIN_COUNTER = TC.HTC_CHAIN_COUNTER AND \n" "\t PR.HPR_L2_OR_EF = TC.HTC_L2_OR_EF\n" % (htm_id, hps_id)) order = "TC.HTC_L2_OR_EF DESC, TC.HTC_CHAIN_COUNTER, TC2TS.HTC2TS_SIGNATURE_COUNTER ASC, S2TE.HTS2TE_ELEMENT_COUNTER ASC" query = "SELECT %s \n FROM %s \n WHERE %s \n ORDER BY %s" % ( columns, tables, conditions, order) sqlutils._run_single(cursor, query) return cursor.fetchall()
def get_chain(cursor, htm_id, hps_id): sigItems = get_chain_record("string") columns = ", ".join(sigItems) tables = (" HLT_TRIGGER_MENU AS TM," " HLT_TM_TO_TC AS M2C," " HLT_TRIGGER_CHAIN AS TC," " HLT_PRESCALE_SET AS PS, " " HLT_PRESCALE AS PR") conditions = ( " TM.HTM_ID = '%i' AND" " PS.HPS_ID = '%i' AND" " TM.HTM_ID = M2C.HTM2TC_TRIGGER_MENU_ID AND TC.HTC_ID = M2C.HTM2TC_TRIGGER_CHAIN_ID AND" " TM.HTM_ID = PS.HPS_TRIGGER_MENU_ID AND PS.HPS_ID = PR.HPR_PRESCALE_SET_ID AND" " PR.HPR_CHAIN_COUNTER = TC.HTC_CHAIN_COUNTER AND" " PR.HPR_L2_OR_EF = TC.HTC_L2_OR_EF\n" % (htm_id, hps_id)) order = "TC.HTC_L2_OR_EF DESC, TC.HTC_CHAIN_COUNTER" query = "SELECT %s FROM %s WHERE %s ORDER BY %s" % (columns, tables, conditions, order) sqlutils._run_single(cursor, query) return cursor.fetchall()
def get_triggerbit(cursor, htm_id): triggerbitItems = get_triggerbit_record("string") columns = ", \n\t".join(triggerbitItems) tables = ("\t HLT_TM_TO_TC AS M2C, \n" "\t HLT_TRIGGER_CHAIN AS TC, \n" "\t HLT_TRIGGER_TYPE AS TT \n") conditions = ("\t '%i' = M2C.HTM2TC_TRIGGER_MENU_ID AND \n" "\t M2C.HTM2TC_TRIGGER_CHAIN_ID = TC.HTC_ID AND \n" "\t TT.HTT_TRIGGER_CHAIN_ID = TC.HTC_ID" % htm_id) order = "TC.HTC_L2_OR_EF DESC, TC.HTC_CHAIN_COUNTER ASC, TT.HTT_TYPEBIT ASC" query = "SELECT %s \n FROM %s \n WHERE %s \n ORDER BY %s" % ( columns, tables, conditions, order) sqlutils._run_single(cursor, query) return cursor.fetchall()
def get_sequence(cursor, htm_id): columns = (" TE.HTE_ID," " TE.HTE_NAME") tables = (" HLT_TM_TO_TC AS M2C," " HLT_TC_TO_TS AS C2S," " HLT_TS_TO_TE AS S2TE," " HLT_TRIGGER_ELEMENT AS TE") conditions = ( " '%i' = M2C.HTM2TC_TRIGGER_MENU_ID" " AND C2S.HTC2TS_TRIGGER_CHAIN_ID = M2C.HTM2TC_TRIGGER_CHAIN_ID" " AND C2S.HTC2TS_TRIGGER_SIGNATURE_ID = S2TE.HTS2TE_TRIGGER_SIGNATURE_ID" " AND TE.HTE_ID = S2TE.HTS2TE_TRIGGER_ELEMENT_ID" % htm_id) order = "TE.HTE_ID ASC" query = "SELECT DISTINCT %s FROM %s WHERE %s ORDER BY %s " % ( columns, tables, conditions, order) sqlutils._run_single(cursor, query) result = cursor.fetchall() teIDstring = str(result[0][0]) for line in result[1:]: teIDstring += "," + str(line[0]) seqItems = get_sequence_record("string") columns = ", ".join(seqItems) tables = (" HLT_TRIGGER_ELEMENT AS TE," " HLT_TE_TO_CP AS TE2CP," " HLT_COMPONENT AS CP," " HLT_TE_TO_TE AS TE2TE") conditions = (" TE.HTE_ID in (%s)" " AND TE.HTE_ID = TE2CP.HTE2CP_TRIGGER_ELEMENT_ID" " AND CP.HCP_ID = TE2CP.HTE2CP_COMPONENT_ID" " AND TE.HTE_ID = TE2TE.HTE2TE_TE_ID" % teIDstring) order = "TE.HTE_NAME ASC, TE2CP.HTE2CP_ALGORITHM_COUNTER ASC, TE2TE.HTE2TE_TE_COUNTER ASC" query = "SELECT %s FROM %s WHERE %s ORDER BY %s" % (columns, tables, conditions, order) sqlutils._run_single(cursor, query) result = cursor.fetchall() return result
def get_triggergroup(cursor, htm_id): triggergroupItems = get_triggergroup_record("string") columns = ", \n\t".join(triggergroupItems) tables = ("\t HLT_TM_TO_TC AS M2C, \n" "\t HLT_TRIGGER_CHAIN AS TC, \n" "\t HLT_TRIGGER_GROUP AS TG \n") conditions = ("\t '%i' = M2C.HTM2TC_TRIGGER_MENU_ID AND \n" "\t M2C.HTM2TC_TRIGGER_CHAIN_ID = TC.HTC_ID AND \n" "\t TG.HTG_TRIGGER_CHAIN_ID = TC.HTC_ID" % htm_id) order = "TC.HTC_L2_OR_EF DESC, TC.HTC_CHAIN_COUNTER ASC, TG.HTG_NAME ASC" query = "SELECT %s \n FROM %s \n WHERE %s \n ORDER BY %s" % ( columns, tables, conditions, order) sqlutils._run_single(cursor, query) result = cursor.fetchall() print result return result
def get_streamtag(cursor, htm_id): streamItems = get_streamtag_record("string") columns = ", \n\t".join(streamItems) tables = ("\t HLT_TM_TO_TC AS M2C, \n" "\t HLT_TRIGGER_CHAIN AS TC, \n" "\t HLT_TC_TO_TR AS C2R, \n" "\t HLT_TRIGGER_STREAM AS TR \n") conditions = ("\t '%i' = M2C.HTM2TC_TRIGGER_MENU_ID AND \n" "\t M2C.HTM2TC_TRIGGER_CHAIN_ID = TC.HTC_ID AND \n" "\t TC.HTC_ID = C2R.HTC2TR_TRIGGER_CHAIN_ID AND \n" "\t C2R.HTC2TR_TRIGGER_STREAM_ID = TR.HTR_ID \n" % htm_id) order = "TC.HTC_L2_OR_EF DESC, TC.HTC_CHAIN_COUNTER ASC, C2R.HTC2TR_TRIGGER_STREAM_PRESCALE ASC, TR.HTR_NAME ASC" query = "SELECT %s \n FROM %s \n WHERE %s \n ORDER BY %s" % ( columns, tables, conditions, order) sqlutils._run_single(cursor, query) return cursor.fetchall()