HPS-MC
 
Loading...
Searching...
No Matches
MergeROOT Class Reference
Inheritance diagram for MergeROOT:
Component

Public Member Functions

 __init__ (self, **kwargs)
 
 cmd_args (self)
 
 scan_root_file (self, filename)
 
 scan_input_files (self, log_out)
 
 scan_output_file (self, log_out)
 
 validate_merge (self, log_out)
 
 print_summary (self, log_out)
 
 execute (self, log_out, log_err)
 
 output_files (self)
 
 required_config (self)
 
- Public Member Functions inherited from Component
 cmd_line_str (self)
 
 cmd_exists (self)
 Check if the component's assigned command exists.
 
 cmd_args_str (self)
 Return list of arguments, making sure they are all converted to strings.
 
 setup (self)
 Perform any necessary setup for this component to run such as making symlinks to required directories.
 
 cleanup (self)
 Perform post-job cleanup such as deleting temporary files.
 
 config_logging (self, parser)
 Configure the logging for a component.
 
 config (self, parser)
 Automatic configuration.
 
 set_parameters (self, params)
 Set class attributes for the component based on JSON parameters.
 
 required_parameters (self)
 Return a list of required parameters.
 
 optional_parameters (self)
 Return a list of optional parameters.
 
 check_config (self)
 Raise an exception on the first missing config setting for this component.
 
 input_files (self)
 Get a list of input files for this component.
 
 config_from_environ (self)
 Configure component from environment variables which are just upper case versions of the required config names set in the shell environment.
 

Public Attributes

 command
 
 force
 
 compression
 
 validate
 
 input_tree_counts
 
 output_tree_counts
 
 outputs
 
 inputs
 
- Public Attributes inherited from Component
 name
 
 command
 
 nevents
 
 seed
 
 inputs
 
 outputs
 
 append_tok
 
 output_ext
 
 ignore_job_params
 
 hpsmc_dir
 
 logger
 

Additional Inherited Members

- Protected Member Functions inherited from Component
 _inputs_to_outputs (self)
 This is the default method for automatically transforming input file names to outputs when output file names are not explicitly provided.
 

Detailed Description

Merge ROOT files using hadd with event count validation.

This component uses ROOT's hadd utility to merge multiple ROOT files
into a single output file, and validates that all events are preserved.

Definition at line 1676 of file tools.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
**  kwargs 
)
Initialize MergeROOT component.

Parameters
----------
inputs : list
    List of input ROOT files to merge
outputs : list
    List containing the output merged ROOT file name
force : bool, optional
    Force overwrite of output file (default: True)
compression : int, optional
    Compression level for output file (0-9, default: None uses hadd default)
validate : bool, optional
    Validate event counts after merge (default: True)

Reimplemented from Component.

Definition at line 1684 of file tools.py.

Member Function Documentation

◆ cmd_args()

cmd_args (   self)
Build command line arguments for hadd.

Returns
-------
list
    List of command arguments

Reimplemented from Component.

Definition at line 1723 of file tools.py.

◆ execute()

execute (   self,
  log_out,
  log_err 
)
Execute MergeROOT component using hadd.

Parameters
----------
log_out : file
    Log file for stdout
log_err : file
    Log file for stderr

Returns
-------
int
    Return code from hadd command

Reimplemented from Component.

Definition at line 1968 of file tools.py.

◆ output_files()

output_files (   self)
Return list of output files.

Returns
-------
list
    List containing the merged output ROOT file

Reimplemented from Component.

Definition at line 2049 of file tools.py.

◆ print_summary()

print_summary (   self,
  log_out 
)
Print a summary of the merge operation.

Parameters
----------
log_out : file
    Log file for output

Definition at line 1936 of file tools.py.

◆ required_config()

required_config (   self)
Return list of required configuration parameters.

Returns
-------
list
    List of required config parameters (empty for MergeROOT)

Reimplemented from Component.

Definition at line 2060 of file tools.py.

◆ scan_input_files()

scan_input_files (   self,
  log_out 
)
Scan all input files and store tree event counts.

Parameters
----------
log_out : file
    Log file for output

Definition at line 1798 of file tools.py.

◆ scan_output_file()

scan_output_file (   self,
  log_out 
)
Scan output file and store tree event counts.

Parameters
----------
log_out : file
    Log file for output

Definition at line 1829 of file tools.py.

◆ scan_root_file()

scan_root_file (   self,
  filename 
)
Scan a ROOT file and extract TTree event counts.

Parameters
----------
filename : str
    Path to ROOT file

Returns
-------
dict
    Dictionary mapping tree names to entry counts

Definition at line 1756 of file tools.py.

◆ validate_merge()

validate_merge (   self,
  log_out 
)
Validate that event counts match between input and output files.

Parameters
----------
log_out : file
    Log file for output

Returns
-------
bool
    True if validation passes, False otherwise

Definition at line 1856 of file tools.py.

Member Data Documentation

◆ command

command

Definition at line 1705 of file tools.py.

◆ compression

compression

Definition at line 1713 of file tools.py.

◆ force

force

Definition at line 1709 of file tools.py.

◆ input_tree_counts

input_tree_counts

Definition at line 1720 of file tools.py.

◆ inputs

inputs

Definition at line 1749 of file tools.py.

◆ output_tree_counts

output_tree_counts

Definition at line 1721 of file tools.py.

◆ outputs

outputs

Definition at line 1743 of file tools.py.

◆ validate

validate

Definition at line 1717 of file tools.py.


The documentation for this class was generated from the following file: