ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
JetAnalysisAlgorithms
python
JetCalibAlgConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
"""
4
JetCalibAlgConfig
5
6
This module currently demonstrates a ConfigBlock for a single JetCalibAlg using the new Jet calibration tools.
7
"""
8
# AnaAlgorithm import(s):
9
from
AnalysisAlgorithmsConfig.ConfigBlock
import
ConfigBlock
10
from
AnaAlgorithm.DualUseConfig
import
isAthena
11
12
# Jet config imports
13
from
JetCalibTools.JetCalibStepsConfig
import
calibToolFromConfigFile
14
15
class
JetCalibAlgConfig
(ConfigBlock):
16
17
def
__init__
(self):
18
super().
__init__
()
19
20
self.addOption(
'inputJets'
,
''
, type=str,
21
info=
"the name of the input jet container, also used to look up the "
22
"calibration configuration (unless `CalibFile` is set)."
)
23
self.addOption(
'calibratedJets'
,
''
, type=str, meta={
'role'
:
'container'
},
24
info=
"the name of the output (calibrated) jet container."
)
25
self.addOption(
'context'
,
'AnalysisLatest'
, type=str,
26
info=
"the calibration context used to look up the calibration "
27
"configuration file (ignored if `CalibFile` is set)."
)
28
self.addOption(
'CalibFile'
,
''
, type=str,
29
info=
"expert override: path to the calibration configuration file, "
30
"skipping the lookup based on `context` and `inputJets`."
)
31
32
def
instanceName
(self) :
33
"""Return the instance name for this block"""
34
return
self.
calibratedJets
35
36
def
makeAlgs
(self, config):
37
38
config.setSourceName (self.
calibratedJets
, self.
inputJets
, originalName = self.
inputJets
)
39
40
if
config.wantCopy (self.
calibratedJets
) :
41
alg = config.createAlgorithm(
'CP::AsgShallowCopyAlg'
,
'JetShallowCopyAlg'
)
42
alg.input = config.readName (self.
calibratedJets
)
43
alg.output = config.copyName (self.
calibratedJets
)
44
45
alg = config.createAlgorithm(
'CP::JetCalibAlg'
,
'JetCalibAlg'
)
46
alg.jets = config.readName(self.
calibratedJets
)
47
48
if
self.
CalibFile
:
49
calibFile = self.
CalibFile
50
else
:
51
from
JetCalibTools.JetCalibToolsCfg
import
get_calib_cfg_path, get_jet_collection_name
52
jetcollection = self.
inputJets
53
if
jetcollection.endswith(
'Jets'
):
54
jetcollection = jetcollection[:-4]
55
jetcollection = get_jet_collection_name(jetcollection)
56
calibFile = get_calib_cfg_path(self.context, jetcollection)
57
58
calibtool = calibToolFromConfigFile(config.flags, calibFile, name=self.
inputJets
+
"Calib"
)
59
60
if
isAthena:
61
# In this case calibtool is a regular configurable and the usual syntax works:
62
alg.calibrationTool = calibtool
63
else
:
64
# AnalysisBase : use the special JetAnalysisCommon syntax to propagate the config of this tool:
65
calibtool.toToolInAnaAlg(alg,
"calibrationTool"
)
python.JetCalibAlgConfig.JetCalibAlgConfig
Definition
JetCalibAlgConfig.py:15
python.JetCalibAlgConfig.JetCalibAlgConfig.__init__
__init__(self)
Definition
JetCalibAlgConfig.py:17
python.JetCalibAlgConfig.JetCalibAlgConfig.makeAlgs
makeAlgs(self, config)
Definition
JetCalibAlgConfig.py:36
python.JetCalibAlgConfig.JetCalibAlgConfig.inputJets
inputJets
Definition
JetCalibAlgConfig.py:38
python.JetCalibAlgConfig.JetCalibAlgConfig.instanceName
instanceName(self)
Definition
JetCalibAlgConfig.py:32
python.JetCalibAlgConfig.JetCalibAlgConfig.CalibFile
CalibFile
Definition
JetCalibAlgConfig.py:48
python.JetCalibAlgConfig.JetCalibAlgConfig.calibratedJets
calibratedJets
Definition
JetCalibAlgConfig.py:38
Generated on
for ATLAS Offline Software by
1.17.0