ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
python
PrintToolConfigAlgConfig.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
from
AnaAlgorithm.DualUseConfig
import
isAthena, useComponentAccumulator
6
7
from
pathlib
import
Path
8
9
class
PrintToolConfigAlgBlock
(ConfigBlock):
10
"""ConfigBlock for tool properties printing.
11
12
This class handles configuration for printing tool properties to a specified
13
output file.
14
"""
15
16
def
__init__
(self):
17
super (PrintToolConfigAlgBlock, self).__init__ ()
18
19
self.addOption(
'OutputFile'
,
'tool_config.txt'
, type=str,
20
info=
"Name of the file where the tool configuration will be written."
)
21
self.addOption(
'OutputDir'
,
None
, type=str,
22
info=
"Directory where the output file will be written. If 'None',"
23
" the current directory of the job."
)
24
25
def
instanceName
(self) :
26
"""Return the instance name for this block"""
27
return
''
# no instance name needed for singleton block
28
29
def
get_output_path
(self) -> Path:
30
"""Get the complete output file path.
31
32
Returns:
33
Path object representing the full output file path.
34
"""
35
output_dir = self.OutputDir
if
self.OutputDir
is
not
None
else
Path.cwd()
36
return
Path(output_dir) / self.OutputFile
37
38
def
makeAlgs
(self, config) -> None:
39
"""Create and configure the PrintToolConfigAlg algorithm.
40
41
Args:
42
config: Configuration object used to create the algorithm.
43
"""
44
if
isAthena
and
useComponentAccumulator:
45
# we leave the implementation for Athena/AthAnalysis to a future MR
46
# this will be based on https://gitlab.cern.ch/atlas/athena/-/merge_requests/77616
47
return
48
49
alg = config.createAlgorithm(
'CP::PrintToolConfigAlg'
,
'PrintToolConfigAlg'
)
50
alg.OutputFile = str(self.
get_output_path
())
python.PrintToolConfigAlgConfig.PrintToolConfigAlgBlock
Definition
PrintToolConfigAlgConfig.py:9
python.PrintToolConfigAlgConfig.PrintToolConfigAlgBlock.__init__
__init__(self)
Definition
PrintToolConfigAlgConfig.py:16
python.PrintToolConfigAlgConfig.PrintToolConfigAlgBlock.instanceName
instanceName(self)
Definition
PrintToolConfigAlgConfig.py:25
python.PrintToolConfigAlgConfig.PrintToolConfigAlgBlock.get_output_path
Path get_output_path(self)
Definition
PrintToolConfigAlgConfig.py:29
python.PrintToolConfigAlgConfig.PrintToolConfigAlgBlock.makeAlgs
None makeAlgs(self, config)
Definition
PrintToolConfigAlgConfig.py:38
Generated on
for ATLAS Offline Software by
1.14.0