Mēnsūra
|
Creates ROOT files and allows writing output into them. More...
#include <TFileService.hpp>
Public Member Functions | |
TFileService (std::string const &name, std::string const &outFileName) | |
Creates a service with the given name and given path for the output file. More... | |
TFileService (std::string const &outFileName="%") | |
A short-cut for the above version with a default name "TFileService". | |
TFileService (TFileService &&)=default | |
Default move constructor. | |
TFileService & | operator= (TFileService const &)=delete |
Assignment operator is deleted. | |
virtual | ~TFileService () noexcept |
Trivial destructor. | |
virtual void | BeginRun (Dataset const &dataset) override |
Creates an output file for the new dataset. More... | |
virtual Service * | Clone () const override |
Creates a newly configured clone. More... | |
template<typename T , typename... Args> | |
T * | Create (std::string const &inFileDirectory, Args const &...args) const |
Creates a ROOT object in the given directory in the output file. More... | |
virtual void | EndRun () override |
Writes and closes the output file. More... | |
![]() | |
Service (std::string const &name) | |
Constructor. More... | |
Service (Service const &)=default | |
Default copy constructor. | |
Service (Service &&)=default | |
Default move constructor. | |
Service & | operator= (Service const &)=default |
Default assignment operator. | |
virtual | ~Service ()=default |
Default destructor. | |
Processor const & | GetMaster () const |
Returns a reference to the master. More... | |
std::string const & | GetName () const |
Returns name of the plugin. | |
void | SetMaster (Processor const *processor) |
Provides a pointer to an instance of Processor class that owns the service. More... | |
Creates ROOT files and allows writing output into them.
This service opens for writing a ROOT file for each processed dataset and allows creation of ROOT objects, such as histograms and trees, to be stored in the file. The main motivation behind this service is to allow aggregating output of multiple plugins in a single output file.
TFileService::TFileService | ( | std::string const & | name, |
std::string const & | outFileName | ||
) |
Creates a service with the given name and given path for the output file.
The given path may include directories, which will be created if needed. The filename part of the path may contain one symbol "%", which will be replaced by the base name of the first file in each dataset. The extension ".root" is optional and is added automatically if omitted.
|
overridevirtual |
|
overridevirtual |
T * TFileService::Create | ( | std::string const & | inFileDirectory, |
Args const &... | args | ||
) | const |
Creates a ROOT object in the given directory in the output file.
The directory path may include subdirectories. Directories are created if they do not exist. In order to create an object in the root directory, use "". Arguments 'args' are forwarded to the constructor of T. The created object is owned by the output file.
|
overridevirtual |