ATLAS Offline Software
Loading...
Searching...
No Matches
DiTauMassConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
4from AthenaConfiguration.Enums import LHCPeriod
5
6
7class 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('floatStopCriterionMinIter', 10000, type=int,
48 info='minimum number of iteration to activate the floating stopping criterion. The default is 10000.')
49 self.addOption('floatStopCriterionCheckFreq', 1000, type=int,
50 info='event frequency for floating stopping criterion to be checked after minimum number of iteration. The default is 1000.')
51 self.addOption('floatStopCriterionComp', 0.05, type=float,
52 info='percentage used to assess compatibility for floating stopping criterion to be applied. The default is 5%.')
53 self.addOption('calibration', '2024', type=str,
54 info='the calibration set (string) to use. The default is `2024` (recommended).')
55 self.addOption('nSigmaMet', -1, type=int,
56 info='the number (int) of sigmas for the MET resolution scan. The default is `-1` (no scan).')
57 self.addOption('useTailCleanup', -1, type=int,
58 info='whether to activate the tail cleanup feature. The default is -1.')
59 self.addOption('niterFit2', -1, type=int,
60 info='the number of iterations for each MET scan loop. The default is -1.')
61 self.addOption('niterFit3', -1, type=int,
62 info='the number of iterations for each Mnu loop. The default is -1.')
63 self.addOption('useTauProbability', 1, type=int,
64 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.')
65 self.addOption('useMnuProbability', False, type=bool,
66 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`.')
67 self.addOption('useDefaultSettings', -1, type=int,
68 info='whether to take all default options from the tool itself. The default is -1.')
69 self.addOption('useEfficiencyRecovery', -1, type=int,
70 info='whether to enable refitting for failed events, to improve efficiency. The default is -1.')
71 self.addOption('useMETdphiLL', False, type=bool,
72 info='whether to parameterise the MET resolution using sumET and dphiLL (only for the lep-lep case). The default is `False`.')
73 self.addOption('paramFilePath', 'MMC_params_v051224_angle_noLikelihoodFit.root', type=str,
74 info='path (string) to the ROOT file used with `calibSet` ≥ 2024, containing the PDFs for the likelihood. The default is `MMC_params_v051224_angle_noLikelihoodFit.root` (recommended).')
75 self.addOption('doMLNU3P', False, type=bool,
76 info='save information about the reconstruction with the best-fit neutrino kinematics.')
77 self.addOption('doMAXW', False, type=bool,
78 info='save information about the reconstruction with the maximum-weight estimator.')
79 self.addOption('saveLlhHisto', False, type=bool,
80 info='save likelihood histograms for debugging purpose. If enabled, it can slow down MMC running time.')
81
82 def instanceName (self) :
83 """Return the instance name for this block"""
84 if self.algName:
85 return self.taus.replace('.', '_') + self.algName
86 else:
87 return self.taus.replace('.', '_')
88
89 def makeAlgs(self, config):
90
91 alg = config.createAlgorithm('CP::DiTauMassCalculatorAlg', 'DiTauMMCAlg')
92
93 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
94 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
95 alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
96 alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
97 alg.met = config.readName(self.met)
98
99 config.addPrivateTool( 'mmcTool', 'DiTauMassTools::MissingMassTool' )
100 alg.mmcTool.Decorate = False # this sets decorations on EventInfo that are not compatible with systematics
101 alg.mmcTool.FloatStoppingCrit = self.floatStopCriterion
102 alg.mmcTool.FloatStoppingCritMinIter = self.floatStopCriterionMinIter
103 alg.mmcTool.FloatStoppingCritCheckFreq = self.floatStopCriterionCheckFreq
104 alg.mmcTool.FloatStoppingCritCheckComp = self.floatStopCriterionComp
105 alg.mmcTool.CalibSet = self.calibration
106 alg.mmcTool.NsigmaMET = self.nSigmaMet
107 alg.mmcTool.UseTailCleanup = self.useTailCleanup
108 alg.mmcTool.NiterFit2 = self.niterFit2
109 alg.mmcTool.NiterFit3 = self.niterFit3
110 alg.mmcTool.UseTauProbability = self.useTauProbability
111 alg.mmcTool.UseMnuProbability = self.useMnuProbability
112 alg.mmcTool.UseDefaults = self.useDefaultSettings
113 alg.mmcTool.UseEfficiencyRecovery = self.useEfficiencyRecovery
114 alg.mmcTool.UseMETDphiLL = self.useMETdphiLL
115 alg.mmcTool.ParamFilePath = self.paramFilePath
116 alg.mmcTool.SaveLlhHisto = self.saveLlhHisto
117
118 if config.geometry() is LHCPeriod.Run2:
119 alg.mmcTool.BeamEnergy = 6500.0
120 else:
121 alg.mmcTool.BeamEnergy = 6800.0
122
123 alg.eventSelection = self.eventSelection
124 alg.doMAXW = self.doMAXW
125 alg.doMLNU3P = self.doMLNU3P
126
127 config.addOutputVar('EventInfo', 'mmc_fit_status_%SYS%', self.algName + 'mmc_fit_status')
128 config.addOutputVar('EventInfo', 'mmc_mlm_mass_%SYS%', self.algName + 'mmc_mlm_mass')
129 if self.doMAXW:
130 config.addOutputVar('EventInfo', 'mmc_maxw_mass_%SYS%', self.algName + 'mmc_maxw_mass')
131 if self.doMLNU3P:
132 config.addOutputVar('EventInfo', 'mmc_mlnu3p_mass_%SYS%', self.algName + 'mmc_mlnu3p_mass')
133
135 if self.doMLNU3P:
136 config.addOutputVar('EventInfo', 'mmc_mlnu3p_res_4vect_%SYS%', self.algName + 'mmc_mlnu3p_res_4vect')
137 config.addOutputVar('EventInfo', 'mmc_mlnu3p_nu1_4vect_%SYS%', self.algName + 'mmc_mlnu3p_nu1_4vect')
138 config.addOutputVar('EventInfo', 'mmc_mlnu3p_nu2_4vect_%SYS%', self.algName + 'mmc_mlnu3p_nu2_4vect')
139 config.addOutputVar('EventInfo', 'mmc_mlnu3p_tau1_4vect_%SYS%', self.algName + 'mmc_mlnu3p_tau1_4vect')
140 config.addOutputVar('EventInfo', 'mmc_mlnu3p_tau2_4vect_%SYS%', self.algName + 'mmc_mlnu3p_tau2_4vect')
141 if self.doMAXW:
142 config.addOutputVar('EventInfo', 'mmc_maxw_res_4vect_%SYS%', self.algName + 'mmc_maxw_res_4vect')
143 config.addOutputVar('EventInfo', 'mmc_maxw_nu1_4vect_%SYS%', self.algName + 'mmc_maxw_nu1_4vect')
144 config.addOutputVar('EventInfo', 'mmc_maxw_nu2_4vect_%SYS%', self.algName + 'mmc_maxw_nu2_4vect')
145 config.addOutputVar('EventInfo', 'mmc_maxw_tau1_4vect_%SYS%', self.algName + 'mmc_maxw_tau1_4vect')
146 config.addOutputVar('EventInfo', 'mmc_maxw_tau2_4vect_%SYS%', self.algName + 'mmc_maxw_tau2_4vect')
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310