Commit 4cd82927 authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'fc-overlay3-2june' into 'master'

Adding Overlay to FastChain

See merge request atlas/athena!53929
parents 8296f9a0 c59fb897
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaConfiguration.Enums import ProductionStep
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
AthSequencer=CompFactory.AthSequencer
......@@ -30,7 +29,7 @@ def AthenaEventLoopMgrCfg(cfgFlags):
from AthenaKernel.EventIdOverrideConfig import EvtIdModifierSvcCfg
elmgr.EvtIdModifierSvc = cfg.getPrimaryAndMerge( EvtIdModifierSvcCfg(cfgFlags) ).name
if cfgFlags.Common.ProductionStep == ProductionStep.Overlay:
if cfgFlags.Common.isOverlay:
if not cfgFlags.Overlay.DataOverlay:
elmgr.RequireInputAttributeList = True
elmgr.UseSecondaryEventNumber = True
......@@ -81,7 +80,7 @@ def AthenaHiveEventLoopMgrCfg(cfgFlags):
from AthenaKernel.EventIdOverrideConfig import EvtIdModifierSvcCfg
elmgr.EvtIdModifierSvc = cfg.getPrimaryAndMerge(EvtIdModifierSvcCfg(cfgFlags)).name
if cfgFlags.Common.ProductionStep == ProductionStep.Overlay:
if cfgFlags.Common.isOverlay:
if not cfgFlags.Overlay.DataOverlay:
elmgr.RequireInputAttributeList = True
elmgr.UseSecondaryEventNumber = True
......
......@@ -20,7 +20,7 @@ def BunchLumisCondAlgCfg (configFlags):
return result
folder = '/TDAQ/OLC/BUNCHLUMIS'
if configFlags.Common.ProductionStep == ProductionStep.Overlay:
if configFlags.Common.isOverlay:
# Load reduced channel list for overlay jobs to try to reduce COOL access
# Need Lucid AND, OR, HitOR, BcmH OR, BcmV OR
folder = '<channelSelection>101,102,103,201,211</channelSelection> ' + folder
......
......@@ -42,7 +42,7 @@ def BCM_DigitizationToolCommonCfg(flags, name="BCM_DigitizationTool", **kwargs):
if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
kwargs.setdefault("OutputRDOKey", flags.Overlay.BkgPrefix + "BCM_RDOs")
kwargs.setdefault("OutputSDOKey", flags.Overlay.BkgPrefix + "BCM_SDO_Map")
elif flags.Common.ProductionStep == ProductionStep.Overlay:
elif flags.Common.isOverlay:
kwargs.setdefault("OnlyUseContainerName", False)
kwargs.setdefault("OutputRDOKey", flags.Overlay.SigPrefix + "BCM_RDOs")
kwargs.setdefault("OutputSDOKey", flags.Overlay.SigPrefix + "BCM_SDO_Map")
......
......@@ -175,7 +175,7 @@ def SCT_SurfaceChargesGeneratorCfg(flags, name="SCT_SurfaceChargesGenerator", **
kwargs.setdefault("SmallStepLength", 5*Units.micrometer)
kwargs.setdefault("DepletionVoltage", 70)
kwargs.setdefault("BiasVoltage", 150)
kwargs.setdefault("isOverlay", flags.Common.ProductionStep == ProductionStep.Overlay)
kwargs.setdefault("isOverlay", flags.Common.isOverlay)
# kwargs.setdefault("doTrapping", True) # ATL-INDET-INT-2016-019
# experimental SCT_DetailedSurfaceChargesGenerator config dropped here
SCT_SurfaceChargesGenerator, SCT_RadDamageSummaryTool = CompFactory.getComps("SCT_SurfaceChargesGenerator", "SCT_RadDamageSummaryTool",)
......@@ -214,7 +214,7 @@ def SCT_FrontEndCfg(flags, name="SCT_FrontEnd", **kwargs):
kwargs.setdefault("NoiseOn", True)
kwargs.setdefault("AnalogueNoiseOn", True)
# In overlay MC, only analogue noise is on (off for data). Noise hits are not added.
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs["NoiseOn"] = False
kwargs["AnalogueNoiseOn"] = flags.Input.isMC
# Use Calibration data from Conditions DB, still for testing purposes only
......@@ -225,14 +225,14 @@ def SCT_FrontEndCfg(flags, name="SCT_FrontEnd", **kwargs):
# DataCompressionMode: 1 is level mode X1X (default), 2 is edge mode 01X, 3 is any hit mode (1XX|X1X|XX1)
if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
kwargs.setdefault("DataCompressionMode", 3)
elif flags.Common.ProductionStep == ProductionStep.Overlay and flags.Input.isMC:
elif flags.Common.isOverlay and flags.Input.isMC:
kwargs.setdefault("DataCompressionMode", 2)
elif flags.Beam.BunchSpacing <= 50:
kwargs.setdefault("DataCompressionMode", 1)
else:
kwargs.setdefault("DataCompressionMode", 3)
# DataReadOutMode: 0 is condensed mode and 1 is expanded mode
if flags.Common.ProductionStep == ProductionStep.Overlay and flags.Input.isMC:
if flags.Common.isOverlay and flags.Input.isMC:
kwargs.setdefault("DataReadOutMode", 0)
else:
kwargs.setdefault("DataReadOutMode", 1)
......
......@@ -167,7 +167,7 @@ def ITkStripSurfaceChargesGeneratorCfg(flags, name="ITkStripSurfaceChargesGenera
kwargs.setdefault("SmallStepLength", 5*Units.micrometer)
kwargs.setdefault("DepletionVoltage", 70)
kwargs.setdefault("BiasVoltage", 150)
kwargs.setdefault("isOverlay", flags.Common.ProductionStep == ProductionStep.Overlay)
kwargs.setdefault("isOverlay", flags.Common.isOverlay)
# kwargs.setdefault("doTrapping", True) # ATL-INDET-INT-2016-019
# experimental ITkStripDetailedSurfaceChargesGenerator config dropped here
tool = CompFactory.ITk.StripSurfaceChargesGenerator(name, **kwargs)
......@@ -209,7 +209,7 @@ def ITkStripFrontEndCfg(flags, name="ITkStripFrontEnd", **kwargs):
# kwargs.setdefault("NoiseOn", True)
# kwargs.setdefault("AnalogueNoiseOn", True)
# In overlay MC, only analogue noise is on (off for data). Noise hits are not added.
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs["NoiseOn"] = False
kwargs["AnalogueNoiseOn"] = flags.Input.isMC
# Use Calibration data from Conditions DB, still for testing purposes only
......
......@@ -43,7 +43,7 @@ def TRT_DigitizationBasicToolCfg(flags, name="TRT_DigitizationBasicTool", **kwar
PartPropSvc = CompFactory.PartPropSvc
acc.addService(PartPropSvc(InputFile="PDGTABLE.MeV"))
# TODO: move this data overlay in a separate place
if flags.Common.ProductionStep == ProductionStep.Overlay and flags.Overlay.DataOverlay:
if flags.Common.isOverlay and flags.Overlay.DataOverlay:
acc.merge(addFolders(flags, "/TRT/Cond/DigVers", "TRT_OFL", tag="TRTCondDigVers-Collisions-01", db="OFLP200",
className = 'AthenaAttributeList'))
else:
......
......@@ -29,7 +29,7 @@ def useLArFloat(flags):
"""Return bool for simplified transient LArHit with float E,time"""
# temporary, remapping to LArHitFloat does not seeem to work
# with this scheme... => larger memory usage
if flags.Digitization.DoXingByXingPileUp or flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Digitization.DoXingByXingPileUp or flags.Common.isOverlay:
return False
# check for fast chain, running digitisation from hits in memory
if flags.Sim.DoFullChain:
......@@ -86,7 +86,7 @@ def LArPileUpToolCfg(flags, name="LArPileUpTool", **kwargs):
acc.merge(LArXTalkWeightCondAlgCfg(flags))
# defaults
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
# Some noise needs to be added during MC Overlay
# No noise should be added during Data Overlay
kwargs.setdefault("NoiseOnOff", not flags.Overlay.DataOverlay)
......@@ -105,9 +105,9 @@ def LArPileUpToolCfg(flags, name="LArPileUpTool", **kwargs):
kwargs.setdefault("PileUpMergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=intervals)).name)
else:
kwargs.setdefault("PileUpMergeSvc", '')
kwargs.setdefault("RndmEvtOverlay", flags.Common.ProductionStep == ProductionStep.Overlay)
kwargs.setdefault("RndmEvtOverlay", flags.Common.isOverlay)
# if doing MC+MC overlay
if flags.Common.ProductionStep == ProductionStep.Overlay and flags.Input.isMC:
if flags.Common.isOverlay and flags.Input.isMC:
kwargs.setdefault("isMcOverlay", True)
# cosmics digitization
......@@ -115,7 +115,7 @@ def LArPileUpToolCfg(flags, name="LArPileUpTool", **kwargs):
kwargs.setdefault("UseTriggerTime", True)
CosmicTriggerTimeTool = CompFactory.CosmicTriggerTimeTool
kwargs.setdefault("TriggerTimeToolName", CosmicTriggerTimeTool())
if flags.Digitization.PileUp or flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Digitization.PileUp or flags.Common.isOverlay:
kwargs.setdefault("PileUp", True)
kwargs.setdefault("useLArFloat", useLArFloat(flags))
if useLArFloat(flags):
......@@ -125,7 +125,7 @@ def LArPileUpToolCfg(flags, name="LArPileUpTool", **kwargs):
acc.merge(InputOverwriteCfg("LArHitContainer","LArHitFCAL","LArHitFloatContainer","LArHitFCAL"))
kwargs.setdefault("LArHitContainers", [])
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
acc.merge(SGInputLoaderCfg(flags, [
"LArHitFloatContainer#LArHitEMB",
......@@ -136,7 +136,7 @@ def LArPileUpToolCfg(flags, name="LArPileUpTool", **kwargs):
else:
kwargs.setdefault("LArHitFloatContainers", [])
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
acc.merge(SGInputLoaderCfg(flags, [
"LArHitContainer#LArHitEMB",
......@@ -144,7 +144,7 @@ def LArPileUpToolCfg(flags, name="LArPileUpTool", **kwargs):
"LArHitContainer#LArHitFCAL",
"LArHitContainer#LArHitHEC",
]))
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs.setdefault("OnlyUseContainerName", False)
if flags.Overlay.DataOverlay:
kwargs.setdefault("InputDigitContainer", f"{flags.Overlay.BkgPrefix}FREE")
......@@ -177,14 +177,14 @@ def LArHitEMapToDigitAlgCfg(flags, name="LArHitEMapToDigitAlgCfg", **kwargs):
requiredConditons=["Noise", "fSampl", "Pedestal", "Shape"]
acc.merge(LArElecCalibDbCfg(flags,requiredConditons))
if flags.Common.ProductionStep != ProductionStep.Overlay:
if not flags.Common.isOverlay:
acc.merge(LArAutoCorrNoiseCondAlgCfg(flags))
#kwargs.setdefault('AutoCorrNoiseKey','LArAutoCorr')
if "ProblemsToMask" not in kwargs:
kwargs["ProblemsToMask"] = ["deadReadout", "deadPhys"]
# defaults
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
# Some noise needs to be added during MC Overlay
# No noise should be added during Data Overlay
kwargs.setdefault("NoiseOnOff", not flags.Overlay.DataOverlay)
......@@ -192,17 +192,17 @@ def LArHitEMapToDigitAlgCfg(flags, name="LArHitEMapToDigitAlgCfg", **kwargs):
kwargs.setdefault("NoiseOnOff", flags.Digitization.DoCaloNoise)
kwargs.setdefault("DoDigiTruthReconstruction", flags.Digitization.DoDigiTruth)
kwargs.setdefault("RandomSeedOffset", flags.Digitization.RandomSeedOffset)
if (not flags.Digitization.HighGainFCal) and (flags.Common.ProductionStep != ProductionStep.Overlay):
if (not flags.Digitization.HighGainFCal) and (not flags.Common.isOverlay):
kwargs.setdefault("HighGainThreshFCAL", 0)
if (not flags.Digitization.HighGainEMECIW) and (flags.Common.ProductionStep != ProductionStep.Overlay):
if (not flags.Digitization.HighGainEMECIW) and (not flags.Common.isOverlay):
kwargs.setdefault("HighGainThreshEMECIW", 0)
kwargs.setdefault("RndmEvtOverlay", flags.Common.ProductionStep == ProductionStep.Overlay)
kwargs.setdefault("RndmEvtOverlay", flags.Common.isOverlay)
if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
kwargs.setdefault("DigitContainer", flags.Overlay.BkgPrefix + "LArDigitContainer_MC")
else:
kwargs.setdefault("DigitContainer", "LArDigitContainer_MC") # FIXME - should not be hard-coded
# if doing MC+MC overlay
if flags.Common.ProductionStep == ProductionStep.Overlay and flags.Input.isMC:
if flags.Common.isOverlay and flags.Input.isMC:
kwargs.setdefault("isMcOverlay", True)
kwargs.setdefault("Nsamples", flags.LAr.ROD.nSamples)
kwargs.setdefault("firstSample", #Need to set a negative value to include preceeding samples
......@@ -309,7 +309,7 @@ def LArAutoCorrNoiseCondSCAlgCfg(flags, **kwargs):
def LArSCL1MakerCfg(flags, **kwargs):
"""Return ComponentAccumulator for LArSCL1Maker"""
acc = ComponentAccumulator()
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
acc.merge(LArOverlayDigitizationBasicCfg(flags))
else:
acc.merge(LArDigitizationBasicCfg(flags))
......@@ -341,7 +341,7 @@ def LArSCL1MakerCfg(flags, **kwargs):
acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)).name)
if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
kwargs.setdefault("SCL1ContainerName", f"{flags.Overlay.BkgPrefix}LArDigitSCL2") # Output - why L2??
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs.setdefault("BkgDigitKey", f"{flags.Overlay.BkgPrefix}LArDigitSCL2")
from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
......
......@@ -37,7 +37,7 @@ def CSC_RangeCfg(flags, name="CSC_Range", **kwargs):
def CSC_DigitizationToolCommonCfg(flags, name="CscDigitizationTool", **kwargs):
"""Return a ComponentAccumulator with configured CscDigitizationTool"""
acc = ComponentAccumulator()
if flags.Digitization.PileUp and flags.Common.ProductionStep is not ProductionStep.Overlay:
if flags.Digitization.PileUp and not flags.Common.isOverlay:
intervals = []
if not flags.Digitization.DoXingByXingPileUp:
intervals += [acc.popToolsAndMerge(CSC_RangeCfg(flags))]
......
......@@ -22,14 +22,14 @@ def MdtRdoToMdtDigitCfg(flags, name="MdtRdoToMdtDigitAlg", **kwargs):
acc = MuonIdHelperSvcCfg(flags)
kwargs.setdefault("mdtRdoDecoderTool", acc.popToolsAndMerge(MdtRDO_DecoderCfg(flags)))
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs.setdefault("MdtRdoContainer", f"{flags.Overlay.BkgPrefix}MDTCSM")
kwargs.setdefault("MdtDigitContainer", f"{flags.Overlay.BkgPrefix}MDT_DIGITS")
else:
kwargs.setdefault("MdtRdoContainer", "MDTCSM")
kwargs.setdefault("MdtDigitContainer", "MDT_DIGITS")
if flags.Common.ProductionStep == ProductionStep.Overlay and not flags.Overlay.DataOverlay:
if flags.Common.isOverlay and not flags.Overlay.DataOverlay:
from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
acc.merge(SGInputLoaderCfg(flags, [f'MdtCsmContainer#{kwargs["MdtRdoContainer"]}']))
......@@ -43,14 +43,14 @@ def RpcRdoToRpcDigitCfg(flags, name="RpcRdoToRpcDigitAlg", **kwargs):
from MuonConfig.MuonCablingConfig import RPCCablingConfigCfg
acc.merge(RPCCablingConfigCfg(flags))
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs.setdefault("RpcRdoContainer", f"{flags.Overlay.BkgPrefix}RPCPAD")
kwargs.setdefault("RpcDigitContainer", f"{flags.Overlay.BkgPrefix}RPC_DIGITS")
else:
kwargs.setdefault("RpcRdoContainer", "RPCPAD")
kwargs.setdefault("RpcDigitContainer", "RPC_DIGITS")
if flags.Common.ProductionStep == ProductionStep.Overlay and not flags.Overlay.DataOverlay:
if flags.Common.isOverlay and not flags.Overlay.DataOverlay:
from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
acc.merge(SGInputLoaderCfg(flags, [f'RpcPadContainer#{kwargs["RpcRdoContainer"]}']))
......@@ -64,14 +64,14 @@ def TgcRdoToTgcDigitCfg(flags, name="TgcRdoToTgcDigitAlg", **kwargs):
from MuonConfig.MuonCablingConfig import TGCCablingConfigCfg
acc.merge(TGCCablingConfigCfg(flags))
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs.setdefault("TgcRdoContainer", f"{flags.Overlay.BkgPrefix}TGCRDO")
kwargs.setdefault("TgcDigitContainer",f"{flags.Overlay.BkgPrefix}TGC_DIGITS")
else:
kwargs.setdefault("TgcRdoContainer", "TGCRDO")
kwargs.setdefault("TgcDigitContainer", "TGC_DIGITS")
if flags.Common.ProductionStep == ProductionStep.Overlay and not flags.Overlay.DataOverlay:
if flags.Common.isOverlay and not flags.Overlay.DataOverlay:
from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
acc.merge(SGInputLoaderCfg(flags, [f'TgcRdoContainer#{kwargs["TgcRdoContainer"]}']))
......@@ -82,7 +82,7 @@ def TgcRdoToTgcDigitCfg(flags, name="TgcRdoToTgcDigitAlg", **kwargs):
def STGC_RdoToDigitCfg(flags, name="STGC_RdoToDigitAlg", **kwargs):
"""Return ComponentAccumulator with configured STGC_RdoToDigit algorithm"""
acc = ComponentAccumulator()
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs.setdefault("sTgcRdoContainer", f"{flags.Overlay.BkgPrefix}sTGCRDO")
kwargs.setdefault("sTgcDigitContainer", f"{flags.Overlay.BkgPrefix}sTGC_DIGITS")
else:
......@@ -91,7 +91,7 @@ def STGC_RdoToDigitCfg(flags, name="STGC_RdoToDigitAlg", **kwargs):
kwargs.setdefault("sTgcRdoDecoderTool", acc.popToolsAndMerge(STgcRdoDecoderCfg(flags)))
if flags.Common.ProductionStep == ProductionStep.Overlay and not flags.Overlay.DataOverlay:
if flags.Common.isOverlay and not flags.Overlay.DataOverlay:
from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
acc.merge(SGInputLoaderCfg(flags, [f'Muon::STGC_RawDataContainer#{kwargs["sTgcRdoContainer"]}']))
......@@ -102,7 +102,7 @@ def STGC_RdoToDigitCfg(flags, name="STGC_RdoToDigitAlg", **kwargs):
def MM_RdoToDigitCfg(flags, name="MM_RdoToDigitAlg", **kwargs):
"""Return ComponentAccumulator with configured MM_RdoToDigit algorithm"""
acc = ComponentAccumulator()
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs.setdefault("MmRdoContainer", f"{flags.Overlay.BkgPrefix}MMRDO")
kwargs.setdefault("MmDigitContainer", f"{flags.Overlay.BkgPrefix}MM_DIGITS")
else:
......@@ -111,7 +111,7 @@ def MM_RdoToDigitCfg(flags, name="MM_RdoToDigitAlg", **kwargs):
kwargs.setdefault("mmRdoDecoderTool", acc.popToolsAndMerge(MMRdoDecoderCfg(flags)))
if flags.Common.ProductionStep == ProductionStep.Overlay and not flags.Overlay.DataOverlay:
if flags.Common.isOverlay and not flags.Overlay.DataOverlay:
from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
acc.merge(SGInputLoaderCfg(flags, [f'Muon::MM_RawDataContainer#{kwargs["MmRdoContainer"]}']))
......@@ -170,9 +170,9 @@ def CscDigitToCscRDOToolCfg(flags, name="CscDigitToCscRDOTool", **kwargs):
kwargs.setdefault("cscCalibTool", acc.popToolsAndMerge(CscCalibToolCfg(flags)))
kwargs.setdefault("NumSamples", 4)
kwargs.setdefault("Latency", 0)
kwargs.setdefault("addNoise", flags.Common.ProductionStep != ProductionStep.Overlay) # doMuonNoise flag not migrated
kwargs.setdefault("addNoise", not flags.Common.isOverlay) # doMuonNoise flag not migrated
if flags.Common.ProductionStep == ProductionStep.Overlay:
if flags.Common.isOverlay:
kwargs.setdefault("InputObjectName", f"{flags.Overlay.SigPrefix}CSC_DIGITS")
kwargs.setdefault("OutputObjectName", f"{flags.Overlay.SigPrefix}CSCRDO")
if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
......
......@@ -2,7 +2,6 @@
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaConfiguration.Enums import ProductionStep
from AthenaCommon.Constants import DEBUG
## Small class to hold the names for cache containers, should help to avoid copy / paste errors
......@@ -50,7 +49,7 @@ def RpcBytestreamDecodeCfg(flags, name="RpcRawDataProvider"):
# Setup the RAW data provider tool
keyName = flags.Overlay.BkgPrefix + "RPCPAD" if flags.Common.ProductionStep == ProductionStep.Overlay else "RPCPAD"
keyName = flags.Overlay.BkgPrefix + "RPCPAD" if flags.Common.isOverlay else "RPCPAD"
Muon__RPC_RawDataProviderToolMT=CompFactory.Muon.RPC_RawDataProviderToolMT
MuonRpcRawDataProviderTool = Muon__RPC_RawDataProviderToolMT(name = "RPC_RawDataProviderToolMT",
Decoder = RPCRodDecoder,
......@@ -96,7 +95,7 @@ def TgcBytestreamDecodeCfg(flags, name="TgcRawDataProvider"):
# Setup the RAW data provider tool
keyName = flags.Overlay.BkgPrefix + "TGCRDO" if flags.Common.ProductionStep == ProductionStep.Overlay else "TGCRDO"
keyName = flags.Overlay.BkgPrefix + "TGCRDO" if flags.Common.isOverlay else "TGCRDO"
Muon__TGC_RawDataProviderToolMT=CompFactory.Muon.TGC_RawDataProviderToolMT
MuonTgcRawDataProviderTool = Muon__TGC_RawDataProviderToolMT(name = "TGC_RawDataProviderToolMT",
Decoder = TGCRodDecoder,
......@@ -143,7 +142,7 @@ def MdtBytestreamDecodeCfg(flags, name="MdtRawDataProvider"):
# Setup the RAW data provider tool
keyName = flags.Overlay.BkgPrefix + "MDTCSM" if flags.Common.ProductionStep == ProductionStep.Overlay else "MDTCSM"
keyName = flags.Overlay.BkgPrefix + "MDTCSM" if flags.Common.isOverlay else "MDTCSM"
Muon__MDT_RawDataProviderToolMT=CompFactory.Muon.MDT_RawDataProviderToolMT
MuonMdtRawDataProviderTool = Muon__MDT_RawDataProviderToolMT(name = "MDT_RawDataProviderToolMT",
Decoder = MDTRodDecoder,
......@@ -186,7 +185,7 @@ def CscBytestreamDecodeCfg(flags, name="CscRawDataProvider"):
# Setup the RAW data provider tool
keyName = flags.Overlay.BkgPrefix + "CSCRDO" if flags.Common.ProductionStep == ProductionStep.Overlay else "CSCRDO"
keyName = flags.Overlay.BkgPrefix + "CSCRDO" if flags.Common.isOverlay else "CSCRDO"
Muon__CSC_RawDataProviderToolMT=CompFactory.Muon.CSC_RawDataProviderToolMT
MuonCscRawDataProviderTool = Muon__CSC_RawDataProviderToolMT(name = "CSC_RawDataProviderToolMT",
Decoder = CSCRodDecoder,
......@@ -229,7 +228,7 @@ def sTgcBytestreamDecodeCfg(flags, name="sTgcRawDataProvider"):
# Setup the RAW data provider tool
keyName = flags.Overlay.BkgPrefix + "sTGCRDO" if flags.Common.ProductionStep == ProductionStep.Overlay else "sTGCRDO"
keyName = flags.Overlay.BkgPrefix + "sTGCRDO" if flags.Common.isOverlay else "sTGCRDO"
Muon__STGC_RawDataProviderToolMT=CompFactory.Muon.STGC_RawDataProviderToolMT
MuonsTgcRawDataProviderTool = Muon__STGC_RawDataProviderToolMT(name = "STGC_RawDataProviderToolMT",
Decoder = STGCRodDecoder,
......@@ -273,7 +272,7 @@ def MmBytestreamDecodeCfg(flags, name="MmRawDataProvider"):
# Setup the RAW data provider tool
#keyName = flags.Overlay.BkgPrefix + "MMRDO" if flags.Detector.OverlayMM else "MMRDO"
keyName = flags.Overlay.BkgPrefix + "MMRDO" if flags.Common.ProductionStep == ProductionStep.Overlay else "MMRDO"
keyName = flags.Overlay.BkgPrefix + "MMRDO" if flags.Common.isOverlay else "MMRDO"
Muon_MM_RawDataProviderToolMT = CompFactory.Muon.MM_RawDataProviderToolMT
MuonMmRawDataProviderTool = Muon_MM_RawDataProviderToolMT(name = "MM_RawDataProviderToolMT",
Decoder = MMRodDecoder,
......
......@@ -44,8 +44,7 @@ def writeDigitizationMetadata(ConfigFlags):
# doMuonNoise no actual flag in new-style
testKey = "doMuonNoise"
from AthenaConfiguration.Enums import ProductionStep
testValue = str(ConfigFlags.Common.ProductionStep != ProductionStep.Overlay) # Hardcoded for now
testValue = str(not ConfigFlags.Common.isOverlay) # Hardcoded for now
dbFiller.addDigitParam(testKey, testValue)
logDigitizationWriteMetadata.info('DigitizationMetaData: setting "%s" to be %s', testKey, testValue)
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
import re
......@@ -25,9 +25,9 @@ def _getFileMD(filenames):
return _fileMetadata[filename]
def signalMetadataCheck(flags, simDict, tagInfoDict):
"""Check the metadata for signal HITS file"""
logger.info("Checking Overlay configuration against Signal Simulation metadata...")
def overlayInputMetadataCheck(flags, simDict, tagInfoDict):
"""Check the metadata for signal HITS or presampled pileup RDO file"""
logger.info("Checking Overlay configuration against Signal or presampled pileup RDO metadata...")
simKeys = simDict.keys()
tagInfoKeys = tagInfoDict.keys()
......@@ -180,25 +180,34 @@ def overlayMetadataCheck(flags):
files = flags.Input.SecondaryFiles
filesPileup = flags.Input.Files
signalMetadata = _getFileMD(files)
signalSimulationMetadata = signalMetadata["/Simulation/Parameters"]
signalTagInfoMetadata = signalMetadata["/TagInfo"]
# signal check
signalMetadataCheck(flags, signalSimulationMetadata, signalTagInfoMetadata)
if files:
signalMetadata = _getFileMD(files)
signalSimulationMetadata = signalMetadata["/Simulation/Parameters"]
signalTagInfoMetadata = signalMetadata["/TagInfo"]
# signal check
overlayInputMetadataCheck(flags, signalSimulationMetadata, signalTagInfoMetadata)
else:
# This can be the case for the FastChain with overlay
# It is not an error.
logger.info("Simulation metadata check not done due to no inputs")
# pile-up check
if not flags.Overlay.DataOverlay:
if not flags.Overlay.DataOverlay and filesPileup:
pileupMetaDataCheck = _getFileMD(filesPileup)
pileupDigitizationMetadata = pileupMetaDataCheck["/Digitization/Parameters"]
pileupSimulationMetadata = pileupMetaDataCheck["/Simulation/Parameters"]
pileupTagInfoMetadata = pileupMetaDataCheck["/TagInfo"]
logger.info("Checking Presampled pile-up metadata against Signal Simulation metadata...")
simulationMetadataCheck(signalSimulationMetadata, pileupSimulationMetadata)
tagInfoMetadataCheck(signalTagInfoMetadata, pileupTagInfoMetadata)
if not flags.Overlay.FastChain:
logger.info("Checking Presampled pile-up metadata against Signal Simulation metadata...")
simulationMetadataCheck(signalSimulationMetadata, pileupSimulationMetadata)
tagInfoMetadataCheck(signalTagInfoMetadata, pileupTagInfoMetadata)
else:
logger.info("Checking Presampled pile-up metadata against configuration of jobs (i.e. flags)...")
overlayInputMetadataCheck(flags, pileupSimulationMetadata, pileupTagInfoMetadata)
logger.info("Completed all checks against Presampled pile-up Simulation metadata.")
if pileupDigitizationMetadata:
writeOverlayDigitizationMetadata(flags,pileupDigitizationMetadata)
......
......@@ -5,6 +5,7 @@ import sys
from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
from PyJobTransforms.TransformUtils import processPreExec, processPreInclude, processPostExec, processPostInclude
from SimuJobTransforms.CommonSimulationSteering import specialConfigPreInclude, specialConfigPostInclude
from AthenaConfiguration.Enums import ProductionStep
def defaultOverlayFlags(configFlags):
......@@ -28,7 +29,7 @@ def setOverlayInputFiles(runArgs, configFlags, log):
hasRDO_BKGInput = hasattr(runArgs, 'inputRDO_BKGFile')
hasBS_SKIMInput = hasattr(runArgs, 'inputBS_SKIMFile')
if not hasattr(runArgs, 'inputHITSFile'):
if configFlags.Common.ProductionStep == ProductionStep.Overlay and not hasattr(runArgs, 'inputHITSFile'):
raise RuntimeError('No input HITS file defined')
if hasRDO_BKGInput and hasBS_SKIMInput:
......@@ -44,7 +45,8 @@ def setOverlayInputFiles(runArgs, configFlags, log):
configFlags.Overlay.DataOverlay = False
configFlags.Input.isMC = True
configFlags.Input.Files = runArgs.inputRDO_BKGFile
configFlags.Input.SecondaryFiles = runArgs.inputHITSFile
if configFlags.Common.ProductionStep == ProductionStep.Overlay:
configFlags.Input.SecondaryFiles = runArgs.inputHITSFile
else:
log.info('Running MC+data overlay')
configFlags.Overlay.DataOverlay = True
......@@ -65,12 +67,11 @@ def fromRunArgs(runArgs):
from AthenaConfiguration.AllConfigFlags import ConfigFlags
commonRunArgsToFlags(runArgs, ConfigFlags)
ConfigFlags.Common.ProductionStep = ProductionStep.Overlay
# Setting input files for Overlay
setOverlayInputFiles(runArgs, ConfigFlags, logOverlay)
from AthenaConfiguration.Enums import ProductionStep
ConfigFlags.Common.ProductionStep = ProductionStep.Overlay
# Setting output files for Overlay
if hasattr(runArgs, 'outputRDOFile'):
if runArgs.outputRDOFile == 'None':
......
......@@ -4,7 +4,7 @@
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaConfiguration.Enums import Format, ProductionStep
from AthenaConfiguration.Enums import Format
def TileDQstatusToolCfg(flags, **kwargs):
......@@ -64,7 +64,7 @@ def TileDQstatusAlgCfg(flags, **kwargs):
rawChannelContainer = 'TileRawChannelCnt'
elif flags.Common.ProductionStep == ProductionStep.Overlay and flags.Overlay.DataOverlay:
elif flags.Common.isOverlay and flags.Overlay.DataOverlay:
beamElemContainer = ''
digitsContainer = flags.Overlay.BkgPrefix + 'TileDigitsCnt'
rawChannelContainer = flags.Overlay.BkgPrefix + 'TileRawChannelCnt'
......
......@@ -69,7 +69,7 @@ def TileRawChannelMakerCfg(flags, **kwargs):
kwargs.setdefault('TileRawChannelBuilder', tileRawChannelBuilder)
if flags.Common.ProductionStep == ProductionStep.Overlay and flags.Concurrency.NumThreads > 0:
if flags.Common.isOverlay and flags.Concurrency.NumThreads > 0:
kwargs.setdefault('Cardinality', flags.Concurrency.NumThreads)
TileRawChannelMaker=CompFactory.TileRawChannelMaker
......
......@@ -15,15 +15,15 @@ def TileDigitsMakerCfg(flags, **kwargs):
name -- name of TileDigitsMaker algorithm. Defaults to TileDigitsMaker.
UseCoolPulseShapes -- flag to use pulse shape from database. Defaults to True.
RndmEvtOverlay -- flag to add PileUp or noise by overlaying random events.
True if Common.ProductionStep equals to ProductionStep.Overlay.
True if flag.Common.isOverlay equals to True.
MaskBadChannels -- flag to mask channels tagged bad. Defaults to False.
"""
kwargs.setdefault('name', 'TileDigitsMaker')
kwargs.setdefault('UseCoolPulseShapes', True)
kwargs.setdefault('MaskBadChannels', False)
kwargs.setdefault('RndmEvtOverlay', flags.Common.ProductionStep == ProductionStep.Overlay)
kwargs.setdefault('OnlyUseContainerName', flags.Common.ProductionStep != ProductionStep.Overlay)
kwargs.setdefault('RndmEvtOverlay', flags.Common.isOverlay)