File indexing completed on 2025-01-18 09:59:25
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 G4VNtupleFileManager_h
0032 #define G4VNtupleFileManager_h 1
0033
0034 #include "G4AnalysisManagerState.hh"
0035 #include "globals.hh"
0036
0037 #include <memory>
0038 #include <string_view>
0039 #include <utility>
0040
0041 class G4VNtupleManager;
0042 class G4NtupleBookingManager;
0043
0044 enum class G4NtupleMergeMode {
0045 kNone,
0046 kMain,
0047 kSlave
0048 };
0049
0050 class G4VNtupleFileManager
0051 {
0052
0053
0054 friend class G4VAnalysisManager;
0055
0056 public:
0057 G4VNtupleFileManager(const G4AnalysisManagerState& state, G4String fileType);
0058 G4VNtupleFileManager() = delete;
0059 virtual ~G4VNtupleFileManager() = default;
0060
0061
0062 G4VNtupleFileManager(const G4VNtupleFileManager& rhs) = delete;
0063 G4VNtupleFileManager& operator=(const G4VNtupleFileManager& rhs) = delete;
0064
0065
0066 virtual void SetNtupleMerging(G4bool mergeNtuples,
0067 G4int nofReducedNtupleFiles = 0);
0068 virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode = true);
0069 virtual void SetBasketSize(unsigned int basketSize);
0070 virtual void SetBasketEntries(unsigned int basketEntries);
0071
0072 virtual std::shared_ptr<G4VNtupleManager> CreateNtupleManager() = 0;
0073 virtual void SetBookingManager(std::shared_ptr<G4NtupleBookingManager> bookingManager);
0074
0075
0076 virtual G4bool ActionAtOpenFile(const G4String& ) = 0;
0077 virtual G4bool ActionAtWrite() = 0;
0078 virtual G4bool ActionAtCloseFile() = 0;
0079 virtual G4bool Reset() = 0;
0080 virtual G4bool IsNtupleMergingSupported() const;
0081 virtual G4NtupleMergeMode GetMergeMode() const;
0082
0083
0084 G4String GetFileType() const;
0085
0086 protected:
0087
0088 void Message(G4int level,
0089 const G4String& action,
0090 const G4String& objectType,
0091 const G4String& objectName = "",
0092 G4bool success = true) const;
0093
0094
0095 const G4AnalysisManagerState& fState;
0096 G4String fFileType;
0097 std::shared_ptr<G4NtupleBookingManager> fBookingManager { nullptr };
0098
0099 private:
0100
0101 static constexpr std::string_view fkClass { "G4VNtupleFileManager" };
0102 };
0103
0104
0105
0106 inline void G4VNtupleFileManager::SetBookingManager(
0107 std::shared_ptr<G4NtupleBookingManager> bookingManager)
0108 {
0109 fBookingManager = std::move(bookingManager);
0110 }
0111
0112 inline G4bool G4VNtupleFileManager::IsNtupleMergingSupported() const {
0113 return false;
0114 }
0115
0116 inline G4String G4VNtupleFileManager::GetFileType() const {
0117 return fFileType;
0118 }
0119
0120 inline void G4VNtupleFileManager::Message(
0121 G4int level, const G4String& action, const G4String& objectType,
0122 const G4String& objectName, G4bool success) const
0123 {
0124 fState.Message(level, action, objectType, objectName, success);
0125 }
0126
0127 inline G4NtupleMergeMode G4VNtupleFileManager::GetMergeMode() const {
0128 return G4NtupleMergeMode::kNone;
0129 }
0130
0131 #endif