File indexing completed on 2025-01-18 09:59:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifndef G4TRNtupleManager_h
0032 #define G4TRNtupleManager_h 1
0033
0034 #include "G4BaseRNtupleManager.hh"
0035 #include "G4TRNtupleDescription.hh"
0036 #include "globals.hh"
0037
0038 #include <vector>
0039 #include <string_view>
0040
0041 template <typename NT>
0042 class G4TRNtupleManager : public G4BaseRNtupleManager
0043 {
0044 public:
0045 G4TRNtupleManager() = delete;
0046
0047 protected:
0048 explicit G4TRNtupleManager(const G4AnalysisManagerState& state);
0049 ~G4TRNtupleManager() override;
0050
0051
0052 G4bool IsEmpty() const;
0053 G4bool Reset();
0054
0055
0056 NT* GetNtuple() const;
0057 NT* GetNtuple(G4int ntupleId) const;
0058
0059
0060
0061
0062 G4int SetNtuple(G4TRNtupleDescription<NT>* rntupleDescription);
0063
0064
0065 using G4BaseRNtupleManager::SetNtupleIColumn;
0066 using G4BaseRNtupleManager::SetNtupleFColumn;
0067 using G4BaseRNtupleManager::SetNtupleDColumn;
0068 using G4BaseRNtupleManager::SetNtupleSColumn;
0069
0070
0071 G4bool SetNtupleIColumn(G4int ntupleId, const G4String& columnName, G4int& value) final;
0072 G4bool SetNtupleFColumn(G4int ntupleId, const G4String& columnName, G4float& value) final;
0073 G4bool SetNtupleDColumn(G4int ntupleId, const G4String& columnName, G4double& value) final;
0074 G4bool SetNtupleSColumn(G4int ntupleId, const G4String& columnName, G4String& value) final;
0075
0076
0077 G4bool SetNtupleIColumn(
0078 G4int ntupleId, const G4String& columnName, std::vector<G4int>& vector) override;
0079 G4bool SetNtupleFColumn(
0080 G4int ntupleId, const G4String& columnName, std::vector<G4float>& vector) override;
0081 G4bool SetNtupleDColumn(
0082 G4int ntupleId, const G4String& columnName, std::vector<G4double>& vector) override;
0083 G4bool SetNtupleSColumn(
0084 G4int ntupleId, const G4String& columnName, std::vector<std::string>& vector) override;
0085
0086 using G4BaseRNtupleManager::GetNtupleRow;
0087 G4bool GetNtupleRow(G4int ntupleId) final;
0088
0089
0090 G4int GetNofNtuples() const final;
0091
0092
0093 G4TRNtupleDescription<NT>* GetNtupleDescriptionInFunction(G4int id,
0094 std::string_view function,
0095 G4bool warn = true) const;
0096
0097 private:
0098
0099
0100 virtual G4bool GetTNtupleRow(G4TRNtupleDescription<NT>* rntupleDescription) = 0;
0101
0102
0103
0104 template <typename T>
0105 G4bool SetNtupleTColumn(G4int ntupleId, const G4String& name,
0106 T& value);
0107
0108 template <typename T>
0109 G4bool SetNtupleTColumn(G4int ntupleId, const G4String& name,
0110 std::vector<T>& vector);
0111
0112
0113 static constexpr std::string_view fkClass { "G4TRNtupleManager<NT>" };
0114
0115
0116 std::vector<G4TRNtupleDescription<NT>*> fNtupleDescriptionVector;
0117 };
0118
0119 #include "G4TRNtupleManager.icc"
0120
0121 #endif
0122