Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
#include <string_view>
|
||||
|
||||
class G4XmlAnalysisManager;
|
||||
class G4XmlFileManager;
|
||||
class G4XmlNtupleFileManager;
|
||||
template <class T>
|
||||
class G4ThreadLocalSingleton;
|
||||
@@ -51,7 +50,7 @@ class G4XmlAnalysisManager : public G4ToolsAnalysisManager
|
||||
friend class G4ThreadLocalSingleton<G4XmlAnalysisManager>;
|
||||
|
||||
public:
|
||||
virtual ~G4XmlAnalysisManager();
|
||||
~G4XmlAnalysisManager() override;
|
||||
|
||||
// Static methods
|
||||
static G4XmlAnalysisManager* Instance();
|
||||
@@ -67,24 +66,14 @@ class G4XmlAnalysisManager : public G4ToolsAnalysisManager
|
||||
std::vector<tools::waxml::ntuple*>::const_iterator BeginConstNtuple() const;
|
||||
std::vector<tools::waxml::ntuple*>::const_iterator EndConstNtuple() const;
|
||||
|
||||
protected:
|
||||
// Virtual methods from base class
|
||||
virtual G4bool OpenFileImpl(const G4String& fileName) final;
|
||||
virtual G4bool WriteImpl() final;
|
||||
virtual G4bool CloseFileImpl(G4bool reset) final;
|
||||
virtual G4bool ResetImpl() final;
|
||||
virtual G4bool IsOpenFileImpl() const final;
|
||||
|
||||
private:
|
||||
G4XmlAnalysisManager();
|
||||
|
||||
// Static data members
|
||||
inline static G4XmlAnalysisManager* fgMasterInstance { nullptr };
|
||||
inline static G4ThreadLocal G4bool fgIsInstance { false };
|
||||
static constexpr std::string_view fkClass { "G4XmlAnalysisManager" };
|
||||
|
||||
// Data members
|
||||
std::shared_ptr<G4XmlFileManager> fFileManager { nullptr };
|
||||
std::shared_ptr<G4XmlNtupleFileManager> fNtupleFileManager { nullptr };
|
||||
};
|
||||
|
||||
|
||||
@@ -28,13 +28,6 @@
|
||||
#include "G4XmlNtupleManager.hh"
|
||||
#include "G4XmlFileManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
G4bool G4XmlAnalysisManager::IsOpenFileImpl() const
|
||||
{
|
||||
return fFileManager->IsOpenFile();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::waxml::ntuple* G4XmlAnalysisManager::GetNtuple() const
|
||||
|
||||
@@ -51,7 +51,7 @@ class G4XmlAnalysisReader : public G4ToolsAnalysisReader
|
||||
friend class G4ThreadLocalSingleton<G4XmlAnalysisReader>;
|
||||
|
||||
public:
|
||||
virtual ~G4XmlAnalysisReader();
|
||||
~G4XmlAnalysisReader() override;
|
||||
|
||||
// Static methods
|
||||
static G4XmlAnalysisReader* Instance();
|
||||
@@ -65,7 +65,7 @@ class G4XmlAnalysisReader : public G4ToolsAnalysisReader
|
||||
G4XmlAnalysisReader();
|
||||
|
||||
// Virtual methods from base class
|
||||
virtual G4bool CloseFilesImpl(G4bool reset) final;
|
||||
G4bool CloseFilesImpl(G4bool reset) final;
|
||||
|
||||
private:
|
||||
// Static data members
|
||||
|
||||
@@ -52,16 +52,16 @@ class G4XmlFileManager : public G4VTFileManager<std::ofstream>
|
||||
public:
|
||||
explicit G4XmlFileManager(const G4AnalysisManagerState& state);
|
||||
G4XmlFileManager() = delete;
|
||||
virtual ~G4XmlFileManager() = default;
|
||||
~G4XmlFileManager() override = default;
|
||||
|
||||
using G4BaseFileManager::GetNtupleFileName;
|
||||
using G4VTFileManager<std::ofstream>::WriteFile;
|
||||
using G4VTFileManager<std::ofstream>::CloseFile;
|
||||
|
||||
// Methods to manipulate output files
|
||||
virtual G4bool OpenFile(const G4String& fileName) final;
|
||||
G4bool OpenFile(const G4String& fileName) final;
|
||||
|
||||
virtual G4String GetFileType() const final { return "xml"; }
|
||||
G4String GetFileType() const final { return "xml"; }
|
||||
|
||||
// Specific methods for files per objects
|
||||
G4bool CreateNtupleFile(XmlNtupleDescription* ntupleDescription);
|
||||
@@ -69,11 +69,11 @@ class G4XmlFileManager : public G4VTFileManager<std::ofstream>
|
||||
|
||||
protected:
|
||||
// Methods derived from templated base class
|
||||
virtual std::shared_ptr<std::ofstream> CreateFileImpl(const G4String& fileName) final;
|
||||
virtual G4bool WriteFileImpl(std::shared_ptr<std::ofstream> file) final;
|
||||
virtual G4bool CloseFileImpl(std::shared_ptr<std::ofstream> file) final;
|
||||
std::shared_ptr<std::ofstream> CreateFileImpl(const G4String& fileName) final;
|
||||
G4bool WriteFileImpl(std::shared_ptr<std::ofstream> file) final;
|
||||
G4bool CloseFileImpl(std::shared_ptr<std::ofstream> file) final;
|
||||
|
||||
private:
|
||||
private:
|
||||
// Utility method
|
||||
G4String GetNtupleFileName(XmlNtupleDescription* ntupleDescription);
|
||||
|
||||
|
||||
@@ -44,13 +44,13 @@ class G4XmlHnFileManager : public G4VTHnFileManager<HT>
|
||||
G4XmlHnFileManager(G4XmlFileManager* fileManger)
|
||||
: G4VTHnFileManager<HT>(), fFileManager(fileManger) {}
|
||||
G4XmlHnFileManager() = delete;
|
||||
virtual ~G4XmlHnFileManager() = default;
|
||||
~G4XmlHnFileManager() override = default;
|
||||
|
||||
// Methods for writing objects
|
||||
// Write to a new file (the file is closed after write)
|
||||
virtual G4bool WriteExtra(HT* ht, const G4String& htName, const G4String& fileName) final;
|
||||
G4bool WriteExtra(HT* ht, const G4String& htName, const G4String& fileName) final;
|
||||
// Write to the default file (handled with OpenFile()/CloseFile methods)
|
||||
virtual G4bool Write(HT* ht, const G4String& htName, G4String& fileName) final;
|
||||
G4bool Write(HT* ht, const G4String& htName, G4String& fileName) final;
|
||||
|
||||
private:
|
||||
// Static data members
|
||||
|
||||
@@ -44,11 +44,11 @@ class G4XmlHnRFileManager : public G4VTHnRFileManager<HT>
|
||||
G4XmlHnRFileManager(G4XmlRFileManager* rfileManger)
|
||||
: G4VTHnRFileManager<HT>(), fRFileManager(rfileManger) {}
|
||||
G4XmlHnRFileManager() = delete;
|
||||
virtual ~G4XmlHnRFileManager() = default;
|
||||
~G4XmlHnRFileManager() override = default;
|
||||
|
||||
// Methods for writing objects
|
||||
virtual HT* Read(const G4String& htName, const G4String& fileName,
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
HT* Read(const G4String& htName, const G4String& fileName, const G4String& dirName,
|
||||
G4bool isUserFileName) final;
|
||||
|
||||
private:
|
||||
// Static data members
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "tools/waxml/ntuple"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
class G4XmlFileManager;
|
||||
class G4XmlNtupleManager;
|
||||
@@ -46,24 +47,21 @@ class G4XmlNtupleFileManager : public G4VNtupleFileManager
|
||||
public:
|
||||
explicit G4XmlNtupleFileManager(const G4AnalysisManagerState& state);
|
||||
G4XmlNtupleFileManager() = delete;
|
||||
virtual ~G4XmlNtupleFileManager() = default;
|
||||
~G4XmlNtupleFileManager() override = default;
|
||||
|
||||
virtual std::shared_ptr<G4VNtupleManager> CreateNtupleManager() override;
|
||||
std::shared_ptr<G4VNtupleManager> CreateNtupleManager() override;
|
||||
|
||||
// Methods to be performed at file management
|
||||
virtual G4bool ActionAtOpenFile(const G4String& fileName) override;
|
||||
virtual G4bool ActionAtWrite() override;
|
||||
virtual G4bool ActionAtCloseFile(G4bool reset) override;
|
||||
virtual G4bool Reset() override;
|
||||
G4bool ActionAtOpenFile(const G4String& fileName) override;
|
||||
G4bool ActionAtWrite() override;
|
||||
G4bool ActionAtCloseFile() override;
|
||||
G4bool Reset() override;
|
||||
|
||||
void SetFileManager(std::shared_ptr<G4XmlFileManager> fileManager);
|
||||
|
||||
std::shared_ptr<G4XmlNtupleManager> GetNtupleManager() const;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
G4bool CloseNtupleFiles();
|
||||
|
||||
// Static data members
|
||||
static constexpr std::string_view fkClass { "G4XmlNtupleFileManager" };
|
||||
|
||||
@@ -76,7 +74,9 @@ class G4XmlNtupleFileManager : public G4VNtupleFileManager
|
||||
|
||||
inline void G4XmlNtupleFileManager::SetFileManager(
|
||||
std::shared_ptr<G4XmlFileManager> fileManager)
|
||||
{ fFileManager = fileManager; }
|
||||
{
|
||||
fFileManager = std::move(fileManager);
|
||||
}
|
||||
|
||||
inline std::shared_ptr<G4XmlNtupleManager> G4XmlNtupleFileManager::GetNtupleManager() const
|
||||
{ return fNtupleManager; }
|
||||
|
||||
@@ -36,9 +36,10 @@
|
||||
|
||||
#include "tools/waxml/ntuple"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
// Types alias
|
||||
using XmlNtupleDescription = G4TNtupleDescription<tools::waxml::ntuple, std::ofstream>;
|
||||
@@ -54,7 +55,7 @@ class G4XmlNtupleManager : public G4TNtupleManager<tools::waxml::ntuple,
|
||||
public:
|
||||
explicit G4XmlNtupleManager(const G4AnalysisManagerState& state);
|
||||
G4XmlNtupleManager() = delete;
|
||||
virtual ~G4XmlNtupleManager() = default;
|
||||
~G4XmlNtupleManager() override = default;
|
||||
|
||||
private:
|
||||
// Functions specific to the output type
|
||||
@@ -68,12 +69,9 @@ class G4XmlNtupleManager : public G4TNtupleManager<tools::waxml::ntuple,
|
||||
|
||||
// Methods from the templated base class
|
||||
//
|
||||
virtual void CreateTNtupleFromBooking(
|
||||
XmlNtupleDescription* ntupleDescription) final;
|
||||
void CreateTNtupleFromBooking(XmlNtupleDescription* ntupleDescription) final;
|
||||
|
||||
virtual void FinishTNtuple(
|
||||
XmlNtupleDescription* ntupleDescription,
|
||||
G4bool fromBooking) final;
|
||||
void FinishTNtuple(XmlNtupleDescription* ntupleDescription, G4bool fromBooking) final;
|
||||
|
||||
// Static data members
|
||||
static constexpr std::string_view fkClass { "G4XmNtupleManager" };
|
||||
@@ -86,7 +84,9 @@ class G4XmlNtupleManager : public G4TNtupleManager<tools::waxml::ntuple,
|
||||
|
||||
inline void
|
||||
G4XmlNtupleManager::SetFileManager(std::shared_ptr<G4XmlFileManager> fileManager)
|
||||
{ fFileManager = fileManager; }
|
||||
{
|
||||
fFileManager = std::move(fileManager);
|
||||
}
|
||||
|
||||
inline const std::vector<G4TNtupleDescription<tools::waxml::ntuple, std::ofstream>*>&
|
||||
G4XmlNtupleManager::GetNtupleDescriptionVector() const
|
||||
|
||||
@@ -45,12 +45,12 @@ class G4XmlRFileManager : public G4VRFileManager
|
||||
public:
|
||||
explicit G4XmlRFileManager(const G4AnalysisManagerState& state);
|
||||
G4XmlRFileManager() = delete;
|
||||
virtual ~G4XmlRFileManager();
|
||||
~G4XmlRFileManager() override;
|
||||
|
||||
virtual G4String GetFileType() const final { return "xml"; }
|
||||
G4String GetFileType() const final { return "xml"; }
|
||||
|
||||
// Methods from base class
|
||||
virtual void CloseFiles() final {}
|
||||
void CloseFiles() final {}
|
||||
|
||||
// Methods to manipulate input files
|
||||
virtual G4bool OpenRFile(const G4String& fileName);
|
||||
|
||||
@@ -53,8 +53,7 @@ tools::raxml_out* G4XmlRFileManager::GetHandler(
|
||||
std::vector<tools::raxml_out>::iterator it;
|
||||
for (it = objects.begin(); it!=objects.end(); ++it) {
|
||||
tools::raxml_out& object = *it;
|
||||
if ( (object.cls().compare(HT::s_class()) == 0) &&
|
||||
(object.name().compare(objectName) == 0) ) {
|
||||
if ((object.cls() == HT::s_class()) && (object.name() == objectName)) {
|
||||
handler = &object;
|
||||
handler->disown();
|
||||
break;
|
||||
|
||||
@@ -37,8 +37,9 @@
|
||||
|
||||
#include "toolx/raxml"
|
||||
|
||||
#include <vector>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class G4XmlRFileManager;
|
||||
struct G4XmlRNtupleDescription;
|
||||
@@ -50,7 +51,7 @@ class G4XmlRNtupleManager : public G4TRNtupleManager<tools::aida::ntuple>
|
||||
public:
|
||||
explicit G4XmlRNtupleManager(const G4AnalysisManagerState& state);
|
||||
G4XmlRNtupleManager() = delete;
|
||||
virtual ~G4XmlRNtupleManager() = default;
|
||||
~G4XmlRNtupleManager() override = default;
|
||||
|
||||
protected:
|
||||
// Set methods
|
||||
@@ -68,20 +69,20 @@ class G4XmlRNtupleManager : public G4TRNtupleManager<tools::aida::ntuple>
|
||||
// Override base class functions for vector columns
|
||||
// in order to fill the maps
|
||||
|
||||
virtual G4bool SetNtupleIColumn(G4int ntupleId, const G4String& columnName,
|
||||
std::vector<G4int>& vector) final;
|
||||
virtual G4bool SetNtupleFColumn(G4int ntupleId, const G4String& columnName,
|
||||
std::vector<G4float>& vector) final;
|
||||
virtual G4bool SetNtupleDColumn(G4int ntupleId, const G4String& columnName,
|
||||
std::vector<G4double>& vector) final;
|
||||
virtual G4bool SetNtupleSColumn(G4int ntupleId, const G4String& columnName,
|
||||
std::vector<std::string>& vector) final;
|
||||
G4bool SetNtupleIColumn(
|
||||
G4int ntupleId, const G4String& columnName, std::vector<G4int>& vector) final;
|
||||
G4bool SetNtupleFColumn(
|
||||
G4int ntupleId, const G4String& columnName, std::vector<G4float>& vector) final;
|
||||
G4bool SetNtupleDColumn(
|
||||
G4int ntupleId, const G4String& columnName, std::vector<G4double>& vector) final;
|
||||
G4bool SetNtupleSColumn(
|
||||
G4int ntupleId, const G4String& columnName, std::vector<std::string>& vector) final;
|
||||
|
||||
private:
|
||||
// Methods from the base class
|
||||
virtual G4int ReadNtupleImpl(const G4String& ntupleName, const G4String& fileName,
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
virtual G4bool GetTNtupleRow(G4TRNtupleDescription<tools::aida::ntuple>* ntupleDescription) final;
|
||||
G4int ReadNtupleImpl(const G4String& ntupleName, const G4String& fileName,
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
G4bool GetTNtupleRow(G4TRNtupleDescription<tools::aida::ntuple>* ntupleDescription) final;
|
||||
|
||||
// Static data members
|
||||
static constexpr std::string_view fkClass { "G4XmlRNtupleManager" };
|
||||
@@ -92,6 +93,8 @@ class G4XmlRNtupleManager : public G4TRNtupleManager<tools::aida::ntuple>
|
||||
|
||||
inline void
|
||||
G4XmlRNtupleManager::SetFileManager(std::shared_ptr<G4XmlRFileManager> fileManager)
|
||||
{ fFileManager = fileManager; }
|
||||
{
|
||||
fFileManager = std::move(fileManager);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user