11#include <reconstruction/persistenceManager/PersistenceManager.h>
13#include <framework/datastore/StoreObjPtr.h>
27namespace Belle2::VariablePersistenceManager {
56 const std::string& directory,
57 Variables& variables)
override;
65 void addEntry(
const EvaluatedVariables& evaluatedVariables)
override;
73 void store()
override;
94 std::shared_ptr<TFile>
m_file{
nullptr};
99 std::map<std::string, std::unique_ptr<StoreObjPtr<RootMergeable<TH1D>>>>
m_histograms;
Wrap a root histogram or TNtuple to make it mergeable.
Variables m_variables
A list of variables associated with the histograms.
void store() override
Writes histogram data to disk.
std::string m_directory
Name of the directory (folder) within the ROOT file where histograms are stored.
void addEntry(const EvaluatedVariables &evaluatedVariables) override
Fills histograms with the current set of evaluated variables.
void registerHistograms()
Registers (books) the histograms based on m_variables.
std::string m_fileName
Name of the ROOT file where histograms will be written.
void openFileWithGuards()
Safely opens the ROOT file specified by m_fileName.
std::map< std::string, std::unique_ptr< StoreObjPtr< RootMergeable< TH1D > > > > m_histograms
A map of histogram names to their respective objects (wrapped in RootMergeable).
ConcreteVariablesToHistogramPersistenceManager()
Default constructor.
void initialize(const std::string &fileName, const std::string &directory, Variables &variables) override
Initializes the manager by opening a ROOT file and creating histograms.
std::shared_ptr< TFile > m_file
Pointer to the ROOT file object.
Abstract base class defining the interface for persisting variables.
Abstract base class for different kinds of events.