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

#include <G4XmlNtupleFileManager.hh>

+ Inheritance diagram for G4XmlNtupleFileManager:

Public Member Functions

 G4XmlNtupleFileManager (const G4AnalysisManagerState &state)
 
 ~G4XmlNtupleFileManager ()
 
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< G4XmlFileManager > fileManager)
 
std::shared_ptr< G4XmlNtupleManagerGetNtupleManager () 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
 

Additional Inherited Members

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

Detailed Description

Definition at line 44 of file G4XmlNtupleFileManager.hh.

Constructor & Destructor Documentation

◆ G4XmlNtupleFileManager()

G4XmlNtupleFileManager::G4XmlNtupleFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 40 of file G4XmlNtupleFileManager.cc.

41 : G4VNtupleFileManager(state, "csv"),
42 fFileManager(nullptr),
43 fNtupleManager(nullptr)
44{}

◆ ~G4XmlNtupleFileManager()

G4XmlNtupleFileManager::~G4XmlNtupleFileManager ( )

Definition at line 47 of file G4XmlNtupleFileManager.cc.

48{}

Member Function Documentation

◆ ActionAtCloseFile()

G4bool G4XmlNtupleFileManager::ActionAtCloseFile ( G4bool  reset)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 106 of file G4XmlNtupleFileManager.cc.

107{
108 auto finalResult = true;
109
110 // Close ntuple files
111 auto result = CloseNtupleFiles();
112 finalResult = finalResult && result;
113
114 // Reset data
115 if ( ! reset ) {
116 result = Reset();
117 if ( ! result ) {
118 G4ExceptionDescription description;
119 description << " " << "Resetting data failed";
120 G4Exception("G4XmlNtupleFileManager::CloseFile()",
121 "Analysis_W021", JustWarning, description);
122 }
123 finalResult = finalResult && result;
124 }
125
126 return finalResult;
127}
@ 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 G4XmlNtupleFileManager::ActionAtOpenFile ( const G4String fileName)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 83 of file G4XmlNtupleFileManager.cc.

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

◆ ActionAtWrite()

G4bool G4XmlNtupleFileManager::ActionAtWrite ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 94 of file G4XmlNtupleFileManager.cc.

95{
96 auto ntupleVector = fNtupleManager->GetNtupleDescriptionVector();
97
98 for ( auto ntuple : ntupleVector ) {
99 if ( ntuple->fNtuple ) ntuple->fNtuple->write_trailer();
100 }
101
102 return true;
103}

◆ CreateNtupleManager()

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

Implements G4VNtupleFileManager.

Definition at line 74 of file G4XmlNtupleFileManager.cc.

75{
76 fNtupleManager = std::make_shared<G4XmlNtupleManager>(fState);
77 fNtupleManager->SetFileManager(fFileManager);
78
79 return fNtupleManager;
80}
const G4AnalysisManagerState & fState

◆ GetNtupleManager()

std::shared_ptr< G4XmlNtupleManager > G4XmlNtupleFileManager::GetNtupleManager ( ) const
inline

Definition at line 77 of file G4XmlNtupleFileManager.hh.

78{ return fNtupleManager; }

◆ Reset()

G4bool G4XmlNtupleFileManager::Reset ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 130 of file G4XmlNtupleFileManager.cc.

131{
132// Reset histograms and ntuple
133
134 return fNtupleManager->Reset(true);
135}

Referenced by ActionAtCloseFile().

◆ SetFileManager()

void G4XmlNtupleFileManager::SetFileManager ( std::shared_ptr< G4XmlFileManager fileManager)
inline

Definition at line 73 of file G4XmlNtupleFileManager.hh.

75{ fFileManager = fileManager; }

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