ATLAS Offline Software
CSC_OverlayConfig.py
Go to the documentation of this file.
1 
2 """Define methods to construct configured CSC 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 CSC_OverlayAlgCfg(flags, name="CscOverlay", **kwargs):
12  """Return a ComponentAccumulator for CSCOverlay algorithm"""
13  acc = ComponentAccumulator()
14 
15  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}CSCRDO")
16  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}CSCRDO")
17  kwargs.setdefault("OutputKey", "CSCRDO")
18 
19  kwargs.setdefault("isDataOverlay", not flags.Input.isMC)
20 
21  if flags.Overlay.ByteStream:
22  from MuonConfig.MuonBytestreamDecodeConfig import CscBytestreamDecodeCfg
23  acc.merge(CscBytestreamDecodeCfg(flags))
24  else:
25  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
26  acc.merge(SGInputLoaderCfg(flags, [f'CscRawDataContainer#{kwargs["BkgInputKey"]}']))
27 
28  from MuonConfig.MuonCalibrationConfig import CscCalibToolCfg
29  kwargs.setdefault("CalibTool", acc.popToolsAndMerge(CscCalibToolCfg(flags)))
30 
31  from MuonConfig.MuonCSC_CnvToolsConfig import MuonCscRDODecoderCfg
32  kwargs.setdefault("CscRdoDecoderTool", acc.popToolsAndMerge(MuonCscRDODecoderCfg(flags)))
33 
34  # Do CSC overlay
35  acc.addEventAlgo(CompFactory.CscOverlay(name, **kwargs))
36 
37  # Setup output
38  if flags.Output.doWriteRDO:
39  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
40  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
41  "CscRawDataContainer#CSCRDO"
42  ]))
43 
44  if flags.Output.doWriteRDO_SGNL:
45  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
46  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
47  f"CscRawDataContainer#{flags.Overlay.SigPrefix}CSCRDO"
48  ]))
49 
50  return acc
51 
52 
53 def CSC_TruthOverlayCfg(flags, name="CscTruthOverlay", **kwargs):
54  """Return a ComponentAccumulator for the CSC SDO overlay algorithm"""
55  acc = ComponentAccumulator()
56 
57  # We do not need background CSC SDOs
58  if not flags.Input.isMC:
59  kwargs.setdefault("BkgInputKey", "")
60  else:
61  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}CSC_SDO")
62 
63  if kwargs["BkgInputKey"]:
64  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
65  acc.merge(SGInputLoaderCfg(flags, [f'CscSimDataCollection#{kwargs["BkgInputKey"]}']))
66 
67  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}CSC_SDO")
68  kwargs.setdefault("OutputKey", "CSC_SDO")
69 
70  # Do CSC truth overlay
71  acc.addEventAlgo(CompFactory.CscSimDataOverlay(name, **kwargs))
72 
73  # Setup output
74  if flags.Output.doWriteRDO:
75  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
76  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
77  "CscSimDataCollection#CSC_SDO"
78  ]))
79 
80  if flags.Output.doWriteRDO_SGNL:
81  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
82  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
83  f"CscSimDataCollection#{flags.Overlay.SigPrefix}CSC_SDO"
84  ]))
85 
86  return acc
87 
88 
89 def CSC_OverlayCfg(flags):
90  """Configure and return a ComponentAccumulator for CSC overlay"""
91  acc = ComponentAccumulator()
92 
93  # Add CSC overlay digitization algorithm
94  from MuonConfig.CSC_DigitizationConfig import CSC_OverlayDigitizationBasicCfg
95  acc.merge(CSC_OverlayDigitizationBasicCfg(flags))
96 
97  # Add CSC digit to RDO config
98  from MuonConfig.MuonByteStreamCnvTestConfig import CscDigitToCscRDOCfg
99  acc.merge(CscDigitToCscRDOCfg(flags))
100 
101  # Add CSC overlay algorithm
102  acc.merge(CSC_OverlayAlgCfg(flags))
103 
104  # Add CSC truth overlay
105  if flags.Digitization.EnableTruth:
106  acc.merge(CSC_TruthOverlayCfg(flags))
107 
108  return acc
python.CSC_OverlayConfig.CSC_OverlayCfg
def CSC_OverlayCfg(flags)
Definition: CSC_OverlayConfig.py:89
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.MuonCalibrationConfig.CscCalibToolCfg
def CscCalibToolCfg(flags, name="CscCalibTool", **kwargs)
CSC calibration.
Definition: MuonCalibrationConfig.py:21
python.MuonBytestreamDecodeConfig.CscBytestreamDecodeCfg
def CscBytestreamDecodeCfg(flags, name="CscRawDataProvider", **kwargs)
Definition: MuonBytestreamDecodeConfig.py:182
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
python.CSC_OverlayConfig.CSC_TruthOverlayCfg
def CSC_TruthOverlayCfg(flags, name="CscTruthOverlay", **kwargs)
Definition: CSC_OverlayConfig.py:53
python.CSC_OverlayConfig.CSC_OverlayAlgCfg
def CSC_OverlayAlgCfg(flags, name="CscOverlay", **kwargs)
Definition: CSC_OverlayConfig.py:11
python.CSC_DigitizationConfig.CSC_OverlayDigitizationBasicCfg
def CSC_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: CSC_DigitizationConfig.py:115
python.MuonCSC_CnvToolsConfig.MuonCscRDODecoderCfg
def MuonCscRDODecoderCfg(flags, **kwargs)
Definition: MuonCSC_CnvToolsConfig.py:6
python.MuonByteStreamCnvTestConfig.CscDigitToCscRDOCfg
def CscDigitToCscRDOCfg(flags, name="CscDigitToCscRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:257