ATLAS Offline Software
Loading...
Searching...
No Matches
XbbAnalysisConfig.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 AnalysisAlgorithmsConfig.ConfigAccumulator import DataType
5
6class XbbConfig (ConfigBlock):
7 """the ConfigBlock for the Xbb tagging config"""
8 def __init__ (self):
9 super (XbbConfig, self).__init__ ()
10 self.setBlockName('Xbb')
11 self.addOption ('containerName', '', type=str,
12 noneAction='error',
13 info="the name of the input container.")
14 self.addOption('XbbWP', 'FlatMassQCDEff_0p25', type=str,
15 info="the Xbb tagging WP." )
16 self.addOption('Xbbtagger', 'GN2Xv01', type=str,
17 info="The output name of the Xbb tagger - should match the first level key of the calibration json file." )
18 self.addOption('calibFile', None, type=str,
19 info="the calibration json file")
20 self.addOption('noEffSF', False, type=bool,
21 info="do not apply the eff SF")
22
23 def instanceName (self) :
24 """Return the instance name for this block"""
25 return self.containerName + '_' + self.Xbbtagger + '_' + self.XbbWP
26
27 def makeAlgs(self, config):
28
29 jetContainer = config.originalName(self.containerName)
30 selectionName = f'{self.Xbbtagger}_{self.XbbWP}'
31
32 alg = config.createAlgorithm( 'CP::XbbInformationDecoratorAlg', 'XbbInfoAlg' )
33 config.addPrivateTool('selectionTool', 'BTaggingSelectionJsonTool' )
34 alg.selectionTool.MaxEta = 4.5
35 alg.selectionTool.MinPt = 0.
36 alg.selectionTool.OutputName = self.Xbbtagger
37 alg.selectionTool.JetAuthor = jetContainer
38 alg.selectionTool.OperatingPoint = self.XbbWP
39 alg.selectionTool.JsonConfigFile = self.calibFile
40 alg.preselection = config.getPreselection (self.containerName, '')
41
42 alg.taggerDecisionDecoration = 'xbb_select_' + selectionName
43 alg.jets = config.readName (self.containerName)
44 config.addOutputVar (self.containerName, 'xbb_select_' + selectionName, selectionName + '_select', noSys=True)
45
46 if not self.noEffSF and config.dataType() != DataType.Data:
47 alg = config.createAlgorithm( 'CP::XbbEfficiencyAlg',
48 'XbbSFAlg' )
49 config.addPrivateTool('efficiencyTool', 'BTaggingEfficiencyJsonTool' )
50 alg.efficiencyTool.MaxEta = 4.5
51 alg.efficiencyTool.MinPt = 0.
52 alg.efficiencyTool.TaggerName = self.Xbbtagger
53 alg.efficiencyTool.JetAuthor = jetContainer
54 alg.efficiencyTool.OperatingPoint = self.XbbWP
55 alg.efficiencyTool.JsonConfigFile = self.calibFile
56 alg.preselection = config.getPreselection (self.containerName, '')
57
58 alg.scaleFactorDecoration = 'xbb_effSF_' + selectionName + '_%SYS%'
59 alg.jets = config.readName (self.containerName)
60 config.addOutputVar (self.containerName, alg.scaleFactorDecoration, selectionName + '_effSF')