ATLAS Offline Software
Loading...
Searching...
No Matches
BJetCalibAnalysisConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3# AnaAlgorithm import(s):
4from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
5import AthenaCommon.SystemOfUnits as Units
6
7
8class BJetCalibAnalysisConfig (ConfigBlock) :
9 """the ConfigBlock for the b-jet calibration sequence"""
10
11 def __init__ (self) :
12 super (BJetCalibAnalysisConfig, self).__init__ ()
13 self.setBlockName('BJetCalib')
14 self.addDependency('FTag', required=False)
15 self.addDependency('Muons', required=True)
16 self.addDependency('MuonsWorkingPoint', required=False)
17 self.addDependency('FTagJetSF', required=False)
18 self.addDependency('JvtWorkingPointEfficiencyConfig', required=False)
19 self.addOption ('containerName', '', type=str,
20 noneAction='error',
21 info="the name of the input jet container.")
22 self.addOption ('muonContainerName', '', type=str,
23 noneAction='error',
24 info="the name of the input muon container.")
25 self.addOption ('jetPreselection', "", type=str,
26 info="the jet preselection.")
27 self.addOption ('muonPreselection', "", type=str,
28 info="the muon preselection.")
29 self.addOption ('doPtCorr', True, type=bool,
30 info=r"whether to run the b-jet $p_\mathrm{T}$ correction on top of the muon-in-jet one.")
31
32 def instanceName (self) :
33 """Return the instance name for this block"""
34 return self.containerName
35
36 def makeAlgs(self, config):
37
38 # Set up kinematic selection for which ftag selection should be used downstream
39 jetPreselection = config.getFullSelection(self.containerName, self.jetPreselection)
40 if jetPreselection:
41 alg = config.createAlgorithm('CP::AsgSelectionAlg',
42 'FtagPTEtaCutAlg')
43 alg.selectionDecoration = 'selectPtEtaFtag'
44 config.addPrivateTool('selectionTool', 'CP::AsgPtEtaSelectionTool')
45 alg.selectionTool.maxEta = 2.5
46 alg.selectionTool.minPt = 20. * Units.GeV
47 alg.particles = config.readName(self.containerName)
48 alg.preselection = config.getPreselection(self.containerName, '')
49 jetPreselection = "selectPtEtaFtag&&"+jetPreselection
50
51 alg = config.createAlgorithm('CP::BJetCalibrationAlg',
52 'BJetCalibAlg')
53 alg.muons = config.readName(self.muonContainerName)
54 alg.muonPreselection = config.getPreselection(self.muonContainerName,
55 self.muonPreselection)
56 alg.jets = config.readName(self.containerName)
57 alg.jetPreselection = jetPreselection
58 alg.jetsOut = config.copyName(self.containerName)
59
60 config.addPrivateTool('muonInJetTool', 'MuonInJetCorrectionTool')
61 # Adjust dR matching for large-R jets
62 if "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets" in alg.jets:
63 alg.muonInJetTool.doLargeR = True
64
65 if self.doPtCorr:
66 config.addPrivateTool('bJetTool', 'BJetCorrectionTool')
67
68 # (re-)decorate jets with the updated energy
69 alg = config.createAlgorithm( 'CP::AsgEnergyDecoratorAlg', 'EnergyDecoratorBJetCalib' )
70 alg.particles = config.readName (self.containerName)