def main(sql, doReload): (ALL, VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL) = range(7) from AthenaCommon.Logging import logging log = logging.getLogger("TrigConfigSvcUtils.py") log.setLevel(VERBOSE) connection = "TRIGGERDBREPR" from TriggerJobOpts.TriggerFlags import TriggerFlags as tf tf.triggerUseFrontier = True from TrigConfigSvc.TrigConfigSvcUtils import interpretConnection connectionParameters = interpretConnection(connection) print "Connection: ", connectionParameters from TrigConfDBConnection import frontier_client as fc fc.init("testFrontier.log", "debug") conn = fc.Connection(connectionParameters['url']) session = fc.Session(conn) conn.setReload(doReload) req = fc.Request("frontier_request:1:DEFAULT", fc.encoding_t.BLOB) param = fc.Request.encodeParam(sql) req.addKey("p1", param) session.getData([req]) session.printHeader() nfield = session.getNumberOfFields() print "\nNumber of fields:", nfield, "\n" nrec = session.getNumberOfRecords() print "\nResult contains", nrec, "objects.\n" session.printRecords2() return 0
def testConnection(): log = logging.getLogger("TrigConfFrontier.py::testConnection()") log.setLevel(logging.DEBUG) from TriggerJobOpts.TriggerFlags import TriggerFlags as tf tf.triggerUseFrontier = True from TrigConfigSvc.TrigConfigSvcUtils import interpretConnection connectionParameters = interpretConnection("TRIGGERDBMC") cursor = FrontierCursor(url=connectionParameters['url'], schema=connectionParameters['schema']) query = "select distinct HPS.HPS_NAME from ATLAS_CONF_TRIGGER_RUN2_MC.HLT_PRESCALE_SET HPS where HPS.HPS_ID = '260'" cursor.execute(query) print(cursor.result) cursor.decodeResult() print(cursor.result[0][0]) assert cursor.result[0][0] == 'MC_pp_v7' return 0
log.error('Failed to set state of TrigConfigSvc to ["xml"]') else: log.info('State of TrigConfigSvc set to ["xml"]') try: _svc.InitialiseSvc() except Exception, ex: log.error('Failed to activate TrigConfigSvc: %r' % ex) _sl = dict([(svc, getattr(svcMgr, svc)) for svc in ['LVL1ConfigSvc', 'HLTConfigSvc'] if svc in dir(svcMgr)]) if TriggerFlags.triggerDbConnection(): from TrigConfigSvc.TrigConfigSvcUtils import interpretConnection _conn_param = interpretConnection(TriggerFlags.triggerDbConnection(), resolveAlias=False) if "alias" in _conn_param: for svc in _sl.values(): svc.ConfigSource = 'DBLookUp' svc.DBServer = _conn_param["alias"] svc.DBUser = "" else: technology = _conn_param["techno"] svcMgr.LVL1ConfigSvc.ConfigSource = technology svcMgr.HLTConfigSvc.ConfigSource = technology if technology == 'sqlite': for svc in _sl.values(): svc.DBServer = _conn_param["filename"] svc.DBUser = "******"
def testConnection(): import os log = logging.getLogger("TrigConfFrontier.py::testConnection()") log.setLevel(logging.DEBUG) from TriggerJobOpts.TriggerFlags import TriggerFlags as tf tf.triggerUseFrontier = True from TrigConfigSvc.TrigConfigSvcUtils import interpretConnection connectionParameters = interpretConnection("TRIGGERDBREPR") cursor = FrontierCursor2(url=connectionParameters['url'], schema=connectionParameters['schema']) query = "select distinct SM.SMT_ID, SM.SMT_NAME, SM.SMT_VERSION, SM.SMT_COMMENT, SM.SMT_ORIGIN, SM.SMT_USERNAME, SM.SMT_STATUS from ATLAS_CONF_TRIGGER_REPR.SUPER_MASTER_TABLE SM order by SM.SMT_ID" cursor.execute(query) for r in cursor.result[:20]: print r query = """ SELECT DISTINCT CP.HCP_NAME, CP.HCP_ALIAS, TE2CP.HTE2CP_ALGORITHM_COUNTER, TE.HTE_ID, TE.HTE_NAME, TE2TE.HTE2TE_TE_INP_ID, TE2TE.HTE2TE_TE_INP_TYPE, TE2TE.HTE2TE_TE_COUNTER FROM ATLAS_CONF_TRIGGER_REPR.SUPER_MASTER_TABLE SM, ATLAS_CONF_TRIGGER_REPR.HLT_MASTER_TABLE HM, ATLAS_CONF_TRIGGER_REPR.HLT_TM_TO_TC M2C, ATLAS_CONF_TRIGGER_REPR.HLT_TC_TO_TS TC2TS, ATLAS_CONF_TRIGGER_REPR.HLT_TS_TO_TE S2TE, ATLAS_CONF_TRIGGER_REPR.HLT_TRIGGER_ELEMENT TE, ATLAS_CONF_TRIGGER_REPR.HLT_TE_TO_CP TE2CP, ATLAS_CONF_TRIGGER_REPR.HLT_TE_TO_TE TE2TE, ATLAS_CONF_TRIGGER_REPR.HLT_COMPONENT CP WHERE SM.SMT_ID = 539 AND HM.HMT_ID = SM.SMT_HLT_MASTER_TABLE_ID AND HM.HMT_TRIGGER_MENU_ID = M2C.HTM2TC_TRIGGER_MENU_ID AND M2C.HTM2TC_TRIGGER_CHAIN_ID = TC2TS.HTC2TS_TRIGGER_CHAIN_ID AND TC2TS.HTC2TS_TRIGGER_SIGNATURE_ID = S2TE.HTS2TE_TRIGGER_SIGNATURE_ID AND TE.HTE_ID = S2TE.HTS2TE_TRIGGER_ELEMENT_ID AND TE.HTE_ID = TE2CP.HTE2CP_TRIGGER_ELEMENT_ID AND TE.HTE_ID = TE2TE.HTE2TE_TE_ID AND CP.HCP_ID = TE2CP.HTE2CP_COMPONENT_ID ORDER BY TE.HTE_ID ASC, TE2CP.HTE2CP_ALGORITHM_COUNTER DESC""" cursor.execute(query) for r in cursor.result[:20]: print r return 0
class TriggerConfigGetter(Configured): """ This class brings to the job Trigger Configuration. """ _environment = "" def __init__(self, environment=""): log = logging.getLogger("TriggerConfigGetter.py") if environment: log.info('Initialize (environment "%s")' % environment) else: log.info('Initialize (interpreting rec and trigger flags)') self._environment = environment super(TriggerConfigGetter, self).__init__() # calls configure def checkFileMetaData(self): log = logging.getLogger("TriggerConfigGetter.py") from RecExConfig.InputFilePeeker import inputFileSummary self.hasLBwiseHLTPrescalesAndL1ItemDef = True if rec.readESD() or rec.readAOD() or "ReadPool" in self._environment: self.hasLBwiseHLTPrescalesAndL1ItemDef = inputFileSummary[ 'metadata'].has_key( '/TRIGGER/HLT/Prescales' ) # they were all added at the same time (Repro with 15.6.3.2 Prod) # protection against early runs if inputFileSummary.has_key( 'run_number' ) and self._environment == "" and globalflags.DataSource( ) == 'data' and rec.readRDO() and any( [run < 134230 for run in inputFileSummary['run_number']]): self.hasLBwiseHLTPrescalesAndL1ItemDef = False if self.hasLBwiseHLTPrescalesAndL1ItemDef: log.info("Using LB-wise HLT prescales") else: log.info("Using run-wise HLT prescales") def checkInput(self): self.checkFileMetaData() log = logging.getLogger("TriggerConfigGetter.py") if "ReadPool" in self._environment or "WritePool" in self._environment: log.info( "Flags are ignored, since 'ReadPool' or 'WritePool' is specified" ) return True if rec.readESD() or rec.readAOD( ): # and globalflags.DataSource()=='data': # need this for MC as well protectedInclude("TrigTier0/TriggerConfigCheckMetadata.py") if rec.readRDO() and globalflags.InputFormat( ) == 'bytestream' and globalflags.DataSource() == 'data': protectedInclude("TrigTier0/TriggerConfigCheckHLTpsk.py") log.info("The following flags are set:") log.info("globalflags.InputFormat : %s" % globalflags.InputFormat()) log.info( "rec.read.* : RDO: %s, ESD: %s, AOD: %s, TAG: %s" % (rec.readRDO(), rec.readESD(), rec.readAOD(), rec.readTAG())) log.info( "rec.doWrite.* : ESD: %s, AOD: %s, TAG: %s" % (rec.doWriteESD(), rec.doWriteAOD(), rec.doWriteTAG())) log.info("globalflags.DataSource : %s" % globalflags.DataSource()) log.info("TriggerFlags.configForStartup : %s" % TriggerFlags.configForStartup()) log.info("TriggerFlags.dataTakingConditions : %s" % TriggerFlags.dataTakingConditions()) log.info("TriggerFlags.configurationSourceList: %s" % TriggerFlags.configurationSourceList()) count = len( [1 for x in [rec.readRDO( ), rec.readESD(), rec.readAOD()] if x]) #readTAG is only set with another input if count == 0: log.warning("Don't know what the input format is.") return False if count >= 2: log.warning( "More than one input format specified, please set only the appropriate one." ) return False return True def setConfigSvcConnParams(self, connectionParameters): sl = [] if hasattr(svcMgr, 'L1TopoConfigSvc'): sl += [svcMgr.L1TopoConfigSvc] if hasattr(svcMgr, 'LVL1ConfigSvc'): sl += [svcMgr.LVL1ConfigSvc] if hasattr(svcMgr, 'HLTConfigSvc'): sl += [svcMgr.HLTConfigSvc] if "alias" in connectionParameters: for svc in sl: svc.ConfigSource = 'DBLookUp' svc.DBServer = connectionParameters["alias"] svc.DBUser = "" else: technology = connectionParameters["techno"] for svc in sl: svc.ConfigSource = technology if technology == 'sqlite': for svc in sl: svc.DBServer = connectionParameters["filename"] svc.DBUser = "******" if technology == 'oracle': for svc in sl: svc.DBServer = connectionParameters["server"] svc.DBAccount = connectionParameters["schema"] svc.DBUser = connectionParameters["user"] svc.DBPass = connectionParameters["passwd"] if hasattr(svcMgr, 'L1TopoConfigSvc'): svcMgr.L1TopoConfigSvc.DBSMKey = TriggerFlags.triggerDbKeys()[0] svcMgr.L1TopoConfigSvc.UseFrontier = TriggerFlags.triggerUseFrontier( ) if hasattr(svcMgr, 'LVL1ConfigSvc'): svcMgr.LVL1ConfigSvc.DBSMKey = TriggerFlags.triggerDbKeys()[0] svcMgr.LVL1ConfigSvc.DBLVL1PSKey = TriggerFlags.triggerDbKeys()[1] svcMgr.LVL1ConfigSvc.DBBGSKey = TriggerFlags.triggerDbKeys()[3] svcMgr.LVL1ConfigSvc.UseFrontier = TriggerFlags.triggerUseFrontier( ) if hasattr(svcMgr, 'HLTConfigSvc'): svcMgr.HLTConfigSvc.DBSMKey = TriggerFlags.triggerDbKeys()[0] svcMgr.HLTConfigSvc.DBHLTPSKey = TriggerFlags.triggerDbKeys()[2] svcMgr.HLTConfigSvc.UseFrontier = TriggerFlags.triggerUseFrontier() def configure(self): log = logging.getLogger("TriggerConfigGetter.py") # first check the input if "HIT2RDO" in self._environment: TriggerFlags.doLVL2 = False TriggerFlags.doEF = False log.info("For simulation jobs the following flags are set:") log.info("globalflags.InputFormat : %s" % globalflags.InputFormat()) log.info("globalflags.DataSource : %s" % globalflags.DataSource()) log.info("TriggerFlags.configForStartup : %s" % TriggerFlags.configForStartup()) log.info("TriggerFlags.dataTakingConditions : %s" % TriggerFlags.dataTakingConditions()) log.info("TriggerFlags.doLVL2 : %s" % TriggerFlags.doLVL2()) log.info("TriggerFlags.doEF : %s" % TriggerFlags.doEF()) else: if not self.checkInput(): log.error( "Could not determine job input. Can't setup trigger configuration and will return!" ) return self.readPool = globalflags.InputFormat() == 'pool' self.readRDO = rec.readRDO() self.writeESDAOD = rec.doWriteESD() or rec.doWriteAOD( ) or rec.doWriteDPD() self.ConfigSrcList = TriggerFlags.configurationSourceList() self.readMC = globalflags.DataSource( ) == 'geant3' or globalflags.DataSource() == 'geant4' self.readTriggerDB = TriggerFlags.readMenuFromTriggerDb( ) and self.readRDO self.isCommisioning = globalflags.DataSource( ) == 'data' and globalflags.DetGeo() == 'commis' self.l1Folders = TriggerFlags.dataTakingConditions( ) == 'FullTrigger' or TriggerFlags.dataTakingConditions() == 'Lvl1Only' self.hltFolders = TriggerFlags.dataTakingConditions( ) == 'FullTrigger' or TriggerFlags.dataTakingConditions() == 'HltOnly' self.isRun1Data = False if globalflags.DataSource() == 'data': from RecExConfig.AutoConfiguration import GetRunNumber runNumber = GetRunNumber() if runNumber > 0 and runNumber < 230000: self.isRun1Data = True self.isTriggerReprocessing = False # the TriggerFlags.readMenuFromTriggerDb() tells us that we read the trigger menu from the database # the connection itself is defined in TriggerFlags.triggerDbConnection() # reading from the TriggerDB can mean different things: # a) TriggerFlags doLVL2() and doEF() are both False: # - create a tmp sqlite file with the conditions (menu) # - use DSConfigSvc # b) TriggerFlags doLVL2() or doEF() is True: # - use HLTConfigSvc if self.readTriggerDB and (TriggerFlags.doLVL2() or TriggerFlags.doEF() or TriggerFlags.doHLT()): self.ConfigSrcList = [ 'xml' ] # to use L1/HLTConfigSvc and not DSConfigSvc, but only if we are running the HLT if self._environment: # I don't think anyone calls TriggerConfigGetter with an argument self.readPool = False self.writeESDAOD = False self.readHits = False if "ReadPoolRDO" in self._environment: self.readPool = True self.readRDO = True elif "ReadPool" in self._environment: self.readPool = True self.readRDO = False if "WritePool" in self._environment: self.writeESDAOD = True if "HIT2RDO" in self._environment: self.readRDO = False self.readHits = True # define ConfigSvc if not self.ConfigSrcList: if (self.readPool and not self.readRDO) or ( self.readRDO and not self.readPool): # (ESD, AOD, DPD) or (RDO-BS) self.ConfigSrcList = ['ds'] elif (self.readRDO and self.readPool ) or rec.readTAG() or self.readHits: # (RDO-MC) or TAG self.ConfigSrcList = ['xml'] else: # should not get here: should be found by checkInput log.fatal('no reading of BS, RDO, AOD, ESD, or TAG specified') # we need the temporary COOL database, if we read the configuration from XML and write ESD/AOD (or have 'ds' set for some reason) self.makeTempCool = self.readRDO and \ ( self.writeESDAOD or 'ds' in self.ConfigSrcList ) and \ ( self.readMC \ or (self.isCommisioning and (TriggerFlags.readLVL1configFromXML() and TriggerFlags.readHLTconfigFromXML())) \ or TriggerFlags.readMenuFromTriggerDb() ) log.info("Need to create temporary cool file? : %r" % self.makeTempCool) log.info('Creating the Trigger Configuration Services') self.svc = SetupTrigConfigSvc() #set the merged system #self.svc.doMergedHLT = TriggerFlags.doHLT() if 'xml' in self.ConfigSrcList or self.makeTempCool: # sets them if plain XML reading is to be used self.svc.l1topoXmlFile = TriggerFlags.outputL1TopoConfigFile( ) # generated in python self.svc.l1XmlFile = TriggerFlags.outputLVL1configFile( ) # generated in python self.svc.hltXmlFile = TriggerFlags.outputHLTconfigFile( ) # generated in python if TriggerFlags.readL1TopoConfigFromXML(): self.svc.l1topoXmlFile = TriggerFlags.inputL1TopoConfigFile( ) # given XML if TriggerFlags.readLVL1configFromXML(): self.svc.l1XmlFile = TriggerFlags.inputLVL1configFile( ) # given XML if TriggerFlags.readHLTconfigFromXML(): self.svc.hltXmlFile = TriggerFlags.inputHLTconfigFile( ) # given XML ### preparations are done! try: self.svc.SetStates(self.ConfigSrcList) except: log.error('Failed to set state of TrigConfigSvc to %r' % self.ConfigSrcList) else: log.info('The following configuration services will be tried: %r' % self.ConfigSrcList) try: self.svc.InitialiseSvc() except Exception, ex: log.error('Failed to activate TrigConfigSvc: %r' % ex) if self.readTriggerDB: log.info("Using TriggerDB connection '%s'" % TriggerFlags.triggerDbConnection()) self.trigDbConnectionParameters = interpretConnection( TriggerFlags.triggerDbConnection(), resolveAlias=False) self.setConfigSvcConnParams(self.trigDbConnectionParameters) log.info("TriggerFlags.triggerCoolDbConnection is '%s' [default: '']" % TriggerFlags.triggerCoolDbConnection()) TrigCoolDbConnection = TriggerFlags.triggerCoolDbConnection() if self.makeTempCool: TrigCoolDbConnection = self.setupTempCOOLWriting( TrigCoolDbConnection) if 'ds' in self.ConfigSrcList or self.writeESDAOD: self.setupCOOLReading(TrigCoolDbConnection) if hasattr(svcMgr, 'DSConfigSvc'): db = 'TRIGGERDB' if self.isRun1Data: db = 'TRIGGERDB_RUN1' elif self.readMC: db = 'TRIGGERDBMC' elif self.isTriggerReprocessing: db = 'TRIGGERDBREPR' svcMgr.DSConfigSvc.ConfigSource = 'dblookup' svcMgr.DSConfigSvc.DBServer = db log.info("DSConfigSvc trigger database is '%s'" % db) if self.writeESDAOD: self.setupCOOLWriting() self.setupxAODWriting() # all went fine we are configured return True
def configure(self): log = logging.getLogger( "TriggerConfigGetter.py" ) from PyUtils.MetaReaderPeekerFull import metadata # first check the input if "HIT2RDO" in self._environment: TriggerFlags.doLVL2 = False TriggerFlags.doEF = False log.info("For simulation jobs the following flags are set:") log.info("globalflags.InputFormat : %s", globalflags.InputFormat()) log.info("globalflags.DataSource : %s", globalflags.DataSource()) log.info("TriggerFlags.configForStartup : %s", TriggerFlags.configForStartup()) log.info("TriggerFlags.dataTakingConditions : %s", TriggerFlags.dataTakingConditions()) log.info("TriggerFlags.doLVL2 : %s", TriggerFlags.doLVL2()) log.info("TriggerFlags.doEF : %s", TriggerFlags.doEF()) else: if not self.checkInput(): log.error("Could not determine job input. Can't setup trigger configuration and will return!") return # self.checkInput() may call TriggerConfigCheckMetadata, this can in turn set "rec.doTrigger.set_Value_and_Lock(False)" # but TriggerConfigGetter might have only been called in the first place due to this flag having been true, # so re-check that we're still OK to be executing here if not (recAlgs.doTrigger() or rec.doTrigger() or TriggerFlags.doTriggerConfigOnly()): log.info("Aborting TriggerConfigGetter as the trigger flags were switched to false in checkInput()") return True self.readPool = globalflags.InputFormat() == 'pool' self.readRDO = rec.readRDO() self.writeESDAOD = rec.doWriteESD() or rec.doWriteAOD() or rec.doWriteDPD() self.writeAOD = rec.doWriteAOD() or rec.doWriteDPD() self.ConfigSrcList = TriggerFlags.configurationSourceList() self.readMC = globalflags.DataSource()=='geant3' or globalflags.DataSource()=='geant4' self.readTriggerDB = TriggerFlags.readMenuFromTriggerDb() and self.readRDO self.isCommisioning = globalflags.DataSource()=='data' and globalflags.DetGeo()=='commis' self.l1Folders = TriggerFlags.dataTakingConditions()=='FullTrigger' or TriggerFlags.dataTakingConditions()=='Lvl1Only' self.hltFolders = TriggerFlags.dataTakingConditions()=='FullTrigger' or TriggerFlags.dataTakingConditions()=='HltOnly' self.isRun1Data = False self.hasxAODMeta = ("metadata_items" in metadata and any(('TriggerMenu' in key) for key in metadata["metadata_items"].keys())) if globalflags.DataSource()=='data': from RecExConfig.AutoConfiguration import GetRunNumber runNumber = GetRunNumber() if runNumber is not None and runNumber > 0 and runNumber < 230000 : self.isRun1Data = True self.isTriggerReprocessing = False # the TriggerFlags.readMenuFromTriggerDb() tells us that we read the trigger menu from the database # the connection itself is defined in TriggerFlags.triggerDbConnection() # reading from the TriggerDB can mean different things: # a) TriggerFlags doLVL2() and doEF() are both False: # - create a tmp sqlite file with the conditions (menu) # - use DSConfigSvc # b) TriggerFlags doLVL2() or doEF() is True: # - use HLTConfigSvc if self.readTriggerDB and (TriggerFlags.doLVL2() or TriggerFlags.doEF() or TriggerFlags.doHLT()): self.ConfigSrcList = ['xml'] # to use L1/HLTConfigSvc and not DSConfigSvc, but only if we are running the HLT if self._environment: # I don't think anyone calls TriggerConfigGetter with an argument self.readPool = False self.writeESDAOD = False self.readHits = False if "ReadPoolRDO" in self._environment: self.readPool = True self.readRDO = True elif "ReadPool" in self._environment: self.readPool = True self.readRDO = False if "WritePool" in self._environment: self.writeESDAOD = True if "HIT2RDO" in self._environment: self.readRDO = False self.readHits = True # define ConfigSvc if not self.ConfigSrcList: if (self.readPool and not self.readRDO) or (self.readRDO and not self.readPool): # (ESD, AOD, DPD) or (RDO-BS) self.ConfigSrcList = ['ds'] elif (self.readRDO and self.readPool) or rec.readTAG() or self.readHits: # (RDO-MC) or TAG self.ConfigSrcList = ['xml'] else: # should not get here: should be found by checkInput log.fatal('no reading of BS, RDO, AOD, ESD, or TAG specified') # we need the temporary COOL database, if we read the configuration from XML and write ESD/AOD (or have 'ds' set for some reason) self.makeTempCool = self.readRDO and \ ( self.writeESDAOD or 'ds' in self.ConfigSrcList ) and \ ( self.readMC \ or (self.isCommisioning and (TriggerFlags.readLVL1configFromXML() and TriggerFlags.readHLTconfigFromXML())) \ or TriggerFlags.readMenuFromTriggerDb() ) log.info("Need to create temporary cool file? : %r", self.makeTempCool) log.info('Creating the Trigger Configuration Services') from AthenaCommon.AppMgr import ServiceMgr as svcMgr ######################################################################## # START OF TEMPORARY SOLUTION FOR RUN-3 TRIGGER DEVELOPMENT ######################################################################## from TriggerJobOpts.HLTTriggerResultGetter import EDMDecodingVersion EDMDecodingVersion() # In most use cases this needs to be called much earlier than in HLTTriggerResultGetter if TriggerFlags.EDMDecodingVersion() >= 3: if self.hasxAODMeta: if not hasattr(svcMgr, 'xAODConfigSvc'): from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODConfigSvc svcMgr += TrigConf__xAODConfigSvc('xAODConfigSvc') else: # Does not have xAODMeta # Run-3 Trigger Configuration Services from TrigConfigSvc.TrigConfigSvcCfg import getL1ConfigSvc, getHLTConfigSvc from AthenaConfiguration.AllConfigFlags import ConfigFlags svcMgr += getL1ConfigSvc(ConfigFlags) svcMgr += getHLTConfigSvc(ConfigFlags) # Needed for TrigConf::xAODMenuWriterMT from TrigConfigSvc.TrigConfigSvcConfig import TrigConfigSvc svcMgr += TrigConfigSvc("TrigConfigSvc") svcMgr.TrigConfigSvc.PriorityList = ["none", "ds", "xml"] else: # non-MT (Run-2) Trigger Configuration self.svc = SetupTrigConfigSvc() if 'xml' in self.ConfigSrcList or self.makeTempCool: # sets them if plain XML reading is to be used self.svc.l1topoXmlFile = TriggerFlags.outputL1TopoConfigFile() # generated in python self.svc.l1XmlFile = TriggerFlags.outputLVL1configFile() # generated in python self.svc.hltXmlFile = TriggerFlags.outputHLTconfigFile() # generated in python if TriggerFlags.readL1TopoConfigFromXML(): self.svc.l1topoXmlFile = TriggerFlags.inputL1TopoConfigFile() # given XML if TriggerFlags.readLVL1configFromXML(): self.svc.l1XmlFile = TriggerFlags.inputLVL1configFile() # given XML if TriggerFlags.readHLTconfigFromXML(): self.svc.hltXmlFile = TriggerFlags.inputHLTconfigFile() # given XML try: self.svc.SetStates( self.ConfigSrcList ) except Exception: log.error( 'Failed to set state of TrigConfigSvc to %r', self.ConfigSrcList ) else: log.info('The following configuration services will be tried: %r', self.ConfigSrcList ) try: self.svc.InitialiseSvc() except Exception as ex: log.error( 'Failed to activate TrigConfigSvc: %r', ex ) ######################################################################## # END OF TEMPORARY SOLUTION FOR RUN-3 TRIGGER DEVELOPMENT ######################################################################## if self.readTriggerDB: log.info( "Using TriggerDB connection '%s'", TriggerFlags.triggerDbConnection() ) self.trigDbConnectionParameters = interpretConnection(TriggerFlags.triggerDbConnection(), resolveAlias=False) self.setConfigSvcConnParams(self.trigDbConnectionParameters) log.info("TriggerFlags.triggerCoolDbConnection is '%s' [default: '']", TriggerFlags.triggerCoolDbConnection()) TrigCoolDbConnection = TriggerFlags.triggerCoolDbConnection() if self.makeTempCool: TrigCoolDbConnection = self.setupTempCOOLWriting(TrigCoolDbConnection) if ('ds' in self.ConfigSrcList) and not self.hasxAODMeta: self.setupCOOLReading(TrigCoolDbConnection) if hasattr(svcMgr, 'DSConfigSvc'): db = 'TRIGGERDB' if self.isRun1Data: db = 'TRIGGERDB_RUN1' elif self.readMC: db = 'TRIGGERDBMC' elif self.isTriggerReprocessing: db = 'TRIGGERDBREPR' svcMgr.DSConfigSvc.ConfigSource = 'dblookup' svcMgr.DSConfigSvc.DBServer = db log.info("DSConfigSvc trigger database is '%s'", db) if not self.hasxAODMeta: self.setupxAODWriting() # all went fine we are configured return True