ATLAS Offline Software
MDT_OverlayConfig.py
Go to the documentation of this file.
1 
2 """Define methods to construct configured MDT 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 MDT_DataOverlayExtraCfg(flags, **kwargs):
12  """Return a ComponentAccumulator with MDT data overlay specifics"""
13  acc = ComponentAccumulator()
14 
15  # We need to convert BS to RDO for data overlay
16  from MuonConfig.MuonBytestreamDecodeConfig import MdtBytestreamDecodeCfg
17  acc.merge(MdtBytestreamDecodeCfg(flags))
18 
19  return acc
20 
21 
22 def MDT_OverlayAlgCfg(flags, name="MdtOverlay", **kwargs):
23  """Return a ComponentAccumulator for MDTOverlay algorithm"""
24  acc = ComponentAccumulator()
25 
26  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}MDT_DIGITS")
27  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}MDT_DIGITS")
28  kwargs.setdefault("OutputKey", "MDT_DIGITS")
29 
30  kwargs.setdefault("IntegrationWindow", 20) # in ns
31 
32  # Do MDT overlay
33  acc.addEventAlgo(CompFactory.MdtOverlay(name, **kwargs))
34 
35  # Setup output
36  if flags.Output.doWriteRDO:
37  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
38  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
39  "MdtCsmContainer#MDTCSM"
40  ]))
41 
42  if flags.Output.doWriteRDO_SGNL:
43  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
44  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
45  f"MdtCsmContainer#{flags.Overlay.SigPrefix}MDTCSM"
46  ]))
47 
48  return acc
49 
50 
51 def MDT_TruthOverlayCfg(flags, name="MdtTruthOverlay", **kwargs):
52  """Return a ComponentAccumulator for the MDT SDO overlay algorithm"""
53  acc = ComponentAccumulator()
54 
55  # We do not need background MDT SDOs
56  if flags.Overlay.DataOverlay:
57  kwargs.setdefault("BkgInputKey", "")
58  else:
59  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}MDT_SDO")
60 
61  if kwargs["BkgInputKey"]:
62  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
63  acc.merge(SGInputLoaderCfg(flags, [f'MuonSimDataCollection#{kwargs["BkgInputKey"]}']))
64 
65  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}MDT_SDO")
66  kwargs.setdefault("OutputKey", "MDT_SDO")
67 
68  # Do MDT truth overlay
69  acc.addEventAlgo(CompFactory.MuonSimDataOverlay(name, **kwargs))
70 
71  # Setup output
72  if flags.Output.doWriteRDO:
73  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
74  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
75  "MuonSimDataCollection#MDT_SDO"
76  ]))
77 
78  if flags.Output.doWriteRDO_SGNL:
79  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
80  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
81  f"MuonSimDataCollection#{flags.Overlay.SigPrefix}MDT_SDO"
82  ]))
83 
84  return acc
85 
86 def MDT_OverlayCfg(flags):
87  """Configure and return a ComponentAccumulator for MDT overlay"""
88  acc = ComponentAccumulator()
89 
90  # Add data overlay specifics
91  if flags.Overlay.DataOverlay:
92  acc.merge(MDT_DataOverlayExtraCfg(flags))
93 
94  # Add MDT RDO to digit config
95  from MuonConfig.MuonByteStreamCnvTestConfig import MdtRdoToMdtDigitCfg
96  acc.merge(MdtRdoToMdtDigitCfg(flags))
97  # Add MDT overlay digitization algorithm
98  from MuonConfig.MDT_DigitizationConfig import MDT_OverlayDigitizationBasicCfg
99  acc.merge(MDT_OverlayDigitizationBasicCfg(flags))
100  # Add MDT overlay algorithm
101  acc.merge(MDT_OverlayAlgCfg(flags))
102  # Add MDT truth overlay
103  if flags.Digitization.EnableTruth:
104  if flags.Muon.usePhaseIIGeoSetup:
105  from MuonTruthOverlayR4.TruthOverlayConfig import TruthOverlayCfg
106  acc.merge(TruthOverlayCfg(flags, name="MdtTruthOverlay", WriteKey="MDT_SDO", deadTime = 700.))
107  else:
108  acc.merge(MDT_TruthOverlayCfg(flags))
109  # Add MDT digit to RDO config
110  from MuonConfig.MuonByteStreamCnvTestConfig import MdtDigitToMdtRDOCfg
111  acc.merge(MdtDigitToMdtRDOCfg(flags))
112 
113  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.MDT_OverlayConfig.MDT_DataOverlayExtraCfg
def MDT_DataOverlayExtraCfg(flags, **kwargs)
Definition: MDT_OverlayConfig.py:11
python.MuonByteStreamCnvTestConfig.MdtRdoToMdtDigitCfg
def MdtRdoToMdtDigitCfg(flags, name="MdtRdoToMdtDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:20
python.MDT_OverlayConfig.MDT_OverlayAlgCfg
def MDT_OverlayAlgCfg(flags, name="MdtOverlay", **kwargs)
Definition: MDT_OverlayConfig.py:22
TruthOverlayConfig.TruthOverlayCfg
def TruthOverlayCfg(flags, name="TruthOverlay", **kwargs)
Definition: TruthOverlayConfig.py:3
python.MDT_OverlayConfig.MDT_OverlayCfg
def MDT_OverlayCfg(flags)
Definition: MDT_OverlayConfig.py:86
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
python.MuonBytestreamDecodeConfig.MdtBytestreamDecodeCfg
def MdtBytestreamDecodeCfg(flags, name="MdtRawDataProvider", **kwargs)
Definition: MuonBytestreamDecodeConfig.py:138
python.MuonByteStreamCnvTestConfig.MdtDigitToMdtRDOCfg
def MdtDigitToMdtRDOCfg(flags, name="MdtDigitToMdtRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:143
python.MDT_OverlayConfig.MDT_TruthOverlayCfg
def MDT_TruthOverlayCfg(flags, name="MdtTruthOverlay", **kwargs)
Definition: MDT_OverlayConfig.py:51
python.MDT_DigitizationConfig.MDT_OverlayDigitizationBasicCfg
def MDT_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: MDT_DigitizationConfig.py:152