ATLAS Offline Software
Loading...
Searching...
No Matches
ALFA_DigitizationConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaConfiguration.Enums import ProductionStep
6from 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
22def 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
33def 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)))
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)))
53
54 acc.setPrivateTools(CompFactory.ALFA_PileUpTool(name, **kwargs))
55 return acc
56
57
58def 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
79def 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
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
110def 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
119def 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_PileUpToolCfg(flags, name="ALFA_PileUpTool", **kwargs)
ALFARangeCfg(flags, name="ALFARange", **kwargs)
ALFA_DigitizationOverlayCfg(flags, **kwargs)
ALFA_DigitizationBasicCfg(flags, **kwargs)
ALFA_OverlayDigitizationBasicCfg(flags, **kwargs)
ALFA_OverlayPileUpToolCfg(flags, name="ALFA_OverlayPileUpTool", **kwargs)