ATLAS Offline Software
egammaSuperClusterBuilderConfig.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 the two supercluster
4 builders with default configuration"""
5 
6 from AthenaCommon.Logging import logging
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory import CompFactory
9 from AthenaConfiguration.Enums import LHCPeriod
10 
11 from egammaTools.EMTrackMatchBuilderConfig import EMTrackMatchBuilderCfg
12 from egammaTools.EMConversionBuilderConfig import EMConversionBuilderCfg
13 from egammaTools.egammaSwToolConfig import egammaSwToolCfg
14 from egammaMVACalib.egammaMVACalibConfig import egammaMVASvcCfg
15 
17  name='electronSuperClusterBuilder',
18  sequenceName=None,
19  **kwargs):
20 
21  mlog = logging.getLogger(name)
22  mlog.debug('Start configuration')
23 
24  seqkw = {'sequence': sequenceName} if sequenceName else {}
25  acc = ComponentAccumulator(**seqkw)
26 
27  kwargs.setdefault("doTrackMatching", flags.Egamma.doTracking)
28  kwargs.setdefault("UseExtendedTG3", flags.GeoModel.Run is LHCPeriod.Run3)
29  kwargs.setdefault("EtThresholdCut",
30  1000 if not flags.Egamma.doLowMu else 300)
31  kwargs.setdefault(
32  "ClusterCorrectionTool",
33  acc.popToolsAndMerge(egammaSwToolCfg(flags)))
34  kwargs.setdefault(
35  "MVACalibSvc",
36  acc.getPrimaryAndMerge(egammaMVASvcCfg(flags)))
37  kwargs.setdefault(
38  "egammaCheckEnergyDepositTool",
39  CompFactory.egammaCheckEnergyDepositTool())
40  kwargs.setdefault(
41  "TrackMatchBuilderTool",
42  acc.popToolsAndMerge(EMTrackMatchBuilderCfg(flags)))
43  kwargs.setdefault(
44  "InputEgammaRecContainerName",
45  flags.Egamma.Keys.Internal.EgammaRecs)
46  kwargs.setdefault(
47  "OutputEgammaRecContainerKey",
48  flags.Egamma.Keys.Internal.ElectronSuperRecs)
49  kwargs.setdefault(
50  "SuperClusterCollectionName",
51  flags.Egamma.Keys.Internal.ElectronSuperClusters)
52 
53  acc.addEventAlgo(CompFactory.electronSuperClusterBuilder(name, **kwargs))
54  return acc
55 
56 
58  flags,
59  name='photonSuperClusterBuilder',
60  sequenceName=None,
61  **kwargs):
62 
63  seqkw = {'sequence': sequenceName} if sequenceName else {}
64  acc = ComponentAccumulator(**seqkw)
65 
66  kwargs.setdefault("doConversions", flags.Egamma.doConversionBuilding)
67  kwargs.setdefault("UseExtendedTG3", flags.GeoModel.Run is LHCPeriod.Run3)
68  kwargs.setdefault(
69  "EtThresholdCut",
70  1500 if not flags.Egamma.doLowMu else 300)
71  kwargs.setdefault(
72  "ClusterCorrectionTool",
73  acc.popToolsAndMerge(egammaSwToolCfg(flags)))
74  kwargs.setdefault(
75  "MVACalibSvc",
76  acc.getPrimaryAndMerge(egammaMVASvcCfg(flags)))
77  kwargs.setdefault(
78  "egammaCheckEnergyDepositTool",
79  CompFactory.egammaCheckEnergyDepositTool())
80  kwargs.setdefault(
81  "ConversionBuilderTool",
82  acc.popToolsAndMerge(EMConversionBuilderCfg(flags)))
83  kwargs.setdefault(
84  "InputEgammaRecContainerName",
85  flags.Egamma.Keys.Internal.EgammaRecs)
86  kwargs.setdefault(
87  "OutputEgammaRecContainerKey",
88  flags.Egamma.Keys.Internal.PhotonSuperRecs)
89  kwargs.setdefault(
90  "SuperClusterCollectionName",
91  flags.Egamma.Keys.Internal.PhotonSuperClusters)
92 
93  acc.addEventAlgo(CompFactory.photonSuperClusterBuilder(name, **kwargs))
94 
95  return acc
96 
97 
98 if __name__ == "__main__":
99  from AthenaConfiguration.AllConfigFlags import initConfigFlags
100  from AthenaConfiguration.TestDefaults import defaultTestFiles
101  from AthenaConfiguration.ComponentAccumulator import printProperties
102  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
103  flags = initConfigFlags()
104  flags.Input.Files = defaultTestFiles.RDO_RUN2
105  flags.lock()
106  acc = MainServicesCfg(flags)
107  acc.merge(electronSuperClusterBuilderCfg(flags))
108  mlog = logging.getLogger("egammaSuperClusterBuilderConfigTest")
109  mlog.info("Configuring electronSuperClusterBuilder: ")
110  printProperties(mlog,
111  acc.getEventAlgo("electronSuperClusterBuilder"),
112  nestLevel=1,
113  printDefaults=True)
114  acc.merge(photonSuperClusterBuilderCfg(flags))
115  mlog.info("Configuring photonSuperClusterBuilder: ")
116  printProperties(mlog,
117  acc.getEventAlgo("photonSuperClusterBuilder"),
118  nestLevel=1,
119  printDefaults=True)
120 
121  with open("egammasuperclusterbuilder.pkl", "wb") as f:
122  acc.store(f)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
egammaSwToolConfig.egammaSwToolCfg
def egammaSwToolCfg(flags, name='egammaSwTool', **kwargs)
Definition: egammaSwToolConfig.py:42
EMConversionBuilderConfig.EMConversionBuilderCfg
def EMConversionBuilderCfg(flags, name='EMConversionBuilder', **kwargs)
Definition: EMConversionBuilderConfig.py:11
python.egammaMVACalibConfig.egammaMVASvcCfg
def egammaMVASvcCfg(flags, name="egammaMVASvc", **kwargs)
Definition: egammaMVACalibConfig.py:15
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
EMTrackMatchBuilderConfig.EMTrackMatchBuilderCfg
def EMTrackMatchBuilderCfg(flags, name='EMTrackMatchBuilder', **kwargs)
Definition: EMTrackMatchBuilderConfig.py:13
egammaSuperClusterBuilderConfig.electronSuperClusterBuilderCfg
def electronSuperClusterBuilderCfg(flags, name='electronSuperClusterBuilder', sequenceName=None, **kwargs)
Definition: egammaSuperClusterBuilderConfig.py:16
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
egammaSuperClusterBuilderConfig.photonSuperClusterBuilderCfg
def photonSuperClusterBuilderCfg(flags, name='photonSuperClusterBuilder', sequenceName=None, **kwargs)
Definition: egammaSuperClusterBuilderConfig.py:57