Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 get_output_path(self) -> Path:
26  """Get the complete output file path.
27 
28  Returns:
29  Path object representing the full output file path.
30  """
31  output_dir = self.OutputDir if self.OutputDir is not None else Path.cwd()
32  return Path(output_dir) / self.OutputFile
33 
34  def makeAlgs(self, config) -> None:
35  """Create and configure the PrintToolConfigAlg algorithm.
36 
37  Args:
38  config: Configuration object used to create the algorithm.
39  """
40  if isAthena and useComponentAccumulator:
41  # we leave the implementation for Athena/AthAnalysis to a future MR
42  # this will be based on https://gitlab.cern.ch/atlas/athena/-/merge_requests/77616
43  return
44 
45  alg = config.createAlgorithm('CP::PrintToolConfigAlg', 'PrintToolConfigAlg')
46  alg.OutputFile = str(self.get_output_path())
python.PrintToolConfigAlgConfig.PrintToolConfigAlgBlock.get_output_path
Path get_output_path(self)
Definition: PrintToolConfigAlgConfig.py:25
python.PrintToolConfigAlgConfig.PrintToolConfigAlgBlock.makeAlgs
None makeAlgs(self, config)
Definition: PrintToolConfigAlgConfig.py:34
python.PrintToolConfigAlgConfig.PrintToolConfigAlgBlock
Definition: PrintToolConfigAlgConfig.py:9
python.PrintToolConfigAlgConfig.PrintToolConfigAlgBlock.__init__
def __init__(self)
Definition: PrintToolConfigAlgConfig.py:16
str
Definition: BTagTrackIpAccessor.cxx:11