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

#include <G4Hdf5RNtupleManager.hh>

Inheritance diagram for G4Hdf5RNtupleManager:
G4TRNtupleManager< tools::hdf5::ntuple > G4BaseRNtupleManager G4VRNtupleManager G4BaseAnalysisManager

Public Member Functions

 G4Hdf5RNtupleManager ()=delete
 
 G4Hdf5RNtupleManager (const G4AnalysisManagerState &state)
 
G4int GetFirstId () const
 
G4bool SetFirstId (G4int firstId)
 
void SetLockFirstId (G4bool lockFirstId)
 
virtual ~G4Hdf5RNtupleManager ()=default
 

Protected Member Functions

virtual G4int GetNofNtuples () const final
 
tools::hdf5::ntuple * GetNtuple () const
 
tools::hdf5::ntuple * GetNtuple (G4int ntupleId) const
 
G4TRNtupleDescription< tools::hdf5::ntuple > * GetNtupleDescriptionInFunction (G4int id, std::string_view function, G4bool warn=true) const
 
virtual G4bool GetNtupleRow () final
 
virtual G4bool GetNtupleRow (G4int ntupleId) final
 
virtual G4bool GetNtupleRow (G4int ntupleId)=0
 
G4bool IsEmpty () const
 
G4bool IsVerbose (G4int verboseLevel) const
 
void Message (G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
 
G4bool Reset ()
 
G4int SetNtuple (G4TRNtupleDescription< tools::hdf5::ntuple > *rntupleDescription)
 
virtual G4bool SetNtupleDColumn (const G4String &columnName, G4double &value) final
 
virtual G4bool SetNtupleDColumn (const G4String &columnName, std::vector< G4double > &vector) final
 
virtual G4bool SetNtupleDColumn (G4int ntupleId, const G4String &columnName, G4double &value) final
 
virtual G4bool SetNtupleDColumn (G4int ntupleId, const G4String &columnName, G4double &value)=0
 
virtual G4bool SetNtupleDColumn (G4int ntupleId, const G4String &columnName, std::vector< G4double > &vector) override
 
virtual G4bool SetNtupleDColumn (G4int ntupleId, const G4String &columnName, std::vector< G4double > &vector)=0
 
virtual G4bool SetNtupleFColumn (const G4String &columnName, G4float &value) final
 
virtual G4bool SetNtupleFColumn (const G4String &columnName, std::vector< G4float > &vector) final
 
virtual G4bool SetNtupleFColumn (G4int ntupleId, const G4String &columnName, G4float &value) final
 
virtual G4bool SetNtupleFColumn (G4int ntupleId, const G4String &columnName, G4float &value)=0
 
virtual G4bool SetNtupleFColumn (G4int ntupleId, const G4String &columnName, std::vector< G4float > &vector) override
 
virtual G4bool SetNtupleFColumn (G4int ntupleId, const G4String &columnName, std::vector< G4float > &vector)=0
 
virtual G4bool SetNtupleIColumn (const G4String &columnName, G4int &value) final
 
virtual G4bool SetNtupleIColumn (const G4String &columnName, std::vector< G4int > &vector) final
 
virtual G4bool SetNtupleIColumn (G4int ntupleId, const G4String &columnName, G4int &value) final
 
virtual G4bool SetNtupleIColumn (G4int ntupleId, const G4String &columnName, G4int &value)=0
 
virtual G4bool SetNtupleIColumn (G4int ntupleId, const G4String &columnName, std::vector< G4int > &vector) override
 
virtual G4bool SetNtupleIColumn (G4int ntupleId, const G4String &columnName, std::vector< G4int > &vector)=0
 
virtual G4bool SetNtupleSColumn (const G4String &columnName, G4String &value) final
 
virtual G4bool SetNtupleSColumn (const G4String &columnName, std::vector< std::string > &vector) final
 
virtual G4bool SetNtupleSColumn (G4int ntupleId, const G4String &columnName, G4String &value) final
 
virtual G4bool SetNtupleSColumn (G4int ntupleId, const G4String &columnName, G4String &value)=0
 
virtual G4bool SetNtupleSColumn (G4int ntupleId, const G4String &columnName, std::vector< std::string > &vector) override
 
virtual G4bool SetNtupleSColumn (G4int ntupleId, const G4String &columnName, std::vector< std::string > &vector)=0
 

Protected Attributes

G4int fFirstId { 0 }
 
G4bool fLockFirstId { false }
 
const G4AnalysisManagerStatefState
 

Private Member Functions

G4int GetCurrentNtupleId () const
 
virtual G4bool GetTNtupleRow (G4TRNtupleDescription< tools::hdf5::ntuple > *ntupleDescription) final
 
virtual G4int ReadNtupleImpl (const G4String &ntupleName, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
 
void SetFileManager (std::shared_ptr< G4Hdf5RFileManager > fileManager)
 
G4bool SetNtupleTColumn (G4int ntupleId, const G4String &name, std::vector< T > &vector)
 
G4bool SetNtupleTColumn (G4int ntupleId, const G4String &name, T &value)
 

Private Attributes

std::shared_ptr< G4Hdf5RFileManagerfFileManager { nullptr }
 
std::vector< G4TRNtupleDescription< tools::hdf5::ntuple > * > fNtupleDescriptionVector
 

Static Private Attributes

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

Friends

class G4Hdf5AnalysisReader
 

Detailed Description

Definition at line 44 of file G4Hdf5RNtupleManager.hh.

Constructor & Destructor Documentation

◆ G4Hdf5RNtupleManager() [1/2]

G4Hdf5RNtupleManager::G4Hdf5RNtupleManager ( const G4AnalysisManagerState state)
explicit

◆ G4Hdf5RNtupleManager() [2/2]

G4Hdf5RNtupleManager::G4Hdf5RNtupleManager ( )
delete

◆ ~G4Hdf5RNtupleManager()

virtual G4Hdf5RNtupleManager::~G4Hdf5RNtupleManager ( )
virtualdefault

Member Function Documentation

◆ GetCurrentNtupleId()

G4int G4BaseRNtupleManager::GetCurrentNtupleId ( ) const
privateinherited

◆ GetFirstId()

G4int G4BaseAnalysisManager::GetFirstId ( ) const
inlineinherited

Definition at line 94 of file G4BaseAnalysisManager.hh.

94 {
95 return fFirstId;
96}

References G4BaseAnalysisManager::fFirstId.

◆ GetNofNtuples()

virtual G4int G4TRNtupleManager< tools::hdf5::ntuple >::GetNofNtuples ( ) const
finalprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ GetNtuple() [1/2]

tools::hdf5::ntuple * G4TRNtupleManager< tools::hdf5::ntuple >::GetNtuple ( ) const
protectedinherited

◆ GetNtuple() [2/2]

tools::hdf5::ntuple * G4TRNtupleManager< tools::hdf5::ntuple >::GetNtuple ( G4int  ntupleId) const
protectedinherited

◆ GetNtupleDescriptionInFunction()

G4TRNtupleDescription< tools::hdf5::ntuple > * G4TRNtupleManager< tools::hdf5::ntuple >::GetNtupleDescriptionInFunction ( G4int  id,
std::string_view  function,
G4bool  warn = true 
) const
protectedinherited

◆ GetNtupleRow() [1/3]

G4bool G4BaseRNtupleManager::GetNtupleRow ( )
finalprotectedvirtualinherited

Reimplemented from G4BaseRNtupleManager.

Definition at line 88 of file G4BaseRNtupleManager.cc.

102{
103 return GetNtupleRow(fFirstId);
104}

◆ GetNtupleRow() [2/3]

virtual G4bool G4TRNtupleManager< tools::hdf5::ntuple >::GetNtupleRow ( G4int  ntupleId)
finalprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ GetNtupleRow() [3/3]

virtual G4bool G4BaseRNtupleManager::GetNtupleRow ( G4int  ntupleId)
protectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ GetTNtupleRow()

G4bool G4Hdf5RNtupleManager::GetTNtupleRow ( G4TRNtupleDescription< tools::hdf5::ntuple > *  ntupleDescription)
finalprivatevirtual

Implements G4TRNtupleManager< tools::hdf5::ntuple >.

Definition at line 73 of file G4Hdf5RNtupleManager.cc.

75{
76 auto ntuple = ntupleDescription->fNtuple;
77
78 auto isInitialized = ntupleDescription->fIsInitialized;
79 if ( ! isInitialized ) {
80 auto ntupleBinding = ntupleDescription->fNtupleBinding;
81 if ( ! ntuple->initialize(G4cout, *ntupleBinding) ) {
82 Warn("Ntuple initialization failed !!", fkClass, "GetTNtupleRow");
83 return false;
84 }
85 ntupleDescription->fIsInitialized = true;
86 }
87
88 if ( ! ntuple->get_row() ) {
89 Warn( "Ntuple get_row() failed !!", fkClass, "GetTNtupleRow");
90 return false;
91 }
92
93 return true;
94}
G4GLOB_DLL std::ostream G4cout
static constexpr std::string_view fkClass
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)
G4bool isInitialized()
tools::ntuple_binding * fNtupleBinding

References G4TRNtupleDescription< NT >::fIsInitialized, fkClass, G4TRNtupleDescription< NT >::fNtuple, G4TRNtupleDescription< NT >::fNtupleBinding, G4cout, G4INCL::Random::isInitialized(), and G4Analysis::Warn().

◆ IsEmpty()

G4bool G4TRNtupleManager< tools::hdf5::ntuple >::IsEmpty ( ) const
protectedinherited

◆ IsVerbose()

G4bool G4BaseAnalysisManager::IsVerbose ( G4int  verboseLevel) const
inlineprotectedinherited

Definition at line 80 of file G4BaseAnalysisManager.hh.

81{ return fState.IsVerbose(verboseLevel); }
G4bool IsVerbose(G4int verboseLevel) const
const G4AnalysisManagerState & fState

References G4BaseAnalysisManager::fState, and G4AnalysisManagerState::IsVerbose().

Referenced by G4RootPNtupleManager::AddNtupleRow(), and G4RootPNtupleManager::Merge().

◆ Message()

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

◆ ReadNtupleImpl()

G4int G4Hdf5RNtupleManager::ReadNtupleImpl ( const G4String ntupleName,
const G4String fileName,
const G4String dirName,
G4bool  isUserFileName 
)
finalprivatevirtual

Implements G4VRNtupleManager.

Definition at line 44 of file G4Hdf5RNtupleManager.cc.

48{
49 Message(kVL4, "read", "ntuple", ntupleName);
50
51 // Ntuples are saved in files per thread
52 // but apply thethe thread suffix only if fileName is not provided explicitly
53 G4String fullFileName = fileName;
54 if ( ! isUserFileName ) {
55 fullFileName = fFileManager->GetFullFileName();
56 }
57
58 // Get directory
59 auto directory = fFileManager->GetNtupleRDirectory(fullFileName, dirName, false);
60 if ( directory < 0 ) return kInvalidId;
61
62 // Create ntuple
63 auto rntuple = new tools::hdf5::ntuple(G4cout, directory, ntupleName);
64 auto rntupleDescription = new G4TRNtupleDescription<tools::hdf5::ntuple>(rntuple);
65 auto id = SetNtuple(rntupleDescription);
66
67 Message(kVL2, "read", "ntuple", ntupleName, id > kInvalidId);
68
69 return id;
70}
void Message(G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
std::shared_ptr< G4Hdf5RFileManager > fFileManager
G4int SetNtuple(G4TRNtupleDescription< tools::hdf5::ntuple > *rntupleDescription)
constexpr G4int kVL2
constexpr G4int kVL4
constexpr G4int kInvalidId

References fFileManager, G4cout, G4Analysis::kInvalidId, G4Analysis::kVL2, G4Analysis::kVL4, G4BaseAnalysisManager::Message(), and G4TRNtupleManager< tools::hdf5::ntuple >::SetNtuple().

◆ Reset()

G4bool G4TRNtupleManager< tools::hdf5::ntuple >::Reset ( )
protectedinherited

◆ SetFileManager()

void G4Hdf5RNtupleManager::SetFileManager ( std::shared_ptr< G4Hdf5RFileManager fileManager)
inlineprivate

Definition at line 72 of file G4Hdf5RNtupleManager.hh.

73{ fFileManager = fileManager; }

References fFileManager.

◆ SetFirstId()

G4bool G4BaseAnalysisManager::SetFirstId ( G4int  firstId)
inherited

Definition at line 46 of file G4BaseAnalysisManager.cc.

47{
48 if ( fLockFirstId ) {
49 Warn("Cannot set FirstId as its value was already used.",
50 fkClass, "SetFirstId");
51
52 return false;
53 }
54
55 fFirstId = firstId;
56 return true;
57}
static constexpr std::string_view fkClass

References G4BaseAnalysisManager::fFirstId, G4BaseAnalysisManager::fkClass, G4BaseAnalysisManager::fLockFirstId, and G4Analysis::Warn().

◆ SetLockFirstId()

void G4BaseAnalysisManager::SetLockFirstId ( G4bool  lockFirstId)
inlineinherited

Definition at line 90 of file G4BaseAnalysisManager.hh.

90 {
91 fLockFirstId = lockFirstId;
92}

References G4BaseAnalysisManager::fLockFirstId.

Referenced by G4HnManager::ClearData().

◆ SetNtuple()

G4int G4TRNtupleManager< tools::hdf5::ntuple >::SetNtuple ( G4TRNtupleDescription< tools::hdf5::ntuple > *  rntupleDescription)
protectedinherited

◆ SetNtupleDColumn() [1/6]

G4bool G4BaseRNtupleManager::SetNtupleDColumn ( const G4String columnName,
G4double value 
)
finalprotectedvirtualinherited

Reimplemented from G4BaseRNtupleManager.

Definition at line 65 of file G4BaseRNtupleManager.cc.

61{
62 return SetNtupleDColumn(GetCurrentNtupleId(), columnName, value);
63}
G4int GetCurrentNtupleId() const
virtual G4bool SetNtupleDColumn(G4int ntupleId, const G4String &columnName, G4double &value) final

◆ SetNtupleDColumn() [2/6]

G4bool G4BaseRNtupleManager::SetNtupleDColumn ( const G4String columnName,
std::vector< G4double > &  vector 
)
finalprotectedvirtualinherited

Reimplemented from G4BaseRNtupleManager.

Definition at line 65 of file G4BaseRNtupleManager.cc.

89{
90 return SetNtupleDColumn(GetCurrentNtupleId(), columnName, vector);
91}

◆ SetNtupleDColumn() [3/6]

virtual G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleDColumn ( G4int  ntupleId,
const G4String columnName,
G4double value 
)
finalprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleDColumn() [4/6]

virtual G4bool G4BaseRNtupleManager::SetNtupleDColumn ( G4int  ntupleId,
const G4String columnName,
G4double value 
)
protectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleDColumn() [5/6]

virtual G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleDColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< G4double > &  vector 
)
overrideprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleDColumn() [6/6]

virtual G4bool G4BaseRNtupleManager::SetNtupleDColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< G4double > &  vector 
)
protectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleFColumn() [1/6]

G4bool G4BaseRNtupleManager::SetNtupleFColumn ( const G4String columnName,
G4float value 
)
finalprotectedvirtualinherited

Reimplemented from G4BaseRNtupleManager.

Definition at line 64 of file G4BaseRNtupleManager.cc.

54{
55 return SetNtupleFColumn(GetCurrentNtupleId(), columnName, value);
56}
virtual G4bool SetNtupleFColumn(G4int ntupleId, const G4String &columnName, G4float &value) final

◆ SetNtupleFColumn() [2/6]

G4bool G4BaseRNtupleManager::SetNtupleFColumn ( const G4String columnName,
std::vector< G4float > &  vector 
)
finalprotectedvirtualinherited

Reimplemented from G4BaseRNtupleManager.

Definition at line 64 of file G4BaseRNtupleManager.cc.

82{
83 return SetNtupleFColumn(GetCurrentNtupleId(), columnName, vector);
84}

◆ SetNtupleFColumn() [3/6]

virtual G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleFColumn ( G4int  ntupleId,
const G4String columnName,
G4float value 
)
finalprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleFColumn() [4/6]

virtual G4bool G4BaseRNtupleManager::SetNtupleFColumn ( G4int  ntupleId,
const G4String columnName,
G4float value 
)
protectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleFColumn() [5/6]

virtual G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleFColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< G4float > &  vector 
)
overrideprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleFColumn() [6/6]

virtual G4bool G4BaseRNtupleManager::SetNtupleFColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< G4float > &  vector 
)
protectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleIColumn() [1/6]

G4bool G4BaseRNtupleManager::SetNtupleIColumn ( const G4String columnName,
G4int value 
)
finalprotectedvirtualinherited

Reimplemented from G4BaseRNtupleManager.

Definition at line 63 of file G4BaseRNtupleManager.cc.

48{
49 return SetNtupleIColumn(GetCurrentNtupleId(), columnName, value);
50}
virtual G4bool SetNtupleIColumn(G4int ntupleId, const G4String &columnName, G4int &value) final

◆ SetNtupleIColumn() [2/6]

G4bool G4BaseRNtupleManager::SetNtupleIColumn ( const G4String columnName,
std::vector< G4int > &  vector 
)
finalprotectedvirtualinherited

Reimplemented from G4BaseRNtupleManager.

Definition at line 63 of file G4BaseRNtupleManager.cc.

75{
76 return SetNtupleIColumn(GetCurrentNtupleId(), columnName, vector);
77}

◆ SetNtupleIColumn() [3/6]

virtual G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleIColumn ( G4int  ntupleId,
const G4String columnName,
G4int value 
)
finalprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleIColumn() [4/6]

virtual G4bool G4BaseRNtupleManager::SetNtupleIColumn ( G4int  ntupleId,
const G4String columnName,
G4int value 
)
protectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleIColumn() [5/6]

virtual G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleIColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< G4int > &  vector 
)
overrideprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleIColumn() [6/6]

virtual G4bool G4BaseRNtupleManager::SetNtupleIColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< G4int > &  vector 
)
protectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleSColumn() [1/6]

G4bool G4BaseRNtupleManager::SetNtupleSColumn ( const G4String columnName,
G4String value 
)
finalprotectedvirtualinherited

Reimplemented from G4BaseRNtupleManager.

Definition at line 66 of file G4BaseRNtupleManager.cc.

68{
69 return SetNtupleSColumn(GetCurrentNtupleId(), columnName, value);
70}
virtual G4bool SetNtupleSColumn(G4int ntupleId, const G4String &columnName, G4String &value) final

◆ SetNtupleSColumn() [2/6]

G4bool G4BaseRNtupleManager::SetNtupleSColumn ( const G4String columnName,
std::vector< std::string > &  vector 
)
finalprotectedvirtualinherited

Reimplemented from G4BaseRNtupleManager.

Definition at line 66 of file G4BaseRNtupleManager.cc.

96{
97 return SetNtupleSColumn(GetCurrentNtupleId(), columnName, vector);
98}

◆ SetNtupleSColumn() [3/6]

virtual G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleSColumn ( G4int  ntupleId,
const G4String columnName,
G4String value 
)
finalprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleSColumn() [4/6]

virtual G4bool G4BaseRNtupleManager::SetNtupleSColumn ( G4int  ntupleId,
const G4String columnName,
G4String value 
)
protectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleSColumn() [5/6]

virtual G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleSColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< std::string > &  vector 
)
overrideprotectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleSColumn() [6/6]

virtual G4bool G4BaseRNtupleManager::SetNtupleSColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< std::string > &  vector 
)
protectedvirtualinherited

Implements G4BaseRNtupleManager.

◆ SetNtupleTColumn() [1/2]

G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleTColumn ( G4int  ntupleId,
const G4String name,
std::vector< T > &  vector 
)
privateinherited

◆ SetNtupleTColumn() [2/2]

G4bool G4TRNtupleManager< tools::hdf5::ntuple >::SetNtupleTColumn ( G4int  ntupleId,
const G4String name,
T &  value 
)
privateinherited

Friends And Related Function Documentation

◆ G4Hdf5AnalysisReader

friend class G4Hdf5AnalysisReader
friend

Definition at line 46 of file G4Hdf5RNtupleManager.hh.

Field Documentation

◆ fFileManager

std::shared_ptr<G4Hdf5RFileManager> G4Hdf5RNtupleManager::fFileManager { nullptr }
private

Definition at line 66 of file G4Hdf5RNtupleManager.hh.

Referenced by ReadNtupleImpl(), and SetFileManager().

◆ fFirstId

G4int G4BaseAnalysisManager::fFirstId { 0 }
protectedinherited

◆ fkClass

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

Definition at line 63 of file G4Hdf5RNtupleManager.hh.

Referenced by GetTNtupleRow().

◆ fLockFirstId

G4bool G4BaseAnalysisManager::fLockFirstId { false }
protectedinherited

◆ fNtupleDescriptionVector

std::vector<G4TRNtupleDescription<tools::hdf5::ntuple >*> G4TRNtupleManager< tools::hdf5::ntuple >::fNtupleDescriptionVector
privateinherited

Definition at line 118 of file G4TRNtupleManager.hh.

◆ fState

const G4AnalysisManagerState& G4BaseAnalysisManager::fState
protectedinherited

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