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 #ifndef G4RootPNtupleDescription_h
0032 #define G4RootPNtupleDescription_h 1
0033
0034 #include "G4TNtupleDescription.hh"
0035 #include "G4RootFileDef.hh"
0036 #include "globals.hh"
0037
0038 #include "tools/ntuple_booking"
0039 #include "tools/wroot/mt_ntuple_row_wise"
0040 #include "tools/wroot/mt_ntuple_column_wise"
0041
0042 #include <fstream>
0043
0044 namespace tools {
0045 namespace wroot {
0046 class branch;
0047 class ntuple;
0048 }
0049 }
0050
0051 using RootNtupleDescription = G4TNtupleDescription<tools::wroot::ntuple, G4RootFile>;
0052
0053 class G4RootPNtupleDescription
0054 {
0055 public:
0056 G4RootPNtupleDescription(G4NtupleBooking* g4NtupleBooking)
0057 : fDescription(g4NtupleBooking) {}
0058
0059 ~G4RootPNtupleDescription()
0060 {
0061 if ( fDescription.GetIsNtupleOwner() ) delete fNtuple;
0062 }
0063
0064
0065 void SetNtuple(tools::wroot::imt_ntuple* intuple);
0066 void SetBasePNtuple(tools::wroot::base_pntuple* basePNtuple);
0067 void Reset();
0068
0069
0070 RootNtupleDescription& GetDescription();
0071 tools::wroot::imt_ntuple* GetNtuple() const;
0072 tools::wroot::base_pntuple* GetBasePNtuple() const;
0073 std::vector<tools::wroot::branch*>& GetMainBranches();
0074
0075 private:
0076 RootNtupleDescription fDescription;
0077 tools::wroot::imt_ntuple* fNtuple { nullptr };
0078 tools::wroot::base_pntuple* fBasePNtuple { nullptr };
0079 std::vector<tools::wroot::branch*> fMainBranches;
0080 };
0081
0082
0083
0084 inline void G4RootPNtupleDescription::SetNtuple(
0085 tools::wroot::imt_ntuple* intuple)
0086 { fNtuple = intuple; }
0087
0088 inline void G4RootPNtupleDescription::SetBasePNtuple(
0089 tools::wroot::base_pntuple* basePNtuple)
0090 { fBasePNtuple = basePNtuple; }
0091
0092 inline void G4RootPNtupleDescription::Reset()
0093 {
0094 if ( fDescription.GetIsNtupleOwner() ) delete fNtuple;
0095 fNtuple = nullptr;
0096 }
0097
0098 inline RootNtupleDescription&
0099 G4RootPNtupleDescription::GetDescription()
0100 { return fDescription; }
0101
0102 inline tools::wroot::imt_ntuple*
0103 G4RootPNtupleDescription::GetNtuple() const
0104 { return fNtuple; }
0105
0106 inline tools::wroot::base_pntuple*
0107 G4RootPNtupleDescription::GetBasePNtuple() const
0108 { return fBasePNtuple; }
0109
0110 inline std::vector<tools::wroot::branch*>&
0111 G4RootPNtupleDescription::GetMainBranches()
0112 { return fMainBranches; }
0113
0114 #endif