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

#include <G4BaseFileManager.hh>

+ Inheritance diagram for G4BaseFileManager:

Public Member Functions

 G4BaseFileManager (const G4AnalysisManagerState &state)
 
virtual ~G4BaseFileManager ()
 
virtual G4bool SetFileName (const G4String &fileName)
 
virtual G4String GetFileType () const
 
void AddFileName (const G4String &fileName)
 
G4String GetFileName () const
 
G4String GetFullFileName (const G4String &baseFileName="", G4bool isPerThread=true) const
 
const std::vector< G4String > & GetFileNames () const
 
G4String GetHnFileName (const G4String &hnType, const G4String &hnName) const
 
G4String GetNtupleFileName (const G4String &ntupleName) const
 
G4String GetNtupleFileName (G4int ntupleFileNumber) const
 
G4String GetPlotFileName () const
 

Protected Attributes

const G4AnalysisManagerStatefState
 
G4String fFileName
 
std::vector< G4StringfFileNames
 

Detailed Description

Definition at line 39 of file G4BaseFileManager.hh.

Constructor & Destructor Documentation

◆ G4BaseFileManager()

G4BaseFileManager::G4BaseFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 35 of file G4BaseFileManager.cc.

36 : fState(state),
37 fFileName(""),
39{
40}
std::vector< G4String > fFileNames
const G4AnalysisManagerState & fState

◆ ~G4BaseFileManager()

G4BaseFileManager::~G4BaseFileManager ( )
virtual

Definition at line 43 of file G4BaseFileManager.cc.

44{
45}

Member Function Documentation

◆ AddFileName()

void G4BaseFileManager::AddFileName ( const G4String fileName)

Definition at line 52 of file G4BaseFileManager.cc.

53{
54 // G4cout << "registering " << fileName << " in manager of " << GetFileType() << G4endl;
55
56 // Do nothing in file name is already present
57 for ( auto name : fFileNames ) {
58 if ( name == fileName ) return;
59 }
60
61 fFileNames.push_back(fileName);
62}

◆ GetFileName()

G4String G4BaseFileManager::GetFileName ( ) const
inline

Definition at line 97 of file G4BaseFileManager.hh.

97 {
98 return fFileName;
99}

◆ GetFileNames()

const std::vector< G4String > & G4BaseFileManager::GetFileNames ( ) const
inline

Definition at line 101 of file G4BaseFileManager.hh.

101 {
102 return fFileNames;
103}

Referenced by G4GenericFileManager::OpenFiles().

◆ GetFileType()

G4String G4BaseFileManager::GetFileType ( ) const
virtual

◆ GetFullFileName()

G4String G4BaseFileManager::GetFullFileName ( const G4String baseFileName = "",
G4bool  isPerThread = true 
) const

Definition at line 73 of file G4BaseFileManager.cc.

75{
76 G4String fileName(baseFileName);
77 if ( fileName == "" ) fileName = fFileName;
78
79 // Take out file extension
80 auto name = G4Analysis::GetBaseName(fileName);
81
82 // Add thread Id to a file name if MT processing
83 if ( isPerThread && ! fState.GetIsMaster() ) {
84 std::ostringstream os;
86 name.append("_t");
87 name.append(os.str());
88 }
89
90 // Add (back if it was present or is defined) file extension
91 auto extension = G4Analysis::GetExtension(fileName, GetFileType());
92 if ( extension.size() ) {
93 name.append(".");
94 name.append(extension);
95 }
96
97 return name;
98}
virtual G4String GetFileType() const
G4String GetExtension(const G4String &fileName, const G4String &defaultExtension="")
G4String GetBaseName(const G4String &fileName)
const char * name(G4int ptype)
G4int G4GetThreadId()
Definition: G4Threading.cc:122

Referenced by G4XmlRFileManager::GetRFile(), G4Hdf5RFileManager::GetRFile(), G4RootRFileManager::GetRFile(), G4Hdf5FileManager::OpenFile(), G4RootFileManager::OpenFile(), G4XmlFileManager::OpenFile(), G4XmlRFileManager::OpenRFile(), G4RootRFileManager::OpenRFile(), and G4Hdf5AnalysisReader::ReadNtupleImpl().

◆ GetHnFileName()

G4String G4BaseFileManager::GetHnFileName ( const G4String hnType,
const G4String hnName 
) const

Definition at line 101 of file G4BaseFileManager.cc.

103{
104 return G4Analysis::GetHnFileName(fFileName, GetFileType(), hnType, hnName);
105}
G4String GetHnFileName(const G4String &fileName, const G4String &fileType, const G4String &hnType, const G4String &hnName)

◆ GetNtupleFileName() [1/2]

G4String G4BaseFileManager::GetNtupleFileName ( const G4String ntupleName) const

Definition at line 108 of file G4BaseFileManager.cc.

109{
111}
G4String GetNtupleFileName(const G4String &fileName, const G4String &fileType, const G4String &ntupleName)

Referenced by G4CsvAnalysisReader::ReadNtupleImpl(), and G4XmlAnalysisReader::ReadNtupleImpl().

◆ GetNtupleFileName() [2/2]

G4String G4BaseFileManager::GetNtupleFileName ( G4int  ntupleFileNumber) const

Definition at line 114 of file G4BaseFileManager.cc.

115{
116 return G4Analysis::GetNtupleFileName(fFileName, GetFileType(), ntupleFileNumber);
117}

◆ GetPlotFileName()

G4String G4BaseFileManager::GetPlotFileName ( ) const

Definition at line 120 of file G4BaseFileManager.cc.

121{
123}
G4String GetPlotFileName(const G4String &fileName)

◆ SetFileName()

G4bool G4BaseFileManager::SetFileName ( const G4String fileName)
inlinevirtual

Reimplemented in G4VFileManager.

Definition at line 91 of file G4BaseFileManager.hh.

91 {
92 // CHECK if still needed in this base class
93 fFileName = fileName;
94 return true;
95}

Referenced by G4VFileManager::SetFileName().

Member Data Documentation

◆ fFileName

◆ fFileNames

std::vector<G4String> G4BaseFileManager::fFileNames
protected

Definition at line 88 of file G4BaseFileManager.hh.

Referenced by AddFileName(), and GetFileNames().

◆ fState


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