Mēnsūra
Public Member Functions | List of all members
TFileService Class Reference

Creates ROOT files and allows writing output into them. More...

#include <TFileService.hpp>

Inheritance diagram for TFileService:
Service

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.
 
TFileServiceoperator= (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 ServiceClone () 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...
 
- Public Member Functions inherited from Service
 Service (std::string const &name)
 Constructor. More...
 
 Service (Service const &)=default
 Default copy constructor.
 
 Service (Service &&)=default
 Default move constructor.
 
Serviceoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Member Function Documentation

void TFileService::BeginRun ( Dataset const &  dataset)
overridevirtual

Creates an output file for the new dataset.

Reimplemented from Service.

Reimplemented from Service.

Service * TFileService::Clone ( ) const
overridevirtual

Creates a newly configured clone.

Implemented from Service.

Implements Service.

template<typename T , typename... Args>
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.

void TFileService::EndRun ( )
overridevirtual

Writes and closes the output file.

Reimplemented from Service.

Reimplemented from Service.


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