def configureTriggerFromDB(self): """ configures trigger from the DB """ log = logging.getLogger("TriggerGetter.py") log.info("configureTriggerFromDb") from TrigConfOffline.HLTConfOffline import HLTConfOffline hltConfOffline = HLTConfOffline() # Set the properties hltConfOffline.setupSource = 'db' hltConfOffline.OutputLevel = 1 # Set the connection to the DB if TF.triggerDbConnection.statusOn: hltConfOffline.dbType = TF.triggerDbConnection()['dbType'] hltConfOffline.dbHost = TF.triggerDbConnection()['dbServer'] hltConfOffline.dbUser = TF.triggerDbConnection()['dbUser'] hltConfOffline.dbName = TF.triggerDbConnection()['dbName'] hltConfOffline.dbPasswd = TF.triggerDbConnection()['dbPasswd'] else: # try to get connection parameters from authentication files if not hltConfOffline.setDbConnectionFromAuthFile(): log.error('failed to set HLTConfOffline service') return False if TF.triggerDbKeys.statusOn: hltConfOffline.SMKey = TF.triggerDbKeys()[0] hltConfOffline.LVL1PrescaleKey = TF.triggerDbKeys()[1] hltConfOffline.HLTPrescaleKey = TF.triggerDbKeys()[2] else: log.error( 'missing DB keys, set the TriggerFlags.triggerDBKeys flag') return False if TF.doLVL2() and TF.doEF(): hltConfOffline.Level = 'BOTH' elif TF.doLVL2(): hltConfOffline.Level = 'L2' elif TF.doEF(): hltConfOffline.Level = 'EF' elif TF.doHLT(): hltConfOffline.Level = 'HLT' else: hltConfOffline.Level = None log.error('no trigger level set') return False # Load the setup and set the services on this place hltConfOffline.load() return True
def generatePyCode(self, algos): #create python code to be executed alglist = "[" for i in algos: #self.__algos__.append(i) algline = self._item_line(i[0], i[1]) alglist += algline+',' alglist += "]" #this should be avoided by a higher level steering # modify the sequence acoording to triggerflags from TriggerJobOpts.TriggerFlags import TriggerFlags if not ( TriggerFlags.doEF() or TriggerFlags.doHLT() ) or not TriggerFlags.doFEX(): from TrigSteeringTest.TrigSteeringTestConf import PESA__dummyAlgo as dummyAlgo_disabledByTriggerFlags_EFID dummyAlgEFID = dummyAlgo_disabledByTriggerFlags_EFID("doEF_or_doFEX_False_no_EFID") alglist = '[dummyAlgEFID]' algseq = [] try: algseq = eval (alglist) except: from sys import exc_info (a,reason,c) = exc_info() print (reason) log.error("Cannot create ID tracking sequence %s, leaving empty" % alglist) import traceback traceback.print_exc() #raise Exception log.debug('%s ' % algseq) self.__sequence__.append(algseq) pass
def InitialiseSvc(self): if self.initialised: raise (RuntimeError, 'athena service has already been added, do nothing.') self.initialised = True from AthenaCommon.AppMgr import ServiceMgr self.mlog.info("initialising TrigConfigSvc using state %s", self.states) if 'xml' in self.states: from TriggerJobOpts.TriggerFlags import TriggerFlags if TriggerFlags.doLVL2() or TriggerFlags.doEF( ) or TriggerFlags.doHLT() or TriggerFlags.configForStartup( ) == 'HLToffline': self.mlog.info( "setup HLTConfigSvc and add instance to ServiceMgr (xml file=" + self.hltXmlFile + ")") hlt = HLTConfigSvc("HLTConfigSvc") hlt.XMLMenuFile = self.hltXmlFile hlt.doMergedHLT = TriggerFlags.doHLT() ServiceMgr += hlt else: self.mlog.info( "Will not setup HLTConfigSvc, since TriggerFlags doLVL2(), doEF(), and doHLT() are all False" ) self.states[self.states.index("xml")] = "xmll1" self.mlog.info( "setup LVL1ConfigSvc and add instance to ServiceMgr (xml file=" + self.l1XmlFile + ")") l1 = LVL1ConfigSvc("LVL1ConfigSvc") l1.XMLMenuFile = self.l1XmlFile ServiceMgr += l1 self.mlog.info( "setup L1TopoConfigSvc and add instance to ServiceMgr (xml file=" + self.l1topoXmlFile + ")") l1topo = L1TopoConfigSvc() l1topo.XMLMenuFile = self.l1topoXmlFile ServiceMgr += l1topo if 'ds' in self.states: self.mlog.info( "setup DSConfigSvc and add instance to ServiceMgr") ds = DSConfigSvc("DSConfigSvc") ServiceMgr += ds self.mlog.info( "setup TrigConfigSvc and add instance to ServiceMgr") trigSvc = TrigConfigSvc("TrigConfigSvc") trigSvc.PriorityList = self.states ServiceMgr += trigSvc from AthenaCommon.AppMgr import theApp theApp.CreateSvc += [ServiceMgr.TrigConfigSvc.getFullName()]
def __init__(self, name='TrigDataAccess'): super(TrigDataAccess, self).__init__(name) from AthenaCommon.AppMgr import ServiceMgr as svcMgr from TriggerJobOpts.TriggerFlags import TriggerFlags from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.Logging import logging log = logging.getLogger(name) self.loadFullCollections = (TriggerFlags.doEF() or TriggerFlags.doHLT()) self.loadAllSamplings = (TriggerFlags.doLVL2() or TriggerFlags.doHLT()) if (globalflags.DatabaseInstance == "COMP200" and TriggerFlags.doCaloOffsetCorrection()): self.ApplyOffsetCorrection = False log.warning( "Not possible to run BCID offset correction with COMP200") else: if TriggerFlags.doCaloOffsetCorrection(): log.info('Enable HLT calo offset correction') if globalflags.DataSource( ) == 'data' and athenaCommonFlags.isOnline(): from IOVDbSvc.CondDB import conddb conddb.addFolder("LAR_ONL", "/LAR/ElecCalibFlat/OFC") from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc svcMgr += LArFlatConditionSvc() svcMgr.LArFlatConditionSvc.OFCInput = "/LAR/ElecCalibFlat/OFC" svcMgr.ProxyProviderSvc.ProviderNames += [ "LArFlatConditionSvc" ] from CaloTools.CaloLumiBCIDToolDefault import CaloLumiBCIDToolDefault theCaloLumiBCIDTool = CaloLumiBCIDToolDefault() svcMgr.ToolSvc += theCaloLumiBCIDTool self.CaloLumiBCIDTool = theCaloLumiBCIDTool self.ApplyOffsetCorrection = True else: log.info('Disable HLT calo offset correction') self.ApplyOffsetCorrection = False from RecExConfig.RecFlags import rec transientBS = (rec.readRDO() and not globalflags.InputFormat() == 'bytestream') if (transientBS or TriggerFlags.writeBS()): if (not hasattr(svcMgr.ToolSvc, 'LArRawDataContByteStreamTool')): from LArByteStream.LArByteStreamConfig import LArRawDataContByteStreamToolConfig svcMgr.ToolSvc += LArRawDataContByteStreamToolConfig() svcMgr.ToolSvc.LArRawDataContByteStreamTool.DSPRunMode = 4 svcMgr.ToolSvc.LArRawDataContByteStreamTool.RodBlockVersion = 10 return
def setupCostJob(config='OPI ROB NOPS'): log = logging.getLogger('setupCostJob') if config.count('OPI'): log.info('Configure TrigSteer algorithm(s)') from AthenaCommon.AlgSequence import AlgSequence topSeq = AlgSequence() from TriggerJobOpts.TriggerFlags import TriggerFlags if TriggerFlags.doHLT(): configSteeringOPI(topSeq, 'TrigSteer_HLT', config, log) else: if TriggerFlags.doEF(): configSteeringOPI(topSeq, 'TrigSteer_EF', config, log) if TriggerFlags.doLVL2(): configSteeringOPI(topSeq, 'TrigSteer_L2', config, log) if config.count('ROB'): log.info( 'Will try to configure online monitoring for ROBDataProviderSvc...' ) from AthenaCommon.AppMgr import ServiceMgr as svcMgr try: log.info('ROBDataProviderSvc type: ' + svcMgr.ROBDataProviderSvc.getType()) if svcMgr.ROBDataProviderSvc.getType() == 'Lvl2ROBDataProviderSvc': log.info('Job already uses online version ROBDataProvider') else: from AthenaCommon.Include import include include('TrigDataAccessMonitoring/MonROBDataProviderSvc.py') log.info('Setup "online" monitoring for ROBDataProvider') except: log.warning('Failed to setup "online" version of ROBDataProvider') try: from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ROBDataProviderSvc svcMgr.ROBDataProviderSvc.doDetailedROBMonitoring = True log.info('Set ROBDataProviderSvc.doDetailedROBMonitoring=True') except: log.warning( 'Failed to set ROBDataProviderSvc.doDetailedROBMonitoring')
def __init__(self, name='TrigDataAccess'): super(TrigDataAccess, self).__init__(name) from AthenaCommon.AppMgr import ServiceMgr as svcMgr from TriggerJobOpts.TriggerFlags import TriggerFlags from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.Logging import logging log = logging.getLogger(name) self.loadFullCollections = ( TriggerFlags.doEF() or TriggerFlags.doHLT() ) self.loadAllSamplings = ( TriggerFlags.doLVL2() or TriggerFlags.doHLT() ) log.info('Not possible anymore to enable HLT calo offset correction, tools deprecated') from RecExConfig.RecFlags import rec transientBS = (rec.readRDO() and not globalflags.InputFormat()=='bytestream') if ( transientBS or TriggerFlags.doTransientByteStream() ): if ( not hasattr(svcMgr.ToolSvc,'LArRawDataContByteStreamTool') ): from LArByteStream.LArByteStreamConfig import LArRawDataContByteStreamToolConfig svcMgr.ToolSvc += LArRawDataContByteStreamToolConfig() svcMgr.ToolSvc.LArRawDataContByteStreamTool.DSPRunMode=4 svcMgr.ToolSvc.LArRawDataContByteStreamTool.RodBlockVersion=10 return
def configure(self): if self._done: log.info("configuration already done, who is calling it again?") return True self._done = True # start with print some information what this will do log.info( "Basic configuration flags RecAlgsFlag.doTrigger: %d RecFlags.doTrigger: %d TriggerFlags.doTriggerConfigOnly %d" % (recAlgs.doTrigger(), rec.doTrigger(), TF.doTriggerConfigOnly())) log.info( "TriggerFlags: doL1Topo: %s, doLVL1: %s, doLVL2: %s, doEF: %s, doHLT: %s" % (TF.doL1Topo(), TF.doLVL1(), TF.doLVL2(), TF.doEF(), TF.doHLT())) willGenerateMenu = recAlgs.doTrigger() and ( TF.doLVL1() or TF.doLVL2() or TF.doEF() or TF.doHLT()) and not TF.doTriggerConfigOnly() willRunTriggerConfigGetter = recAlgs.doTrigger() or rec.doTrigger( ) or TF.doTriggerConfigOnly() willRunLVL1SimulationGetter = recAlgs.doTrigger( ) and not TF.doTriggerConfigOnly() willRunHLTSimulationGetter = willRunLVL1SimulationGetter and ( TF.doLVL2() or TF.doEF() or TF.doHLT()) log.info("Will run: %s%s%s%s" % ( "GenerateMenu " if willGenerateMenu else "", "TriggerConfigGetter " if willRunTriggerConfigGetter else "", "LVL1SimulationGetter " if willRunLVL1SimulationGetter else "", "HLTSimulationGetter " if willRunHLTSimulationGetter else "", )) log.info("Will not run: %s%s%s%s" % ( "GenerateMenu " if not willGenerateMenu else "", "TriggerConfigGetter " if not willRunTriggerConfigGetter else "", "LVL1SimulationGetter " if not willRunLVL1SimulationGetter else "", "HLTSimulationGetter " if not willRunHLTSimulationGetter else "", )) if recAlgs.doTrigger(): # setup the trigger from the DB if TF.readConfigFromTriggerDb(): return self.configureTriggerFromDB() if ((TF.doLVL1() == True or TF.doLVL2() == True or TF.doEF() == True or TF.doHLT() == True) and TF.doTriggerConfigOnly() == False): log.info("generating menu") # trigger menu files generation g = GenerateMenu() g.generate() # after the menu xml file has been created or the TriggerDB access is configured, # the COOL/SQlite db can be written # TB this needs to be optimized -- we do not need ti always but only when AOD or ESD are created if recAlgs.doTrigger() or rec.doTrigger() or TF.doTriggerConfigOnly(): # setup configuration services from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter theConfCOOLWriter.writeConf2COOL() # preconfigure TrigDecisionTool from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool from AthenaCommon.AppMgr import ToolSvc ToolSvc += Trig__TrigDecisionTool("TrigDecisionTool") # tell tdt to use TrigConfigSvc (Since TrigDecisionTool-00-03-40, defaults to not use it) ToolSvc.TrigDecisionTool.TrigConfigSvc = "Trig::TrigConfigSvc/TrigConfigSvc" from TrigEDMConfig.TriggerEDM import EDMLibraries ToolSvc.TrigDecisionTool.Navigation.Dlls = [ e for e in EDMLibraries if 'TPCnv' not in e ] # actuall trigger simulation running if recAlgs.doTrigger() and not TF.doTriggerConfigOnly(): # setup Lvl1 # initialize LVL1ConfigSvc log.info("configuring lvl1") from TriggerJobOpts.Lvl1TriggerGetter import Lvl1SimulationGetter lvl1 = Lvl1SimulationGetter() if jobproperties.Global.InputFormat() != 'bytestream' and ( TF.doLVL2 == True or TF.doEF == True or TF.doHLT == True): # Transient BS construction and intialization from ByteStreamCnvSvc import WriteByteStream StreamBS = WriteByteStream.getStream("Transient", "StreamBS") StreamBS.ForceRead = True StreamBS.ItemList += [ "DataVector<LVL1::TriggerTower>#TriggerTowers" ] StreamBS.ItemList += ["TRT_RDO_Container#TRT_RDOs"] StreamBS.ItemList += ["SCT_RDO_Container#SCT_RDOs"] StreamBS.ItemList += ["PixelRDO_Container#PixelRDOs"] # StreamBS.ItemList +=["LArRawChannelContainer#*"] StreamBS.ItemList += ["2721#*"] # StreamBS.ItemList +=["TileRawChannelContainer#*"] StreamBS.ItemList += ["2927#*"] StreamBS.ItemList += [ "2934#*" ] # added on request from: Arantxa Ruiz Martinez for TileRODMu # don't need Muons in transient BS # StreamBS.ItemList +=["MdtCsmContainer#*"] # StreamBS.ItemList +=["RpcPadContainer#*"] # StreamBS.ItemList +=["TgcRdoContainer#*"] # StreamBS.ItemList +=["CscRawDataContainer#*"] from AthenaCommon.Include import include # setup trans BS for the ID include("InDetRecExample/InDetRecCabling.py") # setup HLT # initialize HLT config svc log.info("TriggerFlags: doLVL2 %r" % TF.doLVL2()) log.info("TriggerFlags: doEF %r" % TF.doEF()) log.info("TriggerFlags: doHLT %r" % TF.doHLT()) if TF.doLVL2() == True or TF.doEF() == True or TF.doHLT() == True: log.info("configuring hlt") from TriggerJobOpts.HLTTriggerGetter import HLTSimulationGetter hlt = HLTSimulationGetter(g) else: from RegionSelector.RegSelSvcDefault import RegSelSvcDefault from AthenaCommon.AppMgr import ServiceMgr ServiceMgr += RegSelSvcDefault() ServiceMgr.RegSelSvc.enablePixel = False ServiceMgr.RegSelSvc.enableSCT = False # prepare result making of L1 from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter hltouput = Lvl1ResultBuilderGetter() # prepare result making of HLT if TF.doLVL2() == True or TF.doEF() == True or TF.doHLT() or ( recAlgs.doTrigger() and TF.readBS()): from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter hltouput = HLTTriggerResultGetter() return True
def addTrigConfMetadata(d3pdalg=None, useTrigConfEventSummaries=False, doCostL2=False, doCostEF=False, doCostHLT=False, saveKeys=True, tuplePath=""): """Helper function that adds the necessary tool(s) and service(s) to the job to save the trigger configuration metadata to the output D3PD file. Arguments: d3pdalg: The D3PD::MakerAlg that is creating the D3PD. If not specified, the configuration is saved in a file called TrigConfig.root useTrigConfEventSummaries: Set true when running in AtlasP1HLT or trigger BS to gather detailed configuration from TrigConfEvent summary objects (TrigCost running). """ # Create a logger for the function: if "logger" in dir(): orig_logger = logger from AthenaCommon.Logging import logging logger = logging.getLogger("addTrigConfMetadata") # Let the user know what we're doing: logger.info("Adding trigger configuration metadata to the D3PD") # The tool needs a special D3PDSvc in which the indexing is turned off # for the TTree-s: _d3pdSvcName = "TrigConfD3PDSvc" from AthenaCommon.AppMgr import ServiceMgr if not hasattr(ServiceMgr, _d3pdSvcName): from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc ServiceMgr += D3PD__RootD3PDSvc(_d3pdSvcName) ServiceMgr.TrigConfD3PDSvc.MasterTree = "" ServiceMgr.TrigConfD3PDSvc.IndexMajor = "" else: logger.info( "The private D3PDSvc for the metadata TTree already exists") _d3pdSvc = getattr(ServiceMgr, _d3pdSvcName) # If no D3PD::MakerAlg has been provided, create a dummy one: if d3pdalg == None: logger.warning("No D3PD MakerAlg given to function!") logger.warning("The trigger configuration will be saved into file: " + "\"TrigConfig.root\"") from AthenaCommon.AlgSequence import AlgSequence theJob = AlgSequence() import D3PDMakerCoreComps d3pdalg = D3PDMakerCoreComps.MakerAlg("trigConf", theJob, file="TrigConfig.root", D3PDSvc=_d3pdSvc) # Add the metadata tool: _d3pdToolName = "TrigConfMetadataTool" if not _d3pdToolName in [t.name() for t in d3pdalg.MetadataTools]: import TriggerD3PDMaker if (tuplePath == ""): tuplePath = d3pdalg.TuplePath _trigConfTool = TriggerD3PDMaker.TrigConfMetadataTool( _d3pdToolName, D3PDSvc=_d3pdSvc, ConfigDir=tuplePath + "Meta") _trigConfTool.UseTrigConfEventSummaries = useTrigConfEventSummaries if useTrigConfEventSummaries: # Figure out if old or new style HLT if using CostMon to get correct storegate key # Old key fomat was HLT_OPI_HLT_monitoring_config if (doCostL2 == True or doCostEF == True or doCostHLT == True): logger.info( "TrigConfMetadataTool will use passed arguments [L2=" + str(doCostL2) + ",EF=" + str(doCostEF) + ",HLT=" + str(doCostHLT) + "]") if (doCostL2 == True or doCostEF == True): _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_EF_monitoring_config" elif (doCostHLT == True): _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_HLT_monitoring_config" else: logger.info( "TrigConfMetadataTool will use TriggerFlags flags for config" ) from TriggerJobOpts.TriggerFlags import TriggerFlags if TriggerFlags.doHLT() and not (TriggerFlags.doEF() or TriggerFlags.doLVL2()): _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_HLT_monitoring_config" elif TriggerFlags.doEF() or TriggerFlags.doLVL2(): _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_EF_monitoring_config" logger.info("TrigConfMetadataTool will use the StoreGate key " + _trigConfTool.keyConfig) d3pdalg.MetadataTools += [_trigConfTool] else: logger.info( "TrigConfMetadataTool was already added to the D3PD::MakerAlg") # Add the DB key filler object: if saveKeys == True: _dbKeysFillerName = "TrigDBKeysFiller" if not hasattr(d3pdalg, _dbKeysFillerName): from TriggerD3PDMaker.TrigDBKeysD3PDObject import TrigDBKeysD3PDObject d3pdalg += TrigDBKeysD3PDObject(0) else: logger.info( "TrigDBKeysD3PDObject already added to the D3PD::MakerAlg") # Restore the original logger if necessary: if "orig_logger" in dir(): logger = orig_logger return
#-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- HelloWorld = CfgMgr.MTCalibPeb("HelloWorld") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += HelloWorld #-------------------------------------------------------------- # Algorithms Private Options #-------------------------------------------------------------- from TriggerJobOpts.TriggerFlags import TriggerFlags if TriggerFlags.doLVL2(): hltInstance = 'L2' elif TriggerFlags.doEF(): hltInstance = 'EF' else: hltInstance = 'HLT' # #--- the HLT instance = L2/EF/HLT # HelloWorld.HLTInstance = hltInstance # #--- the base name of the partial event building info SG key # HelloWorld.HLTResultName = "HLTResult" # #--- retrieve the Level-1 result #
def configure(self): if self._done: log.info("configuration already done, who is calling it again?") return True self._done = True # start with print some information what this will do log.info( "Basic configuration flags RecAlgsFlag.doTrigger: %d RecFlags.doTrigger: %d TriggerFlags.doTriggerConfigOnly %d", recAlgs.doTrigger(), rec.doTrigger(), TF.doTriggerConfigOnly()) log.info( "TriggerFlags: doL1Topo: %s, doLVL1: %s, doLVL2: %s, doEF: %s, doHLT: %s, doMT: %s", TF.doL1Topo(), TF.doLVL1(), TF.doLVL2(), TF.doEF(), TF.doHLT(), TF.doMT()) # RDOtoRDOTrigger MT temporarily coded in the transform skeleton, so skip here if TF.doMT() and rec.readRDO() and rec.doWriteRDO(): log.info("Nothing happens in TriggerGetter for RDOtoRDOTrigger MT") return True else: #GenerateMenu imports slice flags, which are Menu/MenuMT dependent from TriggerMenu.menu.GenerateMenu import GenerateMenu willGenerateMenu = recAlgs.doTrigger() and ( TF.doLVL1() or TF.doLVL2() or TF.doEF() or TF.doHLT()) and not TF.doTriggerConfigOnly() willRunTriggerConfigGetter = recAlgs.doTrigger() or rec.doTrigger( ) or TF.doTriggerConfigOnly() willRunLVL1SimulationGetter = recAlgs.doTrigger( ) and not TF.doTriggerConfigOnly() willRunHLTSimulationGetter = willRunLVL1SimulationGetter and ( TF.doLVL2() or TF.doEF() or TF.doHLT()) log.info( "Will run: %s%s%s%s", "GenerateMenu " if willGenerateMenu else "", "TriggerConfigGetter " if willRunTriggerConfigGetter else "", "LVL1SimulationGetter " if willRunLVL1SimulationGetter else "", "HLTSimulationGetter " if willRunHLTSimulationGetter else "") log.info( "Will not run: %s%s%s%s", "GenerateMenu " if not willGenerateMenu else "", "TriggerConfigGetter " if not willRunTriggerConfigGetter else "", "LVL1SimulationGetter " if not willRunLVL1SimulationGetter else "", "HLTSimulationGetter " if not willRunHLTSimulationGetter else "") if recAlgs.doTrigger(): if ((TF.doLVL1() or TF.doLVL2() or TF.doEF() or TF.doHLT()) and not TF.doTriggerConfigOnly()): log.info("generating menu") # trigger menu files generation g = GenerateMenu() g.generate() # after the menu xml file has been created or the TriggerDB access is configured, # the COOL/SQlite db can be written # TB this needs to be optimized -- we do not need ti always but only when AOD or ESD are created if recAlgs.doTrigger() or rec.doTrigger() or TF.doTriggerConfigOnly(): # setup configuration services from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() # noqa: F841 from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter theConfCOOLWriter.writeConf2COOL() # preconfigure TrigDecisionTool from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool from AthenaCommon.AppMgr import ToolSvc ToolSvc += Trig__TrigDecisionTool("TrigDecisionTool") from PyUtils.MetaReaderPeekerFull import metadata if "metadata_items" in metadata and any( ('TriggerMenu' in key) for key in metadata["metadata_items"].keys()): # Use xAOD configuration. from AthenaCommon.AppMgr import ServiceMgr as svcMgr if not hasattr(svcMgr, 'xAODConfigSvc'): from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODConfigSvc svcMgr += TrigConf__xAODConfigSvc('xAODConfigSvc') ToolSvc += Trig__TrigDecisionTool("TrigDecisionTool") ToolSvc.TrigDecisionTool.TrigConfigSvc = svcMgr.xAODConfigSvc else: # Use TrigConfigSvc ToolSvc.TrigDecisionTool.TrigConfigSvc = "TrigConf::TrigConfigSvc/TrigConfigSvc" from TrigEDMConfig.TriggerEDM import EDMLibraries ToolSvc.TrigDecisionTool.Navigation.Dlls = [ e for e in EDMLibraries if 'TPCnv' not in e ] # actuall trigger simulation running if recAlgs.doTrigger() and not TF.doTriggerConfigOnly(): # setup Lvl1 # initialize LVL1ConfigSvc log.info("configuring lvl1") from TriggerJobOpts.Lvl1TriggerGetter import Lvl1SimulationGetter lvl1 = Lvl1SimulationGetter() # noqa: F841 if TF.doTransientByteStream() or ( jobproperties.Global.InputFormat() != 'bytestream' and (TF.doLVL2() or TF.doEF() or TF.doHLT())): # Transient BS construction and intialization from ByteStreamCnvSvc import WriteByteStream StreamBS = WriteByteStream.getStream("Transient", "StreamBS") StreamBS.ItemList += [ "DataVector<LVL1::TriggerTower>#TriggerTowers" ] StreamBS.ItemList += ["TRT_RDO_Container#TRT_RDOs"] StreamBS.ItemList += ["SCT_RDO_Container#SCT_RDOs"] StreamBS.ItemList += ["PixelRDO_Container#PixelRDOs"] # StreamBS.ItemList +=["LArRawChannelContainer#*"] StreamBS.ItemList += ["2721#*"] # StreamBS.ItemList +=["TileRawChannelContainer#*"] StreamBS.ItemList += ["2927#*"] StreamBS.ItemList += [ "2934#*" ] # added on request from: Arantxa Ruiz Martinez for TileRODMu # don't need Muons in transient BS # StreamBS.ItemList +=["MdtCsmContainer#*"] # StreamBS.ItemList +=["RpcPadContainer#*"] # StreamBS.ItemList +=["TgcRdoContainer#*"] # StreamBS.ItemList +=["CscRawDataContainer#*"] from AthenaCommon.Include import include # setup trans BS for the ID include("InDetRecExample/InDetRecCabling.py") # setup HLT # initialize HLT config svc log.info("TriggerFlags: doLVL2 %r", TF.doLVL2()) log.info("TriggerFlags: doEF %r", TF.doEF()) log.info("TriggerFlags: doHLT %r", TF.doHLT()) if TF.doLVL2() or TF.doEF() or TF.doHLT(): log.info("configuring hlt") from TriggerJobOpts.HLTTriggerGetter import HLTSimulationGetter hlt = HLTSimulationGetter(g) # noqa: F841 else: from RegionSelector.RegSelSvcDefault import RegSelSvcDefault from AthenaCommon.AppMgr import ServiceMgr ServiceMgr += RegSelSvcDefault() ServiceMgr.RegSelSvc.enablePixel = False ServiceMgr.RegSelSvc.enableSCT = False # prepare result making of L1 from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter hltouput = Lvl1ResultBuilderGetter() # prepare result making of HLT if TF.doLVL2() or TF.doEF() or TF.doHLT() or (recAlgs.doTrigger() and TF.readBS()): from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter hltouput = HLTTriggerResultGetter() # noqa: F841 return True
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 'doLVL2' in dir(): TriggerFlags.doLVL2 = bool(doLVL2) if 'doEF' in dir(): TriggerFlags.doEF = bool(doEF) # To extract the Trigger configuration if "doDBConfig" in dir(): TriggerFlags.Online.doDBConfig = bool(doDBConfig) del doDBConfig if "trigBase" in dir(): TriggerFlags.Online.doDBConfigBaseName = trigBase del trigBase # Short hand notation (only use them in *this* file) doLVL2 = TriggerFlags.doLVL2() doEF = TriggerFlags.doEF() # List of all slices allSlices = [ 'testElectron', 'testPhoton', 'testMuon', 'testTau', 'testJet', 'testBjet', 'testMET', 'testBPhysics', 'testMinbias', 'testCombined', 'testAll', 'test_e10', 'test_g10', 'test_mu', 'test_e10_ID', 'test_mu_noID_noCalo', 'test_mu_noCalo', 'test_mu_IDTRT_noCalo', 'test_mu_noIdScan', 'test_mu_noIdScan_noCalo', 'testCosmicEgamma' ] # List of default slices if no flags given #defaultSlices = ['testCosmicEgamma'] defaultSlices = ['testAll'] #defaultSlices = ['testElectron','testPhoton','testTau','testJet','testBjet','testMinbias'] #defaultSlices = ['testMET']
# This jobO should not be included more than once: include.block("TrigCost3PDMaker/TrigEBWeightD3PDMaker_prodJobOFragment.py") from AthenaCommon.Logging import logging TrigEBWeightD3PDStream_msg = logging.getLogger( 'TrigEBWeightD3PDMaker_prodJobOFragment') costConfigL2 = False costConfigEF = False costConfigHLT = False if ('costD3PD_doL2' in dir() or 'costD3PD_doEF' in dir() or 'costD3PD_doHLT' in dir()): TrigEBWeightD3PDStream_msg.info("Configuring via cosD3PD flags") if ('costD3PD_doL2' in dir() and bool(costD3PD_doL2) == True): costConfigL2 = True if ('costD3PD_doEF' in dir() and bool(costD3PD_doEF) == True): costConfigEF = True if ('costD3PD_doHLT' in dir() and bool(costD3PD_doHLT) == True): costConfigHLT = True else: TrigEBWeightD3PDStream_msg.info("Configuring via TriggerFlags") from TriggerJobOpts.TriggerFlags import TriggerFlags if TriggerFlags.doLVL2(): costConfigL2 = True if TriggerFlags.doEF(): costConfigEF = True if TriggerFlags.doHLT(): costConfigHLT = True from TrigCostD3PDMaker.addTrigCostData import addTrigCostData addTrigCostData("EBWEIGHT", "trig_ebweight.root", costConfigL2, costConfigEF, costConfigHLT)
include( "InDetRecExample/InDetRecCabling.py" ) if TriggerFlags.doCalo(): if globalflags.DataSource()=='data': include("TrigT2CaloCommon/CaloCellMasking.py") from CaloTools.CaloToolsConf import CaloCompactCellTool svcMgr.ToolSvc += CaloCompactCellTool() if TriggerFlags.doMuon(): # load services needed for converters import MuonCnvExample.MuonCablingConfig import MuonRecExample.MuonReadCalib if (TriggerFlags.doEF() or TriggerFlags.doHLT()) and 'forceMuonDataPrep' in dir(): if (TriggerFlags.MuonSlice.doEFRoIDrivenAccess()): include("MuonRdoToPrepData/CscRdoToCscPrepData_jobOptions.py") else: include( "MuonRdoToPrepData/MuonRdoToMuonPrepData_jobOptions.py" ) if DetFlags.makeRIO.CSC_on(): include( "CscClusterization/CscThresholdClusterizationOptions.py" ) if globalflags.InputFormat()=='pool': include( "MuonByteStreamCnvTest/jobOptions_MuonRDOToDigit.py" ) include ("MuonRecExample/MuonRecLoadTools.py") # this is to limit messags when running with -s from AthenaCommon.Include import excludeTracePattern excludeTracePattern.append("*/TriggerMenu/menu/TriggerPythonConfig.py")
svcMgr.HLTConfigSvc.DBSMKey = TriggerFlags.triggerDbKeys()[0] svcMgr.HLTConfigSvc.DBHLTPSKey = TriggerFlags.triggerDbKeys()[2] for n, svc in _sl.items(): log.info("Service %s %r" % (n, dir(svc))) from TriggerJobOpts.Lvl1TriggerGetter import Lvl1SimulationGetter lvl1 = Lvl1SimulationGetter() from TriggerJobOpts.HLTTriggerGetter import HLTSimulationGetter hlt = HLTSimulationGetter() rng = getattr(ToolSvc, 'HLT::RandomScaler') rng.useEventSeed = True #EF gets an extra seed "hash-offset" of 1 to make it independent of L2 rng.config(seed=int(TriggerFlags.doEF()), luxury=2) ### End of the mess..... ############################### # Must make sure that no OutStream's have been declared theApp.OutStream = [] # Enable Aditors (i.e. AlgContextAuditor to get algorithm stack in CoreDumpSvc) theApp.AuditAlgorithms = True #------------------------------------------------------------------------------- ######################################## # # POST CONFIGURE RERUNNING OF LVL1
SCT_ConditionsSetup.createTool() TRT_ConditionsSetup.config(useDCS=False, onlineMode=True, prefix='') TRT_ConditionsSetup.lock() TRT_ConditionsSetup.createSvc() include("InDetRecExample/InDetRecCabling.py") if TriggerFlags.doCalo(): if globalflags.DataSource() == 'data': include("TrigT2CaloCommon/CaloCellMasking.py") if TriggerFlags.doMuon(): # load services needed for converters import MuonCnvExample.MuonCablingConfig # noqa: F401 configuration by import, old Run-2 job options import MuonRecExample.MuonReadCalib # noqa: F401 configuration by import, old Run-2 job options if (TriggerFlags.doEF() or TriggerFlags.doHLT()) and 'forceMuonDataPrep' in dir(): if (TriggerFlags.MuonSlice.doEFRoIDrivenAccess()): include("MuonRdoToPrepData/CscRdoToCscPrepData_jobOptions.py") else: include("MuonRdoToPrepData/MuonRdoToMuonPrepData_jobOptions.py") if DetFlags.makeRIO.CSC_on(): include("CscClusterization/CscThresholdClusterizationOptions.py") if globalflags.InputFormat() == 'pool': include("MuonByteStreamCnvTest/jobOptions_MuonRDOToDigit.py") include("MuonRecExample/MuonRecLoadTools.py") # this is to limit messags when running with -s from AthenaCommon.Include import excludeTracePattern
def __init__(self, seqName="Tau", type="tau", seqType="InsideOut"): """ @param[in] seqName which enters into the sequence name inbetween algorithmName_seqName_EFID can be freely modified @param[in] type which is a slice name and is used to set up slice specific variables @param[in] seqType the type of sequence - it can be one of InsideOut, OutsideIn, TRTOnly, Combined,.... """ #print "TrigEFIDSequence seqName=%s type=%s seqType=%s" % (seqName,type,seqType) algos = [] from TrigInDetConf.TrigInDetSequence import vertexXAODCnvNeeded runvtxxaodcnv = vertexXAODCnvNeeded() if seqType == "InsideOut": algos = [ ("PixelClustering", ""), ("SCTClustering", ""), ("TRTDriftCircleMaker", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("SiTrigTrackFinder", ""), ("TrigAmbiguitySolver", ""), ("TRTTrackExtAlg", ""), ("TrigExtProcessor", ""), ("InDetTrigTrackSlimmer", ""), ("InDetTrigTrackingxAODCnv", ""), # ("InDetTrigDetailedTrackTruthMaker",""), ("TrigVxPrimary", ""), # ("InDetTrigParticleCreation",""), # ("InDetTrigTrackParticleTruthMaker",""), ] if runvtxxaodcnv: algos += [("InDetTrigVertexxAODCnv", "")] if type == "minBias" or type == "minBias400": algos = [ ("PixelClustering", ""), ("SCTClustering", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("SiTrigTrackFinder", ""), ("TrigAmbiguitySolver", ""), ("InDetTrigTrackSlimmer", ""), ("InDetTrigTrackingxAODCnv", ""), ("TrigVxPrimary", ""), # ("InDetTrigParticleCreation",""), ] if runvtxxaodcnv: algos += [("InDetTrigVertexxAODCnv", "")] elif type == "bjet": #from InDetTrigVxSecondary.InDetTrigVxSecondary_LoadTools import TrigVxSecondary_EF #algos += [("TrigVxSecondary","")] algos = [ ("PixelClustering", ""), ("SCTClustering", ""), ("TRTDriftCircleMaker", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("SiTrigTrackFinder", ""), ("TrigAmbiguitySolver", ""), ("TRTTrackExtAlg", ""), ("TrigExtProcessor", ""), ("InDetTrigTrackSlimmer", ""), ("InDetTrigTrackingxAODCnv", ""), ("InDetTrigDetailedTrackTruthMaker", ""), ("TrigVxPrimary", ""), # ("InDetTrigParticleCreation",""), ("InDetTrigTrackParticleTruthMaker", "") ] if runvtxxaodcnv: algos += [("InDetTrigVertexxAODCnv", "")] elif seqType == "InsideOutTrk": algos = [("PixelClustering", ""), ("SCTClustering", ""), ("TRTDriftCircleMaker", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("SiTrigTrackFinder", ""), ("TrigAmbiguitySolver", ""), ("TRTTrackExtAlg", ""), ("TrigExtProcessor", ""), ("InDetTrigTrackSlimmer", ""), ("InDetTrigTrackingxAODCnv", ""), ("InDetTrigDetailedTrackTruthMaker", "")] elif seqType == "Vtx": algos = [("TrigVxPrimary", "")] if type == "bjet": algos = [("TrigVxPrimaryAllTE", "")] if runvtxxaodcnv: algos += [("InDetTrigVertexxAODCnv", "")] elif seqType == "InsideOutPost": algos = [ #("InDetTrigParticleCreation",""), ("InDetTrigTrackingxAODCnv", ""), ("InDetTrigTrackParticleTruthMaker", "") ] elif seqType == "InsideOutNoTRT": a1 = [ ("PixelClustering", ""), ("SCTClustering", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("SiTrigTrackFinder", ""), ("TrigAmbiguitySolver", ""), ("InDetTrigTrackSlimmer", ""), ("InDetTrigTrackingxAODCnv", ""), ("InDetTrigDetailedTrackTruthMaker", ""), ] av = [("TrigVxPrimary", "")] if runvtxxaodcnv: av += [("InDetTrigVertexxAODCnv", "")] a2 = [ #("InDetTrigParticleCreation",""), ("InDetTrigTrackParticleTruthMaker", "") ] if type == "heavyIon" or type == "heavyIonFS": algos = a1 + a2 else: algos = a1 + av + a2 elif seqType == "InsideOutLowPt": algos = [ ("PixelClustering", ""), ("SCTClustering", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("SiTrigTrackFinder", ""), ("TrigAmbiguitySolver", ""), ("InDetTrigTrackPRD_Association", ""), ("SiTrigSpacePointFinderLowPt", ""), ("SiTrigTrackFinderLowPt", ""), ("TrigAmbiguitySolverLowPt", ""), ("SimpleTrigTrackCollMerger", ""), ("InDetTrigTrackSlimmer", ""), ("InDetTrigTrackingxAODCnv", ""), ("TrigVxPrimary", ""), #("InDetTrigParticleCreation",""), ] if runvtxxaodcnv: algos += [("InDetTrigVertexxAODCnv", "")] elif seqType == "OutsideIn": algos = [ ("PixelClustering", ""), ("SCTClustering", ""), ("TRTDriftCircleMaker", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("TRT_TrigTrackSegmentsFinder", "InDetTrigTRT_TrackSegmentsFinder_%s_EFID"), ("TRT_TrigSeededTrackFinder", "InDetTrigTRT_SeededTrackFinder_%s_EFID"), ("TRTSeededTrigAmbiguitySolver", ""), ("InDetTrigTrackSlimmer", ""), ("InDetTrigTrackingxAODCnv", ""), ("InDetTrigDetailedTrackTruthMaker", ""), #("InDetTrigParticleCreation",""), ("InDetTrigTrackParticleTruthMaker", "") ] elif seqType == "TRTOnly": algos = [ ("TRTDriftCircleMaker", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("TRT_TrigTrackSegmentsFinder", "InDetTrigTRT_TrackSegmentsFinder_%s_EFID"), ("InDetTrigTrackPRD_Association", "InDetTrigTRTStandalonePRD_Association_%s_EFID"), ("TRT_TrigStandaloneTrackFinder", "InDetTrigTRT_StandaloneTrackFinder_%s_EFID"), ("InDetTrigTrackSlimmer", "InDetTrigTrackSlimmerTRTOnly_%s_EFID"), ("InDetTrigTrackingxAODCnv", "InDetTrigTrackingxAODCnvTRTOnly_%s_EFID"), ("InDetTrigDetailedTrackTruthMaker", "InDetTrigDetailedTrackTruthMakerTRTOnly_%s_EFID"), ("TrigVxPrimary", "TrigVxPrimaryTRTOnly_%s_EFID"), #("InDetTrigParticleCreation", "InDetTrigParticleCreationTRTOnly_%s_EFID"), ("InDetTrigTrackParticleTruthMaker", "InDetTrigTrackParticleTruthMakerTRTOnly_%s_EFID") ] if runvtxxaodcnv: algos += [("InDetTrigVertexxAODCnv", "InDetTrigVertexxAODCnvTRTOnly_%s_EFID")] elif seqType == "Combined": algos = [ ("PixelClustering", ""), ("SCTClustering", ""), ("TRTDriftCircleMaker", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("SiTrigTrackFinder", ""), ("TrigAmbiguitySolver", ""), ("TRTTrackExtAlg", ""), ("TrigExtProcessor", ""), ("InDetTrigTrackPRD_Association", "InDetTrigSegmentPRD_Association_%s_EFID"), ("TRT_TrigTrackSegmentsFinder", "InDetTrigTRT_TrackSegmentsFinderCombined_%s_EFID"), ("TRT_TrigSeededTrackFinder", "InDetTrigTRT_SeededTrackFinder_%s_EFID"), ("TRTSeededTrigAmbiguitySolver", "TRTSeededTrigAmbiguitySolver_%s_EFID"), ("InDetTrigTrackPRD_Association", "InDetTrigTRTOnlyPRD_Association_%s_EFID"), ("TRT_TrigStandaloneTrackFinder", "InDetTrigTRT_StandaloneTrackFinderCombined_%s_EFID"), ("TrkTrigTrackCollectionMerger", "TrigTrackCollectionMerger_%s_EFID"), ("InDetTrigTrackSlimmer", "InDetTrigTrackSlimmerCombined_%s_EFID"), ("InDetTrigTrackingxAODCnv", "InDetTrigTrackingxAODCnvCombined_%s_EFID"), ("InDetTrigDetailedTrackTruthMaker", "InDetTrigDetailedTrackTruthMakerCombined_%s_EFID"), #("InDetTrigParticleCreation", "InDetTrigParticleCreationCombined_%s_EFID"), ("InDetTrigTrackParticleTruthMaker", "InDetTrigTrackParticleTruthMakerCombined_%s_EFID") ] elif seqType == "CombinedWithConversions": algos = [ ("PixelClustering", ""), ("SCTClustering", ""), ("TRTDriftCircleMaker", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("SiTrigTrackFinder", ""), ("TrigAmbiguitySolver", ""), ("TRTTrackExtAlg", ""), ("TrigExtProcessor", ""), ("InDetTrigTrackPRD_Association", "InDetTrigSegmentPRD_Association_%s_EFID"), ("TRT_TrigTrackSegmentsFinder", "InDetTrigTRT_TrackSegmentsFinderCombined_%s_EFID"), ("TRT_TrigSeededTrackFinder", "InDetTrigTRT_SeededTrackFinder_%s_EFID"), ("TRTSeededTrigAmbiguitySolver", "TRTSeededTrigAmbiguitySolver_%s_EFID"), ("InDetTrigTrackPRD_Association", "InDetTrigTRTOnlyPRD_Association_%s_EFID"), ("TRT_TrigStandaloneTrackFinder", "InDetTrigTRT_StandaloneTrackFinderCombined_%s_EFID"), ("TrkTrigTrackCollectionMerger", "TrigTrackCollectionMerger_%s_EFID"), ("InDetTrigTrackSlimmer", "InDetTrigTrackSlimmerCombined_%s_EFID"), ("InDetTrigTrackingxAODCnv", "InDetTrigTrackingxAODCnvCombined_%s_EFID"), ("InDetTrigDetailedTrackTruthMaker", "InDetTrigDetailedTrackTruthMakerCombined_%s_EFID"), #("InDetTrigParticleCreation", "InDetTrigParticleCreationCombined_%s_EFID"), ("InDetTrigTrackParticleTruthMaker", "InDetTrigTrackParticleTruthMakerCombined_%s_EFID"), ("InDetTrigConversionFinder", "InDetTrigConversionFinderCombined_%s_EFID") ] elif seqType == "InsideOutAndTRTOnly": algos = [ ("PixelClustering", ""), ("SCTClustering", ""), ("TRTDriftCircleMaker", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("SiTrigSpacePointFinder", ""), ("SiTrigTrackFinder", ""), ("TrigAmbiguitySolver", ""), ("TRTTrackExtAlg", ""), ("TrigExtProcessor", ""), ("InDetTrigTrackParticleTruthMaker", ""), ("TRT_TrigTrackSegmentsFinder", "InDetTrigTRT_TrackSegmentsFinder_%s_EFID"), ("TRT_TrigStandaloneTrackFinder", "InDetTrigTRT_StandaloneTrackFinder_%s_EFID"), ("TrkTrigTrackCollectionMerger", "TrigTrackCollectionMergerIOTRT_%s_EFID"), ("InDetTrigTrackSlimmer", "InDetTrigTrackSlimmerIOTRT_%s_EFID"), ("InDetTrigTrackingxAODCnv", "InDetTrigTrackingxAODCnvIOTRT_%s_EFID"), ("InDetTrigDetailedTrackTruthMaker", "InDetTrigDetailedTrackTruthMakerIOTRT_%s_EFID"), #("InDetTrigParticleCreation", "InDetTrigParticleCreationIOTRT_%s_EFID"), ("InDetTrigTrackParticleTruthMaker", "InDetTrigTrackParticleTruthMakerIOTRT_%s_EFID"), ("TrigVxPrimary", ""), ] if runvtxxaodcnv: algos += [("InDetTrigVertexxAODCnv", "InDetTrigVertexxAODCnvIOTRT_%s_EFID")] elif seqType == "DataPrep": algos = [ ("PixelClustering", "PixelClustering_%s_IDTrig"), ("SCTClustering", "SCTClustering_%s_IDTrig"), #("TRTDriftCircleMaker",""), ("SiTrigSpacePointFinder", "SiTrigSpacePointFinder_%s_IDTrig"), ] elif seqType == "SimpleTrackFinder": algos = [ #("SiTrigTrackFinder",""), ("SiTrigSimpleTrackFinder", ""), ] elif seqType == "InsideOutMerged": algos = [ #("SiTrigTrackSeededFinder",""), ("TrigAmbiguitySolver", ""), ("TRTDriftCircleMaker", ""), ("InDetTrigPRD_MultiTruthMaker", ""), ("TRTTrackExtAlg", ""), ("TrigExtProcessor", ""), ("InDetTrigTrackSlimmer", ""), ("InDetTrigTrackingxAODCnv", ""), ("InDetTrigDetailedTrackTruthMaker", ""), ("TrigVxPrimary", ""), #("InDetTrigParticleCreation",""), ("InDetTrigTrackParticleTruthMaker", ""), ] if runvtxxaodcnv: algos += [("InDetTrigVertexxAODCnv", "")] elif seqType == "StandAloneVtxAllTE": algos = [ ("TrigVxPrimaryAllTESG", ""), ] if runvtxxaodcnv: algos += [("InDetTrigVertexxAODCnv", "")] #remove truth algorithms if not InDetTrigFlags.doTruth(): import re for i in algos: if re.search('Truth', i[0]): algos.remove((i[0], i[1])) #create python code to be executed alglist = "algseq = [" for i in algos: #self.__algos__.append(i) algline = self._item_line(i[0], i[1], seqName, type, seqType) alglist += algline + ',' alglist += "]" #this should be avoided by a higher level steering # modify the sequence acoording to triggerflags from TriggerJobOpts.TriggerFlags import TriggerFlags if not (TriggerFlags.doEF() or TriggerFlags.doHLT()) or not TriggerFlags.doFEX(): from TrigSteeringTest.TrigSteeringTestConf import PESA__dummyAlgo as dummyAlgo_disabledByTriggerFlags_EFID dummyAlgEFID = dummyAlgo_disabledByTriggerFlags_EFID( "doEF_or_doFEX_False_no_EFID") alglist = 'algseq = [dummyAlgEFID]' algseq = [] try: exec alglist except: from sys import exc_info (a, reason, c) = exc_info() print reason log.error("Cannot create EFID sequence %s, leaving empty" % alglist) import traceback print traceback.format_exc() #raise Exception self.__sequence__ = algseq
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