ATLAS Offline Software
Loading...
Searching...
No Matches
JetCalibAlgConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3"""
4JetCalibAlgConfig
5
6This module is currently demonstrates a ConfigBlock for a single JetCalibAlg using the new Jet calibration tools.
7It is loosely inspired from
8
9"""
10# AnaAlgorithm import(s):
11from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
12from AnaAlgorithm.DualUseConfig import isAthena
13
14# Jet config imports
15from JetCalibTools.JetCalibStepsConfig import calibToolFromConfigFile
16
17class JetCalibAlgConfig(ConfigBlock):
18
19 def __init__(self):
20 super(JetCalibAlgConfig, self).__init__()
21
22 self.addOption('inputJets', '', type=str)
23 self.addOption('calibratedJets', '', type=str)
24
25
26 self.addOption('CalibFile', '', type=str)
27
28 def makeAlgs(self, config):
29
30 config.setSourceName (self.calibratedJets, self.inputJets, originalName = self.inputJets)
31
32 # Perform a shallow copy of the input :
33 if config.wantCopy (self.calibratedJets) :
34 alg = config.createAlgorithm( 'CP::AsgShallowCopyAlg', 'JetShallowCopyAlg' )
35 alg.input = config.readName (self.calibratedJets)
36 alg.output = config.copyName (self.calibratedJets)
37
38 alg = config.createAlgorithm('CP::JetCalibAlg', 'JetCalibAlg')
39 alg.jets = config.readName(self.calibratedJets )
40 alg.OutputLevel = 3
41
42 # Call calibToolFromConfigFile
43 calibtool = calibToolFromConfigFile(config.flags, self.CalibFile, name=self.inputJets+"Calib")
44 calibtool.OutputLevel=3
45
46 if isAthena:
47 # In this case calibtool is a regular configurable and the usual syntax works:
48 alg.calibrationTool = calibtool
49 else:
50 # AnalysisBase : use the special JetAnalysisCommon syntax to propagate the config of this tool:
51 calibtool.toToolInAnaAlg(alg, "calibrationTool")
52
53
54
55
56
57