def RpcPrepDataProviderTool(name="RpcPrepDataProviderTool", **kwargs): global source # setup dependencies which are not yet in C++ import MuonCnvExample.MuonCablingConfig # If we run trigger from BS, then the RDO to PRD tools need to automatically run BS to RDO tools kwargs.setdefault("useBStoRdoTool", DetFlags.readRDOBS.RPC_on() and recAlgs.doTrigger()) kwargs.setdefault("RawDataProviderTool", "RpcRawDataProviderTool") ### TODO: in C++ do not retrieve tool if useBStoRdoTool==False ## if not kwargs["useBStoRdoTool"]: ## kwargs["RawDataProviderTool"] = None # empty tool if source == 'data': kwargs["processingData"] = True kwargs["reduceCablingOverlap"] = True kwargs["produceRpcCoinDatafromTriggerWords"] = True kwargs["overlap_timeTolerance"] = 1000 kwargs["solvePhiAmbiguities"] = True kwargs["etaphi_coincidenceTime"] = 1000 elif source == 'geant4': pass #kwargs["etaphi_coincidenceTime"] = 100 else: raise ValueError("RpcPrepDataProviderTool: unsupported dataSource %s" % source) from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataTool return Muon__RpcRdoToPrepDataTool(name, **kwargs)
def CscPrepDataProviderTool(name="CscPrepDataProviderTool", **kwargs): # setup dependencies which are not yet in C++ import MuonCnvExample.MuonCablingConfig # If we run trigger from BS, then the RDO to PRD tools need to automatically run BS to RDO tools kwargs.setdefault("useBStoRdoTool", DetFlags.readRDOBS.CSC_on() and recAlgs.doTrigger()) kwargs.setdefault("RawDataProviderTool", "CscRawDataProviderTool") ### TODO: in C++ do not retrieve tool if useBStoRdoTool==False ## if not kwargs["useBStoRdoTool"]: ## kwargs["RawDataProviderTool"] = None # empty tool from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscRdoToCscPrepDataTool return Muon__CscRdoToCscPrepDataTool(name, **kwargs)
def BunchCrossingConfProvider(type=""): # Get ourselves a logger: from AthenaCommon.Logging import logging __logger = logging.getLogger("BunchCrossingConfProvider") # If the user requested some instance directly: if type != "": if type == "TrigConf": __logger.info("Forcing the usage of TrigConfBunchCrossingTool") from TrigBunchCrossingTool.BunchCrossingTool import TrigConfBunchCrossingTool return TrigConfBunchCrossingTool() elif type == "LHC": __logger.info("Forcing the usage of LHCBunchCrossingTool") from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool return LHCBunchCrossingTool() elif type == "MC": from TrigBunchCrossingTool.BunchCrossingTool import MCBunchCrossingTool __logger.info("Forcing the usage of MCBunchCrossingTool") return MCBunchCrossingTool() else: __logger.warning("Type = " + type + " not recognized") __logger.warning("Will select tool type based on global flags") # Decide which tool to use based on the global flags: from AthenaCommon.GlobalFlags import globalflags if globalflags.isOverlay(): __logger.info("Selecting LHCBunchCrossingTool for overlay job") from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool return LHCBunchCrossingTool() if globalflags.DataSource() == "data": from RecExConfig.RecFlags import rec from RecExConfig.RecAlgsFlags import recAlgs from TriggerJobOpts.TriggerFlags import TriggerFlags if rec.doTrigger() or TriggerFlags.doTriggerConfigOnly( ) or recAlgs.doTrigger(): from TrigBunchCrossingTool.BunchCrossingTool import TrigConfBunchCrossingTool __logger.info("Selecting TrigConfBunchCrossingTool for this job") return TrigConfBunchCrossingTool() else: __logger.info( "Trigger turned off, selecting LHCBunchCrossingTool for this job" ) from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool return LHCBunchCrossingTool() else: __logger.info("Selecting MCBunchCrossingTool for this job") from TrigBunchCrossingTool.BunchCrossingTool import MCBunchCrossingTool return MCBunchCrossingTool()
def BunchCrossingConfProvider( type = "" ): # Get ourselves a logger: from AthenaCommon.Logging import logging __logger = logging.getLogger( "BunchCrossingConfProvider" ) # If the user requested some instance directly: if type != "": if type == "TrigConf": __logger.info( "Forcing the usage of TrigConfBunchCrossingTool" ) from TrigBunchCrossingTool.BunchCrossingTool import TrigConfBunchCrossingTool return TrigConfBunchCrossingTool() elif type == "LHC": __logger.info( "Forcing the usage of LHCBunchCrossingTool" ) from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool return LHCBunchCrossingTool() elif type == "MC": from TrigBunchCrossingTool.BunchCrossingTool import MCBunchCrossingTool __logger.info( "Forcing the usage of MCBunchCrossingTool" ) return MCBunchCrossingTool() else: __logger.warning( "Type = " + type + " not recognized" ) __logger.warning( "Will select tool type based on global flags" ) # Decide which tool to use based on the global flags: from AthenaCommon.GlobalFlags import globalflags if globalflags.isOverlay(): __logger.info( "Selecting LHCBunchCrossingTool for overlay job" ) from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool return LHCBunchCrossingTool() if globalflags.DataSource() == "data": from RecExConfig.RecFlags import rec from RecExConfig.RecAlgsFlags import recAlgs from TriggerJobOpts.TriggerFlags import TriggerFlags if rec.doTrigger() or TriggerFlags.doTriggerConfigOnly() or recAlgs.doTrigger(): from TrigBunchCrossingTool.BunchCrossingTool import TrigConfBunchCrossingTool __logger.info( "Selecting TrigConfBunchCrossingTool for this job" ) return TrigConfBunchCrossingTool() else: __logger.info( "Trigger turned off, selecting LHCBunchCrossingTool for this job" ) from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool return LHCBunchCrossingTool() else: __logger.info( "Selecting MCBunchCrossingTool for this job" ) from TrigBunchCrossingTool.BunchCrossingTool import MCBunchCrossingTool return MCBunchCrossingTool()
def sync_Trigger2Reco(): from AthenaCommon.Include import include from RecExConfig.RecAlgsFlags import recAlgs from AthenaCommon.GlobalFlags import globalflags from RecExConfig.RecFlags import rec if recAlgs.doTrigger() and rec.readRDO( ) and not globalflags.InputFormat() == 'bytestream': include("TriggerJobOpts/TransientBS_DetFlags.py") if globalflags.InputFormat() == 'bytestream': TriggerFlags.readBS = True TriggerFlags.doLVL1 = False TriggerFlags.doLVL2 = False TriggerFlags.doEF = False if rec.doWriteBS(): TriggerFlags.writeBS = True
def configure(self): # from AthenaServices.AthenaServicesConf import AthenaOutputStream # from AthenaCommon.AppMgr import ServiceMgr # from AthenaCommon.AlgSequence import AlgSequence # topSequence = AlgSequence() # ### the following was gotten from the LVL1TriggerGetter not sure if needed when not simulation # if not (TriggerFlags.fakeLVL1() or TriggerFlags.doLVL1()): # DetFlags.readRIOPool.LVL1_setOn() # # ***Temp : needed to enable required combination of thresholds # # mu4,mu6,mu10,mu11,mu20,mu40 # # Will be replaced by config. from Lvl1ConfigSvc # if hasattr(ServiceMgr,'RPCcablingSimSvc'): # ServiceMgr.RPCcablingSimSvc.HackFor1031 = True if jobproperties.Global.InputFormat() == 'bytestream': theApp.Dlls += ["TrigT1Calo"] include("TrigT1CaloByteStream/ReadLVL1CaloBS_jobOptions.py") # ### from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() if recAlgs.doTrigger(): if (rec.doESD() or rec.doAOD()) and (not(rec.readAOD() or \ rec.readESD())): if jobproperties.Global.InputFormat() == 'bytestream': # Decode ROIB::RoIBResult from ByteStream from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1ByteStreamDecodersRecExSetup L1ByteStreamDecodersRecExSetup() from AnalysisTriggerAlgs.AnalysisTriggerAlgsConfig import \ RoIBResultToAOD topSequence += RoIBResultToAOD("RoIBResultToxAOD") pass pass from TrigEDMConfig.TriggerEDM import getLvl1ESDList objKeyStore.addManyTypesStreamESD(getLvl1ESDList()) from TrigEDMConfig.TriggerEDM import getLvl1AODList objKeyStore.addManyTypesStreamAOD(getLvl1AODList()) return True
def MdtPrepDataProviderTool(name="MdtPrepDataProviderTool", **kwargs): global source, include, getService # setup dependencies which are not yet in C++ import MuonCnvExample.MuonCablingConfig getService("MdtCalibrationSvc") include("AmdcAth/AmdcAth_jobOptions.py") # If we run trigger from BS, then the RDO to PRD tools need to automatically run BS to RDO tools kwargs.setdefault("useBStoRdoTool", DetFlags.readRDOBS.MDT_on() and recAlgs.doTrigger()) kwargs.setdefault("RawDataProviderTool", "MdtRawDataProviderTool") ### TODO: in C++ do not retrieve tool if useBStoRdoTool==False ## if not kwargs["useBStoRdoTool"]: ## kwargs["RawDataProviderTool"] = None # empty tool if source == 'data': kwargs.setdefault("UseTwin", True) from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import Muon__MdtRdoToPrepDataTool return Muon__MdtRdoToPrepDataTool(name, **kwargs)
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 __init__(self, name="RegSelSvcDefault"): # call base class constructor RegSelSvc.__init__(self, name="RegSelSvc") from AthenaCommon.Logging import logging mlog = logging.getLogger('RegSelSvc::__init__ ') mlog.info('entering') # z vertex range for old style methods and now propogation # even for ne style methods # old value - 168 # self.DeltaZ = 168 * mm # new value as of 03-08-2011 for the width LHC beam spot of 75mm self.DeltaZ = 225 * mm # Configure LUT creator tools pixTable = None sctTable = None trtTable = None larTable = None tileTable = None rpcTable = None mdtTable = None tgcTable = None cscTable = None ftkTable = None from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.DetFlags import DetFlags if DetFlags.detdescr.ID_on(): # if DetFlags.detdescr.ftk_on(): ### is the ftk properly integrated yet ??? from InDetRegionSelector.InDetRegionSelectorConf import FTK_RegionSelectorTable if DetFlags.detdescr.FTK_on(): ftkTable = FTK_RegionSelectorTable( name="FTK_RegionSelectorTable", ManagerName="", OutputFile="RoITableFTK.txt", PrintHashId=True, PrintTable=False) ToolSvc += ftkTable mlog.debug(ftkTable) if DetFlags.detdescr.pixel_on(): from InDetRegionSelector.InDetRegionSelectorConf import SiRegionSelectorTable pixTable = SiRegionSelectorTable( name="PixelRegionSelectorTable", ManagerName="Pixel", OutputFile="RoITablePixel.txt", PrintHashId=True, PrintTable=False) ToolSvc += pixTable mlog.debug(pixTable) if DetFlags.detdescr.SCT_on(): from InDetRegionSelector.InDetRegionSelectorConf import SiRegionSelectorTable sctTable = SiRegionSelectorTable( name="SCT_RegionSelectorTable", ManagerName="SCT", OutputFile="RoITableSCT.txt", PrintHashId=True, PrintTable=False) ToolSvc += sctTable mlog.debug(sctTable) if DetFlags.detdescr.TRT_on(): from InDetRegionSelector.InDetRegionSelectorConf import TRT_RegionSelectorTable trtTable = TRT_RegionSelectorTable( name="TRT_RegionSelectorTable", ManagerName="TRT", OutputFile="RoITableTRT.txt", PrintHashId=True, PrintTable=False) ToolSvc += trtTable mlog.debug(trtTable) if DetFlags.detdescr.Calo_on(): from LArRegionSelector.LArRegionSelectorConf import LArRegionSelectorTable larTable = LArRegionSelectorTable(name="LArRegionSelectorTable") ToolSvc += larTable mlog.debug(larTable) from TileRawUtils.TileRawUtilsConf import TileRegionSelectorTable tileTable = TileRegionSelectorTable(name="TileRegionSelectorTable") ToolSvc += tileTable mlog.debug(tileTable) if DetFlags.detdescr.Muon_on(): if DetFlags.detdescr.RPC_on(): from MuonRegionSelector.MuonRegionSelectorConf import RPC_RegionSelectorTable rpcTable = RPC_RegionSelectorTable( name="RPC_RegionSelectorTable") ToolSvc += rpcTable mlog.debug(rpcTable) if DetFlags.detdescr.MDT_on(): from MuonRegionSelector.MuonRegionSelectorConf import MDT_RegionSelectorTable mdtTable = MDT_RegionSelectorTable( name="MDT_RegionSelectorTable") ToolSvc += mdtTable mlog.debug(mdtTable) if DetFlags.detdescr.TGC_on(): from MuonRegionSelector.MuonRegionSelectorConf import TGC_RegionSelectorTable tgcTable = TGC_RegionSelectorTable( name="TGC_RegionSelectorTable") ToolSvc += tgcTable mlog.debug(tgcTable) if DetFlags.detdescr.CSC_on(): from MuonRegionSelector.MuonRegionSelectorConf import CSC_RegionSelectorTable cscTable = CSC_RegionSelectorTable( name="CSC_RegionSelectorTable") ToolSvc += cscTable mlog.debug(cscTable) self.PixelRegionLUT_CreatorTool = pixTable self.SCT_RegionLUT_CreatorTool = sctTable self.TRT_RegionLUT_CreatorTool = trtTable self.FTK_RegionLUT_CreatorTool = ftkTable self.LArRegionSelectorTable = larTable self.TileRegionSelectorTable = tileTable self.RPC_RegionLUT_CreatorTool = rpcTable self.MDT_RegionLUT_CreatorTool = mdtTable self.TGC_RegionLUT_CreatorTool = tgcTable self.CSC_RegionLUT_CreatorTool = cscTable # have some job options to *disable* robs and modules # but also have an *enable* list from OKS, so, first, # - OKS can *enable* robs, then # - it *disables* any robs from the rob list, then # - it *disables* any modules from the module lists. # so be careful !!! self.readSiROBListFromOKS = False self.DeleteSiRobList = [] self.DeletePixelHashList = [] self.DeleteSCTHashList = [] self.DeleteTRTHashList = [] # set geometry and detector flags based on global properties # now obtained by default from GeoModelSvc at C++ init. #from AthenaCommon.GlobalFlags import globalflags #self.GeometryLayout = globalflags.DetDescrVersion() if DetFlags.detdescr.ID_on(): self.enableID = True if DetFlags.detdescr.SCT_on(): self.enableSCT = True else: self.enableSCT = False if DetFlags.detdescr.pixel_on(): self.enablePixel = True else: self.enablePixel = False if DetFlags.detdescr.TRT_on(): self.enableTRT = True else: self.enableTRT = False if DetFlags.detdescr.FTK_on(): self.enableFTK = True else: self.enableFTK = False else: self.enableID = False if DetFlags.detdescr.Calo_on(): self.enableCalo = True else: self.enableCalo = False if DetFlags.detdescr.Muon_on(): self.enableMuon = True if DetFlags.detdescr.RPC_on(): self.enableRPC = True else: self.enableRPC = False if DetFlags.detdescr.MDT_on(): self.enableMDT = True else: self.enableMDT = False if DetFlags.detdescr.TGC_on(): self.enableTGC = True else: self.enableTGC = False if DetFlags.detdescr.CSC_on(): self.enableCSC = True else: self.enableCSC = False else: self.enableMuon = False # now check if the trigger is actually enabled and if not, disable eveything anyway. # so any non-trigger algorithm has to turn it on itself, and *also* has to check that # the relevant detector is actually enabled from RecExConfig.RecAlgsFlags import recAlgs if not recAlgs.doTrigger(): self.enableID = True self.enablePixel = False self.enableSCT = False self.enableTRT = False self.enableFTK = False self.enableCalo = False self.enableMuon = False
def configure(self): log = logging.getLogger("HLTTriggerResultGetter.py") from RecExConfig.ObjKeyStore import objKeyStore # set EDMDecodingVersion EDMDecodingVersion() # Set AODFULL for data unless it was set explicitly already if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource( ) == 'data': TriggerFlags.AODEDMSet = 'AODFULL' from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() log.info("BS unpacking (TF.readBS): %d", TriggerFlags.readBS()) if TriggerFlags.readBS(): if TriggerFlags.EDMDecodingVersion() <= 2: bs = ByteStreamUnpackGetterRun2() # noqa: F841 else: bs = ByteStreamUnpackGetter() # noqa: F841 xAODContainers = {} # if not recAlgs.doTrigger(): #only convert when running on old data if TriggerFlags.EDMDecodingVersion() == 1: xaodcnvrt = xAODConversionGetter() xAODContainers = xaodcnvrt.xaodlist if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly(): if TriggerFlags.EDMDecodingVersion() <= 2: tdt = TrigDecisionGetterRun2() # noqa: F841 else: tdt = TrigDecisionGetter() # noqa: F841 # Temporary hack to add Run-3 navigation to ESD and AOD if (rec.doESD() or rec.doAOD()) and TriggerFlags.EDMDecodingVersion() == 3: # The hack with wildcards is needed for BS->ESD because we don't know the exact keys # of HLT navigation containers before unpacking them from the BS event. objKeyStore._store['streamESD'].allowWildCard(True) objKeyStore._store['streamAOD'].allowWildCard(True) objKeyStore.addManyTypesStreamESD([ 'xAOD::TrigCompositeContainer#HLTNav*', 'xAOD::TrigCompositeAuxContainer#HLTNav*' ]) objKeyStore.addManyTypesStreamAOD([ 'xAOD::TrigCompositeContainer#HLTNav*', 'xAOD::TrigCompositeAuxContainer#HLTNav*' ]) # TrigJetRec additions if rec.doWriteESD(): objKeyStore.addStreamESD("JetKeyDescriptor", "JetKeyMap") objKeyStore.addStreamESD("JetMomentMap", "TrigJetRecMomentMap") if rec.doWriteAOD(): objKeyStore.addStreamAOD("JetKeyDescriptor", "JetKeyMap") objKeyStore.addStreamAOD("JetMomentMap", "TrigJetRecMomentMap") # ID truth if not rec.readESD() and (not rec.readAOD()) and TriggerFlags.doID() \ and rec.doTruth(): try: from TrigInDetTruthAlgs.TrigInDetTruthAlgsConfig import \ TrigIDTruthMaker topSequence += TrigIDTruthMaker() except Exception: log.warning("Couldn't set up the trigger ID truth maker") pass if rec.doESD() or rec.doAOD(): from TrigEDMConfig.TriggerEDM import getTrigIDTruthList objKeyStore.addManyTypesStreamESD( getTrigIDTruthList(TriggerFlags.ESDEDMSet())) objKeyStore.addManyTypesStreamAOD( getTrigIDTruthList(TriggerFlags.AODEDMSet())) if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData(): objKeyStore.addManyTypesStreamESD([ 'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData', 'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.' ]) objKeyStore.addManyTypesStreamAOD([ 'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData', 'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.' ]) log.debug( "HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data." ) if rec.doAOD() or rec.doWriteAOD(): # schedule the RoiDescriptorStore conversion # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" ) roiWriter = RoiWriter() # Add fictional input to ensure data dependency in AthenaMT roiWriter.ExtraInputs += [("TrigBSExtractionOutput", "StoreGateSvc+TrigBSExtractionOutput")] topSequence += roiWriter # write out the RoiDescriptorStores from TrigEDMConfig.TriggerEDMRun2 import TriggerRoiList objKeyStore.addManyTypesStreamAOD(TriggerRoiList) #Are we adding operational info objects in ESD? added = self._AddOPIToESD() if added: log.debug( "Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data." ) # ESD objects definitions _TriggerESDList = {} from TrigEDMConfig.TriggerEDM import getTriggerEDMList # we have to store xAOD containers in the root file, NOT AOD, # if the xAOD container list is not empty if (xAODContainers): _TriggerESDList.update(xAODContainers) else: _TriggerESDList.update( getTriggerEDMList(TriggerFlags.ESDEDMSet(), TriggerFlags.EDMDecodingVersion())) log.info( "ESD content set according to the ESDEDMSet flag: %s and EDM version %d", TriggerFlags.ESDEDMSet(), TriggerFlags.EDMDecodingVersion()) # AOD objects choice _TriggerAODList = {} #from TrigEDMConfig.TriggerEDM import getAODList _TriggerAODList.update( getTriggerEDMList(TriggerFlags.AODEDMSet(), TriggerFlags.EDMDecodingVersion())) log.info( "AOD content set according to the AODEDMSet flag: %s and EDM version %d", TriggerFlags.AODEDMSet(), TriggerFlags.EDMDecodingVersion()) log.debug("ESD EDM list: %s", _TriggerESDList) log.debug("AOD EDM list: %s", _TriggerAODList) # Highlight what is in AOD list but not in ESD list, as this can cause # the "different number of entries in branch" problem, when it is in the # AOD list but the empty container per event is not created # Just compares keys of dicts, which are the class names, not their string keys in StoreGate not_in = [ element for element in _TriggerAODList if element not in _TriggerESDList ] if (len(not_in) > 0): log.warning("In AOD list but not in ESD list: ") log.warning(not_in) else: log.info("AOD list is subset of ESD list - good.") def _addSlimming(stream, edm): from TrigNavTools.TrigNavToolsConfig import navigationThinningSvc edmlist = list(y.split('-')[0] for x in edm.values() for y in x) #flatten names svc = navigationThinningSvc({ 'name': 'HLTNav_%s' % stream, 'mode': 'cleanup', 'result': 'HLTResult_HLT', 'features': edmlist }) from OutputStreamAthenaPool.CreateOutputStreams import registerTrigNavThinningSvc registerTrigNavThinningSvc(stream, svc) log.info("Configured slimming of HLT for %s", stream) print(svc) # noqa: ATL901 del edmlist if TriggerFlags.doNavigationSlimming() and rec.readRDO( ) and rec.doWriteAOD(): _addSlimming('StreamAOD', _TriggerESDList) #Use ESD item list also for AOD! log.info("configured navigation slimming for AOD output") if TriggerFlags.doNavigationSlimming() and rec.readRDO( ) and rec.doWriteESD(): _addSlimming('StreamESD', _TriggerESDList) log.info("configured navigation slimming for ESD output") objKeyStore.addManyTypesStreamESD(_TriggerESDList) objKeyStore.addManyTypesStreamAOD(_TriggerAODList) return True
from TrigT1CaloTools.TrigT1CaloToolsConf import LVL1__L1JEPHitsTools ToolSvc += LVL1__L1JEPHitsTools("L1JEPHitsTools") ToolSvc.L1JEPHitsTools.LVL1ConfigSvc = "TrigConf::TrigConfigSvc/TrigConfigSvc" import TrigT1CaloTools.TrigT1CaloToolsConf as calotools # noqa: F401 for toolName in [ 'L1JetCMXTools', 'L1EnergyCMXTools', 'L1TriggerTowerTool', 'L1CPMTools', 'L1CPCMXTools', 'L1EmTauTools', 'L1JEMJetTools', 'L1JetEtTools', 'L1JetTools' ]: if not hasattr(ToolSvc, toolName): ToolSvc += eval('calotools.LVL1__%s( toolName )' % toolName) getattr(ToolSvc, toolName ).LVL1ConfigSvc = "TrigConf::TrigConfigSvc/TrigConfigSvc" #--------------------------------------------------------------------------- if recAlgs.doTrigger(): try: from TriggerJobOpts.T0TriggerGetter import T0TriggerGetter triggerGetter = T0TriggerGetter() except Exception: from AthenaCommon.Resilience import treatException treatException( "Could not import TriggerJobOpts.TriggerGetter . Switched off !" ) recAlgs.doTrigger = False elif rec.doWriteBS(): include("ByteStreamCnvSvc/RDP_ByteStream_jobOptions.py") ## end of configure the HLT config
def configure(self): log = logging.getLogger("HLTTriggerResultGetter.py") from RecExConfig.ObjKeyStore import objKeyStore # set EDMDecodingVersion EDMDecodingVersion() # Set AODFULL for data unless it was set explicitly already if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource()=='data': TriggerFlags.AODEDMSet = 'AODFULL' from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() log.info("BS unpacking (TF.readBS): %d" % TriggerFlags.readBS() ) if TriggerFlags.readBS(): bs = ByteStreamUnpackGetter() xAODContainers = {} # if not recAlgs.doTrigger(): #only convert when running on old data if TriggerFlags.EDMDecodingVersion()==1: xaodcnvrt = xAODConversionGetter() xAODContainers = xaodcnvrt.xaodlist if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly(): tdt = TrigDecisionGetter() # TrigJetRec additions if rec.doWriteESD(): objKeyStore.addStreamESD("JetKeyDescriptor","JetKeyMap") objKeyStore.addStreamESD("JetMomentMap","TrigJetRecMomentMap") if rec.doWriteAOD(): objKeyStore.addStreamAOD("JetKeyDescriptor","JetKeyMap") objKeyStore.addStreamAOD("JetMomentMap","TrigJetRecMomentMap") # ID truth if not rec.readESD() and (not rec.readAOD()) and TriggerFlags.doID() \ and rec.doTruth(): try: from TrigInDetTruthAlgs.TrigInDetTruthAlgsConfig import \ TrigIDTruthMaker topSequence += TrigIDTruthMaker() except Exception: log.warning( "Couldn't set up the trigger ID truth maker" ) pass if rec.doESD() or rec.doAOD(): from TrigEDMConfig.TriggerEDM import getTrigIDTruthList objKeyStore.addManyTypesStreamESD(getTrigIDTruthList(TriggerFlags.ESDEDMSet())) objKeyStore.addManyTypesStreamAOD(getTrigIDTruthList(TriggerFlags.AODEDMSet())) if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData(): objKeyStore.addManyTypesStreamESD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData', 'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.']) objKeyStore.addManyTypesStreamAOD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData', 'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.']) log.debug("HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data.") if rec.doAOD() or rec.doWriteAOD(): # schedule the RoiDescriptorStore conversion # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" ) topSequence += RoiWriter() # write out the RoiDescriptorStores from TrigEDMConfig.TriggerEDM import TriggerRoiList objKeyStore.addManyTypesStreamAOD( TriggerRoiList ) #Are we adding operational info objects in ESD? added=self._AddOPIToESD() if added: log.debug("Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data.") # ESD objects definitions _TriggerESDList = {} from TrigEDMConfig.TriggerEDM import getTriggerEDMList # we have to store xAOD containers in the root file, NOT AOD, # if the xAOD container list is not empty if(xAODContainers): _TriggerESDList.update( xAODContainers ) else: _TriggerESDList.update( getTriggerEDMList(TriggerFlags.ESDEDMSet(), TriggerFlags.EDMDecodingVersion()) ) log.info("ESD content set according to the ESDEDMSet flag: %s and EDM version %d" % (TriggerFlags.ESDEDMSet() ,TriggerFlags.EDMDecodingVersion()) ) # AOD objects choice _TriggerAODList = {} #from TrigEDMConfig.TriggerEDM import getAODList _TriggerAODList.update( getTriggerEDMList(TriggerFlags.AODEDMSet(), TriggerFlags.EDMDecodingVersion()) ) log.info("AOD content set according to the AODEDMSet flag: %s and EDM version %d" % (TriggerFlags.AODEDMSet(),TriggerFlags.EDMDecodingVersion()) ) log.debug("ESD EDM list: %s", _TriggerESDList) log.debug("AOD EDM list: %s", _TriggerAODList) # Highlight what is in AOD list but not in ESD list, as this can cause # the "different number of entries in branch" problem, when it is in the # AOD list but the empty container per event is not created # Just compares keys of dicts, which are the class names, not their string keys in StoreGate not_in = [ element for element in _TriggerAODList if element not in _TriggerESDList ] if (len(not_in)>0): log.warning("In AOD list but not in ESD list: ") log.warning(not_in) else: log.info("AOD list is subset of ESD list - good.") def _addSlimming(stream, thinningSvc, edm): from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from TrigNavTools.TrigNavToolsConf import HLT__StreamTrigNavSlimming, HLT__TrigNavigationSlimming from TrigNavTools.TrigNavToolsConfig import navigationSlimming edmlist = list(y.split('-')[0] for x in edm.values() for y in x) #flatten names # from HLT result drop unrecorded features # slimmerHLT = HLT__StreamTrigNavSlimming('HLTNavSlimmer_%s'%stream) slimmerHLT = HLT__TrigNavigationSlimming('TrigNavigationSlimmer_%s'%stream) tHLT = navigationSlimming({'name':'HLTNav_%s'%stream, 'mode':'cleanup', 'ThinningSvc':thinningSvc, 'result':'HLTResult_HLT', 'features':edmlist}) #tHLT.SlimmingTool.OutputLevel=DEBUG tHLT.ActInPlace=True slimmerHLT.ThinningTool = tHLT print slimmerHLT.ThinningTool topSequence += slimmerHLT log.info("Configured slimming of HLT") del edmlist from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaServices.Configurables import ThinningSvc, createThinningSvc _doSlimming = True if _doSlimming and rec.readRDO() and rec.doWriteAOD(): if not hasattr(svcMgr, 'ThinningSvc'): # if the default is there it is configured for AODs svcMgr += ThinningSvc(name='ThinningSvc', Streams=['StreamAOD']) _addSlimming('StreamAOD', svcMgr.ThinningSvc, _TriggerESDList ) #Use ESD item list also for AOD! log.info("configured navigation slimming for AOD output") if _doSlimming and rec.readRDO() and rec.doWriteESD(): #rec.doWriteESD() and not rec.readESD(): if not hasattr(svcMgr, 'ESDThinningSvc'): svcMgr += ThinningSvc(name='ESDThinningSvc', Streams=['StreamESD']) # the default is configured for AODs _addSlimming('StreamESD', svcMgr.ESDThinningSvc, _TriggerESDList ) log.info("configured navigation slimming for ESD output") objKeyStore.addManyTypesStreamESD( _TriggerESDList ) objKeyStore.addManyTypesStreamAOD( _TriggerAODList ) return True
# If no AOD objects made, then do not write out a TAG if not rec.doAOD() and not rec.readAOD() and rec.doWriteTAG(): logRecExCommon_flags.warning("no AOD objects available, cannot write out tag, switching rec.doWriteTAG=False") rec.doWriteTAG=False if rec.readTAG(): logRecExCommon_flags.warning("readingTAG switching rec.doWriteTAG=False") rec.doWriteTAG=False # if want to write tag : at least switch on trigger configuration doTriggerConfigOnly=False if rec.doWriteTAG() and not recAlgs.doTrigger() and not ('EventTagFlags' in dir() and not EventTagFlags.doTrigger()) and rec.doTrigger(): try: from TriggerJobOpts.TriggerFlags import TriggerFlags doTriggerConfigOnly=True jobproperties.Trigger.doTriggerConfigOnly=True except: logRecExCommon_flags.info("TriggerJobOpts.TriggerFlags not available.") if not recAlgs.doTrigger() and not rec.readAOD() and not rec.readESD() and rec.doWriteTAG(): logRecExCommon_flags.warning("no trigger and running from RDO: cannot write out tag, switching of trigger part of tag") include ('EventTagAlgs/EventTagFlags.py') EventTagFlags.set_TriggerOff() if rec.doWriteTAG(): include ('EventTagAlgs/EventTagFlags.py') if not rec.doEgamma():
# protectedInclude ("ObjMissingET/ObjMissingET_CBNT_jobOptions.py") #if recAlgs.doMissingETSig() or rec.readESD() or rec.readAOD() : # protectedInclude ("MissingETSig/MissingETSig_CBNT_jobOptions.py") ## #comment out until statuscode is fixed # not supported anymore ## if recAlgs.doEFlow() or rec.readESD(): ## protectedInclude ("eflowRec/jobOptions_CBNT_eflow.py") ## if recAlgs.doEFlowJet(): ## protectedInclude ("eflowRec/ConeJetEflow_CBNT_jobOptions.py") if rec.doHeavyIon(): protectedInclude("HIRecExample/HIRec_CBNT_jobOptions.py") if recAlgs.doTrigger() or (rec.readESD() and not rec.noESDTrigger()): protectedInclude("TriggerRelease/jobOfragment_TriggerCBNT.py") if rec.doAOD() or rec.readAOD(): protectedInclude("CBNT_AOD/AOD_CBNT_jobOptions.py") if recAlgs.doAtlfast(): protectedInclude("CBNT_AOD/AOD_CBNT_FastTree_jobOptions.py") protectedInclude("CBNT_Athena/CBNT_Audit_jobOptions.py") #CBNT_Audit.detailedTime = false ; // put in the ntuple CPU time per algrithm # list of algorithms to be monitored (by default take them all) #CBNT_Audit.Algs += { "GenzModule", "CBNT_Athena" } ;
conddb.addFolderWithTag("INDET_OFL","/Indet/Align","InDetAlign-BLK-UPD4-09",force=True,forceData=True) else: print "EOJT_alignMC found in globals(), so aligning ID to MC conditions" conddb.blockFolder("/TRT/Align") conddb.addFolderWithTag("TRT_OFL","/TRT/Align","TRTAlign_Nominal2",force=True,forceMC=True) conddb.blockFolder("/LAR/Align") conddb.addFolderWithTag("LAR_OFL","/LAR/Align","LARAlign-IOVDEP-00",force=True,forceMC=True) conddb.blockFolder("/Indet/Align") conddb.addFolderWithTag("INDET_OFL","/Indet/Align","InDetAlign_IOVDEP-03",force=True,forceMC=True) #to set beam spot from MC #conddb.blockFolder("/Indet/Beampos") #conddb.addFolderWithTag("INDET_OFL","/Indet/Beampos","IndetBeampos-RunDep-MC15-BestKnowledge-002",force=True,forceMC=True) #to run overlay chain with trigger if (hasattr(runArgs, "triggerConfig") and runArgs.triggerConfig!="NONE") or (hasattr(recAlgs,'doTrigger') and recAlgs.doTrigger() and DetFlags.LVL1_on()): print "running with trigger" conddb.blockFolder("/PIXEL/HLT/DCS/HV") conddb.addFolderWithTag("PIXEL_ONL","/PIXEL/HLT/DCS/HV","PixDCSHV-RUN2-UPD1-00",force=True,forceData=True) conddb.blockFolder("/PIXEL/HLT/DCS/TEMPERATURE") conddb.addFolderWithTag("PIXEL_ONL","/PIXEL/HLT/DCS/TEMPERATURE","PixDCSTemp-RUN2-UPD1-00",force=True,forceData=True) conddb.addOverride("/GLOBAL/Onl/TrigBTagCalib/RUN12","TrigBTagCalibRUN12Onl-08-10") conddb.addOverride("/GLOBAL/Onl/BTagCalib/RUN12","BTagCalibRUN12Onl-08-15") else: print "running wint no trig " conddb.blockFolder("/PIXEL/DCS/HV") conddb.addFolderWithTag("DCS_OFL","/PIXEL/DCS/HV","PixDCSHV-SIM-RUN1-000-00",force=True,forceMC=True) conddb.blockFolder("/PIXEL/PixReco") conddb.addFolderWithTag("PIXEL_OFL","/PIXEL/PixReco","PixReco-SIM-RUN12-000-01",force=True,forceMC=True)
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
rec.doWriteTAGCOM = False # If no AOD objects made, then do not write out a TAG if not rec.doAOD() and not rec.readAOD() and rec.doWriteTAG(): logRecExCommon_flags.warning( "no AOD objects available, cannot write out tag, switching rec.doWriteTAG=False" ) rec.doWriteTAG = False if rec.readTAG(): logRecExCommon_flags.warning("readingTAG switching rec.doWriteTAG=False") rec.doWriteTAG = False # if want to write tag : at least switch on trigger configuration doTriggerConfigOnly = False if rec.doWriteTAG() and not recAlgs.doTrigger() and not ( 'EventTagFlags' in dir() and not EventTagFlags.doTrigger()) and rec.doTrigger(): try: from TriggerJobOpts.TriggerFlags import TriggerFlags doTriggerConfigOnly = True jobproperties.Trigger.doTriggerConfigOnly = True except: logRecExCommon_flags.info("TriggerJobOpts.TriggerFlags not available.") if not recAlgs.doTrigger() and not rec.readAOD() and not rec.readESD( ) and rec.doWriteTAG(): logRecExCommon_flags.warning( "no trigger and running from RDO: cannot write out tag, switching of trigger part of tag" ) include('EventTagAlgs/EventTagFlags.py')
forceMC=True) conddb.blockFolder("/Indet/Align") conddb.addFolderWithTag("INDET_OFL", "/Indet/Align", "InDetAlign-RUN2-BLK-UPD4-16", force=True, forceMC=True) #InDetAlign_IOVDEP-03 #to set beam spot from MC #conddb.blockFolder("/Indet/Beampos") #conddb.addFolderWithTag("INDET_OFL","/Indet/Beampos","IndetBeampos-RunDep-MC15-BestKnowledge-002",force=True,forceMC=True) #to run overlay chain with trigger if (hasattr(runArgs, "triggerConfig") and runArgs.triggerConfig != "NONE") or (hasattr(recAlgs, 'doTrigger') and recAlgs.doTrigger() and DetFlags.LVL1_on()): printfunc("running with trigger ") conddb.addOverride("/GLOBAL/Onl/BTagCalib/RUN12", "BTagCalibRUN12Onl-08-40") else: printfunc("running with no trigger ") if DetFlags.writeRDOPool.pixel_on(): conddb.addFolder("PIXEL_OFL", "/PIXEL/PixReco") conddb.blockFolder("/PIXEL/PixdEdx") conddb.addFolderWithTag("PIXEL_OFL", "/PIXEL/PixdEdx", "PixdEdx-SIM-RUN124-000-00", force=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