Belle II Software development
PersistenceManager Class Referenceabstract

Abstract base class defining the interface for persisting variables. More...

#include <PersistenceManager.h>

Inheritance diagram for PersistenceManager:
ConcreteVariablesToHistogramPersistenceManager ConcreteVariablesToNtuplePersistenceManager

Public Member Functions

virtual void initialize (const std::string &fileName, const std::string &objectName, Variables &variables)=0
 Initializes the persistence manager with the given parameters.
 
virtual void addEntry (const EvaluatedVariables &evaluatedVariables)=0
 Adds a new data entry (event) to the underlying storage.
 
virtual void store ()=0
 Writes the current in-memory data to the final storage medium.
 
virtual ~PersistenceManager ()=default
 Virtual destructor.
 

Detailed Description

Abstract base class defining the interface for persisting variables.

Any class implementing this interface is responsible for storing and retrieving data (e.g., variables to ntuples or histograms). Concrete implementations must provide the following capabilities:

  • Initialization of underlying data structures (e.g., files, trees, histograms)
  • Adding or accumulating event entries
  • Writing final results to disk or another storage medium

Definition at line 29 of file PersistenceManager.h.

Member Function Documentation

◆ addEntry()

virtual void addEntry ( const EvaluatedVariables & evaluatedVariables)
pure virtual

Adds a new data entry (event) to the underlying storage.

Parameters
evaluatedVariablesA map of variable names to their evaluated values.

This method is called once per event or data set. The implementing class should use the provided values to fill or update the data structures (e.g., histograms, tree branches, or other objects).

Implemented in ConcreteVariablesToHistogramPersistenceManager, and ConcreteVariablesToNtuplePersistenceManager.

◆ initialize()

virtual void initialize ( const std::string & fileName,
const std::string & objectName,
Variables & variables )
pure virtual

Initializes the persistence manager with the given parameters.

Parameters
fileNameName or path to the output resource (e.g., a ROOT file).
objectNameName of the object (e.g., tree or directory) used to store data.
variablesA list of variables (TypedVariable or BinnedVariable) used by the manager.

This function should set up any internal data structures needed, such as creating file pointers, booking histograms, or initializing trees. It does not actually store data but prepares for it.

Implemented in ConcreteVariablesToHistogramPersistenceManager, and ConcreteVariablesToNtuplePersistenceManager.

◆ store()

virtual void store ( )
pure virtual

Writes the current in-memory data to the final storage medium.

This method should be called once the data accumulation is complete (e.g., at the end of a run). It ensures that all buffered data is safely written to the output (e.g., a ROOT file).

Implemented in ConcreteVariablesToHistogramPersistenceManager, and ConcreteVariablesToNtuplePersistenceManager.


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