4 from AnalysisAlgorithmsConfig.ConfigAccumulator
import DataType
5 from AnalysisAlgorithmsConfig.ConfigBlock
import ConfigBlock
6 from AthenaCommon.Logging
import logging
7 from AthenaConfiguration.Enums
import LHCPeriod
8 from Campaigns.Utils
import Campaign
12 """the ConfigBlock for the tau four-momentum correction"""
15 super (TauCalibrationConfig, self).__init__ ()
16 self.setBlockName(
'Taus')
17 self.addOption (
'inputContainer',
'', type=str,
18 info=
"select tau input container, by default set to TauJets")
19 self.addOption (
'containerName',
'', type=str,
21 info=
"the name of the output container after calibration.")
22 self.addOption (
'postfix',
'', type=str,
23 info=
"a postfix to apply to decorations and algorithm names. "
24 "Typically not needed here since the calibration is common to "
26 self.addOption (
'rerunTruthMatching',
True, type=bool,
27 info=
"whether to rerun truth matching (sets up an instance of "
28 "CP::TauTruthMatchingAlg). The default is True.")
29 self.addOption (
'decorateTruth',
False, type=bool,
30 info=
"decorate truth particle information on the reconstructed one")
31 self.addOption (
'decorateExtraVariables',
True, type=bool,
32 info=
"decorate extra variables for the reconstructed tau")
35 """Return the instance name for this block"""
36 return self.containerName + self.postfix
41 if 'EleRM' in self.inputContainer:
42 if config.dataType()
is DataType.Data
and config.dataYear() <= 2023:
43 raise RuntimeError(
"EleRM taus are only available from 2024 dataset onward")
44 elif config.dataType()
is not DataType.Data
and config.campaign() <= Campaign.MC23d:
45 raise RuntimeError(
"EleRM taus are only available from 2024 dataset onward")
47 postfix = self.postfix
48 if postfix !=
'' and postfix[0] !=
'_' :
49 postfix =
'_' + postfix
51 inputContainer =
"AnalysisTauJets" if config.isPhyslite()
else "TauJets"
52 if self.inputContainer:
53 inputContainer = self.inputContainer
54 config.setSourceName (self.containerName, inputContainer)
57 if self.rerunTruthMatching
and config.dataType()
is not DataType.Data:
58 alg = config.createAlgorithm(
'CP::TauTruthMatchingAlg',
59 'TauTruthMatchingAlg' )
60 config.addPrivateTool(
'matchingTool',
61 'TauAnalysisTools::TauTruthMatchingTool' )
62 alg.matchingTool.TruthJetContainerName =
'AntiKt4TruthDressedWZJets'
63 alg.taus = config.readName (self.containerName)
64 alg.preselection = config.getPreselection (self.containerName,
'')
67 if self.decorateTruth
and config.dataType()
is not DataType.Data:
68 alg = config.createAlgorithm(
'CP::TauTruthDecorationsAlg',
69 'TauTruthDecorationsAlg',
71 alg.taus = config.readName (self.containerName)
72 alg.doubleDecorations = [
'pt_vis',
'pt_invis',
'eta_vis',
'eta_invis',
'phi_vis',
'phi_invis',
'm_vis',
'm_invis']
73 alg.floatDecorations = []
74 alg.intDecorations = [
'pdgId']
75 alg.unsignedIntDecorations = [
'classifierParticleOrigin',
'classifierParticleType']
76 alg.charDecorations = [
'IsHadronicTau']
80 for var
in [
'DecayMode',
'ParticleType',
'PartonTruthLabelID'] + alg.doubleDecorations[:] + alg.floatDecorations[:] + alg.intDecorations[:] + alg.unsignedIntDecorations[:] + alg.charDecorations[:]:
81 branchName = alg.prefix + var
82 if 'classifierParticle' in var:
83 branchOutput = alg.prefix + var.replace(
'classifierParticle',
'').lower()
85 branchOutput = branchName
86 config.addOutputVar (self.containerName, branchName, branchOutput, noSys=
True)
89 if self.decorateExtraVariables:
90 alg = config.createAlgorithm(
'CP::TauExtraVariablesAlg',
91 'TauExtraVariablesAlg',
93 alg.taus = config.readName (self.containerName)
96 alg = config.createAlgorithm(
'CP::TauSmearingAlg',
'TauSmearingAlg' )
97 config.addPrivateTool(
'smearingTool',
'TauAnalysisTools::TauSmearingTool' )
98 alg.smearingTool.useFastSim = config.dataType()
is DataType.FastSim
99 alg.smearingTool.Campaign =
"mc23" if config.geometry()
is LHCPeriod.Run3
else "mc20"
100 alg.taus = config.readName (self.containerName)
101 alg.tausOut = config.copyName (self.containerName)
102 alg.preselection = config.getPreselection (self.containerName,
'')
105 alg = config.createAlgorithm(
'CP::AsgEnergyDecoratorAlg',
'EnergyDecorator' )
106 alg.particles = config.readName (self.containerName)
108 config.addOutputVar (self.containerName,
'pt',
'pt')
109 config.addOutputVar (self.containerName,
'eta',
'eta', noSys=
True)
110 config.addOutputVar (self.containerName,
'phi',
'phi', noSys=
True)
111 config.addOutputVar (self.containerName,
'e_%SYS%',
'e')
112 config.addOutputVar (self.containerName,
'charge',
'charge', noSys=
True)
113 config.addOutputVar (self.containerName,
'NNDecayMode',
'NNDecayMode', noSys=
True)
114 config.addOutputVar (self.containerName,
'passTATTauMuonOLR',
'passTATTauMuonOLR', noSys=
True)
115 config.addOutputVar (self.containerName,
'TESCompatibility',
'TESCompatibility')
116 if self.decorateExtraVariables:
117 config.addOutputVar (self.containerName,
'nTracksCharged',
'nTracksCharged', noSys=
True)
121 """the ConfigBlock for the tau working point
123 This may at some point be split into multiple blocks (16 Mar 22)."""
126 super (TauWorkingPointConfig, self).__init__ ()
127 self.addOption (
'containerName',
'', type=str,
129 info=
"the name of the input container.")
130 self.addOption (
'selectionName',
'', type=str,
132 info=
"the name of the tau-jet selection to define (e.g. tight or "
134 self.addOption (
'postfix',
None, type=str,
135 info=
"a postfix to apply to decorations and algorithm names. "
136 "Typically not needed here as selectionName is used internally.")
137 self.addOption (
'quality',
None, type=str,
138 info=
"the ID WP (string) to use. Supported ID WPs: Tight, Medium, "
139 "Loose, VeryLoose, Baseline, BaselineForFakes.")
140 self.addOption (
'use_eVeto',
False, type=bool,
141 info=
"use selection with or without eVeto combined with tauID "
142 "recommendations: set it to True if electron mis-reconstructed as tau is a large background for your analysis")
143 self.addOption (
'use_muonOLR',
False, type=bool,
144 info=
"use selection with or without muonOLR with TauID "
145 "recommendations: set it to True if muon mis-reconstructed as tau is a large background for your analysis")
146 self.addOption (
'useGNTau',
False, type=bool,
147 info=
"use GNTau based ID instead of RNNTau ID "
148 "recommendations: that's new experimental feature and might come default soon",
150 self.addOption (
'dropPtCut',
False, type=bool,
151 info=
"select taus without explicit min Pt cut. For PHYS/PHYSLITE, this would mean selecting taus starting from 13 GeV "
152 "recommendations: that's experimental feature and not supported for all combinations of ID/eVeto WPs",
154 self.addOption (
'useLowPt',
False, type=bool,
155 info=
"select taus starting from 15 GeV instead of the default 20 GeV cut "
156 "recommendations: that's experimental feature and not supported for all combinations of ID/eVeto WPs",
158 self.addOption (
'useSelectionConfigFile',
True, type=bool,
159 info=
"use pre-defined configuration files for selecting taus "
160 "recommendations: set this to False only if you want to test/optimise the tau selection for selections not already provided through config files")
161 self.addOption (
'manual_sel_minpt', 20.0, type=float,
162 info=
"minimum pt cut used for tau selection when useSelectionConfigFile is set to false")
163 self.addOption (
'manual_sel_absetaregion', [0, 1.37, 1.52, 2.5], type=list,
164 info=
"eta regions cut used for tau selection when useSelectionConfigFile is set to false")
165 self.addOption (
'manual_sel_abscharges', [1,], type=list,
166 info=
"charge of the tau cut used for tau selection when useSelectionConfigFile is set to false")
167 self.addOption (
'manual_sel_ntracks', [1,3], type=list,
168 info=
"number of tau tracks used for tau selection when useSelectionConfigFile is set to false")
169 self.addOption (
'manual_sel_minrnnscore', -1, type=float,
170 info=
"minimum rnn score cut used for tau selection when useSelectionConfigFile is set to false")
171 self.addOption (
'manual_sel_mingntauscore', -1, type=float,
172 info=
"minimum gntau score selection when useSelectionConfigFile is set to false")
173 self.addOption (
'manual_sel_rnnwp',
None, type=str,
174 info=
"rnn working point used for tau selection when useSelectionConfigFile is set to false")
175 self.addOption (
'manual_sel_gntauwp',
None, type=str,
176 info=
"gntau working point used for tau selection when useSelectionConfigFile is set to false")
177 self.addOption (
'manual_sel_evetowp',
None, type=str,
178 info=
"eveto working point used for tau selection when useSelectionConfigFile is set to false")
179 self.addOption (
'manual_sel_muonolr',
False, type=bool,
180 info=
"use muonolr used for tau selection when useSelectionConfigFile is set to false")
181 self.addOption (
'noEffSF',
False, type=bool,
182 info=
"disables the calculation of efficiencies and scale factors. "
183 "Experimental! only useful to test a new WP for which scale "
184 "factors are not available. The default is False.",
186 self.addOption (
'saveDetailedSF',
True, type=bool,
187 info=
"save all the independent detailed object scale factors. "
188 "The default is True.")
189 self.addOption (
'saveCombinedSF',
False, type=bool,
190 info=
"save the combined object scale factor. "
191 "The default is False.")
192 self.addOption (
'addSelectionToPreselection',
True, type=bool,
193 info=
"whether to retain only tau-jets satisfying the working point "
194 "requirements. The default is True.")
197 """Return the instance name for this block"""
198 if self.postfix
is not None:
199 return self.containerName +
'_' + self.selectionName + self.postfix
201 return self.containerName +
'_' + self.selectionName
205 selectionPostfix = self.selectionName
206 if selectionPostfix !=
'' and selectionPostfix[0] !=
'_' :
207 selectionPostfix =
'_' + selectionPostfix
209 postfix = self.postfix
211 postfix = self.selectionName
212 if postfix !=
'' and postfix[0] !=
'_' :
213 postfix =
'_' + postfix
216 if self.useSelectionConfigFile:
217 nameFormat =
'TauAnalysisAlgorithms/tau_selection_'
219 nameFormat = nameFormat +
'nopt_'
221 nameFormat = nameFormat +
'lowpt_'
223 nameFormat = nameFormat +
'gntau_'
224 nameFormat = nameFormat +
'{}_'
226 nameFormat = nameFormat +
'eleid'
228 nameFormat = nameFormat +
'noeleid'
230 nameFormat = nameFormat +
'_muonolr'
231 nameFormat = nameFormat +
'.conf'
233 if self.
quality not in [
'Tight',
'Medium',
'Loose',
'VeryLoose',
'Baseline',
'BaselineForFakes'] :
234 raise ValueError (
"invalid tau quality: \"" + self.
quality +
235 "\", allowed values are Tight, Medium, Loose, " +
236 "VeryLoose, Baseline, BaselineForFakes")
239 alg = config.createAlgorithm(
'CP::AsgSelectionAlg',
'TauSelectionAlg' )
240 config.addPrivateTool(
'selectionTool',
'TauAnalysisTools::TauSelectionTool' )
241 if self.useSelectionConfigFile:
242 inputfile = nameFormat.format(self.
quality.lower())
243 alg.selectionTool.ConfigPath = inputfile
246 from ROOT
import TauAnalysisTools
247 selectioncuts = TauAnalysisTools.SelectionCuts
248 alg.selectionTool.ConfigPath =
""
249 alg.selectionTool.SelectionCuts =
int(selectioncuts.CutPt |
250 selectioncuts.CutAbsEta |
251 selectioncuts.CutAbsCharge |
252 selectioncuts.CutNTrack |
253 selectioncuts.CutJetRNNScoreSigTrans |
254 selectioncuts.CutGNTauScoreSigTrans |
255 selectioncuts.CutJetIDWP |
256 selectioncuts.CutEleIDWP |
257 selectioncuts.CutMuonOLR)
259 alg.selectionTool.PtMin = self.manual_sel_minpt
260 alg.selectionTool.AbsEtaRegion = self.manual_sel_absetaregion
261 alg.selectionTool.AbsCharges = self.manual_sel_abscharges
262 alg.selectionTool.NTracks = self.manual_sel_ntracks
263 alg.selectionTool.JetRNNSigTransMin = self.manual_sel_minrnnscore
264 alg.selectionTool.GNTauSigTransMin = self.manual_sel_mingntauscore
266 if self.manual_sel_minrnnscore != -1
and self.manual_sel_mingntauscore != -1:
267 raise RuntimeError(
"manual_sel_minrnnscore and manual_sel_mingntauscore have been both set; please choose only one type of ID: RNN or GNTau, not both")
270 alg.selectionTool.JetIDWP = 1
272 alg.selectionTool.JetIDWP = 6
274 alg.selectionTool.JetIDWP = 7
276 alg.selectionTool.JetIDWP = 8
278 alg.selectionTool.JetIDWP = 9
280 raise ValueError (
"invalid RNN TauID WP: \"" + self.
manual_sel_rnnwp +
"\". Allowed values are None, veryloose, loose, medium, tight")
284 raise RuntimeError(
"manual_sel_minrnnscore and manual_sel_rnnwp have been both set; please set only one of them")
288 alg.selectionTool.JetIDWP = 1
290 alg.selectionTool.JetIDWP = 10
292 alg.selectionTool.JetIDWP = 11
294 alg.selectionTool.JetIDWP = 12
296 alg.selectionTool.JetIDWP = 13
298 raise ValueError (
"invalid GNN Tau ID WP: \"" + self.
manual_sel_gntauwp +
"\". Allowed values are None, veryloose, loose, medium, tight")
302 raise RuntimeError(
"manual_sel_mingntauscore and manual_sel_gntauwp have been both set; please set only one of them")
306 alg.selectionTool.EleIDWP = 1
308 alg.selectionTool.EleIDWP = 2
310 alg.selectionTool.EleIDWP = 3
312 alg.selectionTool.EleIDWP = 4
314 raise ValueError (
"invalid eVeto WP: \"" + self.
manual_sel_evetowp +
"\". Allowed values are None, loose, medium, tight")
317 alg.selectionTool.MuonOLR = self.manual_sel_muonolr
319 alg.selectionDecoration =
'selected_tau' + selectionPostfix +
',as_char'
320 alg.particles = config.readName (self.containerName)
321 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
322 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
323 preselection=self.addSelectionToPreselection)
328 if config.dataType()
is not DataType.Data
and not self.noEffSF:
329 log = logging.getLogger(
'TauJetSFConfig')
335 alg = config.createAlgorithm(
'CP::TauEfficiencyCorrectionsAlg',
336 'TauEfficiencyCorrectionsAlgReco' )
337 config.addPrivateTool(
'efficiencyCorrectionsTool',
338 'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
339 alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [0]
340 alg.efficiencyCorrectionsTool.Campaign =
"mc23" if config.geometry()
is LHCPeriod.Run3
else "mc20"
341 alg.efficiencyCorrectionsTool.useFastSim = config.dataType()
is DataType.FastSim
342 alg.scaleFactorDecoration =
'tau_Reco_effSF' + selectionPostfix +
'_%SYS%'
343 alg.outOfValidity = 2
344 alg.outOfValidityDeco =
'bad_Reco_eff' + selectionPostfix
345 alg.taus = config.readName (self.containerName)
346 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
347 if self.saveDetailedSF:
348 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
349 'Reco_effSF' + postfix)
350 sfList += [alg.scaleFactorDecoration]
353 if self.
quality not in (
'VeryLoose',
'Baseline',
'BaselineForFakes'):
354 if not self.useGNTau:
356 alg = config.createAlgorithm(
'CP::TauEfficiencyCorrectionsAlg',
357 'TauEfficiencyCorrectionsAlgID' )
358 config.addPrivateTool(
'efficiencyCorrectionsTool',
359 'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
360 alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [4]
368 raise ValueError (
"invalid tauID: \"" + self.
quality +
"\". Allowed values are loose, medium, tight")
370 alg.efficiencyCorrectionsTool.JetIDLevel = JetIDLevel
371 alg.efficiencyCorrectionsTool.useFastSim = config.dataType()
is DataType.FastSim
372 alg.efficiencyCorrectionsTool.Campaign =
"mc23" if config.geometry()
is LHCPeriod.Run3
else "mc20"
373 alg.scaleFactorDecoration =
'tau_ID_effSF' + selectionPostfix +
'_%SYS%'
374 alg.outOfValidity = 2
375 alg.outOfValidityDeco =
'bad_ID_eff' + selectionPostfix
376 alg.taus = config.readName (self.containerName)
377 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
378 if self.saveDetailedSF:
379 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
380 'ID_effSF' + postfix)
381 sfList += [alg.scaleFactorDecoration]
385 if not self.useGNTau:
387 alg = config.createAlgorithm(
'CP::TauEfficiencyCorrectionsAlg',
388 'TauEfficiencyCorrectionsAlgEvetoFakeTau' )
389 config.addPrivateTool(
'efficiencyCorrectionsTool',
390 'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
391 alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [10]
393 alg.efficiencyCorrectionsTool.EleIDLevel = 2
394 alg.efficiencyCorrectionsTool.useFastSim = config.dataType()
is DataType.FastSim
395 alg.efficiencyCorrectionsTool.Campaign =
"mc23" if config.geometry()
is LHCPeriod.Run3
else "mc20"
396 alg.scaleFactorDecoration =
'tau_EvetoFakeTau_effSF' + selectionPostfix +
'_%SYS%'
403 log.warning(
"eVeto SFs are not available for Tight WP -> fallback to Medium WP")
405 alg.efficiencyCorrectionsTool.JetIDLevel = JetIDLevel
406 alg.outOfValidity = 2
407 alg.outOfValidityDeco =
'bad_EvetoFakeTau_eff' + selectionPostfix
408 alg.taus = config.readName (self.containerName)
409 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
410 if self.saveDetailedSF:
411 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
412 'EvetoFakeTau_effSF' + postfix)
413 sfList += [alg.scaleFactorDecoration]
416 alg = config.createAlgorithm(
'CP::TauEfficiencyCorrectionsAlg',
417 'TauEfficiencyCorrectionsAlgEvetoTrueTau' )
418 config.addPrivateTool(
'efficiencyCorrectionsTool',
419 'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
420 alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [8]
421 alg.efficiencyCorrectionsTool.useFastSim = config.dataType()
is DataType.FastSim
422 alg.efficiencyCorrectionsTool.Campaign =
"mc23" if config.geometry()
is LHCPeriod.Run3
else "mc20"
423 alg.scaleFactorDecoration =
'tau_EvetoTrueTau_effSF' + selectionPostfix +
'_%SYS%'
424 alg.outOfValidity = 2
425 alg.outOfValidityDeco =
'bad_EvetoTrueTau_eff' + selectionPostfix
426 alg.taus = config.readName (self.containerName)
427 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
428 if self.saveDetailedSF:
429 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
430 'EvetoTrueTau_effSF' + postfix)
431 sfList += [alg.scaleFactorDecoration]
433 if self.saveCombinedSF:
434 alg = config.createAlgorithm(
'CP::AsgObjectScaleFactorAlg',
435 'TauCombinedEfficiencyScaleFactorAlg' )
436 alg.particles = config.readName (self.containerName)
437 alg.inScaleFactors = sfList
438 alg.outScaleFactor =
'effSF' + postfix +
'_%SYS%'
439 config.addOutputVar (self.containerName, alg.outScaleFactor,
445 super (EXPERIMENTAL_TauCombineMuonRemovalConfig, self).__init__ ()
447 'inputTaus',
'TauJets', type=str,
449 info=
"the name of the input tau container."
452 'inputTausMuRM',
'TauJets_MuonRM', type=str,
454 info=
"the name of the input tau container with muon removal applied."
457 'outputTaus',
'TauJets_MuonRmCombined', type=str,
459 info=
"the name of the output tau container."
463 """Return the instance name for this block"""
464 return self.outputTaus
468 if config.isPhyslite() :
469 raise(RuntimeError(
"Muon removal taus is not available in Physlite mode"))
471 alg = config.createAlgorithm(
'CP::TauCombineMuonRMTausAlg',
'TauCombineMuonRMTausAlg' )
472 alg.taus = self.inputTaus
473 alg.muonrm_taus = self.inputTausMuRM
474 alg.combined_taus = self.outputTaus
479 super (TauTriggerAnalysisSFBlock, self).__init__ ()
481 self.addOption (
'triggerChainsPerYear', {}, type=
None,
482 info=
"a dictionary with key (string) the year and value (list of "
483 "strings) the trigger chains. The default is {} (empty dictionary).")
484 self.addOption (
'tauID',
'', type=str,
485 info=
"the tau quality WP (string) to use.")
486 self.addOption (
'prefixSF',
'trigEffSF', type=str,
487 info=
"the decoration prefix for trigger scale factors, "
488 "the default is 'trigEffSF'")
489 self.addOption (
'includeAllYearsPerRun',
False, type=bool,
490 info=
"if True, all configured years in the LHC run will "
491 "be included in all jobs. The default is False.")
492 self.addOption (
'removeHLTPrefix',
True, type=bool,
493 info=
"remove the HLT prefix from trigger chain names, "
494 "The default is True.")
495 self.addOption (
'containerName',
'', type=str,
496 info=
"the input tau container, with a possible selection, in "
497 "the format container or container.selection.")
500 """Return the instance name for this block"""
501 return self.containerName +
'_' + self.prefixSF +
'_' + self.
tauID
504 return dictionary.get(
int(year), dictionary.get(
str(year), []))
508 if config.dataType()
is not DataType.Data:
509 log = logging.getLogger(
'TauJetTriggerSFConfig')
511 from TriggerAnalysisAlgorithms.TriggerAnalysisConfig
import is_year_in_current_period
514 if self.includeAllYearsPerRun:
515 for year
in self.triggerChainsPerYear:
518 triggers.update(self.
get_year_data(self.triggerChainsPerYear, year))
519 elif config.campaign()
is Campaign.MC20a:
520 triggers.update(self.
get_year_data(self.triggerChainsPerYear, 2015))
521 triggers.update(self.
get_year_data(self.triggerChainsPerYear, 2016))
522 elif config.campaign()
is Campaign.MC20d:
523 triggers.update(self.
get_year_data(self.triggerChainsPerYear, 2017))
524 elif config.campaign()
is Campaign.MC20e:
525 triggers.update(self.
get_year_data(self.triggerChainsPerYear, 2018))
526 elif config.campaign()
is Campaign.MC23a:
527 triggers.update(self.
get_year_data(self.triggerChainsPerYear, 2022))
528 elif config.campaign()
is Campaign.MC23d:
529 triggers.update(self.
get_year_data(self.triggerChainsPerYear, 2023))
531 log.warning(
"unknown campaign, skipping triggers: %s",
str(config.campaign()))
533 for chain
in triggers:
534 chain_noHLT = chain.replace(
"HLT_",
"")
535 chain_out = chain_noHLT
if self.removeHLTPrefix
else chain
536 alg = config.createAlgorithm(
'CP::TauEfficiencyCorrectionsAlg',
537 'TauTrigEfficiencyCorrectionsAlg_' + chain )
538 config.addPrivateTool(
'efficiencyCorrectionsTool',
539 'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
542 alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [12]
543 if config.geometry()
is LHCPeriod.Run2:
544 alg.efficiencyCorrectionsTool.Campaign =
"mc20"
546 alg.efficiencyCorrectionsTool.Campaign = config.campaign().value
547 alg.efficiencyCorrectionsTool.TriggerName = chain
553 elif self.
tauID==
"Medium":
555 elif self.
tauID==
"Tight":
558 raise ValueError (
"invalid tauID: \"" + self.
tauID +
"\". Allowed values are loose, medium, tight")
559 alg.efficiencyCorrectionsTool.JetIDLevel = JetIDLevel
560 alg.efficiencyCorrectionsTool.TriggerSFMeasurement =
"combined"
561 alg.efficiencyCorrectionsTool.useFastSim = config.dataType()
is DataType.FastSim
563 alg.scaleFactorDecoration = f
"tau_{self.prefixSF}_{chain_out}_%SYS%"
564 alg.outOfValidity = 2
565 alg.outOfValidityDeco = f
"bad_eff_tautrig_{chain_out}"
566 alg.taus = config.readName (self.containerName)
567 alg.preselection = config.getPreselection (self.containerName, self.
tauID)
568 config.addOutputVar (self.containerName, alg.scaleFactorDecoration, f
"{self.prefixSF}_{chain_out}")