File indexing completed on 2025-01-18 09:58:39
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 #ifndef G4MCTSIMEVENT_HH
0031 #define G4MCTSIMEVENT_HH 1
0032
0033 #include <iostream>
0034 #include <vector>
0035 #include <map>
0036
0037 #include "G4Types.hh"
0038
0039 class G4MCTSimParticle;
0040 class G4MCTSimVertex;
0041
0042 using G4MCTSimParticleContainer = std::map<int, G4MCTSimParticle*>;
0043 using G4MCTSimVertexContainer = std::vector<G4MCTSimVertex*>;
0044
0045 class G4MCTSimEvent
0046 {
0047 public:
0048
0049 G4MCTSimEvent();
0050 ~G4MCTSimEvent();
0051
0052 inline G4MCTSimEvent(const G4MCTSimEvent& right);
0053 inline G4MCTSimEvent& operator=(const G4MCTSimEvent& right);
0054
0055
0056 G4bool AddParticle(const G4MCTSimParticle* aparticle);
0057 inline G4int GetNofParticles() const;
0058 inline G4int GetNofVertices() const;
0059 G4int GetNofStoredParticles() const;
0060 G4int GetNofStoredVertices() const;
0061 G4MCTSimParticle* FindParticle(G4int tid) const;
0062 G4MCTSimVertex* GetVertex(G4int vid) const;
0063
0064 void BuildVertexContainer();
0065 void ClearEvent();
0066 void Print(std::ostream& ostr = std::cout) const;
0067
0068
0069 using particle_iterator = G4MCTSimParticleContainer::iterator;
0070 using particle_const_iterator = G4MCTSimParticleContainer::const_iterator;
0071 inline particle_iterator particles_begin();
0072 inline particle_iterator particles_end();
0073 inline particle_const_iterator particles_begin() const;
0074 inline particle_const_iterator particles_end() const;
0075
0076 using vertex_iterator = G4MCTSimVertexContainer::iterator;
0077 using vertex_const_iterator = G4MCTSimVertexContainer::const_iterator;
0078 inline vertex_iterator vertices_begin();
0079 inline vertex_iterator vertices_end();
0080 inline vertex_const_iterator vertices_begin() const;
0081 inline vertex_const_iterator vertices_end() const;
0082
0083 protected:
0084
0085 G4MCTSimParticleContainer particleMap;
0086 G4MCTSimVertexContainer vertexVec;
0087 };
0088
0089
0090
0091
0092
0093 inline G4MCTSimEvent::G4MCTSimEvent(const G4MCTSimEvent& right)
0094 {
0095 *this = right;
0096 }
0097
0098 inline G4MCTSimEvent& G4MCTSimEvent::operator=(const G4MCTSimEvent& right)
0099 {
0100 particleMap = right.particleMap;
0101
0102 return *this;
0103 }
0104
0105 inline G4int G4MCTSimEvent::GetNofParticles() const
0106 {
0107 return (G4int)particleMap.size();
0108 }
0109
0110 inline G4int G4MCTSimEvent::GetNofVertices() const
0111 {
0112 return (G4int)vertexVec.size();
0113 }
0114
0115
0116 inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_begin()
0117 {
0118 return particleMap.begin();
0119 }
0120
0121 inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_end()
0122 {
0123 return particleMap.end();
0124 }
0125
0126 inline G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_begin()
0127 const
0128 {
0129 return particleMap.cbegin();
0130 }
0131
0132 inline G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_end()
0133 const
0134 {
0135 return particleMap.cend();
0136 }
0137
0138 inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_begin()
0139 {
0140 return vertexVec.begin();
0141 }
0142
0143 inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_end()
0144 {
0145 return vertexVec.end();
0146 }
0147
0148 inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_begin()
0149 const
0150 {
0151 return vertexVec.cbegin();
0152 }
0153
0154 inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_end() const
0155 {
0156 return vertexVec.cend();
0157 }
0158
0159 #endif