Skip to content

Implement the NTuple::Writer and NTuple::GenericWriter algorithms for thread-safe NTuple writing

Silia Taider requested to merge staider/Gaudi:NTupleWriter into master

Overview

The NTuple writer is a Gaudi algorithm for writing data of any type from N locations in the event store to a TTree. It allows users to write data from various locations within the event store into a ROOT TTree structure dynamically creating branches leveraging ROOT's dynamic typing and I/O capabilities to support a range of data types based on either runtime or compile-time configurations.

Key Components

  • NTuple::GenericWriter: This class represents an algorithm that dynamically creates branches based on runtime information. It is intended for scenarios where the exact configuration of the TTree branches is determined when configuring the Gaudi application itself. It allows users to specify N input data types and their corresponding locations in the event store to construct matching TTree branches.
  • NTuple::Writer: This class represents a compile-time configured algorithm, inheriting from Gaudi::Functional::Consumer. It requires a transformation function to convert input data into a specific output format allowing it to deal with an arbitrary number of inputs and to also write to the file an arbitrary number of outputs. It relies on templates to define the structure and data transformations at compile time.

Workflow

  • Initialization: Sets up the ROOT file and creates a TTree, initializing branches for each specified input.
  • Execution: Fills the TTree with data from the event store.
  • Finalization: Writes the filled TTree to the ROOT file and closes the file.

Key Features

  • Supports dynamic branch creation based on runtime information.
  • Offers compile-time optimized branch creation for predefined structures.
  • Introduces a data transformation feature for more flexibility and control over what to write.
  • Customizable configurations for file names and branch names.

Coverage

The merge request includes both pytest and Boost frameworks for unit and integration tests.

Merge request reports