ATLAS Offline Software
MM_OverlayConfig.py
Go to the documentation of this file.
1 
2 """Define methods to construct configured MM 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 MM_DataOverlayExtraCfg(flags, **kwargs):
12  """Return a ComponentAccumulator with MM data overlay specifics"""
13  acc = ComponentAccumulator()
14 
15  # We need to convert BS to RDO for data overlay
16  from MuonConfig.MuonBytestreamDecodeConfig import MmBytestreamDecodeCfg
17  acc.merge(MmBytestreamDecodeCfg(flags))
18 
19  return acc
20 
21 
22 def MM_OverlayAlgCfg(flags, name="MM_Overlay", **kwargs):
23  """Return a ComponentAccumulator for MM_Overlay algorithm"""
24  acc = ComponentAccumulator()
25 
26  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}MM_DIGITS")
27  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}MM_DIGITS")
28  kwargs.setdefault("OutputKey", "MM_DIGITS")
29 
30  kwargs.setdefault("IntegrationWindow", 30) # in ns
31 
32  # Do MM overlay
33  acc.addEventAlgo(CompFactory.MM_Overlay(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  "Muon::MM_RawDataContainer#MMRDO"
40  ]))
41 
42  if flags.Output.doWriteRDO_SGNL:
43  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
44  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
45  f"Muon::MM_RawDataContainer#{flags.Overlay.SigPrefix}MMRDO"
46  ]))
47 
48  return acc
49 
50 
51 def MM_TruthOverlayCfg(flags, name="MM_TruthOverlay", **kwargs):
52  """Return a ComponentAccumulator for the MM 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}MM_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}MM_SDO")
66  kwargs.setdefault("OutputKey", "MM_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#MM_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}MM_SDO"
82  ]))
83 
84  return acc
85 
86 
87 def MM_OverlayCfg(flags):
88  """Configure and return a ComponentAccumulator for MM overlay"""
89  acc = ComponentAccumulator()
90 
91  # Add data overlay specifics
92  if flags.Overlay.DataOverlay:
93  acc.merge(MM_DataOverlayExtraCfg(flags))
94 
95  # Add MM RDO to digit config
96  from MuonConfig.MuonByteStreamCnvTestConfig import MM_RdoToDigitCfg
97  acc.merge(MM_RdoToDigitCfg(flags))
98  # Add MM overlay digitization algorithm
99  from MuonConfig.MM_DigitizationConfig import MM_OverlayDigitizationBasicCfg
100  acc.merge(MM_OverlayDigitizationBasicCfg(flags))
101  # Add MM overlay algorithm
102  acc.merge(MM_OverlayAlgCfg(flags))
103  # Add MM truth overlay
104  if flags.Digitization.EnableTruth:
105  if flags.Muon.usePhaseIIGeoSetup:
106  from MuonTruthOverlayR4.TruthOverlayConfig import TruthOverlayCfg
107  acc.merge(TruthOverlayCfg(flags, name="MmTruthOverlay", WriteKey="MM_SDO", deadTime = 300.))
108  else:
109  acc.merge(MM_TruthOverlayCfg(flags))
110  # Add MM digit to RDO config
111  from MuonConfig.MuonByteStreamCnvTestConfig import MM_DigitToRDOCfg
112  acc.merge(MM_DigitToRDOCfg(flags))
113 
114  return acc
python.MM_OverlayConfig.MM_TruthOverlayCfg
def MM_TruthOverlayCfg(flags, name="MM_TruthOverlay", **kwargs)
Definition: MM_OverlayConfig.py:51
python.MM_DigitizationConfig.MM_OverlayDigitizationBasicCfg
def MM_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: MM_DigitizationConfig.py:150
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.MuonByteStreamCnvTestConfig.MM_DigitToRDOCfg
def MM_DigitToRDOCfg(flags, name="MM_DigitToRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:266
python.MuonBytestreamDecodeConfig.MmBytestreamDecodeCfg
def MmBytestreamDecodeCfg(flags, name="MmRawDataProvider", **kwargs)
Definition: MuonBytestreamDecodeConfig.py:341
python.MM_OverlayConfig.MM_OverlayAlgCfg
def MM_OverlayAlgCfg(flags, name="MM_Overlay", **kwargs)
Definition: MM_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.MM_OverlayConfig.MM_DataOverlayExtraCfg
def MM_DataOverlayExtraCfg(flags, **kwargs)
Definition: MM_OverlayConfig.py:11
python.MM_OverlayConfig.MM_OverlayCfg
def MM_OverlayCfg(flags)
Definition: MM_OverlayConfig.py:87
python.MuonByteStreamCnvTestConfig.MM_RdoToDigitCfg
def MM_RdoToDigitCfg(flags, name="MM_RdoToDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:123