Celeritas
0.5.0-56+6b053cd
|
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_ |
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.
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()
.
|
inlinestaticconstexpr |
Whether ROOT interfacing is enabled.
This is true unless the CELER_DISABLE_ROOT
environment variable is set to a non-empty value.