 |
Belle II Software
release-05-01-25
|
13 #include <framework/utilities/RootFileCreationManager.h>
14 #include <framework/logging/Logger.h>
15 #include <framework/core/MetadataService.h>
20 void TFile_Deleter(TFile* file)
22 B2DEBUG(30,
"Closing ROOT file");
38 std::shared_ptr<TFile> ptr =
m_files[fileName].lock();
43 TDirectory::TContext gDirectoryGuard;
45 ptr = std::shared_ptr<TFile>(TFile::Open(fileName.c_str(),
"RECREATE"), TFile_Deleter);
47 if (!ptr || !ptr->IsOpen()) {
48 if (!ignoreErrors) B2ERROR(
"Could not create file " << std::quoted(fileName));
std::map< std::string, std::weak_ptr< TFile > > m_files
store for the open files
This single instance class takes track of all open ROOT files open in "create" mode,...
Abstract base class for different kinds of events.
static RootFileCreationManager & getInstance()
Interface for the FileManager.
std::shared_ptr< TFile > getFile(std::string, bool ignoreErrors=false)
Get a file with a specific name, if is does not exist it will be created.