File indexing completed on 2025-01-18 09:59:03
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
0032 #ifndef G4RootNtupleManager_h
0033 #define G4RootNtupleManager_h 1
0034
0035 #include "G4TNtupleManager.hh"
0036 #include "G4RootFileDef.hh"
0037 #include "globals.hh"
0038
0039 #include "tools/wroot/ntuple"
0040
0041 #include <string_view>
0042
0043 class G4RootMainNtupleManager;
0044 class G4NtupleBookingManager;
0045 class G4RootFileManager;
0046
0047
0048 using RootNtupleDescription = G4TNtupleDescription<tools::wroot::ntuple, G4RootFile>;
0049
0050
0051
0052 template <>
0053 template <>
0054 G4bool G4TNtupleManager<tools::wroot::ntuple, G4RootFile>::FillNtupleTColumn(
0055 G4int ntupleId, G4int columnId, const std::string& value);
0056
0057
0058 class G4RootNtupleManager : public G4TNtupleManager<tools::wroot::ntuple,
0059 G4RootFile>
0060 {
0061 friend class G4RootAnalysisManager;
0062 friend class G4RootMainNtupleManager;
0063 friend class G4RootNtupleFileManager;
0064 friend class G4RootMpiNtupleFileManager;
0065 friend class G4RootMpiNtupleManager;
0066
0067 public:
0068 G4RootNtupleManager(const G4AnalysisManagerState& state,
0069 const std::shared_ptr<G4NtupleBookingManager>& bookingManger,
0070 G4int nofMainManagers, G4int nofReducedFiles,
0071 G4bool rowWise, G4bool rowMode);
0072 G4RootNtupleManager() = delete;
0073 ~G4RootNtupleManager() override = default;
0074
0075 private:
0076
0077 void CreateTNtupleFromBooking(RootNtupleDescription* ntupleDescription) final;
0078 void FinishTNtuple(RootNtupleDescription* ntupleDescription, G4bool fromBooking) final;
0079 G4bool Reset() final;
0080 void Clear() final;
0081 G4bool Delete(G4int id) final;
0082 virtual G4bool Merge();
0083
0084
0085 void SetFileManager(const std::shared_ptr<G4RootFileManager>& fileManager);
0086 void SetNtupleFile(std::shared_ptr<G4RootFile> file);
0087 void SetNtupleRowWise(G4bool rowWise, G4bool rowMode);
0088
0089
0090 void SetNewCycle(G4bool value) final;
0091
0092
0093 const std::vector<RootNtupleDescription*>& GetNtupleDescriptionVector() const;
0094 std::shared_ptr<G4RootMainNtupleManager> GetMainNtupleManager(G4int index) const;
0095 unsigned int GetBasketSize() const;
0096 unsigned int GetBasketEntries() const;
0097
0098
0099 static constexpr std::string_view fkClass { "G4RootNtupleManager" };
0100
0101
0102 std::shared_ptr<G4RootFileManager> fFileManager { nullptr };
0103 std::vector<std::shared_ptr<G4RootMainNtupleManager>> fMainNtupleManagers;
0104 std::shared_ptr<G4RootFile> fNtupleFile { nullptr };
0105 G4bool fRowWise;
0106 G4bool fRowMode;
0107 };
0108
0109 #include "G4RootNtupleManager.icc"
0110
0111 #endif
0112
0113