ATLAS Offline Software
Loading...
Searching...
No Matches
PileUpToolsConfig.py
Go to the documentation of this file.
1"""Configure the algorithm to carry PileUpTools for Digitization
2
3Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
4"""
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7from AthenaConfiguration.Enums import ProductionStep
8
9PileUpToolsAlg, PileUpMTAlg, DigitizationAlg = CompFactory.getComps(
10 "PileUpToolsAlg", "PileUpMTAlg", "DigitizationAlg"
11)
12
13
14def PileUpToolsCfg(flags, **kwargs):
15 """
16 Return ComponentAccumulator with the correct algorithm to carry Digitization PileUpTools
17
18 Keyword argument "PileUpTools" may be an AlgTool or list of AlgTools.
19 """
20 acc = ComponentAccumulator()
21
22 # handle input type variety
23 PileUpTools = kwargs.setdefault("PileUpTools", [])
24 if not isinstance(PileUpTools, list):
25 kwargs["PileUpTools"] = [PileUpTools]
26
27 # declare common extra inputs
28 kwargs["ExtraInputs"] = flags.Digitization.ExtraInputs
29
30 # choose the correct alg
31 if flags.Concurrency.NumThreads > 0 and flags.Digitization.PileUp:
32 Alg = PileUpMTAlg
33 else:
34 if flags.Digitization.DoXingByXingPileUp:
35 Alg = PileUpToolsAlg
36 else:
37 Alg = DigitizationAlg
38
39 # setup EventInfo
40 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
41 kwargs["EventInfoKey"] = flags.Overlay.BkgPrefix + "EventInfo"
42
43 acc.addEventAlgo(Alg(flags.Digitization.DigiSteeringConf, **kwargs))
44 return acc
PileUpToolsCfg(flags, **kwargs)