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

#include <G4CsvNtupleFileManager.hh>

+ Inheritance diagram for G4CsvNtupleFileManager:

Public Member Functions

 G4CsvNtupleFileManager (const G4AnalysisManagerState &state)
 
 ~G4CsvNtupleFileManager ()
 
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< G4CsvFileManager > fileManager)
 
std::shared_ptr< G4CsvNtupleManagerGetNtupleManager () 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 G4CsvAnalysisManager
 

Additional Inherited Members

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

Detailed Description

Definition at line 42 of file G4CsvNtupleFileManager.hh.

Constructor & Destructor Documentation

◆ G4CsvNtupleFileManager()

G4CsvNtupleFileManager::G4CsvNtupleFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 42 of file G4CsvNtupleFileManager.cc.

43 : G4VNtupleFileManager(state, "csv"),
44 fFileManager(nullptr),
45 fNtupleManager(nullptr)
46{}

◆ ~G4CsvNtupleFileManager()

G4CsvNtupleFileManager::~G4CsvNtupleFileManager ( )

Definition at line 49 of file G4CsvNtupleFileManager.cc.

50{}

Member Function Documentation

◆ ActionAtCloseFile()

G4bool G4CsvNtupleFileManager::ActionAtCloseFile ( G4bool  reset)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 106 of file G4CsvNtupleFileManager.cc.

107{
108 auto finalResult = true;
109
110 // close ntuple files
111 auto result = CloseNtupleFiles();
112 finalResult = finalResult && result;
113
114 if ( ! reset ) {
115 // The ntuples must be always reset when closing file)
116 result = Reset();
117 if ( ! result ) {
118 G4ExceptionDescription description;
119 description << " " << "Resetting data failed";
120 G4Exception("G4CsvNtupleFileManager::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 G4CsvNtupleFileManager::ActionAtOpenFile ( const G4String fileName)
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 87 of file G4CsvNtupleFileManager.cc.

88{
89 // G4cout << "G4CsvNtupleFileManager::ActionAtOpenFile" << G4endl;
90
91 // Create ntuples if they are booked
92 // (The files will be created with creating ntuples)
93 fNtupleManager->CreateNtuplesFromBooking(
94 fBookingManager->GetNtupleBookingVector());
95
96 return true;
97}
std::shared_ptr< G4NtupleBookingManager > fBookingManager

◆ ActionAtWrite()

G4bool G4CsvNtupleFileManager::ActionAtWrite ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 100 of file G4CsvNtupleFileManager.cc.

101{
102 return true;
103}

◆ CreateNtupleManager()

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

Implements G4VNtupleFileManager.

Definition at line 76 of file G4CsvNtupleFileManager.cc.

77{
78 // G4cout << "G4CsvNtupleFileManager::CreateNtupleManager" << G4endl;
79
80 fNtupleManager = std::make_shared<G4CsvNtupleManager>(fState);
81 fNtupleManager->SetFileManager(fFileManager);
82
83 return fNtupleManager;
84}
const G4AnalysisManagerState & fState

◆ GetNtupleManager()

std::shared_ptr< G4CsvNtupleManager > G4CsvNtupleFileManager::GetNtupleManager ( ) const
inline

Definition at line 77 of file G4CsvNtupleFileManager.hh.

78{ return fNtupleManager; }

◆ Reset()

G4bool G4CsvNtupleFileManager::Reset ( )
overridevirtual

Implements G4VNtupleFileManager.

Definition at line 130 of file G4CsvNtupleFileManager.cc.

131{
132 return fNtupleManager->Reset(true);
133}

Referenced by ActionAtCloseFile().

◆ SetFileManager()

void G4CsvNtupleFileManager::SetFileManager ( std::shared_ptr< G4CsvFileManager fileManager)
inline

Definition at line 73 of file G4CsvNtupleFileManager.hh.

75{ fFileManager = fileManager; }

Friends And Related Function Documentation

◆ G4CsvAnalysisManager

friend class G4CsvAnalysisManager
friend

Definition at line 44 of file G4CsvNtupleFileManager.hh.


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