ATLAS Offline Software
Loading...
Searching...
No Matches
ThinInDetForwardTrackParticlesConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3__doc__ = """
4 Instantiate the InDetForwardTrackParticles Thinning
5 """
6
7from AthenaCommon.Logging import logging
8from AthenaConfiguration.ComponentFactory import CompFactory
9from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10
11def ThinInDetForwardTrackParticlesCfg(flags, name="ThinInDetForwardTrackParticlesAlg", **kwargs):
12
13 mlog = logging.getLogger(name)
14 mlog.info("Starting InDetForwardTrackParticles Thinning configuration")
15 acc = ComponentAccumulator()
16
17 if (("xAOD::TrackParticleContainer#InDetForwardTrackParticles"
18 not in flags.Input.TypedCollections) and
19 not flags.Tracking.doForwardTracks):
20 mlog.info("Not attempting to thin InDetForwardTrackParticles, because the container InDetForwardTrackParticles does not seem to be available")
21 return acc
22
23 if not flags.Reco.EnableCombinedMuon:
24 mlog.info("Combined muon reconstruction is disabled so all InDetForwardTrackParticles will be thinned")
25 kwargs.setdefault("MuonsKey", "")
26
27 kwargs.setdefault("StreamName", "StreamAOD")
28 acc.addEventAlgo(CompFactory.ThinInDetForwardTrackParticlesAlg(name, **kwargs))
29 mlog.info("InDetForwardTrackParticles Thinning configured")
30 return acc
31
32if __name__ == "__main__":
33 from AthenaConfiguration.AllConfigFlags import initConfigFlags
34 from AthenaConfiguration.TestDefaults import defaultTestFiles
35 from AthenaConfiguration.ComponentAccumulator import printProperties
36 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
37 flags = initConfigFlags()
38 flags.Input.Files = defaultTestFiles.RDO_RUN2
39 flags.Output.doWriteAOD = True # To test the AOD parts
40 flags.lock()
41 acc = MainServicesCfg(flags)
42 acc.merge(ThinInDetForwardTrackParticlesCfg(flags))
43 mlog = logging.getLogger("ThinInDetForwardTrackParticlesConfigTest")
44 printProperties(
45 mlog,
46 acc.getEventAlgo("ThinInDetForwardTrackParticlesAlg"),
47 nestLevel=1,
48 printDefaults=True,
49 )
50
51 with open("thinindetforwardtrackparticlescfg.pkl", "wb") as f:
52 acc.store(f)
ThinInDetForwardTrackParticlesCfg(flags, name="ThinInDetForwardTrackParticlesAlg", **kwargs)