Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MetAnalysisConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 # AnaAlgorithm import(s):
4 from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
5 from AnalysisAlgorithmsConfig.ConfigAccumulator import DataType
6 
7 
8 class MetAnalysisConfig (ConfigBlock):
9  """the ConfigBlock for the MET configuration"""
10 
11  def __init__ (self, containerName='') :
12  super (MetAnalysisConfig, self).__init__ ()
13  self.addOption('containerName', containerName, type=str,
14  noneAction='error',
15  info="the name of the input container")
16  self.addOption ('useJVT', True, type=bool,
17  info="whether to use the JVT decision in the calculation")
18  self.addOption ('useFJVT', False, type=bool,
19  info="whether to use the forward JVT decision in the calculation")
20  self.addOption ('treatPUJets', False, type=bool,
21  info="whether to treat pile-up jets in the MET significance calculation")
22  self.addOption ('setMuonJetEMScale', True, type=bool,
23  info="enables the handling of muons in jets for the MET calculation. "
24  "Should be turned off for analyses where muons are not reconstructed "
25  "at all.")
26  self.addOption ('jets', "", type=str,
27  info="the input jet container")
28  self.addOption ('electrons', "", type=str,
29  info="the input electron container, with a possible selection, in "
30  "the format `container` or `container.selection`")
31  self.addOption ('muons', "", type=str,
32  info="the input muon container, with a possible selection, in the "
33  "format `container` or `container.selection`")
34  self.addOption ('photons', "", type=str,
35  info="the input photon container, with a possible selection, in "
36  "the format `container` or `container.selection`")
37  self.addOption ('taus', "", type=str,
38  info="the input tau-jet container, with a possible selection, in "
39  "the format `container` or `container.selection`")
40  self.addOption ('invisible', "", type=str,
41  info="any input container to be treated as invisible particles, "
42  "in the format `container` (no selection)")
43  self.addOption ('metWP', "Tight", type=str,
44  info="the MET working point to use: Loose, Tight, Tighter, "
45  "Tenacious")
46  self.addOption ('skipSystematicJetSelection', False, type=bool,
47  info="EXPERIMENTAL: whether to use simplified OR based on nominal jets "
48  "and for jet-related systematics only. "
49  "WARNING: this option is strictly for doing physics studies of the feasibility "
50  "of this OR scheme, it should not be used in a regular analysis")
51  self.addOption ('saveSignificance', True, type=bool,
52  info="whether to save the MET significance (default=True)")
53  self.addOption ('useLRT', False, type=bool,
54  info="whether to use LRT MET Core and association map")
55 
56  def makeAlgs (self, config) :
57 
58  if config.isPhyslite() :
59  metSuffix = 'AnalysisMET'
60  else :
61  jetContainer = config.originalName (self.jets)
62  metSuffix = jetContainer[:-4]
63  if self.useLRT:
64  metSuffix += "_LRT"
65 
66  if not self.useFJVT and self.treatPUJets:
67  raise ValueError ("MET significance pile-up treatment requires fJVT")
68 
69  # Remove b-tagging calibration from the MET suffix name
70  btIndex = metSuffix.find('_BTagging')
71  if btIndex != -1:
72  metSuffix = metSuffix[:btIndex]
73 
74  # Set up the met maker algorithm:
75  alg = config.createAlgorithm( 'CP::MetMakerAlg', 'MetMakerAlg' + self.containerName )
76  config.addPrivateTool( 'makerTool', 'met::METMaker' )
77  alg.makerTool.skipSystematicJetSelection = self.skipSystematicJetSelection
78 
79  alg.doJetJVT = self.useJVT
80  if self.useJVT:
81  config.addPrivateTool( 'makerTool.JvtSelTool', 'CP::NNJvtSelectionTool' )
82  alg.makerTool.JvtSelTool.JetContainer = config.readName (self.jets)
83  if self.useFJVT:
84  alg.makerTool.JetRejectionDec = 'passFJVT_internal'
85 
86  alg.makerTool.JetSelection = self.metWP
87  alg.makerTool.DoPFlow = 'PFlow' in metSuffix or metSuffix=="AnalysisMET"
88  alg.makerTool.DoSetMuonJetEMScale = self.setMuonJetEMScale
89 
90  if config.dataType() is not DataType.Data :
91  config.addPrivateTool( 'systematicsTool', 'met::METSystematicsTool' )
92 
93  alg.metCore = 'MET_Core_' + metSuffix
94  alg.metAssociation = 'METAssoc_' + metSuffix
95  alg.jets = config.readName (self.jets)
96  if self.muons != "" :
97  alg.muons, alg.muonsSelection = config.readNameAndSelection (self.muons, excludeFrom={'or'})
98  if self.electrons != "" :
99  alg.electrons, alg.electronsSelection = config.readNameAndSelection (self.electrons, excludeFrom={'or'})
100  if self.photons != "" :
101  alg.photons, alg.photonsSelection = config.readNameAndSelection (self.photons, excludeFrom={'or'})
102  if self.taus != "" :
103  alg.taus, alg.tausSelection = config.readNameAndSelection (self.taus, excludeFrom={'or'})
104  if self.invisible != "" :
105  alg.invisible = config.readName (self.invisible)
106  alg.met = config.writeName (self.containerName, isMet = True)
107 
108 
109  # Set up the met builder algorithm:
110  alg = config.createAlgorithm( 'CP::MetBuilderAlg', 'MetBuilderAlg' + self.containerName )
111  alg.met = config.readName (self.containerName)
112 
113 
114  # Set up the met significance algorithm:
115  if self.saveSignificance:
116  alg = config.createAlgorithm( 'CP::MetSignificanceAlg', 'MetSignificanceAlg' + self.containerName )
117  config.addPrivateTool( 'significanceTool', 'met::METSignificance' )
118  if self.muons != "" :
119  config.addPrivateTool( 'significanceTool.MuonCalibTool', 'CP::MuonCalibTool' )
120  # Retrieve the calibMode from the container name.selections
121  alg.significanceTool.MuonCalibTool.calibMode = (
122  config.calibMode(self.muons.split(".")[0]))
123 
124  alg.significanceTool.SoftTermParam = 0
125  alg.significanceTool.TreatPUJets = self.treatPUJets
126  alg.significanceTool.IsAFII = config.dataType() is DataType.FastSim
127  alg.met = config.readName (self.containerName)
128  config.addOutputVar (self.containerName, 'significance', 'significance')
129 
130  config.addOutputVar (self.containerName, 'met', 'met')
131  config.addOutputVar (self.containerName, 'phi', 'phi')
132  config.addOutputVar (self.containerName, 'sumet', 'sumet')
133 
python.MetAnalysisConfig.MetAnalysisConfig.__init__
def __init__(self, containerName='')
Definition: MetAnalysisConfig.py:11
python.MetAnalysisConfig.MetAnalysisConfig.makeAlgs
def makeAlgs(self, config)
Definition: MetAnalysisConfig.py:56
python.MetAnalysisConfig.MetAnalysisConfig
Definition: MetAnalysisConfig.py:8
Trk::split
@ split
Definition: LayerMaterialProperties.h:38