ATLAS Offline Software
RPC_OverlayConfig.py
Go to the documentation of this file.
1 
2 """Define methods to construct configured RPC overlay algorithms
3 
4 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 """
6 
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory import CompFactory
9 
10 
11 def RPC_OverlayAlgCfg(flags, name="RpcOverlay", **kwargs):
12  """Return a ComponentAccumulator for RPCOverlay algorithm"""
13  acc = ComponentAccumulator()
14 
15  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}RPC_DIGITS")
16  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}RPC_DIGITS")
17  kwargs.setdefault("OutputKey", "RPC_DIGITS")
18 
19  # Do RPC overlay
20  acc.addEventAlgo(CompFactory.RpcOverlay(name, **kwargs))
21 
22  # Setup output
23  if flags.Output.doWriteRDO:
24  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
25  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
26  "RpcPadContainer#RPCPAD"
27  ]))
28  if flags.Muon.enableNRPC:
29  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
30  "xAOD::NRPCRDOContainer#NRPCRDO", "xAOD::NRPCRDOAuxContainer#NRPCRDOAux."
31  ]))
32 
33  if flags.Output.doWriteRDO_SGNL:
34  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
35  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
36  f"RpcPadContainer#{flags.Overlay.SigPrefix}RPCPAD"
37  ]))
38  if flags.Muon.enableNRPC:
39  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
40  f"xAOD::NRPCRDOContainer#{flags.Overlay.SigPrefix}NRPCRDO", f"xAOD::NRPCRDOAuxContainer#{flags.Overlay.SigPrefix}NRPCRDOAux."
41  ]))
42 
43  return acc
44 
45 
46 def RPC_TruthOverlayCfg(flags, name="RpcTruthOverlay", **kwargs):
47  """Return a ComponentAccumulator for the RPC SDO overlay algorithm"""
48  acc = ComponentAccumulator()
49 
50  # We do not need background RPC SDOs
51  if not flags.Input.isMC:
52  kwargs.setdefault("BkgInputKey", "")
53  else:
54  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}RPC_SDO")
55 
56  if kwargs["BkgInputKey"]:
57  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
58  acc.merge(SGInputLoaderCfg(flags, [f'MuonSimDataCollection#{kwargs["BkgInputKey"]}']))
59 
60  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}RPC_SDO")
61  kwargs.setdefault("OutputKey", "RPC_SDO")
62 
63  # Do RPC truth overlay
64  acc.addEventAlgo(CompFactory.MuonSimDataOverlay(name, **kwargs))
65 
66  # Setup output
67  if flags.Output.doWriteRDO:
68  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
69  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
70  "MuonSimDataCollection#RPC_SDO"
71  ]))
72 
73  if flags.Output.doWriteRDO_SGNL:
74  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
75  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
76  f"MuonSimDataCollection#{flags.Overlay.SigPrefix}RPC_SDO"
77  ]))
78 
79  return acc
80 
81 
82 def RPC_OverlayCfg(flags):
83  """Configure and return a ComponentAccumulator for RPC overlay"""
84  acc = ComponentAccumulator()
85 
86  # Add RPC RDO to digit config
87  from MuonConfig.MuonByteStreamCnvTestConfig import RpcRdoToRpcDigitCfg
88  acc.merge(RpcRdoToRpcDigitCfg(flags))
89 
90  # Add RPC overlay digitization algorithm
91  from MuonConfig.RPC_DigitizationConfig import RPC_OverlayDigitizationBasicCfg
92  acc.merge(RPC_OverlayDigitizationBasicCfg(flags))
93 
94  # Add RPC overlay algorithm
95  acc.merge(RPC_OverlayAlgCfg(flags))
96 
97  # Add RPC truth overlay
98  if flags.Digitization.EnableTruth:
99  if flags.Muon.usePhaseIIGeoSetup:
100  from MuonTruthOverlayR4.TruthOverlayConfig import TruthOverlayCfg
101  acc.merge(TruthOverlayCfg(flags, name="RpcTruthOverlay", WriteKey="RPC_SDO", deadTime = 100.))
102  else:
103  acc.merge(RPC_TruthOverlayCfg(flags))
104 
105  # Add RPC digit to RDO config
106  from MuonConfig.MuonByteStreamCnvTestConfig import RpcDigitToRpcRDOCfg
107  acc.merge(RpcDigitToRpcRDOCfg(flags))
108  if flags.Muon.enableNRPC:
109  from MuonConfig.MuonByteStreamCnvTestConfig import NrpcDigitToNrpcRDOCfg
110  acc.merge(NrpcDigitToNrpcRDOCfg(flags))
111 
112  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.MuonByteStreamCnvTestConfig.RpcDigitToRpcRDOCfg
def RpcDigitToRpcRDOCfg(flags, name="RpcDigitToRpcRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:177
python.RPC_OverlayConfig.RPC_OverlayAlgCfg
def RPC_OverlayAlgCfg(flags, name="RpcOverlay", **kwargs)
Definition: RPC_OverlayConfig.py:11
TruthOverlayConfig.TruthOverlayCfg
def TruthOverlayCfg(flags, name="TruthOverlay", **kwargs)
Definition: TruthOverlayConfig.py:3
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
python.MuonByteStreamCnvTestConfig.RpcRdoToRpcDigitCfg
def RpcRdoToRpcDigitCfg(flags, name="RpcRdoToRpcDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:44
python.RPC_OverlayConfig.RPC_TruthOverlayCfg
def RPC_TruthOverlayCfg(flags, name="RpcTruthOverlay", **kwargs)
Definition: RPC_OverlayConfig.py:46
python.RPC_DigitizationConfig.RPC_OverlayDigitizationBasicCfg
def RPC_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: RPC_DigitizationConfig.py:163
python.MuonByteStreamCnvTestConfig.NrpcDigitToNrpcRDOCfg
def NrpcDigitToNrpcRDOCfg(flags, name="NrpcDigitToNrpcRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:198
python.RPC_OverlayConfig.RPC_OverlayCfg
def RPC_OverlayCfg(flags)
Definition: RPC_OverlayConfig.py:82