ATLAS Offline Software
Functions | Variables
DerivationTrackIsoConfig Namespace Reference

Functions

def DerivationTrackIsoCfg (flags, **jwarg)
 
def iso_vars (WP="Nonprompt_All_MaxWeight")
 

Variables

string __doc__
 
 flags = initConfigFlags()
 
 Files
 
 doWriteESD
 
 doWriteAOD
 
 mlog = logging.getLogger("derivationTrackIsolationConfigTest")
 
 acc = MainServicesCfg(flags)
 
string name = "IsolationBuilderNonprompt_All_MaxWeight"+par
 
 nestLevel
 
 printDefaults
 

Function Documentation

◆ DerivationTrackIsoCfg()

def DerivationTrackIsoConfig.DerivationTrackIsoCfg (   flags,
**  jwarg 
)

Definition at line 11 of file DerivationTrackIsoConfig.py.

11 def DerivationTrackIsoCfg(flags,**jwarg):
12 
13  mlog = logging.getLogger('DerivationTrackIsoConfig')
14  mlog.info('Starting track isolation for derivation')
15 
16  acc = ComponentAccumulator()
17 
18  from xAODPrimitives.xAODIso import xAODIso as isoPar
19  # dR in decreasing order
20  ptcone_list = [ [ isoPar.ptcone40, isoPar.ptcone30, isoPar.ptcone20 ] ]
21  trkcor_list = [ [ isoPar.coreTrackPtr ] ]
22 
23  if 'object_types' not in jwarg:
24  object_types = ("Electrons", "Photons", "Muons")
25  else:
26  object_types = jwarg['object_types']
27 
28  if 'WP' not in jwarg:
29  WP = 'Nonprompt_All_MaxWeight'
30  else:
31  WP = jwarg['WP']
32  # TrackIsolationTool need a specific track-vertex association tool
33  # if WP is not Nonprompt_All_MaxWeight
34  from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import isoTTVAToolCfg
35  ttvaCA = acc.popToolsAndMerge(
36  isoTTVAToolCfg(flags, WorkingPoint = WP))
37 
38  postfix = ''
39  if 'postfix' in jwarg:
40  postfix = jwarg['postfix']
41 
42  if 'ptCuts' not in jwarg:
43  ptCuts = (500, 1000)
44  else:
45  ptCuts = jwarg['ptCuts']
46 
47  do_egamma = any(x in object_types for x in ("Electrons", "Photons"))
48 
49  mlog.info('will isolate objects '+" ".join(object_types)+' with TTVA WP = '+WP)
50 
51  for track_pt in ptCuts:
52  for loose_cone in (True, False):
53  if loose_cone and not do_egamma:
54  # Loose cone isolation variables only for electrons and photons
55  continue
56 
57  cone_str = "LooseCone" if loose_cone else ""
58 
59  # The custom variable suffix
60  name = f"{WP}TTVA{cone_str}_pt{track_pt}"
61 
62  # Build up extra IsolationBuilder kwargs
63  kwargs = {}
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"
83 
84 
85  toolkwargs = {}
86  # the TTVA tool is not the default choice
87  if 'WP' in jwarg:
88  toolkwargs['TTVATool'] = ttvaCA
89  # and a track selection tool
90 
91  from InDetConfig.InDetTrackSelectionToolConfig import (
92  isoTrackSelectionToolCfg )
93  toolkwargs['TrackSelectionTool'] = acc.popToolsAndMerge(
94  isoTrackSelectionToolCfg(flags, minPt = track_pt))
95 
96  if loose_cone:
97  toolkwargs['CoreTrackEtaRange'] = 0.01
98 
99  from IsolationAlgs.IsoToolsConfig import TrackIsolationToolCfg
100  kwargs['TrackIsolationTool'] = acc.popToolsAndMerge(
101  TrackIsolationToolCfg(flags,**toolkwargs))
102 
103  # The algorithm
104  kwargs['name'] = f"IsolationBuilder{WP}{cone_str}{track_pt}{postfix}"
105  acc.addEventAlgo(CompFactory.IsolationBuilder(**kwargs))
106 
107  return acc
108 

◆ iso_vars()

def DerivationTrackIsoConfig.iso_vars (   WP = "Nonprompt_All_MaxWeight")

Definition at line 109 of file DerivationTrackIsoConfig.py.

109 def iso_vars(WP = "Nonprompt_All_MaxWeight"):
110  # Get the list of isolation variables calculated by these functions
111  iso_vars = []
112  for track_pt in 500, 1000:
113  for cone_str in "", "LooseCone":
114  name = f"{WP}TTVA{cone_str}_pt{track_pt}"
115  iso_vars += [ "ptconeCorrBitset_"+name,
116  "ptconecoreTrackPtrCorrection_"+name ]
117  for cone_size in 20, 30, 40:
118  for var_str in "", "var":
119  iso_vars.append(f"pt{var_str}cone{cone_size}_{name}")
120  return iso_vars
121 

Variable Documentation

◆ __doc__

string DerivationTrackIsoConfig.__doc__
private
Initial value:
1 = """
2  Instantiate more custom track isolation in derivation
3  """

Definition at line 3 of file DerivationTrackIsoConfig.py.

◆ acc

DerivationTrackIsoConfig.acc = MainServicesCfg(flags)

Definition at line 136 of file DerivationTrackIsoConfig.py.

◆ doWriteAOD

DerivationTrackIsoConfig.doWriteAOD

Definition at line 130 of file DerivationTrackIsoConfig.py.

◆ doWriteESD

DerivationTrackIsoConfig.doWriteESD

Definition at line 129 of file DerivationTrackIsoConfig.py.

◆ Files

DerivationTrackIsoConfig.Files

Definition at line 128 of file DerivationTrackIsoConfig.py.

◆ flags

DerivationTrackIsoConfig.flags = initConfigFlags()

Definition at line 127 of file DerivationTrackIsoConfig.py.

◆ mlog

DerivationTrackIsoConfig.mlog = logging.getLogger("derivationTrackIsolationConfigTest")

Definition at line 133 of file DerivationTrackIsoConfig.py.

◆ name

string DerivationTrackIsoConfig.name = "IsolationBuilderNonprompt_All_MaxWeight"+par

Definition at line 141 of file DerivationTrackIsoConfig.py.

◆ nestLevel

DerivationTrackIsoConfig.nestLevel

Definition at line 144 of file DerivationTrackIsoConfig.py.

◆ printDefaults

DerivationTrackIsoConfig.printDefaults

Definition at line 145 of file DerivationTrackIsoConfig.py.

python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.InDetTrackSelectionToolConfig.isoTrackSelectionToolCfg
def isoTrackSelectionToolCfg(flags, name="isoTrackSelectionTool", **kwargs)
Definition: InDetTrackSelectionToolConfig.py:41
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.TrackIsolationDecoratorConfig.TrackIsolationToolCfg
def TrackIsolationToolCfg(ConfigFlags, name="TrackIsolationTool", **kwargs)
Definition: TrackIsolationDecoratorConfig.py:12
DerivationTrackIsoConfig.DerivationTrackIsoCfg
def DerivationTrackIsoCfg(flags, **jwarg)
Definition: DerivationTrackIsoConfig.py:11
DerivationTrackIsoConfig.iso_vars
def iso_vars(WP="Nonprompt_All_MaxWeight")
Definition: DerivationTrackIsoConfig.py:109
TrackVertexAssociationToolConfig.isoTTVAToolCfg
def isoTTVAToolCfg(flags, name="ttvaToolForIso", **kwargs)
Definition: TrackVertexAssociationToolConfig.py:36