34#include "tools/waxml/begend"
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);
59 auto ntupleFileName = ntupleDescription->
GetFileName();
60 if (ntupleFileName.size() != 0u) {
67 ntupleFileName = GetNtupleFileName(
71 return ntupleFileName;
81 std::shared_ptr<std::ofstream> file = std::make_shared<std::ofstream>(fileName);
83 Warn(
G4String(
"Cannot create file ") + fileName, fkClass,
"CreateFileImpl");
101 if ( ! file )
return false;
122 Warn(
G4String(
"File ") + fileName +
" already exists.", fkClass,
"OpenFile");
131 Warn(
G4String(
"Failed to create file") + fileName, fkClass,
"OpenFile");
146 auto ntupleFileName = GetNtupleFileName(ntupleDescription);
149 auto ntupleFile =
GetTFile(ntupleFileName,
false);
150 if ( ntupleFile ==
nullptr) {
154 ntupleDescription->
SetFile(ntupleFile);
156 return (ntupleDescription->
GetFile() !=
nullptr);
164 auto ntupleFileName = GetNtupleFileName(ntupleDescription);
169 ntupleDescription->
GetFile().reset();
G4bool GetIsMaster() const
G4String GetFullFileName(const G4String &baseFileName="", G4bool isPerThread=true) const
const G4AnalysisManagerState & fState
std::shared_ptr< FT > GetTFile(const G4String &fileName, G4bool warn=true) const
std::shared_ptr< FT > CreateTFile(const G4String &fileName)
void SetFile(std::shared_ptr< FT > file)
const tools::ntuple_booking & GetNtupleBooking() const
G4bool GetHasFill() const
std::shared_ptr< FT > GetFile() const
G4String GetFileName() const
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
G4bool SetIsEmpty(const G4String &fileName, G4bool isEmpty) final
std::shared_ptr< std::ofstream > fFile
G4bool OpenFile(const G4String &fileName) final
G4String GetFileType() const final
G4bool CloseFileImpl(std::shared_ptr< std::ofstream > file) final
G4XmlFileManager()=delete
std::shared_ptr< std::ofstream > CreateFileImpl(const G4String &fileName) final
G4bool WriteFileImpl(std::shared_ptr< std::ofstream > file) final
G4bool CloseNtupleFile(XmlNtupleDescription *ntupleDescription)
G4bool CreateNtupleFile(XmlNtupleDescription *ntupleDescription)
G4String GetTnFileName(const G4String &fileName, const G4String &fileType, G4int cycle=0)
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)