42 fH1FileManager = std::make_shared<G4CsvHnFileManager<histo::h1d>>(
this);
43 fH2FileManager = std::make_shared<G4CsvHnFileManager<histo::h2d>>(
this);
44 fH3FileManager = std::make_shared<G4CsvHnFileManager<histo::h3d>>(
this);
45 fP1FileManager = std::make_shared<G4CsvHnFileManager<histo::p1d>>(
this);
46 fP2FileManager = std::make_shared<G4CsvHnFileManager<histo::p2d>>(
this);
61 auto ntupleFileName = ntupleDescription->
fFileName;
62 if ( ntupleFileName.size() ) {
67 ntupleFileName = GetNtupleFileName(ntupleDescription->
fNtupleBooking.name());
69 return ntupleFileName;
79 std::shared_ptr<std::ofstream> file = std::make_shared<std::ofstream>(fileName);
83 description <<
" " <<
"Cannot create file " << fileName;
102 if ( ! file )
return false;
130 auto ntupleFileName = GetNtupleFileName(ntupleDescription);
139 while (
GetTFile(ntupleFileName,
false) ) {
141 auto oldName = ntupleDescription->
fFileName;
147 <<
"Ntuple filename " << oldName <<
" is already in use." <<
G4endl
148 <<
"It will be replaced with : " << newName;
152 ntupleFileName = GetNtupleFileName(ntupleDescription);
163 return (ntupleDescription->
fFile !=
nullptr);
171 if ( ! ntupleDescription->
fFile )
return true;
173 auto finalResult =
true;
175 auto ntupleFileName = GetNtupleFileName(ntupleDescription);
185 finalResult = result && finalResult;
189 finalResult = result && finalResult;
192 ntupleDescription->
fFile.reset();
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
const G4AnalysisManagerState & fState
G4bool CreateNtupleFile(CsvNtupleDescription *ntupleDescription)
virtual std::shared_ptr< std::ofstream > CreateFileImpl(const G4String &fileName) final
virtual G4bool OpenFile(const G4String &fileName) final
virtual G4bool CloseFileImpl(std::shared_ptr< std::ofstream > file) final
G4CsvFileManager(const G4AnalysisManagerState &state)
virtual G4bool WriteFileImpl(std::shared_ptr< std::ofstream > file) final
G4bool CloseNtupleFile(CsvNtupleDescription *ntupleDescription)
virtual G4String GetFileType() const final
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
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