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

#include <G4Hdf5NtupleFileManager.hh>

+ Inheritance diagram for G4Hdf5NtupleFileManager:

Public Member Functions

 G4Hdf5NtupleFileManager (const G4AnalysisManagerState &state)
 
 ~G4Hdf5NtupleFileManager ()
 
virtual std::shared_ptr< G4VNtupleManagerCreateNtupleManager () override
 
virtual G4bool ActionAtOpenFile (const G4String &fileName) override
 
virtual G4bool ActionAtWrite () override
 
virtual G4bool ActionAtCloseFile (G4bool reset) override
 
virtual G4bool Reset () override
 
void SetFileManager (std::shared_ptr< G4Hdf5FileManager > fileManager)
 
std::shared_ptr< G4Hdf5NtupleManagerGetNtupleManager () const
 
- Public Member Functions inherited from G4VNtupleFileManager
 G4VNtupleFileManager (const G4AnalysisManagerState &state, const G4String &fileType)
 
virtual ~G4VNtupleFileManager ()
 
 G4VNtupleFileManager (const G4VNtupleFileManager &rhs)=delete
 
G4VNtupleFileManageroperator= (const G4VNtupleFileManager &rhs)=delete
 
virtual void SetNtupleMerging (G4bool mergeNtuples, G4int nofReducedNtupleFiles=0)
 
virtual void SetNtupleRowWise (G4bool rowWise, G4bool rowMode=true)
 
virtual void SetBasketSize (unsigned int basketSize)
 
virtual void SetBasketEntries (unsigned int basketEntries)
 
virtual std::shared_ptr< G4VNtupleManagerCreateNtupleManager ()=0
 
virtual void SetBookingManager (std::shared_ptr< G4NtupleBookingManager > bookingManager)
 
virtual G4bool ActionAtOpenFile (const G4String &)=0
 
virtual G4bool ActionAtWrite ()=0
 
virtual G4bool ActionAtCloseFile (G4bool)=0
 
virtual G4bool Reset ()=0
 
virtual G4bool IsNtupleMergingSupported () const
 
G4String GetFileType () const
 

Friends

class G4Hdf5AnalysisManager
 

Additional Inherited Members

- Protected Attributes inherited from G4VNtupleFileManager
const G4AnalysisManagerStatefState
 
G4String fFileType
 
std::shared_ptr< G4NtupleBookingManagerfBookingManager
 

Detailed Description

Definition at line 42 of file G4Hdf5NtupleFileManager.hh.

Constructor & Destructor Documentation

◆ G4Hdf5NtupleFileManager()

G4Hdf5NtupleFileManager::G4Hdf5NtupleFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 46 of file G4Hdf5NtupleFileManager.cc.

47 : G4VNtupleFileManager(state, "hdf5"),
48 fFileManager(nullptr),
49 fNtupleManager(nullptr)
50{}

◆ ~G4Hdf5NtupleFileManager()

G4Hdf5NtupleFileManager::~G4Hdf5NtupleFileManager ( )

Definition at line 53 of file G4Hdf5NtupleFileManager.cc.

54{}

Member Function Documentation

◆ ActionAtCloseFile()

G4bool G4Hdf5NtupleFileManager::ActionAtCloseFile ( G4bool  reset)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 123 of file G4Hdf5NtupleFileManager.cc.

124{
125 auto finalResult = true;
126
127 // Close ntuple files
128 auto result = CloseNtupleFiles();
129 finalResult = finalResult && result;
130
131 if ( ! reset ) {
132 // The ntuples must be always reset when closing file)
133 result = Reset();
134 if ( ! result ) {
135 G4ExceptionDescription description;
136 description << " " << "Resetting data failed";
137 G4Exception("G4Hdf5NtupleFileManager::CloseFile()",
138 "Analysis_W021", JustWarning, description);
139 }
140 finalResult = finalResult && result;
141 }
142
143 return finalResult;
144}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
virtual G4bool Reset() override

◆ ActionAtOpenFile()

G4bool G4Hdf5NtupleFileManager::ActionAtOpenFile ( const G4String fileName)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 91 of file G4Hdf5NtupleFileManager.cc.

92{
93 // Create ntuples if they are booked
94 // (The files will be created with creating ntuples)
95 fNtupleManager->CreateNtuplesFromBooking(
96 fBookingManager->GetNtupleBookingVector());
97
98 return true;
99}
std::shared_ptr< G4NtupleBookingManager > fBookingManager

◆ ActionAtWrite()

G4bool G4Hdf5NtupleFileManager::ActionAtWrite ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 102 of file G4Hdf5NtupleFileManager.cc.

103{
104 // notify that ntuple file is not empty
105
106 auto finalResult = true;
107
108 // Notify that ntuple files are not empty
109 auto ntupleVector
110 = fNtupleManager->GetNtupleDescriptionVector();
111
112 for ( auto ntupleDescription : ntupleVector) {
113 if (ntupleDescription->fFile) {
114 auto result = fFileManager->SetIsEmpty(ntupleDescription->fFileName, false);
115 finalResult = finalResult && result;
116 }
117 }
118
119 return finalResult;
120}

◆ CreateNtupleManager()

std::shared_ptr< G4VNtupleManager > G4Hdf5NtupleFileManager::CreateNtupleManager ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 80 of file G4Hdf5NtupleFileManager.cc.

81{
82
83 // The managers will be deleted by the base class
84 fNtupleManager = std::make_shared<G4Hdf5NtupleManager>(fState);
85 fNtupleManager->SetFileManager(fFileManager);
86
87 return fNtupleManager;
88}
const G4AnalysisManagerState & fState

◆ GetNtupleManager()

std::shared_ptr< G4Hdf5NtupleManager > G4Hdf5NtupleFileManager::GetNtupleManager ( ) const
inline

Definition at line 75 of file G4Hdf5NtupleFileManager.hh.

76{ return fNtupleManager; }

◆ Reset()

G4bool G4Hdf5NtupleFileManager::Reset ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 147 of file G4Hdf5NtupleFileManager.cc.

148{
149 return fNtupleManager->Reset(true);
150}

Referenced by ActionAtCloseFile().

◆ SetFileManager()

void G4Hdf5NtupleFileManager::SetFileManager ( std::shared_ptr< G4Hdf5FileManager fileManager)
inline

Definition at line 71 of file G4Hdf5NtupleFileManager.hh.

73{ fFileManager = fileManager; }

Friends And Related Function Documentation

◆ G4Hdf5AnalysisManager

friend class G4Hdf5AnalysisManager
friend

Definition at line 44 of file G4Hdf5NtupleFileManager.hh.


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