Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes
G4BaseFileManager Class Reference

#include <G4BaseFileManager.hh>

Inheritance diagram for G4BaseFileManager:
G4VFileManager G4VRFileManager G4VTFileManager< std::ofstream > G4VTFileManager< G4Hdf5File > G4VTFileManager< G4RootFile > G4GenericFileManager G4VTFileManager< FT > G4CsvRFileManager G4Hdf5RFileManager G4RootRFileManager G4XmlRFileManager

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

G4String fFileName
 
std::vector< G4StringfFileNames
 
const G4AnalysisManagerStatefState
 

Detailed Description

Definition at line 39 of file G4BaseFileManager.hh.

Constructor & Destructor Documentation

◆ G4BaseFileManager() [1/2]

G4BaseFileManager::G4BaseFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 35 of file G4BaseFileManager.cc.

36 : fState(state)
37{}
const G4AnalysisManagerState & fState

◆ G4BaseFileManager() [2/2]

G4BaseFileManager::G4BaseFileManager ( )
delete

◆ ~G4BaseFileManager()

virtual G4BaseFileManager::~G4BaseFileManager ( )
virtualdefault

Member Function Documentation

◆ AddFileName()

void G4BaseFileManager::AddFileName ( const G4String fileName)

Definition at line 44 of file G4BaseFileManager.cc.

45{
46 // G4cout << "registering " << fileName << " in manager of " << GetFileType() << G4endl;
47
48 // Do nothing in file name is already present
49 for ( const auto& name : fFileNames ) {
50 if ( name == fileName ) return;
51 }
52
53 fFileNames.push_back(fileName);
54}
std::vector< G4String > fFileNames
const char * name(G4int ptype)

References fFileNames, and G4InuclParticleNames::name().

◆ GetFileName()

G4String G4BaseFileManager::GetFileName ( ) const
inline

Definition at line 105 of file G4BaseFileManager.hh.

105 {
106 return fFileName;
107}

References fFileName.

◆ GetFileNames()

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

Definition at line 109 of file G4BaseFileManager.hh.

109 {
110 return fFileNames;
111}

References fFileNames.

Referenced by G4GenericFileManager::OpenFiles().

◆ GetFileType()

G4String G4BaseFileManager::GetFileType ( ) const
virtual

◆ GetFullFileName()

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

Definition at line 63 of file G4BaseFileManager.cc.

65{
66 G4String fileName(baseFileName);
67 if ( fileName == "" ) fileName = fFileName;
68
69 // Take out file extension
70 auto name = G4Analysis::GetBaseName(fileName);
71
72 // Add thread Id to a file name if MT processing
73 if ( isPerThread && ! fState.GetIsMaster() ) {
74 std::ostringstream os;
76 name.append("_t");
77 name.append(os.str());
78 }
79
80 // Add (back if it was present or is defined) file extension
81 auto extension = G4Analysis::GetExtension(fileName, GetFileType());
82 if ( extension.size() ) {
83 name.append(".");
84 name.append(extension);
85 }
86
87 return name;
88}
virtual G4String GetFileType() const
G4String GetExtension(const G4String &fileName, const G4String &defaultExtension="")
G4String GetBaseName(const G4String &fileName)
G4int G4GetThreadId()
Definition: G4Threading.cc:122

References fFileName, G4Analysis::GetBaseName(), and G4InuclParticleNames::name().

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

◆ GetHnFileName()

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

Definition at line 91 of file G4BaseFileManager.cc.

93{
94 return G4Analysis::GetHnFileName(fFileName, GetFileType(), hnType, hnName);
95}
G4String GetHnFileName(const G4String &fileName, const G4String &fileType, const G4String &hnType, const G4String &hnName)

References fFileName, GetFileType(), and G4Analysis::GetHnFileName().

◆ GetNtupleFileName() [1/2]

G4String G4BaseFileManager::GetNtupleFileName ( const G4String ntupleName) const

Definition at line 98 of file G4BaseFileManager.cc.

99{
101}
G4String GetNtupleFileName(const G4String &fileName, const G4String &fileType, const G4String &ntupleName)

References fFileName, GetFileType(), and G4Analysis::GetNtupleFileName().

◆ GetNtupleFileName() [2/2]

G4String G4BaseFileManager::GetNtupleFileName ( G4int  ntupleFileNumber) const

Definition at line 104 of file G4BaseFileManager.cc.

105{
106 return G4Analysis::GetNtupleFileName(fFileName, GetFileType(), ntupleFileNumber);
107}

References fFileName, GetFileType(), and G4Analysis::GetNtupleFileName().

◆ GetPlotFileName()

G4String G4BaseFileManager::GetPlotFileName ( ) const

Definition at line 110 of file G4BaseFileManager.cc.

111{
113}
G4String GetPlotFileName(const G4String &fileName)

References fFileName, and G4Analysis::GetPlotFileName().

◆ Message()

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

◆ SetFileName()

G4bool G4BaseFileManager::SetFileName ( const G4String fileName)
inlinevirtual

Reimplemented in G4VFileManager.

Definition at line 99 of file G4BaseFileManager.hh.

99 {
100 // CHECK if still needed in this base class
101 fFileName = fileName;
102 return true;
103}

References fFileName.

Referenced by G4VFileManager::SetFileName().

Field Documentation

◆ fFileName

G4String G4BaseFileManager::fFileName
protected

◆ fFileNames

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

Definition at line 96 of file G4BaseFileManager.hh.

Referenced by AddFileName(), and GetFileNames().

◆ fState

const G4AnalysisManagerState& G4BaseFileManager::fState
protected

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