File indexing completed on 2025-01-18 09:59:13
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
0033
0034 #ifndef G4TrackStack_hh
0035 #define G4TrackStack_hh 1
0036
0037 #include <vector>
0038
0039 #include "G4StackedTrack.hh"
0040 #include "G4Types.hh"
0041
0042 class G4SmartTrackStack;
0043
0044 class G4TrackStack : public std::vector<G4StackedTrack>
0045 {
0046 public:
0047
0048 G4TrackStack() = default;
0049 explicit G4TrackStack(std::size_t n)
0050 : safetyValue1(G4int(4*n/5)),
0051 safetyValue2(G4int(4*n/5-100)), nstick(100) { reserve(n); }
0052 ~G4TrackStack();
0053
0054 G4TrackStack& operator=(const G4TrackStack&) = delete;
0055 G4bool operator==(const G4TrackStack&) const = delete;
0056 G4bool operator!=(const G4TrackStack&) const = delete;
0057
0058 inline void PushToStack(const G4StackedTrack& aStackedTrack)
0059 {
0060 push_back(aStackedTrack);
0061 if(size()>maxEntry) maxEntry = size();
0062 }
0063 inline G4StackedTrack PopFromStack()
0064 { G4StackedTrack st = back(); pop_back(); return st; }
0065 void TransferTo(G4TrackStack* aStack);
0066 void TransferTo(G4SmartTrackStack* aStack);
0067
0068 void clearAndDestroy();
0069
0070 inline std::size_t GetNTrack() const { return size(); }
0071 inline std::size_t GetMaxNTrack() const { return maxEntry; }
0072 inline G4int GetSafetyValue1() const { return safetyValue1; }
0073 inline G4int GetSafetyValue2() const { return safetyValue2; }
0074 inline G4int GetNStick() const { return nstick; }
0075
0076 G4double getTotalEnergy() const;
0077 inline void SetSafetyValue2(G4int x) { safetyValue2 = x < 0 ? 0 : x; }
0078
0079 private:
0080
0081 G4int safetyValue1{0};
0082 G4int safetyValue2{0};
0083 G4int nstick{0};
0084 std::size_t maxEntry{0};
0085 };
0086
0087 #endif