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);
63 auto ntupleFileName = ntupleDescription->
fFileName;
64 if ( ntupleFileName.size() ) {
69 ntupleFileName = GetNtupleFileName(ntupleDescription->
fNtupleBooking.name());
71 return ntupleFileName;
81 std::shared_ptr<std::ofstream> file = std::make_shared<std::ofstream>(fileName);
85 description <<
" " <<
"Cannot create file " << fileName;
105 if ( ! file )
return false;
127 description <<
"File " << fileName <<
" already exists.";
139 description <<
"Failed to create file " << fileName;
156 auto ntupleFileName = GetNtupleFileName(ntupleDescription);
165 while (
GetTFile(ntupleFileName,
false) ) {
167 auto oldName = ntupleDescription->
fFileName;
173 <<
"Ntuple filename " << oldName <<
" is already in use." <<
G4endl
174 <<
"It will be replaced with : " << newName;
178 ntupleFileName = GetNtupleFileName(ntupleDescription);
189 return (ntupleDescription->
fFile !=
nullptr);
197 if ( ! ntupleDescription->
fFile )
return true;
199 auto finalResult =
true;
201 auto ntupleFileName = GetNtupleFileName(ntupleDescription);
211 finalResult = result && finalResult;
215 finalResult = result && finalResult;
218 ntupleDescription->
fFile.reset();
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4AnalysisVerbose * GetVerboseL2() const
G4bool GetIsMaster() const
const G4AnalysisVerbose * GetVerboseL4() const
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4String GetFullFileName(const G4String &baseFileName="", G4bool isPerThread=true) const
const G4AnalysisManagerState & fState
G4bool CloseTFile(const G4String &fileName)
std::shared_ptr< FT > GetTFile(const G4String &fileName, G4bool warn=true) const
std::shared_ptr< FT > CreateTFile(const G4String &fileName)
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
virtual G4bool SetIsEmpty(const G4String &fileName, G4bool isEmpty) final
std::shared_ptr< std::ofstream > fFile
virtual G4bool OpenFile(const G4String &fileName) final
virtual G4bool CloseFileImpl(std::shared_ptr< std::ofstream > file) final
G4XmlFileManager(const G4AnalysisManagerState &state)
virtual std::shared_ptr< std::ofstream > CreateFileImpl(const G4String &fileName) final
virtual G4bool WriteFileImpl(std::shared_ptr< std::ofstream > file) final
G4bool CloseNtupleFile(XmlNtupleDescription *ntupleDescription)
virtual G4String GetFileType() const final
G4bool CreateNtupleFile(XmlNtupleDescription *ntupleDescription)
G4String GetExtension(const G4String &fileName, const G4String &defaultExtension="")
G4String GetTnFileName(const G4String &fileName, const G4String &fileType)
G4String GetBaseName(const G4String &fileName)
std::shared_ptr< TF > fFile
tools::ntuple_booking fNtupleBooking