|
HIPO
4.3.0
High Performance Output data format for experimental physics
|
#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. More... | |
| int | add (std::string_view filename) |
| Add a single file to the chain. More... | |
| int | add (std::vector< std::string > &filenames) |
| Add multiple files to the chain. More... | |
| int | add_pattern (std::string_view pattern) |
| Add files matching a glob pattern. More... | |
| void | clear () |
| Remove all files from the chain. More... | |
| std::size_t | size () const noexcept |
| Number of files in the chain. More... | |
| bool | empty () const noexcept |
| Check if chain is empty. More... | |
| int | get_nb_files () const noexcept |
| Legacy alias for size() More... | |
| const FileInfo & | operator[] (std::size_t index) const |
| Get file info by index. More... | |
| const FileInfo & | file_info (int index) const |
| Legacy alias for operator[]. More... | |
| std::vector< FileInfo > & | files () noexcept |
| Get all file infos. More... | |
| void | set_tags (const std::vector< long > &tags) |
| Set event tags for filtering. More... | |
| void | set_threads (int n) |
| Set number of processing threads. More... | |
| void | set_progress (bool show) |
| Enable/disable progress display. More... | |
| void | set_verbose (bool verbose) |
| Enable/disable verbose output. More... | |
| void | open (bool validate_all=true) |
| Validate and optionally load metadata for all files. More... | |
| void | scan () |
| Scan and display detailed information about all files. More... | |
| void | list () const |
| Print list of files in chain. More... | |
| iterator | begin () |
| Get iterator to first event. More... | |
| iterator | end () |
| Get end iterator. More... | |
| template<typename ProcessFunc > | |
| void | process (ProcessFunc &&process_func, double percentage=100.0) |
| Process events in parallel across all files (record-level parallelism) More... | |
| 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) More... | |
| template<typename FileFunc > | |
| void | for_each_file (FileFunc &&func) |
| Apply a function to each file (for file-level operations) More... | |
| const ChainStatistics & | statistics () const noexcept |
| Get processing statistics. More... | |
| long | total_events () |
| Get total event count (loads metadata if needed) More... | |
| long | total_events_count () const |
| Legacy alias. More... | |
| void | print_statistics () const |
| Print processing statistics. More... | |
| void | show_all_info () |
| Show detailed info for all files. More... | |
| bool | any_has_config (std::string_view name) |
| Check if any file has a configuration key. More... | |
| std::optional< std::string > | get_config (std::string_view name) |
| Get configuration from first file that has it. More... | |
| ThreadPool & | threadpool () noexcept |
| Get the thread pool for advanced use. More... | |
Friends | |
| class | ChainIterator |
@brief Chain multiple HIPO files for unified processing
The chain class provides:
- File management (add, remove, pattern matching)
- Sequential iteration via range-based for loops
- Parallel processing with configurable thread pools
- Lazy metadata loading for minimal memory overhead
- Progress tracking and statistics
@code
hipo::chain ch(4); // 4 threads
ch.add_pattern("data/*.hipo");
| using hipo::chain::iterator = ChainIterator |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get iterator to first event.
Enables range-based for loops:
|
inline |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
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 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 |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
friend |