13 mlog = logging.getLogger(
'DerivationTrackIsoConfig')
14 mlog.info(
'Starting track isolation for derivation')
18 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
20 ptcone_list = [ [ isoPar.ptcone40, isoPar.ptcone30, isoPar.ptcone20 ] ]
21 trkcor_list = [ [ isoPar.coreTrackPtr ] ]
23 if 'object_types' not in jwarg:
24 object_types = (
"Electrons",
"Photons",
"Muons")
26 object_types = jwarg[
'object_types']
29 WP =
'Nonprompt_All_MaxWeight'
34 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig
import isoTTVAToolCfg
35 ttvaCA = acc.popToolsAndMerge(
39 if 'postfix' in jwarg:
40 postfix = jwarg[
'postfix']
42 if 'ptCuts' not in jwarg:
45 ptCuts = jwarg[
'ptCuts']
47 do_egamma = any(x
in object_types
for x
in (
"Electrons",
"Photons"))
49 mlog.info(
'will isolate objects '+
" ".
join(object_types)+
' with TTVA WP = '+WP)
51 for track_pt
in ptCuts:
52 for loose_cone
in (
True,
False):
53 if loose_cone
and not do_egamma:
57 cone_str =
"LooseCone" if loose_cone
else ""
60 name = f
"{WP}TTVA{cone_str}_pt{track_pt}"
64 if "Electrons" in object_types:
65 kwargs[
"ElIsoTypes"] = ptcone_list
66 kwargs[
"ElCorTypes"] = trkcor_list
67 kwargs[
"ElCorTypesExtra"] = [[]]
68 kwargs[
"CustomConfigurationNameEl"] = name
69 if "Electrons" in object_types
and "LRT" in postfix:
70 kwargs[
"ElectronCollectionContainerName"] =
"LRTElectrons"
71 if "Photons" in object_types:
72 kwargs[
"PhIsoTypes"] = ptcone_list
73 kwargs[
"PhCorTypes"] = trkcor_list
74 kwargs[
"PhCorTypesExtra"] = [[]]
75 kwargs[
"CustomConfigurationNamePh"] = name
76 if "Muons" in object_types
and not loose_cone:
77 kwargs[
"MuIsoTypes"] = ptcone_list
78 kwargs[
"MuCorTypes"] = trkcor_list
79 kwargs[
"MuCorTypesExtra"] = [[]]
80 kwargs[
"CustomConfigurationNameMu"] = name
81 if "Muons" in object_types
and not loose_cone
and "LRT" in postfix:
82 kwargs[
"MuonCollectionContainerName"] =
"MuonsLRT"
88 toolkwargs[
'TTVATool'] = ttvaCA
91 from InDetConfig.InDetTrackSelectionToolConfig
import (
92 isoTrackSelectionToolCfg )
93 toolkwargs[
'TrackSelectionTool'] = acc.popToolsAndMerge(
97 toolkwargs[
'CoreTrackEtaRange'] = 0.01
99 from IsolationAlgs.IsoToolsConfig
import TrackIsolationToolCfg
100 kwargs[
'TrackIsolationTool'] = acc.popToolsAndMerge(
104 kwargs[
'name'] = f
"IsolationBuilder{WP}{cone_str}{track_pt}{postfix}"
105 acc.addEventAlgo(CompFactory.IsolationBuilder(**kwargs))