Celeritas  0.5.0-86+4a8eea4
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
celeritas::RootFileManager Class Reference

ROOT TFile manager. More...

#include <RootFileManager.hh>

Public Member Functions

 RootFileManager (char const *filename)
 Construct with ROOT filename.
 
char const * filename () const
 Get the filename of the associated ROOT file.
 
UPRootTreeWritable make_tree (char const *name, char const *title)
 Create tree by providing its name and title. More...
 
void write ()
 Manually write TFile.
 

Static Public Member Functions

constexpr static bool use_root ()
 Whether ROOT interfacing is enabled. More...
 

Public Attributes

UPRootFileWritable tfile_
 

Detailed Description

ROOT TFile manager.

Currently this class is not thread-safe. Since there is only one TFile*, any writer class (such as RootStepWriter.hh) can just create their own TTrees and ROOT will know how to handle them.

If this is expanded to store one TFile per thread, we will need to expand make_tree("name, "title") to include a thread id as input parameter.

Member Function Documentation

◆ make_tree()

UPRootTreeWritable celeritas::RootFileManager::make_tree ( char const *  name,
char const *  title 
)

Create tree by providing its name and title.

It is still possible to simply create a TTree("name", "title") in any scope that a RootFileManager exists, but this function explicitly shows the relationship between the newly created tree and this->tfile_.

To expand this class to write multiple root files (one per thread), add a tid input parameter and call tfile_[tid].get().

◆ use_root()

bool celeritas::RootFileManager::use_root ( )
inlinestaticconstexpr

Whether ROOT interfacing is enabled.

This is true unless the CELER_DISABLE_ROOT environment variable is set to a non-empty value.


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