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-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 sTGC_OverlayAlgCfg(flags, name="STGC_Overlay", **kwargs):
12  """Return a ComponentAccumulator for STGC_Overlay algorithm"""
13  acc = ComponentAccumulator()
14 
15  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}sTGC_DIGITS")
16  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}sTGC_DIGITS")
17  kwargs.setdefault("OutputKey", "sTGC_DIGITS")
18 
19  # Do sTGC overlay
20  acc.addEventAlgo(CompFactory.STGC_Overlay(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  "Muon::STGC_RawDataContainer#sTGCRDO"
27  ]))
28 
29  if flags.Output.doWriteRDO_SGNL:
30  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
31  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
32  f"Muon::STGC_RawDataContainer#{flags.Overlay.SigPrefix}sTGCRDO"
33  ]))
34 
35  return acc
36 
37 
38 def sTGC_TruthOverlayCfg(flags, name="STGC_TruthOverlay", **kwargs):
39  """Return a ComponentAccumulator for the sTGC SDO overlay algorithm"""
40  acc = ComponentAccumulator()
41 
42  # We do not need background TGC SDOs
43  if not flags.Input.isMC:
44  kwargs.setdefault("BkgInputKey", "")
45  else:
46  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}sTGC_SDO")
47 
48  if kwargs["BkgInputKey"]:
49  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
50  acc.merge(SGInputLoaderCfg(flags, [f'MuonSimDataCollection#{kwargs["BkgInputKey"]}']))
51 
52  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}sTGC_SDO")
53  kwargs.setdefault("OutputKey", "sTGC_SDO")
54 
55  # Do TGC truth overlay
56  acc.addEventAlgo(CompFactory.MuonSimDataOverlay(name, **kwargs))
57 
58  # Setup output
59  if flags.Output.doWriteRDO:
60  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
61  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
62  "MuonSimDataCollection#sTGC_SDO"
63  ]))
64 
65  if flags.Output.doWriteRDO_SGNL:
66  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
67  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
68  f"MuonSimDataCollection#{flags.Overlay.SigPrefix}sTGC_SDO"
69  ]))
70 
71  return acc
72 
73 
74 def sTGC_OverlayCfg(flags):
75  """Configure and return a ComponentAccumulator for sTGC overlay"""
76  acc = ComponentAccumulator()
77 
78  # Add sTGC RDO to digit config
79  from MuonConfig.MuonByteStreamCnvTestConfig import STGC_RdoToDigitCfg
80  acc.merge(STGC_RdoToDigitCfg(flags))
81 
82  # Add sTGC overlay digitization algorithm
83  from MuonConfig.sTGC_DigitizationConfig import sTGC_OverlayDigitizationBasicCfg
84  acc.merge(sTGC_OverlayDigitizationBasicCfg(flags))
85 
86  # Add sTGC overlay algorithm
87  acc.merge(sTGC_OverlayAlgCfg(flags))
88 
89  # Add sTGC truth overlay
90  if flags.Digitization.EnableTruth:
91  if flags.Muon.usePhaseIIGeoSetup:
92  from MuonTruthOverlayR4.TruthOverlayConfig import TruthOverlayCfg
93  acc.merge(TruthOverlayCfg(flags, name="sTgcTruthOverlay", WriteKey="sTGC_SDO", deadTime = 100.))
94  else:
95  acc.merge(sTGC_TruthOverlayCfg(flags))
96 
97  # Add sTGC digit to RDO config
98  from MuonConfig.MuonByteStreamCnvTestConfig import STGC_DigitToRDOCfg
99  acc.merge(STGC_DigitToRDOCfg(flags))
100 
101  return acc
python.sTGC_OverlayConfig.sTGC_OverlayAlgCfg
def sTGC_OverlayAlgCfg(flags, name="STGC_Overlay", **kwargs)
Definition: sTGC_OverlayConfig.py:11
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
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.STGC_DigitToRDOCfg
def STGC_DigitToRDOCfg(flags, name="STGC_DigitToRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:270
python.sTGC_OverlayConfig.sTGC_TruthOverlayCfg
def sTGC_TruthOverlayCfg(flags, name="STGC_TruthOverlay", **kwargs)
Definition: sTGC_OverlayConfig.py:38
python.MuonByteStreamCnvTestConfig.STGC_RdoToDigitCfg
def STGC_RdoToDigitCfg(flags, name="STGC_RdoToDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:116
python.sTGC_OverlayConfig.sTGC_OverlayCfg
def sTGC_OverlayCfg(flags)
Definition: sTGC_OverlayConfig.py:74