Warning, file /include/Geant4/G4SubEvent.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 G4SubEvent_hh
0033 #define G4SubEvent_hh 1
0034
0035 #include <vector>
0036
0037 class G4Event;
0038
0039 #include "globals.hh"
0040 #include "evtdefs.hh"
0041 #include "G4Allocator.hh"
0042 #include "G4StackedTrack.hh"
0043 #include "G4Types.hh"
0044
0045 class G4SubEvent : public std::vector<G4StackedTrack>
0046 {
0047 public:
0048
0049 G4SubEvent() = default;
0050 explicit G4SubEvent(G4int ty, std::size_t maxEnt)
0051 : fSubEventType(ty), fMaxEnt(maxEnt) {;}
0052 ~G4SubEvent();
0053
0054 G4SubEvent& operator=(const G4SubEvent&) = delete;
0055
0056 inline void *operator new(std::size_t);
0057 inline void operator delete(void* anEvent);
0058
0059 G4bool operator==(const G4SubEvent&) const = delete;
0060 G4bool operator!=(const G4SubEvent&) const = delete;
0061
0062 inline void PushToStack(const G4StackedTrack& aStackedTrack)
0063 { push_back(aStackedTrack); }
0064 G4StackedTrack PopFromStack();
0065
0066 void clearAndDestroy();
0067
0068 inline G4int GetSubEventType() const { return fSubEventType; }
0069 inline std::size_t GetNTrack() const { return size(); }
0070 inline std::size_t GetMaxNTrack() const { return fMaxEnt; }
0071
0072 G4double getTotalEnergy() const;
0073
0074
0075 inline void SetEvent(G4Event* evt) { fpEvent = evt; }
0076 inline G4Event* GetEvent() const { return fpEvent; }
0077
0078
0079
0080 inline void SetCompleted(G4bool val=true) const { fCompleted = val; }
0081 inline G4bool IsCompleted() const { return fCompleted; }
0082
0083 private:
0084
0085 G4int fSubEventType = -1;
0086 std::size_t fMaxEnt = 1000;
0087 G4Event* fpEvent = nullptr;
0088 mutable G4bool fCompleted = false;
0089
0090 };
0091
0092 extern G4EVENT_DLL G4Allocator<G4SubEvent>*& aSubEventAllocator();
0093
0094 inline void* G4SubEvent::operator new(std::size_t)
0095 {
0096 if (aSubEventAllocator() == nullptr)
0097 {
0098 aSubEventAllocator() = new G4Allocator<G4SubEvent>;
0099 }
0100 return (void*)aSubEventAllocator()->MallocSingle();
0101 }
0102
0103 inline void G4SubEvent::operator delete(void* aSubEvent)
0104 {
0105 aSubEventAllocator()->FreeSingle((G4SubEvent*)aSubEvent);
0106 }
0107
0108 #endif