Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Hdf5RFileManager Class Reference

#include <G4Hdf5RFileManager.hh>

+ Inheritance diagram for G4Hdf5RFileManager:

Public Member Functions

 G4Hdf5RFileManager (const G4AnalysisManagerState &state)
 
 G4Hdf5RFileManager ()=delete
 
 ~G4Hdf5RFileManager () override=default
 
G4String GetFileType () const final
 
void CloseFiles () final
 
G4Hdf5FileGetRFile (const G4String &fileName, G4bool isPerThread)
 
hid_t GetHistoRDirectory (const G4String &fileName, const G4String &dirName, G4bool isPerThread)
 
hid_t GetNtupleRDirectory (const G4String &fileName, const G4String &dirName, G4bool isPerThread)
 
- Public Member Functions inherited from G4VRFileManager
 G4VRFileManager (const G4AnalysisManagerState &state)
 
 G4VRFileManager ()=delete
 
 ~G4VRFileManager () override=default
 
virtual void CloseFiles ()=0
 
template<typename HT >
std::shared_ptr< G4VTHnRFileManager< HT > > GetHnRFileManager () const
 
- Public Member Functions inherited from G4BaseFileManager
 G4BaseFileManager (const G4AnalysisManagerState &state)
 
 G4BaseFileManager ()=delete
 
virtual ~G4BaseFileManager ()=default
 
virtual G4bool SetFileName (const G4String &fileName)
 
virtual G4String GetFileType () const
 
virtual G4bool HasCycles () const
 
void AddFileName (const G4String &fileName)
 
G4String GetFileName () const
 
G4String GetFullFileName (const G4String &baseFileName="", G4bool isPerThread=true) const
 
const std::vector< G4String > & GetFileNames () const
 
G4String GetHnFileName (const G4String &hnType, const G4String &hnName) const
 
G4String GetHnFileName (const G4String &fileName, G4int cycle=0) const
 
G4String GetNtupleFileName (const G4String &ntupleName, G4int cycle=0) const
 
G4String GetNtupleFileName (G4int ntupleFileNumber, G4int cycle=0) const
 
G4String GetPlotFileName () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4BaseFileManager
void Message (G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
 
- Protected Attributes inherited from G4VRFileManager
std::shared_ptr< G4VTHnRFileManager< tools::histo::h1d > > fH1RFileManager { nullptr }
 
std::shared_ptr< G4VTHnRFileManager< tools::histo::h2d > > fH2RFileManager { nullptr }
 
std::shared_ptr< G4VTHnRFileManager< tools::histo::h3d > > fH3RFileManager { nullptr }
 
std::shared_ptr< G4VTHnRFileManager< tools::histo::p1d > > fP1RFileManager { nullptr }
 
std::shared_ptr< G4VTHnRFileManager< tools::histo::p2d > > fP2RFileManager { nullptr }
 
- Protected Attributes inherited from G4BaseFileManager
const G4AnalysisManagerStatefState
 
G4String fFileName
 
std::vector< G4StringfFileNames
 
- Static Protected Attributes inherited from G4VRFileManager
static constexpr std::string_view fkClass { "G4VRFileManager" }
 

Detailed Description

Definition at line 45 of file G4Hdf5RFileManager.hh.

Constructor & Destructor Documentation

◆ G4Hdf5RFileManager() [1/2]

G4Hdf5RFileManager::G4Hdf5RFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 42 of file G4Hdf5RFileManager.cc.

43 : G4VRFileManager(state)
44{
45 // Create helpers defined in the base class
46 fH1RFileManager = std::make_shared<G4Hdf5HnRFileManager<histo::h1d>>(this);
47 fH2RFileManager = std::make_shared<G4Hdf5HnRFileManager<histo::h2d>>(this);
48 fH3RFileManager = std::make_shared<G4Hdf5HnRFileManager<histo::h3d>>(this);
49 fP1RFileManager = std::make_shared<G4Hdf5HnRFileManager<histo::p1d>>(this);
50 fP2RFileManager = std::make_shared<G4Hdf5HnRFileManager<histo::p2d>>(this);
51}
std::shared_ptr< G4VTHnRFileManager< tools::histo::h2d > > fH2RFileManager
std::shared_ptr< G4VTHnRFileManager< tools::histo::p2d > > fP2RFileManager
std::shared_ptr< G4VTHnRFileManager< tools::histo::h3d > > fH3RFileManager
G4VRFileManager()=delete
std::shared_ptr< G4VTHnRFileManager< tools::histo::p1d > > fP1RFileManager
std::shared_ptr< G4VTHnRFileManager< tools::histo::h1d > > fH1RFileManager

◆ G4Hdf5RFileManager() [2/2]

G4Hdf5RFileManager::G4Hdf5RFileManager ( )
delete

◆ ~G4Hdf5RFileManager()

G4Hdf5RFileManager::~G4Hdf5RFileManager ( )
overridedefault

Member Function Documentation

◆ CloseFiles()

void G4Hdf5RFileManager::CloseFiles ( )
finalvirtual

Implements G4VRFileManager.

Definition at line 180 of file G4Hdf5RFileManager.cc.

181{
182 // Close all open directories and file
183 for ( auto [key, rfile] : fRFiles ) {
184 if (std::get<1>(rfile) != kInvalidId) {
185 ::H5Gclose(std::get<1>(rfile));
186 }
187 if (std::get<2>(rfile) != kInvalidId) {
188 ::H5Gclose(std::get<2>(rfile));
189 }
190 if (std::get<0>(rfile) != kInvalidId) {
191 ::H5Fclose(std::get<0>(rfile));
192 }
193 }
194}
constexpr G4int kInvalidId

◆ GetFileType()

G4String G4Hdf5RFileManager::GetFileType ( ) const
inlinefinalvirtual

Reimplemented from G4BaseFileManager.

Definition at line 52 of file G4Hdf5RFileManager.hh.

52{ return "hdf5"; }

◆ GetHistoRDirectory()

hid_t G4Hdf5RFileManager::GetHistoRDirectory ( const G4String fileName,
const G4String dirName,
G4bool  isPerThread 
)

Definition at line 166 of file G4Hdf5RFileManager.cc.

168{
169 return GetRDirectory("histograms", fileName, dirName, isPerThread);
170}

◆ GetNtupleRDirectory()

hid_t G4Hdf5RFileManager::GetNtupleRDirectory ( const G4String fileName,
const G4String dirName,
G4bool  isPerThread 
)

Definition at line 173 of file G4Hdf5RFileManager.cc.

175{
176 return GetRDirectory("ntuples", fileName, dirName, isPerThread);
177}

◆ GetRFile()

G4Hdf5File * G4Hdf5RFileManager::GetRFile ( const G4String fileName,
G4bool  isPerThread 
)

Definition at line 152 of file G4Hdf5RFileManager.cc.

154{
155 // Get full file name
156 G4String name = GetFullFileName(fileName, isPerThread);
157
158 auto it = fRFiles.find(name);
159 if (it != fRFiles.end()) {
160 return &(it->second);
161 }
162 return nullptr;
163}
G4String GetFullFileName(const G4String &baseFileName="", G4bool isPerThread=true) const
const char * name(G4int ptype)

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