ATLAS Offline Software
ZDC_SimuDigitizationConfig.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 ZDC Digitization code.
11  return 0 #Assume ZDC 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 ZDC Digitization code.
18  return 0 #Assume ZDC is only sensitive to the current bunch crossing, for the moment
19 
20 
21 
22 def ZDC_RangeCfg(flags, name="ZdcRange" , **kwargs):
23  #this is the time of the xing in ns
24  kwargs.setdefault('FirstXing', ZDC_FirstXing() )
25  kwargs.setdefault('LastXing', ZDC_LastXing() )
26  kwargs.setdefault('CacheRefreshFrequency', 1.0 ) #default 0 no dataproxy reset
27  kwargs.setdefault('ItemList', ["ZDC_SimFiberHit_Collection#ZDC_SimFiberHit_Collection" ] )
28  return PileUpXingFolderCfg(flags, name, **kwargs)
29 
30 
31 
32 def ZDC_PileUpToolCfg(flags, name="ZDC_PileUpTool",**kwargs):
33  """Return ComponentAccumulator with ZDC digitization tool."""
34  acc = ComponentAccumulator()
35 
36  # Configure bunch-crossing envelope
37  if flags.Digitization.PileUp:
38  intervals = []
39  if flags.Digitization.DoXingByXingPileUp:
40  kwargs.setdefault("FirstXing", ZDC_FirstXing() )
41  kwargs.setdefault("LastXing", ZDC_LastXing() )
42  else:
43  intervals += [acc.popToolsAndMerge(ZDC_RangeCfg(flags))]
44  kwargs.setdefault("mergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=intervals)).name)
45  #kwargs.setdefault("OnlyUseContainerName", True) # TODO in future MR
46  else:
47  kwargs.setdefault("mergeSvc", '')
48  #kwargs.setdefault("OnlyUseContainerName", False) #TODO in future MR
49 
50  from RngComps.RngCompsConfig import AthRNGSvcCfg
51  kwargs.setdefault("RndmSvc", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)).name)
52 
53  config = "PbPb2023"
54  from AthenaConfiguration.Enums import LHCPeriod
55  if flags.GeoModel.Run in [LHCPeriod.Run1, LHCPeriod.Run2]:
56  config = "PbPb2015"
57 
58  acc.setPrivateTools(CompFactory.ZDC_PileUpTool(name, configuration = config, **kwargs))
59  return acc
60 
61 
62 def ZDC_OverlayPileUpToolCfg(flags, name="ZDC_OverlayPileUpTool", **kwargs):
63  """Return ComponentAccumulator with ZDC_PileUpTool for Overlay"""
64  acc = ComponentAccumulator()
65  kwargs.setdefault("mergeSvc", '')
66  #kwargs.setdefault("OnlyUseContainerName", False) #TODO in future MR
67  tool = acc.popToolsAndMerge(ZDC_PileUpToolCfg(flags, name, **kwargs))
68  acc.setPrivateTools(tool)
69  return acc
70 
71 
73  """Return ComponentAccumulator with Output for ZDC. Not standalone."""
74  acc = ComponentAccumulator()
75  if flags.Output.doWriteRDO:
76  ItemList = ["xAOD::ZdcModuleContainer#*", "xAOD::ZdcModuleAuxContainer#*.", "CaloCalibrationHitContainer#*"]
77  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
78  acc.merge(OutputStreamCfg(flags,"RDO", ItemList))
79  return acc
80 
81 
82 def ZDC_DigitizationBasicCfg(flags, **kwargs):
83  """Return ComponentAccumulator for ZDC digitization"""
84  acc = ComponentAccumulator()
85  if "PileUpTools" not in kwargs:
86  PileUpTools = acc.popToolsAndMerge(ZDC_PileUpToolCfg(flags))
87  kwargs["PileUpTools"] = PileUpTools
88  from DigitizationConfig.PileUpToolsConfig import PileUpToolsCfg
89  acc.merge(PileUpToolsCfg(flags, **kwargs))
90  from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg
91  acc.merge(DetDescrCnvSvcCfg(flags))
92  from ZDC_GeoM.ZdcGeoModelConfig import ZDC_DetToolCfg
93  acc.merge(ZDC_DetToolCfg(flags))
94  return acc
95 
96 
97 def ZDC_OverlayDigitizationBasicCfg(flags, **kwargs):
98  """Return ComponentAccumulator with ZDC_DigiAlg."""
99  acc = ComponentAccumulator()
100  if flags.Common.ProductionStep != ProductionStep.FastChain:
101  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
102  acc.merge(SGInputLoaderCfg(flags,Load={
103  ('ZDC_SimFiberHit_Collection','ZDC_SimFiberHit_Collection')} ) )
104  if "DigitizationTool" not in kwargs:
105  kwargs.setdefault("DigitizationTool", acc.popToolsAndMerge(ZDC_OverlayPileUpToolCfg(flags)))
106 
107  if flags.Concurrency.NumThreads > 0:
108  kwargs.setdefault("Cardinality", flags.Concurrency.NumThreads)
109 
110  # Set common overlay extra inputs
111  kwargs.setdefault("ExtraInputs", flags.Overlay.ExtraInputs)
112 
113  acc.addEventAlgo(CompFactory.ZDC_DigiAlg("ZDC_DigiAlg", **kwargs))
114  return acc
115 
116 
117 def ZDC_DigitizationCfg(flags, **kwargs):
118  """Return ComponentAccumulator for ZDC digitization and Output"""
119  acc = ComponentAccumulator()
120  acc.merge(ZDC_DigitizationBasicCfg(flags, **kwargs))
121  acc.merge(ZDC_DigitizationOutputCfg(flags))
122 
123  return acc
124 
125 
126 def ZDC_DigitizationOverlayCfg(flags, **kwargs):
127  """Return ComponentAccumulator for ZDC digitization and Output"""
128  acc = ComponentAccumulator()
129  acc.merge(ZDC_OverlayDigitizationBasicCfg(flags, **kwargs))
130  acc.merge(ZDC_DigitizationOutputCfg(flags))
131 
132  return acc
ZDC_SimuDigitizationConfig.ZDC_LastXing
def ZDC_LastXing()
Definition: ZDC_SimuDigitizationConfig.py:17
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
ZDC_SimuDigitizationConfig.ZDC_OverlayPileUpToolCfg
def ZDC_OverlayPileUpToolCfg(flags, name="ZDC_OverlayPileUpTool", **kwargs)
Definition: ZDC_SimuDigitizationConfig.py:62
ZDC_SimuDigitizationConfig.ZDC_FirstXing
def ZDC_FirstXing()
Definition: ZDC_SimuDigitizationConfig.py:10
ZDC_SimuDigitizationConfig.ZDC_PileUpToolCfg
def ZDC_PileUpToolCfg(flags, name="ZDC_PileUpTool", **kwargs)
Definition: ZDC_SimuDigitizationConfig.py:32
ZDC_SimuDigitizationConfig.ZDC_DigitizationCfg
def ZDC_DigitizationCfg(flags, **kwargs)
Definition: ZDC_SimuDigitizationConfig.py:117
python.DetDescrCnvSvcConfig.DetDescrCnvSvcCfg
def DetDescrCnvSvcCfg(flags, **kwargs)
Definition: DetDescrCnvSvcConfig.py:6
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
ZdcGeoModelConfig.ZDC_DetToolCfg
def ZDC_DetToolCfg(flags)
Definition: ZdcGeoModelConfig.py:4
python.PileUpToolsConfig.PileUpToolsCfg
def PileUpToolsCfg(flags, **kwargs)
Definition: PileUpToolsConfig.py:14
ZDC_SimuDigitizationConfig.ZDC_DigitizationBasicCfg
def ZDC_DigitizationBasicCfg(flags, **kwargs)
Definition: ZDC_SimuDigitizationConfig.py:82
python.PileUpMergeSvcConfig.PileUpXingFolderCfg
def PileUpXingFolderCfg(flags, name="PileUpXingFolder", **kwargs)
Definition: PileUpMergeSvcConfig.py:35
ZDC_SimuDigitizationConfig.ZDC_RangeCfg
def ZDC_RangeCfg(flags, name="ZdcRange", **kwargs)
Definition: ZDC_SimuDigitizationConfig.py:22
ZDC_SimuDigitizationConfig.ZDC_DigitizationOverlayCfg
def ZDC_DigitizationOverlayCfg(flags, **kwargs)
Definition: ZDC_SimuDigitizationConfig.py:126
python.PileUpMergeSvcConfig.PileUpMergeSvcCfg
def PileUpMergeSvcCfg(flags, name="PileUpMergeSvc", Intervals=[], **kwargs)
Definition: PileUpMergeSvcConfig.py:10
ZDC_SimuDigitizationConfig.ZDC_OverlayDigitizationBasicCfg
def ZDC_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: ZDC_SimuDigitizationConfig.py:97
ZDC_SimuDigitizationConfig.ZDC_DigitizationOutputCfg
def ZDC_DigitizationOutputCfg(flags)
Definition: ZDC_SimuDigitizationConfig.py:72
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51