10def PileUpMergeSvcCfg(flags, name="PileUpMergeSvc", Intervals=[], **kwargs):
11 """Return ComponentAccumulator with PileUpMergeSvc
12
13 If doing XingByXingPileUp, Intervals should contian PileUpXingFolder tools.
14 Otherwise it should be empty, and we enforce that here.
15 """
16 acc = ComponentAccumulator()
17
18 if not flags.Digitization.DoXingByXingPileUp:
19
20 if not isinstance(Intervals, list):
21 Intervals = [Intervals]
22 kwargs["Intervals"] = Intervals
23
24 presampling = flags.Common.ProductionStep == ProductionStep.PileUpPresampling
25 if presampling:
26 kwargs.setdefault(
27 "EventInfoKeyName", flags.Overlay.BkgPrefix + "EventInfo"
28 )
29 else:
30 kwargs.setdefault("EventInfoKeyName", "EventInfo")
31 acc.addService(CompFactory.PileUpMergeSvc(name, **kwargs), primary=True)
32 return acc
33
34