ATLAS Offline Software
JetFitterTagConfig.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 JetTagTools.JetFitterNtupleWriterNNConfig import JetFitterNtupleWriterNNCfg
6 from JetTagTools.JetFitterNNToolConfig import JetFitterNNToolCfg
7 
8 def JetFitterTagCfg(flags, name = 'JetFitterTagNN', scheme = '', CombinedIPNN = False, useBTagFlagsDefaults = True, runNN=False, **options):
9  """Sets up a JetFitterTagNN tool and returns it.
10 
11  The following options have BTaggingFlags defaults:
12 
13  Runmodus default: BTagging.RunModus
14  jetCollectionList default: BTaggingFlags.Jets
15  SecVxFinderName default: "JetFitter"
16  useForcedCalibration default: False
17  ipinfoTaggerName default: ""
18 
19  If CombinedIPNN is True
20  ipinfoTaggerName default: "IP3D"
21 
22 
23  input: name: The name of the tool (should be unique).
24  useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
25  **options: Python dictionary with options for the tool.
26  output: The actual tool."""
27  acc = ComponentAccumulator()
28  options['name'] = name
29  options['xAODBaseName'] = 'JetFitter'
30 
31  if scheme == "" or scheme == "Trig":
32  if useBTagFlagsDefaults:
33  if not CombinedIPNN:
34  if runNN:
35  jetfitterClassifier = acc.popToolsAndMerge(JetFitterNNToolCfg(flags, 'JetFitterNNTool', scheme))
36  else:
37  # FIXME: there has to be an easier way to instance
38  # a #@$%ing tool :'(
39  inneracc = ComponentAccumulator()
40  DummyClassifier = (
41  CompFactory.Analysis.JetFitterDummyClassifier)
42  inneracc.setPrivateTools(DummyClassifier(
43  name='JetFitterDummyClassifier'))
44  jetfitterClassifier = acc.popToolsAndMerge(inneracc)
45 
46  jetFitterNtupleWriterNN = acc.popToolsAndMerge(JetFitterNtupleWriterNNCfg('JetFitterNtupleWriterNN'))
47  defaults = { 'Runmodus' : flags.BTagging.RunModus,
48  'jetCollectionList' : [], #used only in reference mode
49  'SecVxFinderName' : 'JetFitter',
50  'useForcedCalibration' : False,
51  'ipinfoTaggerName' : "",
52  'jetfitterNtupleWriter' : jetFitterNtupleWriterNN,
53  'jetfitterClassifier' : jetfitterClassifier,
54  }
55  else:
56  defaults = { 'Runmodus' : flags.BTagging.RunModus,
57  'jetCollectionList' : [], #used only in reference mode
58  'SecVxFinderName' : 'JetFitter',
59  'useForcedCalibration' : False,
60  'ipinfoTaggerName' : 'IP3D',
61  }
62  elif (scheme == "Flip"): #Prepare Flip mode tagger, JetFitterFlip not defined yet
63  # JetFitterFlip should be a flip version of JetFitter created in setupSecVtxTool
64  if useBTagFlagsDefaults:
65  defaults = { 'Runmodus' : flags.BTagging.RunModus,
66  'jetCollectionList' : [], #used only in reference mode
67  'SecVxFinderName' : 'JetFitterFlip',
68  'useForcedCalibration' : False,
69  'ipinfoTaggerName' : 'IP3D',
70  }
71  for option in defaults:
72  options.setdefault(option, defaults[option])
73  acc.setPrivateTools(CompFactory.Analysis.JetFitterTag(**options))
74 
75  return acc
JetFitterTagConfig.JetFitterTagCfg
def JetFitterTagCfg(flags, name='JetFitterTagNN', scheme='', CombinedIPNN=False, useBTagFlagsDefaults=True, runNN=False, **options)
Definition: JetFitterTagConfig.py:8
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302