Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes
G4XmlFileManager Class Reference

#include <G4XmlFileManager.hh>

Inheritance diagram for G4XmlFileManager:
G4VTFileManager< std::ofstream > G4VFileManager G4TFileManager< std::ofstream > G4BaseFileManager

Public Member Functions

void AddFileName (const G4String &fileName)
 
virtual void Clear () final
 
void ClearData ()
 
virtual G4bool CloseFile (const G4String &fileName) final
 
virtual G4bool CloseFile (const G4String &fileName)=0
 
virtual G4bool CloseFiles () final
 
G4bool CloseNtupleFile (XmlNtupleDescription *ntupleDescription)
 
G4bool CloseTFile (const G4String &fileName)
 
virtual G4bool CreateFile (const G4String &fileName) final
 
G4bool CreateNtupleFile (XmlNtupleDescription *ntupleDescription)
 
std::shared_ptr< std::ofstream > CreateTFile (const G4String &fileName)
 
virtual G4bool DeleteEmptyFiles () final
 
 G4XmlFileManager ()=delete
 
 G4XmlFileManager (const G4AnalysisManagerState &state)
 
std::shared_ptr< std::ofstream > GetFile () const
 
G4String GetFileName () const
 
const std::vector< G4String > & GetFileNames () const
 
virtual G4String GetFileType () const final
 
G4String GetFullFileName (const G4String &baseFileName="", G4bool isPerThread=true) const
 
G4String GetHistoDirectoryName () const
 
template<typename HT >
std::shared_ptr< G4VTHnFileManager< HT > > GetHnFileManager () const
 
G4String GetHnFileName (const G4String &hnType, const G4String &hnName) const
 
G4String GetNtupleDirectoryName () const
 
G4String GetNtupleFileName (const G4String &ntupleName) const
 
G4String GetNtupleFileName (G4int ntupleFileNumber) const
 
G4String GetPlotFileName () const
 
std::shared_ptr< std::ofstream > GetTFile (const G4String &fileName, G4bool warn=true) const
 
G4bool IsOpenFile () const
 
void LockDirectoryNames ()
 
virtual G4bool OpenFile (const G4String &fileName) final
 
G4bool OpenFiles ()
 
virtual G4bool SetFileName (const G4String &fileName) final
 
virtual G4bool SetHistoDirectoryName (const G4String &dirName)
 
virtual G4bool SetIsEmpty (const G4String &fileName, G4bool isEmpty) final
 
virtual G4bool SetNtupleDirectoryName (const G4String &dirName)
 
void UnlockDirectoryNames ()
 
virtual G4bool WriteFile (const G4String &fileName) final
 
virtual G4bool WriteFile (const G4String &fileName)=0
 
virtual G4bool WriteFiles () final
 
G4bool WriteTFile (const G4String &fileName)
 
virtual ~G4XmlFileManager ()=default
 

Protected Member Functions

virtual G4bool CloseFileImpl (std::shared_ptr< std::ofstream > file) final
 
virtual std::shared_ptr< std::ofstream > CreateFileImpl (const G4String &fileName) final
 
void Message (G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
 
virtual G4bool WriteFileImpl (std::shared_ptr< std::ofstream > file) final
 

Protected Attributes

std::shared_ptr< std::ofstream > fFile
 
G4String fFileName
 
std::vector< G4StringfFileNames
 
std::shared_ptr< G4VTHnFileManager< tools::histo::h1d > > fH1FileManager { nullptr }
 
std::shared_ptr< G4VTHnFileManager< tools::histo::h2d > > fH2FileManager { nullptr }
 
std::shared_ptr< G4VTHnFileManager< tools::histo::h3d > > fH3FileManager { nullptr }
 
G4String fHistoDirectoryName
 
G4bool fIsOpenFile { false }
 
G4bool fLockDirectoryNames { false }
 
G4String fNtupleDirectoryName
 
std::shared_ptr< G4VTHnFileManager< tools::histo::p1d > > fP1FileManager { nullptr }
 
std::shared_ptr< G4VTHnFileManager< tools::histo::p2d > > fP2FileManager { nullptr }
 
const G4AnalysisManagerStatefState
 

Private Member Functions

G4bool CloseTFile (std::shared_ptr< std::ofstream > file, const G4String &fileName)
 
G4bool DeleteEmptyFile (const G4String &fileName)
 
void FileNotFoundWarning (const G4String &fileName, std::string_view functionName) const
 
G4TFileInformation< std::ofstream > * GetFileInfoInFunction (const G4String &fileName, std::string_view functionName, G4bool warn=true) const
 
std::shared_ptr< std::ofstream > GetFileInFunction (const G4String &fileName, std::string_view functionName, G4bool warn=true) const
 
G4String GetNtupleFileName (XmlNtupleDescription *ntupleDescription)
 
G4bool WriteTFile (std::shared_ptr< std::ofstream > file, const G4String &fileName)
 

Private Attributes

const G4AnalysisManagerStatefAMState
 
std::map< G4String, G4TFileInformation< std::ofstream > * > fFileMap
 

Static Private Attributes

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

Detailed Description

Definition at line 50 of file G4XmlFileManager.hh.

Constructor & Destructor Documentation

◆ G4XmlFileManager() [1/2]

G4XmlFileManager::G4XmlFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 40 of file G4XmlFileManager.cc.

42{
43 // Create helpers defined in the base class
44 fH1FileManager = std::make_shared<G4XmlHnFileManager<histo::h1d>>(this);
45 fH2FileManager = std::make_shared<G4XmlHnFileManager<histo::h2d>>(this);
46 fH3FileManager = std::make_shared<G4XmlHnFileManager<histo::h3d>>(this);
47 fP1FileManager = std::make_shared<G4XmlHnFileManager<histo::p1d>>(this);
48 fP2FileManager = std::make_shared<G4XmlHnFileManager<histo::p2d>>(this);
49}
std::shared_ptr< G4VTHnFileManager< tools::histo::h3d > > fH3FileManager
std::shared_ptr< G4VTHnFileManager< tools::histo::h1d > > fH1FileManager
std::shared_ptr< G4VTHnFileManager< tools::histo::p1d > > fP1FileManager
std::shared_ptr< G4VTHnFileManager< tools::histo::p2d > > fP2FileManager
std::shared_ptr< G4VTHnFileManager< tools::histo::h2d > > fH2FileManager

References G4VFileManager::fH1FileManager, G4VFileManager::fH2FileManager, G4VFileManager::fH3FileManager, G4VFileManager::fP1FileManager, and G4VFileManager::fP2FileManager.

◆ G4XmlFileManager() [2/2]

G4XmlFileManager::G4XmlFileManager ( )
delete

◆ ~G4XmlFileManager()

virtual G4XmlFileManager::~G4XmlFileManager ( )
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().

◆ Clear()

void G4VTFileManager< std::ofstream >::Clear
inlinefinalvirtualinherited

Implements G4VFileManager.

Definition at line 65 of file G4VTFileManager.hh.

◆ ClearData()

void G4TFileManager< std::ofstream >::ClearData ( )
inherited

◆ CloseFile() [1/2]

G4bool G4VTFileManager< std::ofstream >::CloseFile ( const G4String fileName)
inlinefinalvirtualinherited

Implements G4VFileManager.

Definition at line 56 of file G4VTFileManager.hh.

96{
97 return G4TFileManager<FT>::CloseTFile(fileName);
98}
G4bool CloseTFile(const G4String &fileName)

◆ CloseFile() [2/2]

virtual G4bool G4VFileManager::CloseFile ( const G4String fileName)
virtualinherited

Implements G4VFileManager.

◆ CloseFileImpl()

G4bool G4XmlFileManager::CloseFileImpl ( std::shared_ptr< std::ofstream >  file)
finalprotectedvirtual

Implements G4TFileManager< std::ofstream >.

Definition at line 95 of file G4XmlFileManager.cc.

96{
97 if ( ! file ) return false;
98
99 // close file
100 waxml::end(*file);
101 file->close();
102
103 return true;
104}

References geant4_check_module_cycles::file.

◆ CloseFiles()

G4bool G4VTFileManager< std::ofstream >::CloseFiles
inlinefinalvirtualinherited

Implements G4VFileManager.

Definition at line 61 of file G4VTFileManager.hh.

120{
121 auto result = G4TFileManager<FT>::CloseFiles();
122
123 fIsOpenFile = false;
124 fFile.reset();
125
126 return result;
127}
G4bool CloseFiles()
std::shared_ptr< std::ofstream > fFile

◆ CloseNtupleFile()

G4bool G4XmlFileManager::CloseNtupleFile ( XmlNtupleDescription ntupleDescription)

Definition at line 168 of file G4XmlFileManager.cc.

170{
171 // Do nothing if there is no file
172 if ( ! ntupleDescription->fFile ) return true;
173
174 auto result = true;
175
176 auto ntupleFileName = GetNtupleFileName(ntupleDescription);
177
178 Message(kVL4, "close", "ntuple file", ntupleFileName);
179
180 // Close file
181 result &= CloseTFile(ntupleFileName);
182 // Notify not empty file
183 result &=SetIsEmpty(ntupleFileName, ! ntupleDescription->fHasFill);
184
185 // Reset file info in ntuple description
186 ntupleDescription->fFile.reset();
187
188 Message(kVL2, "close", "ntuple file", ntupleFileName);
189
190 return result;
191}
void Message(G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
virtual G4bool SetIsEmpty(const G4String &fileName, G4bool isEmpty) final
G4String GetNtupleFileName(XmlNtupleDescription *ntupleDescription)
constexpr G4int kVL2
constexpr G4int kVL4
std::shared_ptr< FT > fFile

References G4TFileManager< std::ofstream >::CloseTFile(), G4TNtupleDescription< NT, FT >::fFile, G4TNtupleDescription< NT, FT >::fHasFill, GetNtupleFileName(), G4Analysis::kVL2, G4Analysis::kVL4, G4BaseFileManager::Message(), and G4VTFileManager< std::ofstream >::SetIsEmpty().

◆ CloseTFile() [1/2]

G4bool G4TFileManager< std::ofstream >::CloseTFile ( const G4String fileName)
inherited

◆ CloseTFile() [2/2]

G4bool G4TFileManager< std::ofstream >::CloseTFile ( std::shared_ptr< std::ofstream >  file,
const G4String fileName 
)
privateinherited

◆ CreateFile()

G4bool G4VTFileManager< std::ofstream >::CreateFile ( const G4String fileName)
inlinefinalvirtualinherited

Implements G4VFileManager.

Definition at line 54 of file G4VTFileManager.hh.

80{
81 return (G4TFileManager<FT>::CreateTFile(fileName) != nullptr);
82}

◆ CreateFileImpl()

std::shared_ptr< std::ofstream > G4XmlFileManager::CreateFileImpl ( const G4String fileName)
finalprotectedvirtual

Implements G4TFileManager< std::ofstream >.

Definition at line 75 of file G4XmlFileManager.cc.

76{
77 std::shared_ptr<std::ofstream> file = std::make_shared<std::ofstream>(fileName);
78 if ( file->fail() ) {
79 Warn(G4String("Cannot create file ") + fileName, fkClass, "CreateFileImpl");
80 return nullptr;
81 }
82
83 waxml::begin(*file);
84 return file;
85}
static constexpr std::string_view fkClass
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)

References geant4_check_module_cycles::file, fkClass, and G4Analysis::Warn().

◆ CreateNtupleFile()

G4bool G4XmlFileManager::CreateNtupleFile ( XmlNtupleDescription ntupleDescription)

Definition at line 138 of file G4XmlFileManager.cc.

140{
141 // get ntuple file name per object (if defined)
142 auto ntupleFileName = GetNtupleFileName(ntupleDescription);
143
144 Message(kVL4, "create", "ntuple file", ntupleFileName);
145
146 // update file name if it is already in use
147 while ( GetTFile(ntupleFileName, false) ) {
148 // the file is already in use
149 auto oldName = ntupleDescription->fFileName;
150 auto newName = GetBaseName(oldName) + "_bis." + GetExtension(oldName);
151 ntupleDescription->fFileName = newName;
152
153 Warn(G4String( "Ntuple filename ") + oldName + " is already in use.\n" +
154 "It will be replaced with : " + newName,
155 fkClass, "CreateNtupleFile");
156
157 ntupleFileName = GetNtupleFileName(ntupleDescription);
158 }
159
160 ntupleDescription->fFile = CreateTFile(ntupleFileName);
161
162 Message(kVL2, "create", "ntuple file", ntupleFileName);
163
164 return (ntupleDescription->fFile != nullptr);
165}
std::shared_ptr< std::ofstream > GetTFile(const G4String &fileName, G4bool warn=true) const
std::shared_ptr< std::ofstream > CreateTFile(const G4String &fileName)
G4String GetExtension(const G4String &fileName, const G4String &defaultExtension="")
G4String GetBaseName(const G4String &fileName)

References G4TFileManager< std::ofstream >::CreateTFile(), G4TNtupleDescription< NT, FT >::fFile, G4TNtupleDescription< NT, FT >::fFileName, fkClass, G4Analysis::GetBaseName(), G4Analysis::GetExtension(), GetNtupleFileName(), G4TFileManager< std::ofstream >::GetTFile(), G4Analysis::kVL2, G4Analysis::kVL4, G4BaseFileManager::Message(), and G4Analysis::Warn().

◆ CreateTFile()

std::shared_ptr< std::ofstream > G4TFileManager< std::ofstream >::CreateTFile ( const G4String fileName)
inherited

◆ DeleteEmptyFile()

G4bool G4TFileManager< std::ofstream >::DeleteEmptyFile ( const G4String fileName)
privateinherited

◆ DeleteEmptyFiles()

G4bool G4VTFileManager< std::ofstream >::DeleteEmptyFiles
inlinefinalvirtualinherited

Implements G4VFileManager.

Definition at line 62 of file G4VTFileManager.hh.

133{
135}
G4bool DeleteEmptyFiles()

◆ FileNotFoundWarning()

void G4TFileManager< std::ofstream >::FileNotFoundWarning ( const G4String fileName,
std::string_view  functionName 
) const
privateinherited

◆ GetFile()

std::shared_ptr< std::ofstream > G4VTFileManager< std::ofstream >::GetFile
inlineinherited

Definition at line 68 of file G4VTFileManager.hh.

149{
150 return fFile;
151}

◆ GetFileInfoInFunction()

G4TFileInformation< std::ofstream > * G4TFileManager< std::ofstream >::GetFileInfoInFunction ( const G4String fileName,
std::string_view  functionName,
G4bool  warn = true 
) const
privateinherited

◆ GetFileInFunction()

std::shared_ptr< std::ofstream > G4TFileManager< std::ofstream >::GetFileInFunction ( const G4String fileName,
std::string_view  functionName,
G4bool  warn = true 
) const
privateinherited

◆ 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()

virtual G4String G4XmlFileManager::GetFileType ( ) const
inlinefinalvirtual

Reimplemented from G4BaseFileManager.

Definition at line 64 of file G4XmlFileManager.hh.

64{ return "xml"; }

Referenced by GetNtupleFileName().

◆ 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
const G4AnalysisManagerState & fState
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(), OpenFile(), G4XmlRFileManager::OpenRFile(), G4Hdf5RFileManager::OpenRFile(), and G4RootRFileManager::OpenRFile().

◆ GetHistoDirectoryName()

G4String G4VFileManager::GetHistoDirectoryName ( ) const
inlineinherited

Definition at line 120 of file G4VFileManager.hh.

121{ return fHistoDirectoryName; }
G4String fHistoDirectoryName

References G4VFileManager::fHistoDirectoryName.

Referenced by G4GenericFileManager::CreateFileManager().

◆ GetHnFileManager()

template<typename HT >
std::shared_ptr< G4VTHnFileManager< HT > > G4VFileManager::GetHnFileManager ( ) const
inherited

◆ 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().

◆ GetNtupleDirectoryName()

G4String G4VFileManager::GetNtupleDirectoryName ( ) const
inlineinherited

◆ GetNtupleFileName() [1/3]

G4String G4BaseFileManager::GetNtupleFileName ( const G4String ntupleName) const

Definition at line 71 of file G4BaseFileManager.cc.

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

◆ GetNtupleFileName() [2/3]

G4String G4BaseFileManager::GetNtupleFileName ( G4int  ntupleFileNumber) const

Definition at line 77 of file G4BaseFileManager.cc.

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

◆ GetNtupleFileName() [3/3]

G4String G4XmlFileManager::GetNtupleFileName ( XmlNtupleDescription ntupleDescription)
private

Definition at line 56 of file G4XmlFileManager.cc.

57{
58 // get ntuple file name
59 auto ntupleFileName = ntupleDescription->fFileName;
60 if ( ntupleFileName.size() ) {
61 // update filename per object per thread
62 ntupleFileName = GetTnFileName(ntupleFileName, GetFileType());
63 } else {
64 // compose ntuple file name from the default file name
65 ntupleFileName = GetNtupleFileName(ntupleDescription->fNtupleBooking.name());
66 }
67 return ntupleFileName;
68}
G4String GetTnFileName(const G4String &fileName, const G4String &fileType)
tools::ntuple_booking fNtupleBooking

References G4TNtupleDescription< NT, FT >::fFileName, G4TNtupleDescription< NT, FT >::fNtupleBooking, GetFileType(), GetNtupleFileName(), and G4Analysis::GetTnFileName().

Referenced by CloseNtupleFile(), CreateNtupleFile(), and GetNtupleFileName().

◆ 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().

◆ GetTFile()

std::shared_ptr< std::ofstream > G4TFileManager< std::ofstream >::GetTFile ( const G4String fileName,
G4bool  warn = true 
) const
inherited

◆ IsOpenFile()

G4bool G4VFileManager::IsOpenFile ( ) const
inlineinherited

Definition at line 117 of file G4VFileManager.hh.

118{ return fIsOpenFile; }

References G4VFileManager::fIsOpenFile.

◆ LockDirectoryNames()

void G4VFileManager::LockDirectoryNames ( )
inlineinherited

◆ Message()

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

◆ OpenFile()

G4bool G4XmlFileManager::OpenFile ( const G4String fileName)
finalvirtual

Implements G4VFileManager.

Definition at line 111 of file G4XmlFileManager.cc.

112{
113 // Keep and locks file name
114 fFileName = fileName;
116
117 if ( fFile ) {
118 Warn(G4String("File ") + fileName + " already exists.", fkClass, "OpenFile");
119 fFile.reset();
120 }
121
122 // Create histograms file (on master)
123 if ( fState.GetIsMaster() ) {
124 // Create file (and save in in the file map (on master only)
126 if ( ! fFile) {
127 Warn(G4String("Failed to create file") + fileName, fkClass, "OpenFile");
128 return false;
129 }
130 }
131
132 fIsOpenFile = true;
133
134 return true;
135}
G4String GetFullFileName(const G4String &baseFileName="", G4bool isPerThread=true) const

References G4TFileManager< std::ofstream >::CreateTFile(), G4VTFileManager< std::ofstream >::fFile, G4BaseFileManager::fFileName, G4VFileManager::fIsOpenFile, fkClass, G4BaseFileManager::fState, G4BaseFileManager::GetFullFileName(), G4AnalysisManagerState::GetIsMaster(), G4InuclParticleNames::name(), and G4Analysis::Warn().

◆ OpenFiles()

G4bool G4TFileManager< std::ofstream >::OpenFiles ( )
inherited

◆ SetFileName()

G4bool G4VFileManager::SetFileName ( const G4String fileName)
finalvirtualinherited

Reimplemented from G4BaseFileManager.

Definition at line 45 of file G4VFileManager.cc.

46{
47 // Check extension
48 auto name = fileName;
49 auto extension = G4Analysis::GetExtension(fileName);
50 if ( extension.size() && GetFileType().size() && extension != GetFileType() ) {
51 // replace extension
52 name = G4Analysis::GetBaseName(fileName) + "." + GetFileType();
53 Warn(fileName + " file extension is not valid for " + GetFileType() + " output.\n" +
54 name + " will be used.", fkClass, "SetFileName");
55 }
56
58}
virtual G4bool SetFileName(const G4String &fileName)
static constexpr std::string_view fkClass

References G4VFileManager::fkClass, G4Analysis::GetBaseName(), G4Analysis::GetExtension(), G4BaseFileManager::GetFileType(), G4InuclParticleNames::name(), G4BaseFileManager::SetFileName(), and G4Analysis::Warn().

Referenced by G4GenericFileManager::OpenFile().

◆ SetHistoDirectoryName()

G4bool G4VFileManager::SetHistoDirectoryName ( const G4String dirName)
virtualinherited

Reimplemented in G4GenericFileManager, and G4CsvFileManager.

Definition at line 61 of file G4VFileManager.cc.

62{
63 if ( fLockDirectoryNames ) {
64 Warn("Cannot set Histo directory name as its value was already used.",
65 fkClass, "SetHistoDirectoryName");
66 return false;
67 }
68
69 fHistoDirectoryName = dirName;
70 return true;
71}

References G4VFileManager::fHistoDirectoryName, G4VFileManager::fkClass, G4VFileManager::fLockDirectoryNames, and G4Analysis::Warn().

Referenced by G4GenericFileManager::SetHistoDirectoryName(), and G4CsvFileManager::SetHistoDirectoryName().

◆ SetIsEmpty()

G4bool G4VTFileManager< std::ofstream >::SetIsEmpty ( const G4String fileName,
G4bool  isEmpty 
)
inlinefinalvirtualinherited

Implements G4VFileManager.

Definition at line 57 of file G4VTFileManager.hh.

104{
105 return G4TFileManager<FT>::SetIsEmpty(fileName, isEmpty);
106}
G4bool SetIsEmpty(const G4String &fileName, G4bool isEmpty)

◆ SetNtupleDirectoryName()

G4bool G4VFileManager::SetNtupleDirectoryName ( const G4String dirName)
virtualinherited

Reimplemented in G4GenericFileManager, and G4CsvFileManager.

Definition at line 74 of file G4VFileManager.cc.

75{
76 if ( fLockDirectoryNames ) {
77 Warn("Cannot set Ntuple directory name as its value was already used.",
78 fkClass, "SetNtupleDirectoryName");
79 return false;
80 }
81
82 fNtupleDirectoryName = dirName;
83 return true;
84}

References G4VFileManager::fkClass, G4VFileManager::fLockDirectoryNames, G4VFileManager::fNtupleDirectoryName, and G4Analysis::Warn().

Referenced by G4GenericFileManager::SetNtupleDirectoryName(), and G4CsvFileManager::SetNtupleDirectoryName().

◆ UnlockDirectoryNames()

void G4VFileManager::UnlockDirectoryNames ( )
inlineinherited

Definition at line 114 of file G4VFileManager.hh.

115{ fLockDirectoryNames = false; }

References G4VFileManager::fLockDirectoryNames.

Referenced by G4GenericFileManager::Clear().

◆ WriteFile() [1/2]

G4bool G4VTFileManager< std::ofstream >::WriteFile ( const G4String fileName)
inlinefinalvirtualinherited

Implements G4VFileManager.

Definition at line 55 of file G4VTFileManager.hh.

88{
89 return G4TFileManager<FT>::WriteTFile(fileName);
90}
G4bool WriteTFile(const G4String &fileName)

◆ WriteFile() [2/2]

virtual G4bool G4VFileManager::WriteFile ( const G4String fileName)
virtualinherited

Implements G4VFileManager.

◆ WriteFileImpl()

G4bool G4XmlFileManager::WriteFileImpl ( std::shared_ptr< std::ofstream >  file)
finalprotectedvirtual

Implements G4TFileManager< std::ofstream >.

Definition at line 88 of file G4XmlFileManager.cc.

89{
90 // Nothing to be done here
91 return true;
92}

◆ WriteFiles()

G4bool G4VTFileManager< std::ofstream >::WriteFiles
inlinefinalvirtualinherited

Implements G4VFileManager.

Definition at line 60 of file G4VTFileManager.hh.

112{
114}
G4bool WriteFiles()

◆ WriteTFile() [1/2]

G4bool G4TFileManager< std::ofstream >::WriteTFile ( const G4String fileName)
inherited

◆ WriteTFile() [2/2]

G4bool G4TFileManager< std::ofstream >::WriteTFile ( std::shared_ptr< std::ofstream >  file,
const G4String fileName 
)
privateinherited

Field Documentation

◆ fAMState

const G4AnalysisManagerState& G4TFileManager< std::ofstream >::fAMState
privateinherited

Definition at line 87 of file G4TFileManager.hh.

◆ fFile

std::shared_ptr<std::ofstream > G4VTFileManager< std::ofstream >::fFile
protectedinherited

Definition at line 73 of file G4VTFileManager.hh.

◆ fFileMap

std::map<G4String, G4TFileInformation<std::ofstream >*> G4TFileManager< std::ofstream >::fFileMap
privateinherited

Definition at line 88 of file G4TFileManager.hh.

◆ fFileName

G4String G4BaseFileManager::fFileName
protectedinherited

◆ fFileNames

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

◆ fH1FileManager

std::shared_ptr<G4VTHnFileManager<tools::histo::h1d> > G4VFileManager::fH1FileManager { nullptr }
protectedinherited

◆ fH2FileManager

std::shared_ptr<G4VTHnFileManager<tools::histo::h2d> > G4VFileManager::fH2FileManager { nullptr }
protectedinherited

◆ fH3FileManager

std::shared_ptr<G4VTHnFileManager<tools::histo::h3d> > G4VFileManager::fH3FileManager { nullptr }
protectedinherited

◆ fHistoDirectoryName

G4String G4VFileManager::fHistoDirectoryName
protectedinherited

◆ fIsOpenFile

G4bool G4VFileManager::fIsOpenFile { false }
protectedinherited

◆ fkClass

constexpr std::string_view G4XmlFileManager::fkClass { "G4XmlFileManager" }
staticconstexprprivate

Definition at line 81 of file G4XmlFileManager.hh.

Referenced by CreateFileImpl(), CreateNtupleFile(), and OpenFile().

◆ fLockDirectoryNames

G4bool G4VFileManager::fLockDirectoryNames { false }
protectedinherited

◆ fNtupleDirectoryName

G4String G4VFileManager::fNtupleDirectoryName
protectedinherited

◆ fP1FileManager

std::shared_ptr<G4VTHnFileManager<tools::histo::p1d> > G4VFileManager::fP1FileManager { nullptr }
protectedinherited

◆ fP2FileManager

std::shared_ptr<G4VTHnFileManager<tools::histo::p2d> > G4VFileManager::fP2FileManager { nullptr }
protectedinherited

◆ fState

const G4AnalysisManagerState& G4BaseFileManager::fState
protectedinherited

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