33 #include "tools/wroot/file"
39 using namespace G4Analysis;
45 fHistoDirectory(nullptr),
46 fNtupleDirectory(nullptr),
49 fMainNtupleDirectories(),
65 auto finalResult =
true;
79 rfile->add_ziper(
'Z', tools::compress_buffer);
82 if ( !
rfile->is_open() ) {
84 description <<
" " <<
"Cannot open file " <<
name;
93 tools::wroot::directory* directory = &
rfile->dir();
100 G4Exception(
"G4RootFileManager::OpenNtupleFiles()",
102 directory = &
fFile->dir();
129 if ( ! fIsOpenFile )
return true;
132 if ( fState.GetVerboseL4() )
133 fState.GetVerboseL4()->Message(
"write",
"file", fileName);
137 auto result = rfile->write(n);
140 if ( fState.GetVerboseL1() )
141 fState.GetVerboseL1()->Message(
"write",
"file", fileName, result);
156 if ( ! fIsOpenFile )
return true;
159 if ( fState.GetVerboseL4() )
160 fState.GetVerboseL4()->Message(
"close",
"file", fileName);
166 if ( fState.GetVerboseL1() )
167 fState.GetVerboseL1()->Message(
"close",
"file", fileName,
true);
188 fFile->add_ziper(
'Z',tools::compress_buffer);
191 if ( !
fFile->is_open() ) {
194 description <<
" " <<
"Cannot open file " << fileName;
219 auto finalResult =
true;
222 finalResult = finalResult && result;
227 finalResult = finalResult && result;
235 auto finalResult =
true;
238 finalResult = finalResult && result;
243 finalResult = finalResult && result;
272 G4Exception(
"G4RootFileManager::CreateHistoDirectory()",
306 G4Exception(
"G4RootFileManager::CreateNtupleDirectory()",
321 std::shared_ptr<tools::wroot::file>
327 G4String inFunction =
"G4RootFileManager::GetNtupleFile()";
329 description <<
" " <<
"ntuple file " << index <<
" does not exist.";
338 tools::wroot::directory*
344 G4String inFunction =
"G4RootFileManager::GetMainNtupleDirectory()";
346 description <<
" " <<
"main ntuple directory " << index <<
" does not exist.";