ATLAS Offline Software
TGC_OverlayConfig.py
Go to the documentation of this file.
1 
2 """Define methods to construct configured TGC 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 TGC_OverlayAlgCfg(flags, name="TgcOverlay", **kwargs):
12  """Return a ComponentAccumulator for TGCOverlay algorithm"""
13  acc = ComponentAccumulator()
14 
15  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}TGC_DIGITS")
16  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}TGC_DIGITS")
17  kwargs.setdefault("OutputKey", "TGC_DIGITS")
18 
19  # Do TGC overlay
20  acc.addEventAlgo(CompFactory.TgcOverlay(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  "TgcRdoContainer#TGCRDO"
27  ]))
28 
29  if flags.Output.doWriteRDO_SGNL:
30  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
31  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
32  f"TgcRdoContainer#{flags.Overlay.SigPrefix}TGCRDO"
33  ]))
34 
35  return acc
36 
37 
38 def TGC_TruthOverlayCfg(flags, name="TgcTruthOverlay", **kwargs):
39  """Return a ComponentAccumulator for the TGC 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}TGC_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}TGC_SDO")
53  kwargs.setdefault("OutputKey", "TGC_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#TGC_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}TGC_SDO"
69  ]))
70 
71  return acc
72 
73 
74 def TGC_OverlayCfg(flags):
75  """Configure and return a ComponentAccumulator for TGC overlay"""
76  acc = ComponentAccumulator()
77 
78  # Add TGC RDO to digit config
79  from MuonConfig.MuonByteStreamCnvTestConfig import TgcRdoToTgcDigitCfg
80  acc.merge(TgcRdoToTgcDigitCfg(flags))
81 
82  # Add TGC overlay digitization algorithm
83  from MuonConfig.TGC_DigitizationConfig import TGC_OverlayDigitizationBasicCfg
84  acc.merge(TGC_OverlayDigitizationBasicCfg(flags))
85 
86  # Add TGC overlay algorithm
87  acc.merge(TGC_OverlayAlgCfg(flags))
88 
89  # Add TGC truth overlay
90  if flags.Digitization.EnableTruth:
91  if flags.Muon.usePhaseIIGeoSetup:
92  from MuonTruthOverlayR4.TruthOverlayConfig import TruthOverlayCfg
93  acc.merge(TruthOverlayCfg(flags, name="TgcTruthOverlay", WriteKey="TGC_SDO", deadTime = 100.))
94  else:
95  acc.merge(TGC_TruthOverlayCfg(flags))
96 
97  # Add TGC digit to RDO config
98  from MuonConfig.MuonByteStreamCnvTestConfig import TgcDigitToTgcRDOCfg
99  acc.merge(TgcDigitToTgcRDOCfg(flags))
100 
101  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TGC_OverlayConfig.TGC_TruthOverlayCfg
def TGC_TruthOverlayCfg(flags, name="TgcTruthOverlay", **kwargs)
Definition: TGC_OverlayConfig.py:38
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.TGC_OverlayConfig.TGC_OverlayAlgCfg
def TGC_OverlayAlgCfg(flags, name="TgcOverlay", **kwargs)
Definition: TGC_OverlayConfig.py:11
python.TGC_OverlayConfig.TGC_OverlayCfg
def TGC_OverlayCfg(flags)
Definition: TGC_OverlayConfig.py:74
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.TGC_DigitizationConfig.TGC_OverlayDigitizationBasicCfg
def TGC_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: TGC_DigitizationConfig.py:124
python.MuonByteStreamCnvTestConfig.TgcRdoToTgcDigitCfg
def TgcRdoToTgcDigitCfg(flags, name="TgcRdoToTgcDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:91
python.MuonByteStreamCnvTestConfig.TgcDigitToTgcRDOCfg
def TgcDigitToTgcRDOCfg(flags, name="TgcDigitToTgcRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:218