4 Instantiate the pflow isolation for egamma in derivation
7 from AthenaCommon.Logging
import logging
8 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
9 from AthenaConfiguration.ComponentFactory
import CompFactory
13 mlog = logging.getLogger(name)
14 mlog.info(
'Starting Isolation steering')
18 suff =
'CSSK' if inType.find(
'CSSK') >= 0
else ''
19 from IsolationAlgs.IsoDensityConfig
import NFlowInputAlgCfg
22 if not flags.HeavyIon.Egamma.doSubtractedClusters:
23 from IsolationAlgs.IsoDensityConfig
import DensityForIsoAlgCfg
30 margs[
'FlowElementsInConeTool'] = CompFactory.xAOD.FlowElementsInConeTool(
31 name=suff+
'FlowElementsInConeTool')
33 kwargs[
'CustomConfigurationNameEl'] = suff
34 kwargs[
'CustomConfigurationNamePh'] = suff
35 margs[
'EFlowEDCentralContainer'] =
'NeutralParticle'+suff+
'FlowIsoCentralEventShape'
36 margs[
'EFlowEDForwardContainer'] =
'NeutralParticle'+suff+
'FlowIsoForwardEventShape'
37 margs[
'FlowElementsInConeTool'].PFlowKey=suff+
'NeutralParticleFlowObjects'
38 from IsolationAlgs.IsoToolsConfig
import EGammaCaloIsolationToolCfg
42 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
43 isoType = [ [ isoPar.neflowisol20, isoPar.neflowisol30, isoPar.neflowisol40 ] ]
44 isoCor = [ [ isoPar.coreCone ] ]
45 if not flags.HeavyIon.Egamma.doSubtractedClusters:
46 isoCor[0].
append(isoPar.pileupCorrection)
47 isoExCor = [ [ isoPar.coreConeSC ] ]
48 kwargs[
'ElIsoTypes'] = isoType
49 kwargs[
'ElCorTypes'] = isoCor
50 kwargs[
'ElCorTypesExtra'] = isoExCor
51 kwargs[
'PhIsoTypes'] = isoType
52 kwargs[
'PhCorTypes'] = isoCor
53 kwargs[
'PhCorTypesExtra'] = isoExCor
55 kwargs[
'name'] = suff+
'PFlowIsolationBuilder'
57 acc.addEventAlgo(CompFactory.IsolationBuilder(**kwargs))
59 mlog.info(
"PFlow isolation configured")
65 mlog = logging.getLogger(name)
66 mlog.info(
'Starting LRT electron calo Isolation steering')
71 from IsolationAlgs.IsoDensityConfig
import (
72 NFlowInputAlgCfg, DensityForIsoAlgCfg)
79 the_pflowElementsTool = CompFactory.xAOD.FlowElementsInConeTool(
80 name=
'FlowElementsInConeTool')
82 from IsolationAlgs.IsoToolsConfig
import EGammaCaloIsolationToolCfg
84 FlowElementsInConeTool = the_pflowElementsTool))
87 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
88 isoType = [ [ isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40 ],
89 [ isoPar.neflowisol20, isoPar.neflowisol30, isoPar.neflowisol40 ] ]
90 isoCor = [ [ isoPar.core57cells, isoPar.ptCorrection, isoPar.pileupCorrection ],
91 [ isoPar.coreCone, isoPar.pileupCorrection ] ]
92 isoExCor = [ [ ], [ isoPar.coreConeSC ] ]
94 acc.addEventAlgo(CompFactory.IsolationBuilder(**kwargs,
95 name =
'LRTElectronCaloIsolationBuilder',
96 ElectronCollectionContainerName =
'LRT'+flags.Egamma.Keys.Output.Electrons,
99 ElCorTypesExtra = isoExCor,
100 CaloTopoIsolationTool = cisoTool,
101 PFlowIsolationTool = cisoTool))
103 mlog.info(
"LRTElectron calo isolation configured")
109 mlog = logging.getLogger(name)
110 mlog.info(
'Starting LRT muon calo Isolation steering')
115 from IsolationAlgs.IsoDensityConfig
import (
116 NFlowInputAlgCfg, DensityForIsoAlgCfg)
122 the_pflowElementsTool = CompFactory.xAOD.FlowElementsInConeTool(
123 name=
'FlowElementsInConeTool')
125 from IsolationAlgs.IsoToolsConfig
import MuonCaloIsolationToolCfg
127 FlowElementsInConeTool = the_pflowElementsTool ))
129 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
130 misoType = [ [ isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40 ],
131 [ isoPar.neflowisol20, isoPar.neflowisol30, isoPar.neflowisol40 ] ]
132 misoCor = [ [ isoPar.coreCone, isoPar.pileupCorrection ],
133 [ isoPar.coreCone, isoPar.pileupCorrection ] ]
134 misoExCor = [ [ ], [ ] ]
136 acc.addEventAlgo(CompFactory.IsolationBuilder(name=
"LRTMuonCaloIsolationBuilder",
137 MuonCollectionContainerName =
"MuonsLRT",
138 MuCorTypesExtra = misoExCor,
139 MuCorTypes = misoCor,
140 CaloTopoIsolationTool = cisoTool,
141 PFlowIsolationTool = cisoTool,
142 MuIsoTypes = misoType ))
144 mlog.info(
"MuonLRT calo isolation configured")
148 if __name__ ==
"__main__":
149 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
150 from AthenaConfiguration.ComponentAccumulator
import printProperties
151 from AthenaConfiguration.TestDefaults
import defaultTestFiles
152 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
154 flags.Input.Files = defaultTestFiles.RDO_RUN2
155 flags.Output.doWriteESD =
True
156 flags.Output.doWriteAOD =
True
159 mlog = logging.getLogger(
"isolationConfigTest")
160 mlog.info(
"Configuring isolation: ")
166 acc.printConfig(withDetails=
True,
169 acc.getEventAlgo(
'PFlowIsolationBuilder'),
173 acc.getEventAlgo(
'LRTElectronCaloIsolationBuilder'),
177 acc.getEventAlgo(
'LRTMuonCaloIsolationBuilder'),
181 with open(
"isolationconfig.pkl",
"wb")
as f: