ATLAS Offline Software
ALFA_DigitizationConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.Enums import ProductionStep
6 from DigitizationConfig.PileUpMergeSvcConfig import PileUpMergeSvcCfg, PileUpXingFolderCfg
7 
8 # The earliest bunch crossing time for which interactions will be sent
9 # to the ALFA Digitization code.
11  return 0 #Assume ALFA is only sensitive to the current bunch crossing, for the moment
12 
13 
14 
15 # The latest bunch crossing time for which interactions will be sent
16 # to the ALFA Digitization code.
18  return 0 #Assume ALFA is only sensitive to the current bunch crossing, for the moment
19 
20 
21 
22 def ALFARangeCfg(flags, name="ALFARange", **kwargs):
23  #this is the time of the xing in ns
24  kwargs.setdefault('FirstXing', ALFA_FirstXing() )
25  kwargs.setdefault('LastXing', ALFA_LastXing() )
26  kwargs.setdefault('CacheRefreshFrequency', 1.0 ) #default 0 no dataproxy reset
27  kwargs.setdefault('ItemList', ["ALFA_HitCollection#ALFA_HitCollection",
28  "ALFA_ODHitCollection#ALFA_ODHitCollection"] )
29  return PileUpXingFolderCfg(flags, name, **kwargs)
30 
31 
32 
33 def ALFA_PileUpToolCfg(flags, name="ALFA_PileUpTool", **kwargs):
34  """Return ComponentAccumulator with ALFA digitization tool."""
35  acc = ComponentAccumulator()
36 
37  # Configure bunch-crossing envelope
38  if flags.Digitization.PileUp:
39  intervals = []
40  if flags.Digitization.DoXingByXingPileUp:
41  kwargs.setdefault("FirstXing", ALFA_FirstXing() )
42  kwargs.setdefault("LastXing", ALFA_LastXing() )
43  else:
44  intervals += [acc.popToolsAndMerge(ALFARangeCfg(flags))]
45  kwargs.setdefault("mergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=intervals)).name)
46  #kwargs.setdefault("OnlyUseContainerName", True) # TODO in future MR
47  else:
48  kwargs.setdefault("mergeSvc", '')
49  #kwargs.setdefault("OnlyUseContainerName", False) #TODO in future MR
50 
51  from RngComps.RngCompsConfig import AthRNGSvcCfg
52  kwargs.setdefault("RndmSvc", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)).name)
53 
54  acc.setPrivateTools(CompFactory.ALFA_PileUpTool(name, **kwargs))
55  return acc
56 
57 
58 def ALFA_OverlayPileUpToolCfg(flags, name="ALFA_OverlayPileUpTool", **kwargs):
59  """Return ComponentAccumulator with ALFA_PileUpTool for Overlay"""
60  acc = ComponentAccumulator()
61  kwargs.setdefault("mergeSvc", '')
62  #kwargs.setdefault("OnlyUseContainerName", False) #TODO in future MR
63  tool = acc.popToolsAndMerge(ALFA_PileUpToolCfg(flags, name, **kwargs))
64  acc.setPrivateTools(tool)
65  return acc
66 
67 
69  """Return ComponentAccumulator with Output for ALFA. Not standalone."""
70  acc = ComponentAccumulator()
71  if flags.Output.doWriteRDO:
72  ItemList = ["ALFA_DigitCollection#ALFA_DigitCollection",
73  "ALFA_ODDigitCollection#ALFA_ODDigitCollection"]
74  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
75  acc.merge(OutputStreamCfg(flags,"RDO", ItemList))
76  return acc
77 
78 
79 def ALFA_DigitizationBasicCfg(flags, **kwargs):
80  """Return ComponentAccumulator for ALFA digitization"""
81  acc = ComponentAccumulator()
82  if "PileUpTools" not in kwargs:
83  PileUpTools = acc.popToolsAndMerge(ALFA_PileUpToolCfg(flags))
84  kwargs["PileUpTools"] = PileUpTools
85  from DigitizationConfig.PileUpToolsConfig import PileUpToolsCfg
86  acc.merge(PileUpToolsCfg(flags, **kwargs))
87  return acc
88 
89 
90 def ALFA_OverlayDigitizationBasicCfg(flags, **kwargs):
91  """Return ComponentAccumulator with ALFA_DigiAlg."""
92  acc = ComponentAccumulator()
93  if flags.Common.ProductionStep != ProductionStep.FastChain:
94  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
95  acc.merge(SGInputLoaderCfg(flags,Load={('ALFA_HitCollection','ALFA_HitCollection'),
96  ('ALFA_ODHitCollection','ALFA_ODHitCollection')} ) )
97  if "DigitizationTool" not in kwargs:
98  kwargs.setdefault("DigitizationTool", acc.popToolsAndMerge(ALFA_OverlayPileUpToolCfg(flags)))
99 
100  if flags.Concurrency.NumThreads > 0:
101  kwargs.setdefault("Cardinality", flags.Concurrency.NumThreads)
102 
103  # Set common overlay extra inputs
104  kwargs.setdefault("ExtraInputs", flags.Overlay.ExtraInputs)
105 
106  acc.addEventAlgo(CompFactory.ALFA_DigiAlg("ALFA_DigiAlg", **kwargs))
107  return acc
108 
109 
110 def ALFA_DigitizationCfg(flags, **kwargs):
111  """Return ComponentAccumulator for ALFA digitization and Output"""
112  acc = ComponentAccumulator()
113  acc.merge(ALFA_DigitizationBasicCfg(flags, **kwargs))
114  acc.merge(ALFA_DigitizationOutputCfg(flags))
115 
116  return acc
117 
118 
119 def ALFA_DigitizationOverlayCfg(flags, **kwargs):
120  """Return ComponentAccumulator for ALFA digitization and Output"""
121  acc = ComponentAccumulator()
122  acc.merge(ALFA_OverlayDigitizationBasicCfg(flags, **kwargs))
123  acc.merge(ALFA_DigitizationOutputCfg(flags))
124 
125  return acc
ALFA_DigitizationConfig.ALFA_DigitizationCfg
def ALFA_DigitizationCfg(flags, **kwargs)
Definition: ALFA_DigitizationConfig.py:110
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
ALFA_DigitizationConfig.ALFA_FirstXing
def ALFA_FirstXing()
Definition: ALFA_DigitizationConfig.py:10
ALFA_DigitizationConfig.ALFA_DigitizationBasicCfg
def ALFA_DigitizationBasicCfg(flags, **kwargs)
Definition: ALFA_DigitizationConfig.py:79
ALFA_DigitizationConfig.ALFA_LastXing
def ALFA_LastXing()
Definition: ALFA_DigitizationConfig.py:17
ALFA_DigitizationConfig.ALFA_PileUpToolCfg
def ALFA_PileUpToolCfg(flags, name="ALFA_PileUpTool", **kwargs)
Definition: ALFA_DigitizationConfig.py:33
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
ALFA_DigitizationConfig.ALFARangeCfg
def ALFARangeCfg(flags, name="ALFARange", **kwargs)
Definition: ALFA_DigitizationConfig.py:22
ALFA_DigitizationConfig.ALFA_OverlayDigitizationBasicCfg
def ALFA_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: ALFA_DigitizationConfig.py:90
ALFA_DigitizationConfig.ALFA_DigitizationOverlayCfg
def ALFA_DigitizationOverlayCfg(flags, **kwargs)
Definition: ALFA_DigitizationConfig.py:119
ALFA_DigitizationConfig.ALFA_OverlayPileUpToolCfg
def ALFA_OverlayPileUpToolCfg(flags, name="ALFA_OverlayPileUpTool", **kwargs)
Definition: ALFA_DigitizationConfig.py:58
python.PileUpToolsConfig.PileUpToolsCfg
def PileUpToolsCfg(flags, **kwargs)
Definition: PileUpToolsConfig.py:14
python.PileUpMergeSvcConfig.PileUpXingFolderCfg
def PileUpXingFolderCfg(flags, name="PileUpXingFolder", **kwargs)
Definition: PileUpMergeSvcConfig.py:35
python.PileUpMergeSvcConfig.PileUpMergeSvcCfg
def PileUpMergeSvcCfg(flags, name="PileUpMergeSvc", Intervals=[], **kwargs)
Definition: PileUpMergeSvcConfig.py:10
ALFA_DigitizationConfig.ALFA_DigitizationOutputCfg
def ALFA_DigitizationOutputCfg(flags)
Definition: ALFA_DigitizationConfig.py:68
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51