ATLAS Offline Software
DiTauMassConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
4 from AthenaConfiguration.Enums import LHCPeriod
5 
6 
7 class DiTauMassBlock(ConfigBlock):
8  """ConfigBlock for the di-tau Missing Mass Calculator algorithm"""
9  """Further notes on the tool are available at [DiTauMassTools](https://gitlab.cern.ch/atlas/athena/-/tree/main/PhysicsAnalysis/TauID/DiTauMassTools)."""
10  r"""Usage in the ATLAS Run 2 $H\to\tau\tau$ analysis is documented in Section 10 of [ATL-COM-PHYS-2020-721](https://cds.cern.ch/record/2741326)."""
11  """A detailed description of the Missing Mass Calculator (MMC) method and its alternatives is given in Chapter 4 of [Michael Hübner's PhD thesis](https://bonndoc.ulb.uni-bonn.de/xmlui/bitstream/handle/20.500.11811/9734/6567.pdf)."""
12  r"""
13  The MMC method can be applied to had-had, had-lep and lep-lep di-tau decays. Based on the input collections given to the algorithm, the following priority ordering is made internally:
14 
15  1. $\tau$-had + $\tau$-had
16  1. $\tau$-had + $\mu$
17  1. $\tau$-had + e
18  1. e + $\mu$
19  1. $\mu$ + $\mu$
20  1. e + e
21 
22  This means that if your event has 2 hadronic tau-jets and 1 electron, the MMC fit will be run under the assumption of a had-had event. To force the MMC fit to consider the 1 electron in a had-lep topology, you'd need to edit the C++ code. Alternatively, if you have determined that some objects should not be used as inputs (e.g. hadronic tau-jet already assigned to top reconstruction, pair of leptons assigned to a Z boson), you should decorate these objects with a flag and use the relevant `container.selection` options of the algorithm. In that way, the MMC fit will only be run on the "left-over" objects.
23  """
24  """ WARNING """
25  r""" The MMC method assumes that the MET in a given event originates mostly from the neutrinos associated to the decay of the di-tau system. If your topology has additional sources of MET (e.g. $t\bar{t}H(\to\tau\tau)$, $W(\to\ell\nu)H(\to\tau\tau)$), the MMC method is not recommended and will give nonsensical answers. See e.g. the ATLAS Run 2 search for BSM $VH(\to\tau\tau)$ in [ATL-COM-PHYS-2022-022](https://cds.cern.ch/record/2799543) where the MMC method is combined with alternatives. Additional neutrinos from the decay of B-hadrons typically do not lead to significant enough MET to be a problem, i.e. $t\bar{t}(\to\text{jets})H(\to\tau\tau)$ should be safe."""
26 
27  def __init__(self):
28  super(DiTauMassBlock, self).__init__()
29  self.addOption('algName', '', type=str,
30  info='optional name to distinguish between multiple instances of the algorithm. The default is `''` (empty string).')
31  self.addOption('electrons', '', type=str,
32  info='the input electron container, with a possible selection, in the format `container` or `container.selection`. The default is `''` (empty string).')
33  self.addOption('muons', '', type=str,
34  info='the input muon container, with a possible selection, in the format `container` or `container.selection`. The default is `''` (empty string).')
35  self.addOption('jets', '', type=str,
36  info='the input jet container, with a possible selection, in the format `container` or `container.selection`. The default is `''` (empty string).')
37  self.addOption('taus', '', type=str,
38  info='the input tau-jet container, with a possible selection, in the format `container` or `container.selection`. The default is `''` (empty string).')
39  self.addOption('met', '', type=str,
40  info='the input MET container. The default is `''` (empty string).')
41  self.addOption('eventSelection', '', type=str,
42  info='optional event filter to run on. The default is `''` (empty string), i.e. all events.')
43  self.addOption('saveExtraVariables', False, type=bool,
44  info='whether to save additional output information from the MMC. The default is `False`.')
45  self.addOption('floatStopCriterion', True, type=bool,
46  info='whether to activate the floating stopping criterion. The default is `True`.')
47  self.addOption('calibration', '2019', type=str,
48  info='the calibration set (string) to use. The default is `2019` (recommended).')
49  self.addOption('nSigmaMet', -1, type=int,
50  info='the number (int) of sigmas for the MET resolution scan. The default is `-1` (no scan).')
51  self.addOption('useTailCleanup', -1, type=int,
52  info='whether to activate the tail cleanup feature. The default is -1.')
53  self.addOption('niterFit2', -1, type=int,
54  info='the number of iterations for each MET scan loop. The default is -1.')
55  self.addOption('niterFit3', -1, type=int,
56  info='the number of iterations for each Mnu loop. The default is -1.')
57  self.addOption('useTauProbability', 1, type=int,
58  info='whether to apply tau probability (additional PDF term corresponding to the ratio of the neutrino momentum to the reconstructed tau momentum). The default is 1.')
59  self.addOption('useMnuProbability', False, type=bool,
60  info='whether to apply $m_\nu$ probability (additional PDF term corresponding to the mass of the neutrino system per tau decay, only applied to leptonic tau decays). The default is `False`.')
61  self.addOption('useDefaultSettings', -1, type=int,
62  info='whether to take all default options from the tool itself. The default is -1.')
63  self.addOption('useEfficiencyRecovery', -1, type=int,
64  info='whether to enable refitting for failed events, to improve efficiency. The default is -1.')
65  self.addOption('useMETdphiLL', False, type=bool,
66  info='whether to parameterise the MET resolution using sumET and dphiLL (only for the lep-lep case). The default is `False`.')
67  self.addOption('paramFilePath', 'MMC_params_v1_fixed.root', type=str,
68  info='path (string) to the ROOT file used with `calibSet` ≥ 2019, containing the PDFs for the likelihood. The default is `MMC_params_v1_fixed.root` (recommended).')
69  self.addOption('doMLNU3P', False, type=bool,
70  info='save information about the reconstruction with the best-fit neutrino kinematics.')
71  self.addOption('doMAXW', False, type=bool,
72  info='save information about the reconstruction with the maximum-weight estimator.')
73  self.addOption('saveLlhHisto', False, type=bool,
74  info='save likelihood histograms for debugging purpose. If enabled, it can slow down MMC running time.')
75 
76  def makeAlgs(self, config):
77 
78  alg = config.createAlgorithm('CP::DiTauMassCalculatorAlg', 'DiTauMMCAlg' + self.algName)
79 
80  alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
81  alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
82  alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
83  alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
84  alg.met = config.readName(self.met)
85 
86  config.addPrivateTool( 'mmcTool', 'DiTauMassTools::MissingMassTool' )
87  alg.mmcTool.Decorate = False # this sets decorations on EventInfo that are not compatible with systematics
88  alg.mmcTool.FloatStoppingCrit = self.floatStopCriterion
89  alg.mmcTool.CalibSet = self.calibration
90  alg.mmcTool.NsigmaMET = self.nSigmaMet
91  alg.mmcTool.UseTailCleanup = self.useTailCleanup
92  alg.mmcTool.NiterFit2 = self.niterFit2
93  alg.mmcTool.NiterFit3 = self.niterFit3
94  alg.mmcTool.UseTauProbability = self.useTauProbability
95  alg.mmcTool.UseMnuProbability = self.useMnuProbability
96  alg.mmcTool.UseDefaults = self.useDefaultSettings
97  alg.mmcTool.UseEfficiencyRecovery = self.useEfficiencyRecovery
98  alg.mmcTool.UseMETDphiLL = self.useMETdphiLL
99  alg.mmcTool.ParamFilePath = self.paramFilePath
100  alg.mmcTool.SaveLlhHisto = self.saveLlhHisto
101 
102  if config.geometry() is LHCPeriod.Run2:
103  alg.mmcTool.BeamEnergy = 6500.0
104  else:
105  alg.mmcTool.BeamEnergy = 6800.0
106 
107  alg.eventSelection = self.eventSelection
108  alg.doMAXW = self.doMAXW
109  alg.doMLNU3P = self.doMLNU3P
110 
111  config.addOutputVar('EventInfo', 'mmc_fit_status_%SYS%', self.algName + 'mmc_fit_status')
112  config.addOutputVar('EventInfo', 'mmc_mlm_mass_%SYS%', self.algName + 'mmc_mlm_mass')
113  if self.doMAXW:
114  config.addOutputVar('EventInfo', 'mmc_maxw_mass_%SYS%', self.algName + 'mmc_maxw_mass')
115  if self.doMLNU3P:
116  config.addOutputVar('EventInfo', 'mmc_mlnu3p_mass_%SYS%', self.algName + 'mmc_mlnu3p_mass')
117 
118  if self.saveExtraVariables:
119  if self.doMLNU3P:
120  config.addOutputVar('EventInfo', 'mmc_mlnu3p_res_4vect_%SYS%', self.algName + 'mmc_mlnu3p_res_4vect')
121  config.addOutputVar('EventInfo', 'mmc_mlnu3p_nu1_4vect_%SYS%', self.algName + 'mmc_mlnu3p_nu1_4vect')
122  config.addOutputVar('EventInfo', 'mmc_mlnu3p_nu2_4vect_%SYS%', self.algName + 'mmc_mlnu3p_nu2_4vect')
123  config.addOutputVar('EventInfo', 'mmc_mlnu3p_tau1_4vect_%SYS%', self.algName + 'mmc_mlnu3p_tau1_4vect')
124  config.addOutputVar('EventInfo', 'mmc_mlnu3p_tau2_4vect_%SYS%', self.algName + 'mmc_mlnu3p_tau2_4vect')
125  if self.doMAXW:
126  config.addOutputVar('EventInfo', 'mmc_maxw_res_4vect_%SYS%', self.algName + 'mmc_maxw_res_4vect')
127  config.addOutputVar('EventInfo', 'mmc_maxw_nu1_4vect_%SYS%', self.algName + 'mmc_maxw_nu1_4vect')
128  config.addOutputVar('EventInfo', 'mmc_maxw_nu2_4vect_%SYS%', self.algName + 'mmc_maxw_nu2_4vect')
129  config.addOutputVar('EventInfo', 'mmc_maxw_tau1_4vect_%SYS%', self.algName + 'mmc_maxw_tau1_4vect')
130  config.addOutputVar('EventInfo', 'mmc_maxw_tau2_4vect_%SYS%', self.algName + 'mmc_maxw_tau2_4vect')
python.DiTauMassConfig.DiTauMassBlock.__init__
def __init__(self)
Definition: DiTauMassConfig.py:27
python.DiTauMassConfig.DiTauMassBlock.makeAlgs
def makeAlgs(self, config)
Definition: DiTauMassConfig.py:76
python.DiTauMassConfig.DiTauMassBlock
Definition: DiTauMassConfig.py:7