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 meta={'role':'containerRef'})
15 self.addOption('XbbWP', 'FlatMassQCDEff_0p25', type=str,
16 info="the Xbb tagging WP." )
17 self.addOption('Xbbtagger', 'GN2Xv01', type=str,
18 info="the output name of the Xbb tagger - should match the first level key of the calibration json file." )
19 self.addOption('calibFile', None, type=str,
20 info="path to a Xbb JSON calibration file.")
21 self.addOption('noEffSF', False, type=bool,
22 info="do not compute the efficiency SF.")
23
24 def instanceName (self) :
25 """Return the instance name for this block"""
26 return self.containerName + '_' + self.Xbbtagger + '_' + self.XbbWP
27
28 def makeAlgs(self, config):
29
30 jetContainer = config.originalName(self.containerName)
31 selectionName = f'{self.Xbbtagger}_{self.XbbWP}'
32
33 alg = config.createAlgorithm( 'CP::XbbInformationDecoratorAlg', 'XbbInfoAlg' )
34 config.addPrivateTool('selectionTool', 'BTaggingSelectionJsonTool' )
35 alg.selectionTool.MaxEta = 4.5
36 alg.selectionTool.MinPt = 0.
37 alg.selectionTool.OutputName = self.Xbbtagger
38 alg.selectionTool.JetAuthor = jetContainer
39 alg.selectionTool.OperatingPoint = self.XbbWP
40 alg.selectionTool.JsonConfigFile = self.calibFile
41 alg.preselection = config.getPreselection (self.containerName, '')
42
43 alg.taggerDecisionDecoration = 'xbb_select_' + selectionName
44 alg.jets = config.readName (self.containerName)
45 config.addOutputVar (self.containerName, 'xbb_select_' + selectionName, selectionName + '_select', noSys=True)
46
47 if not self.noEffSF and config.dataType() != DataType.Data:
48 alg = config.createAlgorithm( 'CP::XbbEfficiencyAlg',
49 'XbbSFAlg' )
50 config.addPrivateTool('efficiencyTool', 'BTaggingEfficiencyJsonTool' )
51 alg.efficiencyTool.MaxEta = 4.5
52 alg.efficiencyTool.MinPt = 0.
53 alg.efficiencyTool.OutputName = self.Xbbtagger
54 alg.efficiencyTool.JetAuthor = jetContainer
55 alg.efficiencyTool.OperatingPoint = self.XbbWP
56 alg.efficiencyTool.JsonConfigFile = self.calibFile
57 alg.preselection = config.getPreselection (self.containerName, '')
58
59 alg.scaleFactorDecoration = 'xbb_effSF_' + selectionName + '_%SYS%'
60 alg.jets = config.readName (self.containerName)
61 config.addOutputVar (self.containerName, alg.scaleFactorDecoration, selectionName + '_effSF')