ATLAS Offline Software
BCMOverlayConfig.py
Go to the documentation of this file.
1 """Define methods to construct configured BCM overlay algorithms
2 
3 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 """
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 
9 
10 def BCMRawDataProviderAlgCfg(flags, name="BCMRawDataProvider", **kwargs):
11  """Return a ComponentAccumulator for BCM raw data provider"""
12  # Temporary until available in the central location
13  acc = ComponentAccumulator()
14 
15  kwargs.setdefault("RDOKey", f"{flags.Overlay.BkgPrefix}BCM_RDOs")
16 
17  acc.addEventAlgo(CompFactory.BCM_RawDataProvider(name, **kwargs))
18 
19  return acc
20 
21 
22 def BCMOverlayAlgCfg(flags, name="BCMOverlay", **kwargs):
23  """Return a ComponentAccumulator for BCMOverlay algorithm"""
24  acc = ComponentAccumulator()
25 
26  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}BCM_RDOs")
27  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}BCM_RDOs")
28  kwargs.setdefault("OutputKey", "BCM_RDOs")
29 
30  kwargs.setdefault("isDataOverlay", not flags.Input.isMC)
31 
32  # Input setup
33  if flags.Overlay.ByteStream:
34  acc.merge(BCMRawDataProviderAlgCfg(flags))
35  else:
36  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
37  acc.merge(SGInputLoaderCfg(flags, [f'BCM_RDO_Container#{kwargs["BkgInputKey"]}']))
38 
39  # Do BCM overlay
40  acc.addEventAlgo(CompFactory.BCMOverlay(name, **kwargs))
41 
42  # Setup output
43  if flags.Output.doWriteRDO:
44  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
45  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
46  "BCM_RDO_Container#BCM_RDOs"
47  ]))
48 
49  if flags.Output.doWriteRDO_SGNL:
50  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
51  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
52  f"BCM_RDO_Container#{flags.Overlay.SigPrefix}BCM_RDOs"
53  ]))
54 
55  return acc
56 
57 
58 def BCMTruthOverlayCfg(flags, name="BCMSDOOverlay", **kwargs):
59  """Return a ComponentAccumulator for the BCM SDO overlay algorithm"""
60  acc = ComponentAccumulator()
61 
62  # We do not need background BCM SDOs
63  kwargs.setdefault("BkgInputKey", "")
64 
65  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}BCM_SDO_Map")
66  kwargs.setdefault("OutputKey", "BCM_SDO_Map")
67 
68  # Do BCM truth overlay
69  acc.addEventAlgo(CompFactory.InDetSDOOverlay(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  "InDetSimDataCollection#BCM_SDO_Map"
76  ]))
77 
78  if flags.Output.doWriteRDO_SGNL:
79  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
80  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
81  f"InDetSimDataCollection#{flags.Overlay.SigPrefix}BCM_SDO_Map"
82  ]))
83 
84  return acc
85 
86 
87 def BCMOverlayCfg(flags):
88  """Configure and return a ComponentAccumulator for BCM overlay"""
89  acc = ComponentAccumulator()
90 
91  # Add BCM overlay digitization algorithm
92  from BCM_Digitization.BCM_DigitizationConfig import BCM_OverlayDigitizationBasicCfg
93  acc.merge(BCM_OverlayDigitizationBasicCfg(flags))
94 
95  # Add BCM overlay algorithm
96  acc.merge(BCMOverlayAlgCfg(flags))
97 
98  # Add BCM truth overlay
99  if flags.Digitization.EnableTruth:
100  acc.merge(BCMTruthOverlayCfg(flags))
101 
102  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
BCM_DigitizationConfig.BCM_OverlayDigitizationBasicCfg
def BCM_OverlayDigitizationBasicCfg(flags, name="BCM_OverlayDigitization", **kwargs)
Definition: BCM_DigitizationConfig.py:123
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
BCMOverlayConfig.BCMOverlayCfg
def BCMOverlayCfg(flags)
Definition: BCMOverlayConfig.py:87
BCMOverlayConfig.BCMOverlayAlgCfg
def BCMOverlayAlgCfg(flags, name="BCMOverlay", **kwargs)
Definition: BCMOverlayConfig.py:22
BCMOverlayConfig.BCMRawDataProviderAlgCfg
def BCMRawDataProviderAlgCfg(flags, name="BCMRawDataProvider", **kwargs)
Definition: BCMOverlayConfig.py:10
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
BCMOverlayConfig.BCMTruthOverlayCfg
def BCMTruthOverlayCfg(flags, name="BCMSDOOverlay", **kwargs)
Definition: BCMOverlayConfig.py:58