17#include <reconstruction/persistenceManager/PersistenceManager.h>
18#include <framework/pcore/RootMergeable.h>
19#include <framework/datastore/StoreObjPtr.h>
21namespace Belle2::VariablePersistenceManager {
50 const std::string& treeName,
51 Variables& variables)
override;
61 void addEntry(
const EvaluatedVariables& evaluatedVariables)
override;
69 void store()
override;
95 std::shared_ptr<TFile>
m_file{
nullptr};
134 const VariableType& value);
Type-safe access to single objects in the data store.
Variables m_variables
The list of variables that will be written to the TTree.
void registerBranches()
Registers TTree branches for each variable in m_variables.
void store() override
Writes the current buffered data to disk.
void updateBranch(const std::string &variableName, const VariableType &value)
Updates the branch buffer for a given variable with a new value.
std::map< std::string, bool > m_branchesBool
Storage for bool branches.
int m_basketSize
Basket size for the TTree branches.
void addEntry(const EvaluatedVariables &evaluatedVariables) override
Adds a single event's worth of variable data to the TTree.
std::map< std::string, double > m_branchesDouble
Maps of variable names to storage for double, int, and bool TTree branches.
void initialize(const std::string &fileName, const std::string &treeName, Variables &variables) override
Initializes the manager by opening a ROOT file and preparing a TTree.
std::string m_fileName
Name of the ROOT file where TTree data is stored.
void openFileWithGuards()
Safely opens the ROOT file specified by m_fileName.
ConcreteVariablesToNtuplePersistenceManager()
Default constructor.
StoreObjPtr< RootMergeable< TTree > > m_tree
A store pointer to the RootMergeable wrapper for the TTree.
std::map< std::string, int > m_branchesInt
Storage for int branches.
std::shared_ptr< TFile > m_file
Pointer to the ROOT file object.
std::string m_treeName
Name of the TTree that will be created and filled.
Abstract base class defining the interface for persisting variables.