ATLAS Offline Software
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 
7 from AthenaCommon.Logging import logging
8 from AthenaConfiguration.ComponentFactory import CompFactory
9 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10 
11 def 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 
32 if __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")
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)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
python.ThinInDetForwardTrackParticlesConfig.ThinInDetForwardTrackParticlesCfg
def ThinInDetForwardTrackParticlesCfg(flags, name="ThinInDetForwardTrackParticlesAlg", **kwargs)
Definition: ThinInDetForwardTrackParticlesConfig.py:11
extractSporadic.printProperties
def printProperties(h, q, hLB)
Definition: extractSporadic.py:8
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19