ATLAS Offline Software
sTGC_OverlayConfig.py
Go to the documentation of this file.
1 
2 """Define methods to construct configured sTGC 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 sTGC_DataOverlayExtraCfg(flags, **kwargs):
12  """Return a ComponentAccumulator with sTGC data overlay specifics"""
13  acc = ComponentAccumulator()
14 
15  # We need to convert BS to RDO for data overlay
16  from MuonConfig.MuonBytestreamDecodeConfig import sTgcBytestreamDecodeCfg
17  acc.merge(sTgcBytestreamDecodeCfg(flags))
18 
19  return acc
20 
21 
22 def sTGC_OverlayAlgCfg(flags, name="STGC_Overlay", **kwargs):
23  """Return a ComponentAccumulator for STGC_Overlay algorithm"""
24  acc = ComponentAccumulator()
25 
26  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}sTGC_DIGITS")
27  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}sTGC_DIGITS")
28  kwargs.setdefault("OutputKey", "sTGC_DIGITS")
29 
30  # Do sTGC overlay
31  acc.addEventAlgo(CompFactory.STGC_Overlay(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  "Muon::STGC_RawDataContainer#sTGCRDO"
38  ]))
39 
40  if flags.Output.doWriteRDO_SGNL:
41  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
42  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
43  f"Muon::STGC_RawDataContainer#{flags.Overlay.SigPrefix}sTGCRDO"
44  ]))
45 
46  return acc
47 
48 
49 def sTGC_TruthOverlayCfg(flags, name="STGC_TruthOverlay", **kwargs):
50  """Return a ComponentAccumulator for the sTGC SDO overlay algorithm"""
51  acc = ComponentAccumulator()
52 
53  # We do not need background TGC SDOs
54  if flags.Overlay.DataOverlay:
55  kwargs.setdefault("BkgInputKey", "")
56  else:
57  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}sTGC_SDO")
58 
59  if kwargs["BkgInputKey"]:
60  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
61  acc.merge(SGInputLoaderCfg(flags, [f'MuonSimDataCollection#{kwargs["BkgInputKey"]}']))
62 
63  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}sTGC_SDO")
64  kwargs.setdefault("OutputKey", "sTGC_SDO")
65 
66  # Do TGC truth overlay
67  acc.addEventAlgo(CompFactory.MuonSimDataOverlay(name, **kwargs))
68 
69  # Setup output
70  if flags.Output.doWriteRDO:
71  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
72  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
73  "MuonSimDataCollection#sTGC_SDO"
74  ]))
75 
76  if flags.Output.doWriteRDO_SGNL:
77  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
78  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
79  f"MuonSimDataCollection#{flags.Overlay.SigPrefix}sTGC_SDO"
80  ]))
81 
82  return acc
83 
84 
85 def sTGC_OverlayCfg(flags):
86  """Configure and return a ComponentAccumulator for sTGC overlay"""
87  acc = ComponentAccumulator()
88 
89  # Add data overlay specifics
90  if flags.Overlay.DataOverlay:
91  acc.merge(sTGC_DataOverlayExtraCfg(flags))
92 
93  # Add sTGC RDO to digit config
94  from MuonConfig.MuonByteStreamCnvTestConfig import STGC_RdoToDigitCfg
95  acc.merge(STGC_RdoToDigitCfg(flags))
96  # Add sTGC overlay digitization algorithm
97  from MuonConfig.sTGC_DigitizationConfig import sTGC_OverlayDigitizationBasicCfg
98  acc.merge(sTGC_OverlayDigitizationBasicCfg(flags))
99  # Add sTGC overlay algorithm
100  acc.merge(sTGC_OverlayAlgCfg(flags))
101  # Add sTGC truth overlay
102  if flags.Digitization.EnableTruth:
103  acc.merge(sTGC_TruthOverlayCfg(flags))
104  # Add sTGC digit to RDO config
105  from MuonConfig.MuonByteStreamCnvTestConfig import STGC_DigitToRDOCfg
106  acc.merge(STGC_DigitToRDOCfg(flags))
107 
108  return acc
python.sTGC_OverlayConfig.sTGC_OverlayAlgCfg
def sTGC_OverlayAlgCfg(flags, name="STGC_Overlay", **kwargs)
Definition: sTGC_OverlayConfig.py:22
python.sTGC_DigitizationConfig.sTGC_OverlayDigitizationBasicCfg
def sTGC_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: sTGC_DigitizationConfig.py:127
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
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
python.MuonByteStreamCnvTestConfig.STGC_DigitToRDOCfg
def STGC_DigitToRDOCfg(flags, name="STGC_DigitToRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:249
python.sTGC_OverlayConfig.sTGC_TruthOverlayCfg
def sTGC_TruthOverlayCfg(flags, name="STGC_TruthOverlay", **kwargs)
Definition: sTGC_OverlayConfig.py:49
python.MuonByteStreamCnvTestConfig.STGC_RdoToDigitCfg
def STGC_RdoToDigitCfg(flags, name="STGC_RdoToDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:103
python.sTGC_OverlayConfig.sTGC_OverlayCfg
def sTGC_OverlayCfg(flags)
Definition: sTGC_OverlayConfig.py:85
python.sTGC_OverlayConfig.sTGC_DataOverlayExtraCfg
def sTGC_DataOverlayExtraCfg(flags, **kwargs)
Definition: sTGC_OverlayConfig.py:11
python.MuonBytestreamDecodeConfig.sTgcBytestreamDecodeCfg
def sTgcBytestreamDecodeCfg(flags, name="sTgcRawDataProvider", **kwargs)
Definition: MuonBytestreamDecodeConfig.py:235