ATLAS Offline Software
Loading...
Searching...
No Matches
EMBremCollectionBuilderConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaCommon.Logging import logging
6
7
9 name="EMBremCollectionBuilder",
10 **kwargs):
11 """ Algorithm to create the GSF collection
12 We need to refit with GSF
13 Create a Track Summary
14 Create the relevant TrackParticles """
15
16 acc = ComponentAccumulator()
17
18 if "TrackRefitTool" not in kwargs:
19 from egammaTrackTools.egammaTrackToolsConfig import (
20 egammaTrkRefitterToolCfg)
21 kwargs["TrackRefitTool"] = acc.popToolsAndMerge(
22 egammaTrkRefitterToolCfg(flags))
23
24 if "TrackParticleCreatorTool" not in kwargs:
25 from TrkConfig.TrkParticleCreatorConfig import (
26 GSFBuildInDetParticleCreatorToolCfg)
27 kwargs["TrackParticleCreatorTool"] = acc.popToolsAndMerge(
28 GSFBuildInDetParticleCreatorToolCfg(flags))
29
30 if "TrackSlimmingTool" not in kwargs:
31 from TrkConfig.TrkTrackSlimmingToolConfig import GSFTrackSlimmingToolCfg
32 kwargs["TrackSlimmingTool"] = acc.popToolsAndMerge(GSFTrackSlimmingToolCfg(flags))
33
34 kwargs.setdefault(
35 "usePixel",
36 flags.Detector.EnablePixel or flags.Detector.EnableITkPixel)
37 kwargs.setdefault(
38 "useSCT",
39 flags.Detector.EnableSCT or flags.Detector.EnableITkStrip)
40 kwargs.setdefault("useTRT", flags.Detector.EnableTRT)
41 kwargs.setdefault("DoTruth", flags.Input.isMC)
42 kwargs.setdefault("slimTrkTracks", flags.Egamma.slimGSFTrkTracks)
43 kwargs.setdefault("TrackParticleContainerName", "InDetTrackParticles")
44 kwargs.setdefault("useHGTD", flags.Reco.EnableHGTDExtension)
45
46 extraInputs = []
47 # P->T conversion extra dependencies
48 if flags.Detector.GeometryITk:
49 extraInputs += [
50 ("InDetDD::SiDetectorElementCollection",
51 "ConditionStore+ITkPixelDetectorElementCollection"),
52 ("InDetDD::SiDetectorElementCollection",
53 "ConditionStore+ITkStripDetectorElementCollection"),
54 ]
55 else:
56 extraInputs += [
57 ("InDetDD::SiDetectorElementCollection",
58 "ConditionStore+PixelDetectorElementCollection"),
59 ("InDetDD::SiDetectorElementCollection",
60 "ConditionStore+SCT_DetectorElementCollection"),
61 ]
62
63 if flags.Reco.EnableHGTDExtension:
64 extraInputs += [
65 ("xAOD::TrackParticleContainer",
66 "StoreGateSvc+" + kwargs["TrackParticleContainerName"] + ".time")
67 ]
68
69 kwargs.setdefault("ExtraInputs", extraInputs)
70
71 alg = CompFactory.EMBremCollectionBuilder(name, **kwargs)
72 acc.addEventAlgo(alg)
73 return acc
74
75
76if __name__ == "__main__":
77 from AthenaConfiguration.AllConfigFlags import initConfigFlags
78 from AthenaConfiguration.TestDefaults import defaultTestFiles
79 from AthenaConfiguration.ComponentAccumulator import printProperties
80 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
81 flags = initConfigFlags()
82 flags.Input.Files = defaultTestFiles.RDO_RUN2
83 flags.lock()
84 acc = MainServicesCfg(flags)
85 acc.merge(EMBremCollectionBuilderCfg(flags))
86 mlog = logging.getLogger("EMBremCollectionBuilderConfigTest")
87 mlog.info("Configuring EMBremCollectionBuilder: ")
88 printProperties(mlog,
89 acc.getEventAlgo("EMBremCollectionBuilder"),
90 nestLevel=1,
91 printDefaults=True)
92 with open("embremcollectionbuilder.pkl", "wb") as f:
93 acc.store(f)
EMBremCollectionBuilderCfg(flags, name="EMBremCollectionBuilder", **kwargs)