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

#include <G4CsvNtupleFileManager.hh>

Inheritance diagram for G4CsvNtupleFileManager:
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
 
 G4CsvNtupleFileManager ()=delete
 
 G4CsvNtupleFileManager (const G4AnalysisManagerState &state)
 
G4String GetFileType () const
 
std::shared_ptr< G4CsvNtupleManagerGetNtupleManager () 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< G4CsvFileManager > fileManager)
 
virtual void SetNtupleMerging (G4bool mergeNtuples, G4int nofReducedNtupleFiles=0)
 
virtual void SetNtupleRowWise (G4bool rowWise, G4bool rowMode=true)
 
virtual ~G4CsvNtupleFileManager ()=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< G4CsvFileManagerfFileManager { nullptr }
 
std::shared_ptr< G4CsvNtupleManagerfNtupleManager { nullptr }
 

Static Private Attributes

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

Friends

class G4CsvAnalysisManager
 

Detailed Description

Definition at line 44 of file G4CsvNtupleFileManager.hh.

Constructor & Destructor Documentation

◆ G4CsvNtupleFileManager() [1/2]

G4CsvNtupleFileManager::G4CsvNtupleFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 38 of file G4CsvNtupleFileManager.cc.

39 : G4VNtupleFileManager(state, "csv")
40{}
G4VNtupleFileManager()=delete

◆ G4CsvNtupleFileManager() [2/2]

G4CsvNtupleFileManager::G4CsvNtupleFileManager ( )
delete

◆ ~G4CsvNtupleFileManager()

virtual G4CsvNtupleFileManager::~G4CsvNtupleFileManager ( )
virtualdefault

Member Function Documentation

◆ ActionAtCloseFile()

G4bool G4CsvNtupleFileManager::ActionAtCloseFile ( G4bool  reset)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 95 of file G4CsvNtupleFileManager.cc.

96{
97 auto result = true;
98
99 // close ntuple files
100 result &= CloseNtupleFiles();
101
102 if ( ! reset ) {
103 // The ntuples must be always reset when closing file)
104 result = Reset();
105 if ( ! result ) {
106 Warn("Resetting data failed", fkClass, "ActionAtCloseFile");
107 }
108 }
109
110 return result;
111}
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 G4CsvNtupleFileManager::ActionAtOpenFile ( const G4String fileName)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 76 of file G4CsvNtupleFileManager.cc.

77{
78 // G4cout << "G4CsvNtupleFileManager::ActionAtOpenFile" << G4endl;
79
80 // Create ntuples if they are booked
81 // (The files will be created with creating ntuples)
82 fNtupleManager->CreateNtuplesFromBooking(
83 fBookingManager->GetNtupleBookingVector());
84
85 return true;
86}
std::shared_ptr< G4CsvNtupleManager > fNtupleManager
std::shared_ptr< G4NtupleBookingManager > fBookingManager

References G4VNtupleFileManager::fBookingManager, and fNtupleManager.

◆ ActionAtWrite()

G4bool G4CsvNtupleFileManager::ActionAtWrite ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 89 of file G4CsvNtupleFileManager.cc.

90{
91 return true;
92}

◆ CloseNtupleFiles()

G4bool G4CsvNtupleFileManager::CloseNtupleFiles ( )
private

Definition at line 47 of file G4CsvNtupleFileManager.cc.

48{
49 // Close ntuple files
50
51 auto result = true;
52 auto ntupleVector = fNtupleManager->GetNtupleDescriptionVector();
53 for ( auto ntupleDescription : ntupleVector) {
54 result &= fFileManager->CloseNtupleFile(ntupleDescription);
55 }
56
57 return result;
58}
std::shared_ptr< G4CsvFileManager > fFileManager

References fFileManager, and fNtupleManager.

Referenced by ActionAtCloseFile().

◆ CreateNtupleManager()

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

Implements G4VNtupleFileManager.

Definition at line 65 of file G4CsvNtupleFileManager.cc.

66{
67 // G4cout << "G4CsvNtupleFileManager::CreateNtupleManager" << G4endl;
68
69 fNtupleManager = std::make_shared<G4CsvNtupleManager>(fState);
70 fNtupleManager->SetFileManager(fFileManager);
71
72 return fNtupleManager;
73}
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< G4CsvNtupleManager > G4CsvNtupleFileManager::GetNtupleManager ( ) const
inline

Definition at line 83 of file G4CsvNtupleFileManager.hh.

84{ 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 G4CsvNtupleFileManager::Reset ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 114 of file G4CsvNtupleFileManager.cc.

115{
116 return fNtupleManager->Reset();
117}

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 G4CsvNtupleFileManager::SetFileManager ( std::shared_ptr< G4CsvFileManager fileManager)
inline

Definition at line 79 of file G4CsvNtupleFileManager.hh.

81{ 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

◆ G4CsvAnalysisManager

friend class G4CsvAnalysisManager
friend

Definition at line 46 of file G4CsvNtupleFileManager.hh.

Field Documentation

◆ fBookingManager

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

◆ fFileManager

std::shared_ptr<G4CsvFileManager> G4CsvNtupleFileManager::fFileManager { nullptr }
private

Definition at line 73 of file G4CsvNtupleFileManager.hh.

Referenced by CloseNtupleFiles(), CreateNtupleManager(), and SetFileManager().

◆ fFileType

G4String G4VNtupleFileManager::fFileType
protectedinherited

◆ fkClass

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

Definition at line 70 of file G4CsvNtupleFileManager.hh.

Referenced by ActionAtCloseFile().

◆ fNtupleManager

std::shared_ptr<G4CsvNtupleManager> G4CsvNtupleFileManager::fNtupleManager { nullptr }
private

◆ fState

const G4AnalysisManagerState& G4VNtupleFileManager::fState
protectedinherited

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