|
HIPO4 C++ Library 4.4.1
Columnar I/O library for CLAS12 physics data
|
Chain multiple HIPO files for unified processing. More...
#include <chain.h>
Public Types | |
| using | iterator = ChainIterator |
| using | const_iterator = ChainIterator |
Public Member Functions | |
| chain (int threads=0, bool progress=true, bool verbose=false) | |
| Construct a chain with specified thread count. | |
| int | add (std::string_view filename) |
| Add a single file to the chain. | |
| int | add (std::vector< std::string > &filenames) |
| Add multiple files to the chain. | |
| int | add_pattern (std::string_view pattern) |
| Add files matching a glob pattern. | |
| void | clear () |
| Remove all files from the chain. | |
| std::size_t | size () const noexcept |
| Number of files in the chain. | |
| bool | empty () const noexcept |
| Check if chain is empty. | |
| int | get_nb_files () const noexcept |
| Legacy alias for size() | |
| const FileInfo & | operator[] (std::size_t index) const |
| Get file info by index. | |
| const FileInfo & | file_info (int index) const |
| Legacy alias for operator[]. | |
| std::vector< FileInfo > & | files () noexcept |
| Get all file infos. | |
| void | set_tags (const std::vector< long > &tags) |
| Set event tags for filtering. | |
| void | set_threads (int n) |
| Set number of processing threads. | |
| void | set_progress (bool show) |
| Enable/disable progress display. | |
| void | set_verbose (bool verbose) |
| Enable/disable verbose output. | |
| void | open (bool validate_all=true) |
| Validate and optionally load metadata for all files. | |
| void | scan () |
| Scan and display detailed information about all files. | |
| void | list () const |
| Print list of files in chain. | |
| banklist | getBanks (const std::vector< std::string > &names) |
| Create a banklist from bank names using the first file's dictionary. | |
| banklist | get_banks (const std::vector< std::string > &names) |
| Alias for getBanks (snake_case) | |
| iterator | begin () |
| Get iterator to first event. | |
| iterator | end () |
| Get end iterator. | |
| template<typename ProcessFunc > | |
| void | process (ProcessFunc &&process_func, double percentage=100.0) |
| Process events in parallel across all files (record-level parallelism) | |
| template<typename ProcessFunc > | |
| void | process (ProcessFunc &&process_func, long num_events) |
| Process a specific number of events in parallel across all files. | |
| template<typename ProcessFunc > | |
| void | process (const banklist &banks, ProcessFunc &&process_func, double percentage=100.0) |
| Process events in parallel using a banklist (record-level parallelism) | |
| template<typename ProcessFunc > | |
| void | process_filtered (ProcessFunc &&process_func, const std::vector< std::string > &required_banks, double percentage=100.0) |
| Process events with bank filtering (record-level parallelism) | |
| template<typename ProcessFunc > | |
| void | process_filtered (ProcessFunc &&process_func, const std::vector< std::string > &required_banks, long num_events) |
| Process filtered events with an absolute event count. | |
| template<typename FileFunc > | |
| void | for_each_file (FileFunc &&func) |
| Apply a function to each file (for file-level operations) | |
| const ChainStatistics & | statistics () const noexcept |
| Get processing statistics. | |
| long | total_events () |
| Get total event count (loads metadata if needed) | |
| long | total_events_count () const |
| Legacy alias. | |
| void | print_statistics () const |
| Print processing statistics. | |
| void | show_all_info () |
| Show detailed info for all files. | |
| bool | any_has_config (std::string_view name) |
| Check if any file has a configuration key. | |
| std::optional< std::string > | get_config (std::string_view name) |
| Get configuration from first file that has it. | |
| ThreadPool & | threadpool () noexcept |
| Get the thread pool for advanced use. | |
Friends | |
| class | ChainIterator |
Chain multiple HIPO files for unified processing.
The chain class provides:
| using hipo::chain::iterator = ChainIterator |
|
inlineexplicit |
Construct a chain with specified thread count.
| threads | Number of threads (0 = auto-detect hardware concurrency) |
| progress | Show progress bar during processing |
| verbose | Enable verbose output |
|
inline |
Add a single file to the chain.
| filename | Path to the HIPO file |
|
inline |
Add multiple files to the chain.
| filenames | Vector of file paths |
|
inline |
Add files matching a glob pattern.
| pattern | Glob pattern (e.g., "data/*.hipo", "run_???.hipo") |
|
inline |
Remove all files from the chain.
|
inlinenoexcept |
Number of files in the chain.
|
inlinenoexcept |
Check if chain is empty.
|
inlinenoexcept |
Legacy alias for size()
|
inline |
Get file info by index.
|
inline |
Legacy alias for operator[].
|
inlinenoexcept |
Get all file infos.
|
inline |
Set event tags for filtering.
|
inline |
Set number of processing threads.
|
inline |
Enable/disable progress display.
|
inline |
Enable/disable verbose output.
|
inline |
Validate and optionally load metadata for all files.
| validate_all | If true, open each file to validate; if false, only check existence |
| std::runtime_error | if no valid files in chain |
|
inline |
Scan and display detailed information about all files.
|
inline |
Print list of files in chain.
|
inline |
Create a banklist from bank names using the first file's dictionary.
Creates bank objects with the correct schemas, ready to be filled by chain_event::readBanks(). The chain must have at least one file added.
|
inline |
Alias for getBanks (snake_case)
|
inline |
|
inline |
Get end iterator.
|
inline |
Process events in parallel across all files (record-level parallelism)
Uses record-level parallelism for efficient I/O: each thread grabs entire records and processes all events within them sequentially. This minimizes random access and maximizes cache efficiency.
| process_func | Callable with signature: void(chain_event&, int file_idx, long event_idx) |
| percentage | Percentage of events to process (0-100) |
|
inline |
Process a specific number of events in parallel across all files.
Same as process(func, percentage) but accepts an absolute event count.
| process_func | Callable with signature: void(chain_event&, int file_idx, long event_idx) |
| num_events | Number of events to process |
|
inline |
Process events in parallel using a banklist (record-level parallelism)
Each thread gets its own copy of the banklist for thread safety. For each event, the event data is read into the thread-local banklist before calling the user function.
| banks | Template banklist (created via chain::getBanks); each thread copies it |
| process_func | Callable with signature: void(banklist&, int file_idx, long event_idx) |
| percentage | Percentage of events to process (0-100) |
|
inline |
Process events with bank filtering (record-level parallelism)
Only processes events containing all specified banks. Uses record-level parallelism for efficient I/O.
| process_func | Callable with signature: void(chain_event&, int file_idx, long event_idx) |
| required_banks | List of bank names that must be present |
| percentage | Percentage of matching events to process |
|
inline |
Process filtered events with an absolute event count.
Same as process_filtered(func, banks, percentage) but accepts an absolute count of matching events to process.
| process_func | Callable with signature: void(chain_event&, int file_idx, long event_idx) |
| required_banks | List of bank names that must be present |
| num_events | Number of matching events to process |
|
inline |
Apply a function to each file (for file-level operations)
| func | Callable with signature: void(reader&, const FileInfo&) |
|
inlinenoexcept |
Get processing statistics.
|
inline |
Get total event count (loads metadata if needed)
|
inline |
Legacy alias.
|
inline |
Print processing statistics.
|
inline |
Show detailed info for all files.
|
inline |
Check if any file has a configuration key.
|
inline |
Get configuration from first file that has it.
|
inlinenoexcept |
Get the thread pool for advanced use.
|
friend |