Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends
G4Hdf5NtupleFileManager Class Reference

#include <G4Hdf5NtupleFileManager.hh>

Inheritance diagram for G4Hdf5NtupleFileManager:
G4VNtupleFileManager

Public Member Functions

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

Protected Member Functions

void Message (G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
 

Protected Attributes

std::shared_ptr< G4NtupleBookingManagerfBookingManager { nullptr }
 
G4String fFileType
 
const G4AnalysisManagerStatefState
 

Private Member Functions

G4bool CloseNtupleFiles ()
 

Private Attributes

std::shared_ptr< G4Hdf5FileManagerfFileManager { nullptr }
 
std::shared_ptr< G4Hdf5NtupleManagerfNtupleManager { nullptr }
 

Static Private Attributes

static constexpr std::string_view fkClass { "G4Hdf5NtupleFileManager" }
 

Friends

class G4Hdf5AnalysisManager
 

Detailed Description

Definition at line 44 of file G4Hdf5NtupleFileManager.hh.

Constructor & Destructor Documentation

◆ G4Hdf5NtupleFileManager() [1/2]

G4Hdf5NtupleFileManager::G4Hdf5NtupleFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 42 of file G4Hdf5NtupleFileManager.cc.

43 : G4VNtupleFileManager(state, "hdf5")
44{}
G4VNtupleFileManager()=delete

◆ G4Hdf5NtupleFileManager() [2/2]

G4Hdf5NtupleFileManager::G4Hdf5NtupleFileManager ( )
delete

◆ ~G4Hdf5NtupleFileManager()

virtual G4Hdf5NtupleFileManager::~G4Hdf5NtupleFileManager ( )
virtualdefault

Member Function Documentation

◆ ActionAtCloseFile()

G4bool G4Hdf5NtupleFileManager::ActionAtCloseFile ( G4bool  reset)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 98 of file G4Hdf5NtupleFileManager.cc.

99{
100 auto result = true;
101
102 // Close ntuple files
103 result &= CloseNtupleFiles();
104
105 if ( ! reset ) {
106 // The ntuples must be always reset when closing file)
107 result = Reset();
108 if ( ! result ) {
109 Warn("Resetting data failed", fkClass, "ActionAtCloseFile");
110 }
111 }
112
113 return result;
114}
static constexpr std::string_view fkClass
virtual G4bool Reset() override
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)

References CloseNtupleFiles(), fkClass, Reset(), and G4Analysis::Warn().

◆ ActionAtOpenFile()

G4bool G4Hdf5NtupleFileManager::ActionAtOpenFile ( const G4String fileName)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 80 of file G4Hdf5NtupleFileManager.cc.

81{
82 // Create ntuples if they are booked
83 // (The files will be created with creating ntuples)
84 fNtupleManager->CreateNtuplesFromBooking(
85 fBookingManager->GetNtupleBookingVector());
86
87 return true;
88}
std::shared_ptr< G4Hdf5NtupleManager > fNtupleManager
std::shared_ptr< G4NtupleBookingManager > fBookingManager

References G4VNtupleFileManager::fBookingManager, and fNtupleManager.

◆ ActionAtWrite()

G4bool G4Hdf5NtupleFileManager::ActionAtWrite ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 91 of file G4Hdf5NtupleFileManager.cc.

92{
93 // Nothing to be done
94 return true;
95}

◆ CloseNtupleFiles()

G4bool G4Hdf5NtupleFileManager::CloseNtupleFiles ( )
private

Definition at line 51 of file G4Hdf5NtupleFileManager.cc.

52{
53 // Close ntuple files
54
55 auto result = true;
56 auto ntupleVector = fNtupleManager->GetNtupleDescriptionVector();
57 for ( auto ntupleDescription : ntupleVector) {
58 result &= fFileManager->CloseNtupleFile(ntupleDescription);
59 }
60
61 return result;
62}
std::shared_ptr< G4Hdf5FileManager > fFileManager

References fFileManager, and fNtupleManager.

Referenced by ActionAtCloseFile().

◆ CreateNtupleManager()

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

Implements G4VNtupleFileManager.

Definition at line 69 of file G4Hdf5NtupleFileManager.cc.

70{
71
72 // The managers will be deleted by the base class
73 fNtupleManager = std::make_shared<G4Hdf5NtupleManager>(fState);
74 fNtupleManager->SetFileManager(fFileManager);
75
76 return fNtupleManager;
77}
const G4AnalysisManagerState & fState

References fFileManager, fNtupleManager, and G4VNtupleFileManager::fState.

◆ GetFileType()

G4String G4VNtupleFileManager::GetFileType ( ) const
inlineinherited

Definition at line 107 of file G4VNtupleFileManager.hh.

107 {
108 return fFileType;
109}

References G4VNtupleFileManager::fFileType.

◆ GetNtupleManager()

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

Definition at line 81 of file G4Hdf5NtupleFileManager.hh.

82{ return fNtupleManager; }

References fNtupleManager.

◆ IsNtupleMergingSupported()

G4bool G4VNtupleFileManager::IsNtupleMergingSupported ( ) const
inlinevirtualinherited

Reimplemented in G4RootNtupleFileManager.

Definition at line 103 of file G4VNtupleFileManager.hh.

103 {
104 return false;
105}

◆ Message()

void G4VNtupleFileManager::Message ( G4int  level,
const G4String action,
const G4String objectType,
const G4String objectName = "",
G4bool  success = true 
) const
inlineprotectedinherited

◆ Reset()

G4bool G4Hdf5NtupleFileManager::Reset ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 117 of file G4Hdf5NtupleFileManager.cc.

118{
119 return fNtupleManager->Reset();
120}

References fNtupleManager.

Referenced by ActionAtCloseFile().

◆ SetBasketEntries()

void G4VNtupleFileManager::SetBasketEntries ( unsigned int  basketEntries)
virtualinherited

Reimplemented in G4RootNtupleFileManager.

Definition at line 85 of file G4VNtupleFileManager.cc.

86{
87// The function is overridden in the managers which supports ntuple merging
88// Here we give just a warning that the feature is not available.
89
90 NtupleMergingWarning(fkClass, "SetBasketEntries", fFileType);
91}
static constexpr std::string_view fkClass
void NtupleMergingWarning(std::string_view className, std::string_view functionName, const G4String &outputType)

References G4VNtupleFileManager::fFileType, G4VNtupleFileManager::fkClass, and anonymous_namespace{G4VNtupleFileManager.cc}::NtupleMergingWarning().

◆ SetBasketSize()

void G4VNtupleFileManager::SetBasketSize ( unsigned int  basketSize)
virtualinherited

Reimplemented in G4RootNtupleFileManager.

Definition at line 76 of file G4VNtupleFileManager.cc.

77{
78// The function is overridden in the managers which supports ntuple merging
79// Here we give just a warning that the feature is not available.
80
81 NtupleMergingWarning(fkClass, "SetBasketSize", fFileType);
82}

References G4VNtupleFileManager::fFileType, G4VNtupleFileManager::fkClass, and anonymous_namespace{G4VNtupleFileManager.cc}::NtupleMergingWarning().

◆ SetBookingManager()

void G4VNtupleFileManager::SetBookingManager ( std::shared_ptr< G4NtupleBookingManager bookingManager)
inlinevirtualinherited

Definition at line 99 of file G4VNtupleFileManager.hh.

101{ fBookingManager = bookingManager; }

References G4VNtupleFileManager::fBookingManager.

◆ SetFileManager()

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

Definition at line 77 of file G4Hdf5NtupleFileManager.hh.

79{ fFileManager = fileManager; }

References fFileManager.

◆ SetNtupleMerging()

void G4VNtupleFileManager::SetNtupleMerging ( G4bool  mergeNtuples,
G4int  nofReducedNtupleFiles = 0 
)
virtualinherited

Reimplemented in G4RootNtupleFileManager.

Definition at line 56 of file G4VNtupleFileManager.cc.

58{
59// The function is overridden in the managers which supports ntuple merging
60// Here we give just a warning that the feature is not available.
61
62 NtupleMergingWarning(fkClass, "SetNtupleMerging", fFileType);
63}

References G4VNtupleFileManager::fFileType, G4VNtupleFileManager::fkClass, and anonymous_namespace{G4VNtupleFileManager.cc}::NtupleMergingWarning().

◆ SetNtupleRowWise()

void G4VNtupleFileManager::SetNtupleRowWise ( G4bool  rowWise,
G4bool  rowMode = true 
)
virtualinherited

Reimplemented in G4RootNtupleFileManager.

Definition at line 66 of file G4VNtupleFileManager.cc.

68{
69// The function is overridden in the managers which supports ntuple merging
70// Here we give just a warning that the feature is not available.
71
72 NtupleMergingWarning(fkClass, "SetNtupleRowWise", fFileType);
73}

References G4VNtupleFileManager::fFileType, G4VNtupleFileManager::fkClass, and anonymous_namespace{G4VNtupleFileManager.cc}::NtupleMergingWarning().

Friends And Related Function Documentation

◆ G4Hdf5AnalysisManager

friend class G4Hdf5AnalysisManager
friend

Definition at line 46 of file G4Hdf5NtupleFileManager.hh.

Field Documentation

◆ fBookingManager

std::shared_ptr<G4NtupleBookingManager> G4VNtupleFileManager::fBookingManager { nullptr }
protectedinherited

◆ fFileManager

std::shared_ptr<G4Hdf5FileManager> G4Hdf5NtupleFileManager::fFileManager { nullptr }
private

◆ fFileType

G4String G4VNtupleFileManager::fFileType
protectedinherited

◆ fkClass

constexpr std::string_view G4Hdf5NtupleFileManager::fkClass { "G4Hdf5NtupleFileManager" }
staticconstexprprivate

Definition at line 70 of file G4Hdf5NtupleFileManager.hh.

Referenced by ActionAtCloseFile().

◆ fNtupleManager

std::shared_ptr<G4Hdf5NtupleManager> G4Hdf5NtupleFileManager::fNtupleManager { nullptr }
private

◆ fState

const G4AnalysisManagerState& G4VNtupleFileManager::fState
protectedinherited

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