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-2022 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_DataOverlayExtraCfg(flags, **kwargs):
12  """Return a ComponentAccumulator with RPC data overlay specifics"""
13  acc = ComponentAccumulator()
14 
15  # We need to convert BS to RDO for data overlay
16  from MuonConfig.MuonBytestreamDecodeConfig import RpcBytestreamDecodeCfg
17  acc.merge(RpcBytestreamDecodeCfg(flags))
18 
19  return acc
20 
21 
22 def RPC_OverlayAlgCfg(flags, name="RpcOverlay", **kwargs):
23  """Return a ComponentAccumulator for RPCOverlay algorithm"""
24  acc = ComponentAccumulator()
25 
26  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}RPC_DIGITS")
27  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}RPC_DIGITS")
28  kwargs.setdefault("OutputKey", "RPC_DIGITS")
29 
30  # Do RPC overlay
31  acc.addEventAlgo(CompFactory.RpcOverlay(name, **kwargs))
32 
33  # Setup output
34  if flags.Output.doWriteRDO:
35  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
36  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
37  "RpcPadContainer#RPCPAD"
38  ]))
39  if flags.Muon.enableNRPC:
40  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
41  "xAOD::NRPCRDOContainer#NRPCRDO", "xAOD::NRPCRDOAuxContainer#NRPCRDOAux."
42  ]))
43 
44  if flags.Output.doWriteRDO_SGNL:
45  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
46  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
47  f"RpcPadContainer#{flags.Overlay.SigPrefix}RPCPAD"
48  ]))
49  if flags.Muon.enableNRPC:
50  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
51  f"xAOD::NRPCRDOContainer#{flags.Overlay.SigPrefix}NRPCRDO", f"xAOD::NRPCRDOAuxContainer#{flags.Overlay.SigPrefix}NRPCRDOAux."
52  ]))
53 
54  return acc
55 
56 
57 def RPC_TruthOverlayCfg(flags, name="RpcTruthOverlay", **kwargs):
58  """Return a ComponentAccumulator for the RPC SDO overlay algorithm"""
59  acc = ComponentAccumulator()
60 
61  # We do not need background RPC SDOs
62  if flags.Overlay.DataOverlay:
63  kwargs.setdefault("BkgInputKey", "")
64  else:
65  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}RPC_SDO")
66 
67  if kwargs["BkgInputKey"]:
68  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
69  acc.merge(SGInputLoaderCfg(flags, [f'MuonSimDataCollection#{kwargs["BkgInputKey"]}']))
70 
71  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}RPC_SDO")
72  kwargs.setdefault("OutputKey", "RPC_SDO")
73 
74  # Do RPC truth overlay
75  acc.addEventAlgo(CompFactory.MuonSimDataOverlay(name, **kwargs))
76 
77  # Setup output
78  if flags.Output.doWriteRDO:
79  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
80  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
81  "MuonSimDataCollection#RPC_SDO"
82  ]))
83 
84  if flags.Output.doWriteRDO_SGNL:
85  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
86  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
87  f"MuonSimDataCollection#{flags.Overlay.SigPrefix}RPC_SDO"
88  ]))
89 
90  return acc
91 
92 
93 def RPC_OverlayCfg(flags):
94  """Configure and return a ComponentAccumulator for RPC overlay"""
95  acc = ComponentAccumulator()
96 
97  # Add data overlay specifics
98  if flags.Overlay.DataOverlay:
99  acc.merge(RPC_DataOverlayExtraCfg(flags))
100 
101  # Add RPC RDO to digit config
102  from MuonConfig.MuonByteStreamCnvTestConfig import RpcRdoToRpcDigitCfg
103  acc.merge(RpcRdoToRpcDigitCfg(flags))
104  # Add RPC overlay digitization algorithm
105  from MuonConfig.RPC_DigitizationConfig import RPC_OverlayDigitizationBasicCfg
106  acc.merge(RPC_OverlayDigitizationBasicCfg(flags))
107  # Add RPC overlay algorithm
108  acc.merge(RPC_OverlayAlgCfg(flags))
109  # Add RPC truth overlay
110  if flags.Digitization.EnableTruth:
111  if flags.Muon.usePhaseIIGeoSetup:
112  from MuonTruthOverlayR4.TruthOverlayConfig import TruthOverlayCfg
113  acc.merge(TruthOverlayCfg(flags, name="RpcTruthOverlay", WriteKey="RPC_SDO", deadTime = 100.))
114  else:
115  acc.merge(RPC_TruthOverlayCfg(flags))
116  # Add RPC digit to RDO config
117  from MuonConfig.MuonByteStreamCnvTestConfig import RpcDigitToRpcRDOCfg
118  acc.merge(RpcDigitToRpcRDOCfg(flags))
119  if flags.Muon.enableNRPC:
120  from MuonConfig.MuonByteStreamCnvTestConfig import NrpcDigitToNrpcRDOCfg
121  acc.merge(NrpcDigitToNrpcRDOCfg(flags))
122 
123  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.RPC_OverlayConfig.RPC_DataOverlayExtraCfg
def RPC_DataOverlayExtraCfg(flags, **kwargs)
Definition: RPC_OverlayConfig.py:11
python.MuonByteStreamCnvTestConfig.RpcDigitToRpcRDOCfg
def RpcDigitToRpcRDOCfg(flags, name="RpcDigitToRpcRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:156
python.RPC_OverlayConfig.RPC_OverlayAlgCfg
def RPC_OverlayAlgCfg(flags, name="RpcOverlay", **kwargs)
Definition: RPC_OverlayConfig.py:22
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:39
python.RPC_OverlayConfig.RPC_TruthOverlayCfg
def RPC_TruthOverlayCfg(flags, name="RpcTruthOverlay", **kwargs)
Definition: RPC_OverlayConfig.py:57
python.MuonBytestreamDecodeConfig.RpcBytestreamDecodeCfg
def RpcBytestreamDecodeCfg(flags, name="RpcRawDataProvider", **kwargs)
This configuration function sets up everything for decoding RPC bytestream data into RDOs.
Definition: MuonBytestreamDecodeConfig.py:34
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:177
python.RPC_OverlayConfig.RPC_OverlayCfg
def RPC_OverlayCfg(flags)
Definition: RPC_OverlayConfig.py:93