|  | Belle II Software
    light-2205-abys
    | 
Helper class to factorize some necessary tasks when working with Belle2 output files. More...
#include <RootFileInfo.h>

| Public Member Functions | |
| RootFileInfo (const std::string &filename) | |
| Create an object from a given filename or url.  More... | |
| ~RootFileInfo () | |
| Close the file and delete all structures associated with it. | |
| TTree & | getPersistentTree () | 
| Return a reference to the persistent tree. | |
| TTree & | getEventTree () | 
| Return a reference to the event tree. | |
| const FileMetaData & | getFileMetaData () | 
| Return the event metadata from the file.  More... | |
| const std::set< std::string > & | getBranchNames (bool persistent=false) | 
| Return a set of branch names for either the event or the persistent tree. | |
| void | checkMissingBranches (const std::set< std::string > &required, bool persistent=false) | 
| Check if the event or persistent tree contain at least all the branches in the set of required branches.  More... | |
| Private Attributes | |
| std::unique_ptr< TFile > | m_file | 
| Pointer to the file object. | |
| std::unique_ptr< TTree > | m_persistent | 
| Pointer to the persistent tree. | |
| std::unique_ptr< TTree > | m_events | 
| Pointer to the event tree. | |
| std::unique_ptr< FileMetaData > | m_metadata | 
| Pointer to the file metadata once it has been read. | |
| std::optional< std::set< std::string > > | m_persistentBranches | 
| Cached set of persistent branch names. | |
| std::optional< std::set< std::string > > | m_eventBranches | 
| Cached set of event branch names. | |
Helper class to factorize some necessary tasks when working with Belle2 output files.
Like the correct way to obtain the FileMetaData from a file or to check the list of existing branches
Definition at line 27 of file RootFileInfo.h.
| 
 | explicit | 
Create an object from a given filename or url.
This will open the file and read the tree headers. It will throw exceptions if it encounters any problems:
Definition at line 18 of file RootFileInfo.cc.
| void checkMissingBranches | ( | const std::set< std::string > & | required, | 
| bool | persistent = false | ||
| ) | 
Check if the event or persistent tree contain at least all the branches in the set of required branches.
Throw a std::runtime_error if not
Definition at line 75 of file RootFileInfo.cc.
| const FileMetaData & getFileMetaData | ( | ) | 
Return the event metadata from the file.
On the first call it will be read from the persistent tree. If this fails a std::runtime_error is thrown.
Definition at line 41 of file RootFileInfo.cc.