Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
G4VRFileManager Class Referenceabstract

#include <G4VRFileManager.hh>

Inheritance diagram for G4VRFileManager:
G4BaseFileManager G4CsvRFileManager G4Hdf5RFileManager G4RootRFileManager G4XmlRFileManager

Public Member Functions

void AddFileName (const G4String &fileName)
 
virtual void CloseFiles ()=0
 
 G4VRFileManager ()=delete
 
 G4VRFileManager (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
 
template<typename HT >
std::shared_ptr< G4VTHnRFileManager< HT > > GetHnRFileManager () const
 
G4String GetNtupleFileName (const G4String &ntupleName) const
 
G4String GetNtupleFileName (G4int ntupleFileNumber) const
 
G4String GetPlotFileName () const
 
virtual G4bool SetFileName (const G4String &fileName)
 
virtual ~G4VRFileManager ()=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
 
std::shared_ptr< G4VTHnRFileManager< tools::histo::h1d > > fH1RFileManager { nullptr }
 
std::shared_ptr< G4VTHnRFileManager< tools::histo::h2d > > fH2RFileManager { nullptr }
 
std::shared_ptr< G4VTHnRFileManager< tools::histo::h3d > > fH3RFileManager { nullptr }
 
std::shared_ptr< G4VTHnRFileManager< tools::histo::p1d > > fP1RFileManager { nullptr }
 
std::shared_ptr< G4VTHnRFileManager< tools::histo::p2d > > fP2RFileManager { nullptr }
 
const G4AnalysisManagerStatefState
 

Static Protected Attributes

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

Detailed Description

Definition at line 50 of file G4VRFileManager.hh.

Constructor & Destructor Documentation

◆ G4VRFileManager() [1/2]

G4VRFileManager::G4VRFileManager ( const G4AnalysisManagerState state)
inlineexplicit

Definition at line 53 of file G4VRFileManager.hh.

54 : G4BaseFileManager(state) {}
G4BaseFileManager()=delete

◆ G4VRFileManager() [2/2]

G4VRFileManager::G4VRFileManager ( )
delete

◆ ~G4VRFileManager()

virtual G4VRFileManager::~G4VRFileManager ( )
virtualdefault

Member Function Documentation

◆ AddFileName()

void G4BaseFileManager::AddFileName ( const G4String fileName)
inherited

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 G4BaseFileManager::fFileNames, and G4InuclParticleNames::name().

◆ CloseFiles()

virtual void G4VRFileManager::CloseFiles ( )
pure virtual

◆ GetFileName()

G4String G4BaseFileManager::GetFileName ( ) const
inlineinherited

Definition at line 105 of file G4BaseFileManager.hh.

105 {
106 return fFileName;
107}

References G4BaseFileManager::fFileName.

◆ GetFileNames()

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

Definition at line 109 of file G4BaseFileManager.hh.

109 {
110 return fFileNames;
111}

References G4BaseFileManager::fFileNames.

Referenced by G4GenericFileManager::OpenFiles().

◆ GetFileType()

G4String G4BaseFileManager::GetFileType ( ) const
virtualinherited

◆ GetFullFileName()

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

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 G4BaseFileManager::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
inherited

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 G4BaseFileManager::fFileName, G4BaseFileManager::GetFileType(), and G4Analysis::GetHnFileName().

◆ GetHnRFileManager()

template<typename HT >
std::shared_ptr< G4VTHnRFileManager< HT > > G4VRFileManager::GetHnRFileManager ( ) const

◆ GetNtupleFileName() [1/2]

G4String G4BaseFileManager::GetNtupleFileName ( const G4String ntupleName) const
inherited

Definition at line 98 of file G4BaseFileManager.cc.

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

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

◆ GetNtupleFileName() [2/2]

G4String G4BaseFileManager::GetNtupleFileName ( G4int  ntupleFileNumber) const
inherited

◆ GetPlotFileName()

G4String G4BaseFileManager::GetPlotFileName ( ) const
inherited

Definition at line 110 of file G4BaseFileManager.cc.

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

References G4BaseFileManager::fFileName, and G4Analysis::GetPlotFileName().

◆ Message()

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

◆ SetFileName()

G4bool G4BaseFileManager::SetFileName ( const G4String fileName)
inlinevirtualinherited

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 G4BaseFileManager::fFileName.

Referenced by G4VFileManager::SetFileName().

Field Documentation

◆ fFileName

G4String G4BaseFileManager::fFileName
protectedinherited

◆ fFileNames

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

◆ fH1RFileManager

std::shared_ptr<G4VTHnRFileManager<tools::histo::h1d> > G4VRFileManager::fH1RFileManager { nullptr }
protected

◆ fH2RFileManager

std::shared_ptr<G4VTHnRFileManager<tools::histo::h2d> > G4VRFileManager::fH2RFileManager { nullptr }
protected

◆ fH3RFileManager

std::shared_ptr<G4VTHnRFileManager<tools::histo::h3d> > G4VRFileManager::fH3RFileManager { nullptr }
protected

◆ fkClass

constexpr std::string_view G4VRFileManager::fkClass { "G4VRFileManager" }
staticconstexprprotected

Definition at line 67 of file G4VRFileManager.hh.

◆ fP1RFileManager

std::shared_ptr<G4VTHnRFileManager<tools::histo::p1d> > G4VRFileManager::fP1RFileManager { nullptr }
protected

◆ fP2RFileManager

std::shared_ptr<G4VTHnRFileManager<tools::histo::p2d> > G4VRFileManager::fP2RFileManager { nullptr }
protected

◆ fState

const G4AnalysisManagerState& G4BaseFileManager::fState
protectedinherited

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