ATLAS Offline Software
IP3DTagConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from TrkConfig.TrkVertexFitterUtilsConfig import AtlasTrackToVertexIPEstimatorCfg
6 from JetTagTools.SVForIPToolConfig import SVForIPToolCfg
7 from JetTagTools.IPDetailedTrackGradeFactoryConfig import IPDetailedTrackGradeFactoryCfg
8 from JetTagTools.IPTrackSelectorConfig import IPTrackSelectorCfg
9 from JetTagTools.NewLikelihoodToolConfig import NewLikelihoodToolCfg
10 
11 def IP3DTagCfg( flags, name = 'IP3DTag', PrimaryVertexCollectionName="", scheme = '', useBTagFlagsDefaults = True,FlipOption='STANDARD', **options ):
12  """Sets up a IP3DTag tool and returns it.
13 
14  The following options have BTaggingFlags defaults:
15 
16  Runmodus default: BTagging.RunModus
17  referenceType default: BTagging.ReferenceType
18  impactParameterView default: "3D"
19  trackGradePartitions default: [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ]
20  RejectBadTracks default: False
21  jetCollectionList default: BTaggingFlags.Jets
22  unbiasIPEstimation default: False (switch to true (better!) when creating new PDFs)
23  SecVxFinderName default: "SV1"
24  UseCHypo default: True
25 
26  input: name: The name of the tool (should be unique).
27  useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
28  **options: Python dictionary with options for the tool.
29  output: The actual tool."""
30  acc = ComponentAccumulator()
31  options['name'] = name
32  options['xAODBaseName'] = 'IP3D'
33  options['trackAssociationName'] = 'BTagTrackToJetAssociator'
34 
35  if useBTagFlagsDefaults:
36  trackToVertexIPEstimator = acc.popToolsAndMerge(AtlasTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator'))
37  svForIPTool = acc.popToolsAndMerge(SVForIPToolCfg('SVForIPTool'))
38  trackGradeFactory = acc.popToolsAndMerge(IPDetailedTrackGradeFactoryCfg(flags, 'IP3DDetailedTrackGradeFactory'))
39  trackSelectorTool = acc.popToolsAndMerge(IPTrackSelectorCfg(flags, 'IP3DTrackSelector'))
40  likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'IP3DNewLikelihoodTool', 'IP3D', scheme))
41 
42  defaults = { 'Runmodus' : flags.BTagging.RunModus,
43  'referenceType' : flags.BTagging.ReferenceType,
44  'jetPtMinRef' : flags.BTagging.JetPtMinRef,
45  'impactParameterView' : '3D',
46  'trackGradePartitions' : flags.BTagging.Grades,
47  'RejectBadTracks' : True,
48  'jetCollectionList' : [], #used only in reference mode
49  'unbiasIPEstimation' : False,
50  'UseCHypo' : True,
51  'SecVxFinderName' : 'SV1',
52  'storeTrackParticles': True,
53  'storeTrackParameters': True,
54  'storeIpValues': True,
55  'LikelihoodTool' : likelihood,
56  'trackSelectorTool' : trackSelectorTool,
57  'SVForIPTool' : svForIPTool,
58  'trackGradeFactory' : trackGradeFactory,
59  'TrackToVertexIPEstimator' : trackToVertexIPEstimator,
60  }
61  for option in defaults:
62  options.setdefault(option, defaults[option])
63 
64  # Define the settings for the IP3DNeg ("NEGATIVE_IP_ONLY") and IP2DFlip ("FLIP_SIGN") taggers.
65  # Set as well a different name to distinguish from the "Standard" taggers
66 
67  if FlipOption=='NEGATIVE_IP_ONLY':
68  negtagoptions = {
69  'flipIPSign' : True,
70  'flipZIPSign' : True,
71  'usePosIP' : True,
72  'useNegIP' : False
73  }
74  # make sure that the name includes 'Neg' if setup 'Neg' tagging option
75  nameNeg=''
76  if 'NegTag' in name:
77  nameNeg=name
78  elif 'Tag' in name:
79  nameNeg=name.replace("Tag","NegTag")
80  else:
81  nameNeg=name+"Neg"
82  options['name'] = nameNeg
83  options['xAODBaseName'] = 'IP3DNeg'
84  for option in negtagoptions:
85  options.setdefault(option, negtagoptions[option])
86 
87  elif FlipOption=='FLIP_SIGN':
88  fliptagoptions = {
89  'flipIPSign' : True,
90  'flipZIPSign' : True, #would naively say 'True' but in Rel.21 (https://gitlab.cern.ch/atlas/athena/-/blob/21.2/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP3DFlipTag.py), the default from 'False' is not changed
91  'usePosIP' : True,
92  'useNegIP' : True
93  }
94  nameFlip=''
95  if 'FlipTag' in name:
96  nameFlip=name
97  elif 'Tag' in name:
98  nameFlip=name.replace("Tag","FlipTag")
99  else:
100  nameFlip=name+"Flip"
101  options['name'] = nameFlip
102  options['xAODBaseName'] = 'IP3DFlip'
103  for option in fliptagoptions:
104  options.setdefault(option, fliptagoptions[option])
105 
106 
107  acc.setPrivateTools(CompFactory.Analysis.IPTag( **options))
108 
109  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TrkVertexFitterUtilsConfig.AtlasTrackToVertexIPEstimatorCfg
def AtlasTrackToVertexIPEstimatorCfg(flags, name='AtlasTrackToVertexIPEstimator', **kwargs)
Definition: TrkVertexFitterUtilsConfig.py:63
NewLikelihoodToolConfig.NewLikelihoodToolCfg
def NewLikelihoodToolCfg(flags, name='NewLikelihoodTool', taggername='IP2D', scheme='', useBTagFlagsDefaults=True, **options)
Definition: NewLikelihoodToolConfig.py:6
IPTrackSelectorConfig.IPTrackSelectorCfg
def IPTrackSelectorCfg(flags, name='IPTrackSelector', useBTagFlagsDefaults=True, **options)
Definition: IPTrackSelectorConfig.py:10
SVForIPToolConfig.SVForIPToolCfg
def SVForIPToolCfg(name='SVForIPTool', **options)
Definition: SVForIPToolConfig.py:6
IP3DTagConfig.IP3DTagCfg
def IP3DTagCfg(flags, name='IP3DTag', PrimaryVertexCollectionName="", scheme='', useBTagFlagsDefaults=True, FlipOption='STANDARD', **options)
Definition: IP3DTagConfig.py:11
IPDetailedTrackGradeFactoryConfig.IPDetailedTrackGradeFactoryCfg
def IPDetailedTrackGradeFactoryCfg(flags, name='IPDetailedTrackGradeFactory', useBTagFlagsDefaults=True, **options)
Definition: IPDetailedTrackGradeFactoryConfig.py:8