33#include "tools/hdf5/h2file"
42const G4String G4Hdf5RFileManager::fgkDefaultDirectoryName =
"default";
61hid_t G4Hdf5RFileManager::OpenRFile(
const G4String& fileName,
73 hid_t newFile = H5Fopen(name, H5F_ACC_RDONLY, H5P_DEFAULT);
76 description <<
" " <<
"Cannot open file " << name;
85 std::map<G4String, hid_t>::iterator it
87 if ( it != fRFiles.end() ) {
91 fRFiles[
name] = newFile;
97 ->
Message(
"open",
"read analysis file", name);
104hid_t G4Hdf5RFileManager::OpenDirectory(hid_t file,
const G4String& directoryName)
112 auto directory = tools_H5Gopen(file, directoryName);
113 if ( directory < 0 ) {
116 <<
"cannot open directory " << directoryName;
132hid_t G4Hdf5RFileManager::GetRDirectory(
const G4String& directoryType,
138 auto rfile =
GetRFile(fileName, isPerThread);
141 if ( ! OpenRFile(fileName, isPerThread) )
return kInvalidId;
142 rfile =
GetRFile(fileName, isPerThread);
146 auto newDirName = dirName;
147 if ( newDirName ==
"" ) {
156 newDirName = fgkDefaultDirectoryName;
158 newDirName += directoryType;
162 return OpenDirectory(rfile, newDirName);
177 std::map<G4String, hid_t>::const_iterator it
178 = fRFiles.find(name);
179 if ( it != fRFiles.end() )
190 return GetRDirectory(
"histograms", fileName, dirName, isPerThread);
197 return GetRDirectory(
"ntuples", fileName, dirName, isPerThread);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL1() const
const G4AnalysisVerbose * GetVerboseL4() const
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4String GetFullFileName(const G4String &baseFileName="", G4bool isPerThread=true) const
const G4AnalysisManagerState & fState
hid_t GetRFile(const G4String &fileName, G4bool isPerThread) const
virtual ~G4Hdf5RFileManager()
hid_t GetNtupleRDirectory(const G4String &fileName, const G4String &dirName, G4bool isPerThread)
hid_t GetHistoRDirectory(const G4String &fileName, const G4String &dirName, G4bool isPerThread)
G4Hdf5RFileManager(const G4AnalysisManagerState &state)
const char * name(G4int ptype)