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