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