ATLAS Offline Software
EMTrackMatchBuilderConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 __doc__ = "Instantiate EMTrackMatchBuilder with default configuration"
4 
5 from AthenaCommon.Logging import logging
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from AthenaConfiguration.Enums import BeamType
9 from egammaTrackTools.egammaTrackToolsConfig import (
10  EMExtrapolationToolsCfg)
11 
12 
13 def EMTrackMatchBuilderCfg(flags, name='EMTrackMatchBuilder', **kwargs):
14 
15  mlog = logging.getLogger(name)
16  mlog.debug('Start configuration')
17 
18  acc = ComponentAccumulator()
19 
20  if "ExtrapolationTool" not in kwargs:
21  extrap = EMExtrapolationToolsCfg(flags)
22  kwargs["ExtrapolationTool"] = acc.popToolsAndMerge(extrap)
23 
24  if "TrackParticlesName" not in kwargs:
25  kwargs.setdefault("TrackParticlesName",
26  flags.Egamma.Keys.Output.GSFTrackParticles)
27 
28  # candidate match is done in 2 times this so +- 0.2
29  kwargs.setdefault("broadDeltaEta", 0.1)
30  # candidate match is done in 2 times this so +- 0.3
31  kwargs.setdefault("broadDeltaPhi", 0.15)
32  kwargs.setdefault("useCandidateMatch", True)
33  kwargs.setdefault("useScoring", True)
34  kwargs.setdefault("SecondPassRescale", True)
35  kwargs.setdefault("UseRescaleMetric", True)
36  kwargs.setdefault("isCosmics", flags.Beam.Type is BeamType.Cosmics)
37 
38  tool = CompFactory.EMTrackMatchBuilder(name, **kwargs)
39 
40  acc.setPrivateTools(tool)
41  return acc
42 
43 
44 if __name__ == "__main__":
45 
46  from AthenaConfiguration.AllConfigFlags import initConfigFlags
47  from AthenaConfiguration.ComponentAccumulator import printProperties
48  from AthenaConfiguration.TestDefaults import defaultTestFiles
49  flags = initConfigFlags()
50  flags.Input.Files = defaultTestFiles.RDO_RUN2
51  flags.fillFromArgs()
52  flags.lock()
53  flags.dump()
54 
56  mlog = logging.getLogger("EMTrackMatchBuilderConfigTest")
57  mlog.info("Configuring EMTrackMatchBuilder: ")
58  printProperties(mlog, cfg.popToolsAndMerge(
59  EMTrackMatchBuilderCfg(flags)),
60  nestLevel=1,
61  printDefaults=True)
62 
63  f = open("emtrackmatchbuilder.pkl", "wb")
64  cfg.store(f)
65  f.close()
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
egammaTrackToolsConfig.EMExtrapolationToolsCfg
def EMExtrapolationToolsCfg(flags, **kwargs)
Definition: egammaTrackToolsConfig.py:13
EMTrackMatchBuilderConfig.EMTrackMatchBuilderCfg
def EMTrackMatchBuilderCfg(flags, name='EMTrackMatchBuilder', **kwargs)
Definition: EMTrackMatchBuilderConfig.py:13
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