3 """ Instantiate the pflow isolation for egamma in derivation """
5 from AthenaCommon.Logging
import logging
6 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory
import CompFactory
11 mlog = logging.getLogger(name)
12 mlog.info(
'Starting Isolation steering')
16 suff =
'CSSK' if inType.find(
'CSSK') >= 0
else ''
17 from IsolationAlgs.IsoDensityConfig
import NFlowInputAlgCfg
20 if not flags.HeavyIon.Egamma.doSubtractedClusters:
21 from IsolationAlgs.IsoDensityConfig
import DensityForIsoAlgCfg
28 margs[
'FlowElementsInConeTool'] = CompFactory.xAOD.FlowElementsInConeTool(
29 name=suff+
'FlowElementsInConeTool')
31 kwargs[
'CustomConfigurationNameEl'] = suff
32 kwargs[
'CustomConfigurationNamePh'] = suff
33 margs[
'EFlowEDCentralContainer'] =
'NeutralParticle'+suff+
'FlowIsoCentralEventShape'
34 margs[
'EFlowEDForwardContainer'] =
'NeutralParticle'+suff+
'FlowIsoForwardEventShape'
35 margs[
'FlowElementsInConeTool'].PFlowKey=suff+
'NeutralParticleFlowObjects'
36 from IsolationAlgs.IsoToolsConfig
import EGammaCaloIsolationToolCfg
40 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
41 isoType = [ [ isoPar.neflowisol20, isoPar.neflowisol30, isoPar.neflowisol40 ] ]
42 isoCor = [ [ isoPar.coreCone ] ]
43 if not flags.HeavyIon.Egamma.doSubtractedClusters:
44 isoCor[0].
append(isoPar.pileupCorrection)
45 isoExCor = [ [ isoPar.coreConeSC ] ]
46 kwargs[
'ElIsoTypes'] = isoType
47 kwargs[
'ElCorTypes'] = isoCor
48 kwargs[
'ElCorTypesExtra'] = isoExCor
49 kwargs[
'PhIsoTypes'] = isoType
50 kwargs[
'PhCorTypes'] = isoCor
51 kwargs[
'PhCorTypesExtra'] = isoExCor
53 kwargs[
'name'] = suff+
'PFlowIsolationBuilder'
55 acc.addEventAlgo(CompFactory.IsolationBuilder(**kwargs))
57 mlog.info(
"PFlow isolation configured")
63 mlog = logging.getLogger(name)
64 mlog.info(
'Starting LRT electron calo Isolation steering')
69 from IsolationAlgs.IsoDensityConfig
import (
70 NFlowInputAlgCfg, DensityForIsoAlgCfg)
77 the_pflowElementsTool = CompFactory.xAOD.FlowElementsInConeTool(
78 name=
'FlowElementsInConeTool')
80 from IsolationAlgs.IsoToolsConfig
import EGammaCaloIsolationToolCfg
82 FlowElementsInConeTool = the_pflowElementsTool))
85 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
86 isoType = [ [ isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40 ],
87 [ isoPar.neflowisol20, isoPar.neflowisol30, isoPar.neflowisol40 ] ]
88 isoCor = [ [ isoPar.core57cells, isoPar.ptCorrection, isoPar.pileupCorrection ],
89 [ isoPar.coreCone, isoPar.pileupCorrection ] ]
90 isoExCor = [ [ ], [ isoPar.coreConeSC ] ]
92 acc.addEventAlgo(CompFactory.IsolationBuilder(**kwargs,
93 name =
'LRTElectronCaloIsolationBuilder',
94 ElectronCollectionContainerName =
'LRT'+flags.Egamma.Keys.Output.Electrons,
97 ElCorTypesExtra = isoExCor,
98 CaloTopoIsolationTool = cisoTool,
99 PFlowIsolationTool = cisoTool))
101 mlog.info(
"LRTElectron calo isolation configured")
107 mlog = logging.getLogger(name)
108 mlog.info(
'Starting LRT muon calo Isolation steering')
113 from IsolationAlgs.IsoDensityConfig
import (
114 NFlowInputAlgCfg, DensityForIsoAlgCfg)
120 the_pflowElementsTool = CompFactory.xAOD.FlowElementsInConeTool(
121 name=
'FlowElementsInConeTool')
123 from IsolationAlgs.IsoToolsConfig
import MuonCaloIsolationToolCfg
125 FlowElementsInConeTool = the_pflowElementsTool ))
127 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
128 misoType = [ [ isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40 ],
129 [ isoPar.neflowisol20, isoPar.neflowisol30, isoPar.neflowisol40 ] ]
130 misoCor = [ [ isoPar.coreCone, isoPar.pileupCorrection ],
131 [ isoPar.coreCone, isoPar.pileupCorrection ] ]
132 misoExCor = [ [ ], [ ] ]
134 acc.addEventAlgo(CompFactory.IsolationBuilder(name=
"LRTMuonCaloIsolationBuilder",
135 MuonCollectionContainerName =
"MuonsLRT",
136 MuCorTypesExtra = misoExCor,
137 MuCorTypes = misoCor,
138 CaloTopoIsolationTool = cisoTool,
139 PFlowIsolationTool = cisoTool,
140 MuIsoTypes = misoType ))
142 mlog.info(
"MuonLRT calo isolation configured")
146 if __name__ ==
"__main__":
147 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
148 from AthenaConfiguration.ComponentAccumulator
import printProperties
149 from AthenaConfiguration.TestDefaults
import defaultTestFiles
150 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
152 flags.Input.Files = defaultTestFiles.RDO_RUN2
153 flags.Output.doWriteESD =
True
154 flags.Output.doWriteAOD =
True
157 mlog = logging.getLogger(
"isolationConfigTest")
158 mlog.info(
"Configuring isolation: ")
164 acc.printConfig(withDetails=
True,
167 acc.getEventAlgo(
'PFlowIsolationBuilder'),
171 acc.getEventAlgo(
'LRTElectronCaloIsolationBuilder'),
175 acc.getEventAlgo(
'LRTMuonCaloIsolationBuilder'),
179 with open(
"isolationconfig.pkl",
"wb")
as f: