if remove == 'ALL': signatures_all = slice.signatures.get_Value( ) # Save the chain definitions slice.signatures.set_Value([]) # Remove all chains else: slice.disableSignatures(remove) if s in addSignatures: add = addSignatures[s] slice.enableSignatures( [sig for sig in signatures_all if sig[0] in add]) log.info('Enabled ' + str(add) + ' in ' + s) from TriggerMenu.menu.GenerateMenu import GenerateMenu GenerateMenu.overwriteSignaturesWith(enableDisableChains) log.info("=============== Running slices: ===============") for s in slicesToRun: log.info(s) log.info("===============================================") #------------------------------------------------------------- # Setup trigger #------------------------------------------------------------- include("TriggerRelease/Trigger_topOptions_standalone.py") log = logging.getLogger('runHLT_standalone.py') # ---------------------------------------------------------------- # Number of events to be processed - for athena # ----------------------------------------------------------------
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
log.info("Using new TriggerMenu: %r" % useNewTM) except: useNewTM = False log.info( "Using old TriggerMenuPython since TriggerMenu.useNewTriggerMenu can't be imported" ) if useNewTM: from TriggerMenu.menu.GenerateMenu import GenerateMenu else: from TriggerMenuPython.GenerateMenu import GenerateMenu # flags for command-line input if ('sliceName' in dir()): if sliceName == 'egamma': GenerateMenu.overwriteSignaturesWith(egammaOnly) elif sliceName == 'muon': GenerateMenu.overwriteSignaturesWith(muonOnly) elif sliceName == 'jet': GenerateMenu.overwriteSignaturesWith(jetOnly) elif sliceName == 'bjet': GenerateMenu.overwriteSignaturesWith(bjetOnly) elif sliceName == 'bphysics': GenerateMenu.overwriteSignaturesWith(bphysicsOnly) elif sliceName == 'met': GenerateMenu.overwriteSignaturesWith(metOnly) elif sliceName == 'tau': GenerateMenu.overwriteSignaturesWith(tauOnly) elif sliceName == 'minbias': GenerateMenu.overwriteSignaturesWith(minbiasOnly) elif sliceName == 'minbiasEnhanced':
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") excludeTracePattern.append("*/TriggerMenu/menu/HltConfig.py") # trigger menu files generation log.info("generating menu") from TriggerMenu.menu.GenerateMenu import GenerateMenu import time g = GenerateMenu() t0 = time.time() g.generate() log.info('Trigger menu generation took %0.fs', time.time() - t0) log = logging.getLogger( 'Trigger_topOptions_standalone.py') # generate modifies the log # setup Lvl1 # initialize LVL1ConfigSvc log.info("configuring LVL1 (L1Topo and CTP)") from TriggerJobOpts.Lvl1TriggerOnlineGetter import Lvl1SimulationGetter lvl1 = Lvl1SimulationGetter() if globalflags.InputFormat() == 'pool': log.info("setting up transient BS")
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
#-------------end of temporary fix------------------- #override menu def ElectronOnly(): TriggerFlags.Slices_all_setOff() # Enable electron slice TriggerFlags.EgammaSlice.setAll() TriggerFlags.EgammaSlice.unsetCalo() TriggerFlags.Lvl1.items = TriggerFlags.Lvl1.items() + [ ] TriggerFlags.EgammaSlice.signatures = [ ['e28_lhtight_idperf', 'L1_EM24VHI', [], ['express'], ['RATE:IDMonitoring', 'BW:Egamma', 'BW:ID'],-1], ] from TriggerMenu.menu.GenerateMenu import GenerateMenu GenerateMenu.overwriteSignaturesWith(ElectronOnly) #----------------------------------------------------------- include("RecExCommon/RecExCommon_topOptions.py") #----------------------------------------------------------- #----------------------------------------------------------- include("TriggerTest/TriggerTestCommon.py") #-----------------------------------------------------------
TriggerFlags.triggerMenuSetup = triggerMenuVersion else: TriggerFlags.triggerMenuSetup = 'MC_pp_v7' TriggerFlags.doHLT=True from TriggerMenu.menu.GenerateMenu import GenerateMenu TriggerFlags.readHLTconfigFromXML=False TriggerFlags.readLVL1configFromXML=False #TriggerFlags.doMuon=False TriggerFlags.doHypo=False TriggerFlags.doTruth=True GenerateMenu.overwriteSignaturesWith(resetSigs) #------------------------------------------------------------- # End of setting flags #------------------------------------------------------------- include( "RecExCommon/RecExCommon_topOptions.py" ) TriggerFlags.abortOnConfigurationError=True Service ("StoreGateSvc" ).ActivateHistory=False Service( "RegSelSvc" ).enableCalo = False # disabling pixel barrel layer 1 for robustness test
try: from TriggerMenu import useNewTriggerMenu useNewTM = useNewTriggerMenu() log.info("Using new TriggerMenu: %r" % useNewTM) except: useNewTM = False log.info( "Using old TriggerMenuPython since TriggerMenu.useNewTriggerMenu can't be imported" ) if useNewTM: from TriggerMenu.menu.GenerateMenu import GenerateMenu else: from TriggerMenuPython.GenerateMenu import GenerateMenu GenerateMenu.overwriteSignaturesWith(L1Only) #----------------------------------------------------------- include("RecExCommon/RecExCommon_topOptions.py") #----------------------------------------------------------- #------------------------------------------------------------ include("TriggerTest/TriggerTestCommon.py") #------------------------------------------------------------ #print AlgSequence() #print ServiceMgr print DetFlags print TriggerFlags
'HLT_e26_lhtight_nod0_ringer_ivarloose', 'HLT_e28_lhtight_nod0_iloose', ] triggerList = list(set(monitoringTP_electron + triggerTags)) #Protection to duplicate chains current = TriggerFlags.EgammaSlice.signatures.get_Value() TriggerFlags.Slices_all_setOff() #Searching for: "Registered chain" into athena log file to check the chains TriggerFlags.EgammaSlice.signatures = [ trig for trig in current if 'HLT_' + trig[0] in triggerList ] from TriggerMenu.menu.GenerateMenu import GenerateMenu GenerateMenu.overwriteSignaturesWith(egammaOnly) ######################################################################### ################## MAIN REC JOBOPTION INCLUDE: ########################## ######################################################################### include("RecExCommon/RecExCommon_topOptions.py") ######################################################################### ########################### Ringer!!! ################################## ######################################################################### if doCaloRinger: include('CaloRingerAlgs/CaloRinger_reconstruction.py') ######################################################################### ########################### POST-INCLUDE ################################ #########################################################################
from TriggerJobOpts.TriggerFlags import TriggerFlags TriggerFlags.triggerMenuSetup = 'MC_pp_v6' TriggerFlags.L1PrescaleSet = 'None' TriggerFlags.HLTPrescaleSet = 'None' def modifySignatures(): TriggerFlags.JetSlice.signatures = TriggerFlags.JetSlice.signatures() + [[ '2j250_j150', 'L1_J100', [], ["Main"], ['RATE:MultiJet', 'BW:Jet'], -1 ]] from TriggerMenu.menu.GenerateMenu import GenerateMenu GenerateMenu.overwriteSignaturesWith(modifySignatures)