ATLAS Offline Software
IsolationSteeringConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 """ Instantiate the isolation """
4 
5 from AthenaCommon.Logging import logging
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 
8 def IsolationSteeringCfg(flags, name = 'IsolationSteering'):
9 
10  mlog = logging.getLogger(name)
11  mlog.info('Starting Isolation steering')
12 
13  acc = ComponentAccumulator()
14 
15  from IsolationAlgs.IsoDensityConfig import (
16  EMTopoInputAlgCfg, NFlowInputAlgCfg, DensityForIsoAlgCfg)
17  if flags.Reco.EnableEgamma or flags.Reco.EnableCombinedMuon:
18  if flags.Detector.EnableCalo:
19  # do not compute density if HI with subtracted clusters
20  # since no pu correction in this case
21  if not flags.HeavyIon.Egamma.doSubtractedClusters:
22  acc.merge(EMTopoInputAlgCfg(flags))
23  acc.merge(DensityForIsoAlgCfg(flags))
24  acc.merge(DensityForIsoAlgCfg(flags,name='ForwardDensityForTopoIso'))
25  # should be switch off also for HI, but if done, crash sowewhere else...
26  if flags.Reco.EnablePFlow:
27  acc.merge(NFlowInputAlgCfg(flags))
28  acc.merge(DensityForIsoAlgCfg(flags,name='CentralDensityForNFlowIso'))
29  acc.merge(DensityForIsoAlgCfg(flags,name='ForwardDensityForNFlowIso'))
30 
31  from IsolationAlgs.IsolationBuilderConfig import egIsolationCfg, muIsolationCfg
32  if flags.Reco.EnableEgamma:
33  acc.merge(egIsolationCfg(flags,name = 'photonIsolation'))
34  acc.merge(egIsolationCfg(flags,name = 'electronIsolation'))
35  if flags.Reco.EnableCombinedMuon:
36  acc.merge(muIsolationCfg(flags,name = 'muonIsolation'))
37 
38  # Add density related containers to the output stream
39  if flags.Output.doWriteESD or flags.Output.doWriteAOD:
40  from IsolationAlgs.IsoOutputConfig import IsoOutputCfg
41  acc.merge(IsoOutputCfg(flags))
42 
43  return acc
44 
45 if __name__ == "__main__":
46  from AthenaConfiguration.AllConfigFlags import initConfigFlags
47  from AthenaConfiguration.ComponentAccumulator import printProperties
48  from AthenaConfiguration.TestDefaults import defaultTestFiles
49  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
50  flags = initConfigFlags()
51  flags.Input.Files = defaultTestFiles.RDO_RUN2
52  flags.Output.doWriteESD = True # To test the ESD parts
53  flags.Output.doWriteAOD = True # To test the AOD parts
54  flags.lock()
55 
56  mlog = logging.getLogger("isolationConfigTest")
57  mlog.info("Configuring isolation: ")
58 
59  acc = MainServicesCfg(flags)
60  acc.merge(IsolationSteeringCfg(flags))
61  acc.printConfig(withDetails=True,
62  printDefaults=True)
63  printProperties(mlog,
64  acc.getEventAlgo('photonIsolationBuilder'),
65  nestLevel=1,
66  printDefaults=True)
67 
68  with open("isolationconfig.pkl", "wb") as f:
69  acc.store(f)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
IsoDensityConfig.NFlowInputAlgCfg
def NFlowInputAlgCfg(flags, name='NFlowInputAlg', **kwargs)
Definition: IsoDensityConfig.py:28
IsoOutputConfig.IsoOutputCfg
def IsoOutputCfg(flags, name="IsoOutputList")
Definition: IsoOutputConfig.py:8
IsoDensityConfig.DensityForIsoAlgCfg
def DensityForIsoAlgCfg(flags, name="CentralDensityForTopoIso", **kwargs)
Definition: IsoDensityConfig.py:62
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
IsolationBuilderConfig.egIsolationCfg
def egIsolationCfg(flags, name='egIsolation', noCalo=False, **kwargs)
Definition: IsolationBuilderConfig.py:9
IsoDensityConfig.EMTopoInputAlgCfg
def EMTopoInputAlgCfg(flags, name='EMTopoInputAlg', **kwargs)
Definition: IsoDensityConfig.py:10
IsolationSteeringConfig.IsolationSteeringCfg
def IsolationSteeringCfg(flags, name='IsolationSteering')
Definition: IsolationSteeringConfig.py:8
extractSporadic.printProperties
def printProperties(h, q, hLB)
Definition: extractSporadic.py:7
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
IsolationBuilderConfig.muIsolationCfg
def muIsolationCfg(flags, name='muIsolation', noCalo=False, **kwargs)
Definition: IsolationBuilderConfig.py:73