File indexing completed on 2025-01-18 09:58:05
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 G4CsvNtupleManager_h
0032 #define G4CsvNtupleManager_h 1
0033
0034 #include "G4TNtupleManager.hh"
0035 #include "globals.hh"
0036
0037 #include "tools/wcsv_ntuple"
0038
0039 #include <memory>
0040 #include <string_view>
0041 #include <utility>
0042
0043
0044 using CsvNtupleDescription = G4TNtupleDescription<tools::wcsv::ntuple, std::ofstream>;
0045
0046 class G4CsvFileManager;
0047
0048 class G4CsvNtupleManager : public G4TNtupleManager<tools::wcsv::ntuple,
0049 std::ofstream>
0050 {
0051 friend class G4CsvAnalysisManager;
0052 friend class G4CsvNtupleFileManager;
0053
0054 public:
0055 explicit G4CsvNtupleManager(const G4AnalysisManagerState& state);
0056 G4CsvNtupleManager() = delete;
0057 ~G4CsvNtupleManager() override = default;
0058
0059 private:
0060
0061
0062
0063 void SetFileManager(std::shared_ptr<G4CsvFileManager> fileManager);
0064
0065
0066 const std::vector<CsvNtupleDescription*>& GetNtupleDescriptionVector() const;
0067
0068 void SetIsCommentedHeader(G4bool isCommentedHeader);
0069 void SetIsHippoHeader(G4bool isHippoHeader);
0070
0071
0072
0073 void CreateTNtupleFromBooking(CsvNtupleDescription* ntupleDescription) final;
0074
0075 void FinishTNtuple(CsvNtupleDescription* ntupleDescription, G4bool fromBooking) final;
0076
0077 G4bool WriteHeader(tools::wcsv::ntuple* ntuple) const;
0078
0079
0080 static constexpr std::string_view fkClass { "G4CsvNtupleManager" };
0081
0082
0083 std::shared_ptr<G4CsvFileManager> fFileManager { nullptr };
0084 G4bool fIsCommentedHeader { true };
0085 G4bool fIsHippoHeader { false };
0086 };
0087
0088
0089
0090 inline void
0091 G4CsvNtupleManager::SetFileManager(std::shared_ptr<G4CsvFileManager> fileManager)
0092 {
0093 fFileManager = std::move(fileManager);
0094 }
0095
0096 inline const std::vector<G4TNtupleDescription<tools::wcsv::ntuple, std::ofstream>*>&
0097 G4CsvNtupleManager::GetNtupleDescriptionVector() const
0098 { return fNtupleDescriptionVector; }
0099
0100 inline void G4CsvNtupleManager::SetIsCommentedHeader(G4bool isCommentedHeader)
0101 { fIsCommentedHeader = isCommentedHeader; }
0102
0103 inline void G4CsvNtupleManager::SetIsHippoHeader(G4bool isHippoHeader)
0104 { fIsHippoHeader = isHippoHeader; }
0105
0106 #endif