Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MCTSimEvent Class Reference

#include <G4MCTSimEvent.hh>

Public Types

typedef G4MCTSimParticleContainer::iterator particle_iterator
 
typedef G4MCTSimParticleContainer::const_iterator particle_const_iterator
 
typedef G4MCTSimVertexContainer::iterator vertex_iterator
 
typedef G4MCTSimVertexContainer::const_iterator vertex_const_iterator
 

Public Member Functions

 G4MCTSimEvent ()
 
 ~G4MCTSimEvent ()
 
 G4MCTSimEvent (const G4MCTSimEvent &right)
 
const G4MCTSimEventoperator= (const G4MCTSimEvent &right)
 
G4bool AddParticle (const G4MCTSimParticle *aparticle)
 
int GetNofParticles () const
 
int GetNofVertices () const
 
int GetNofStoredParticles () const
 
int GetNofStoredVertices () const
 
G4MCTSimParticleFindParticle (int tid) const
 
G4MCTSimVertexGetVertex (int vid) const
 
void BuildVertexContainer ()
 
void ClearEvent ()
 
void Print (std::ostream &ostr=std::cout) const
 
particle_iterator particles_begin ()
 
particle_iterator particles_end ()
 
particle_const_iterator particles_begin () const
 
particle_const_iterator particles_end () const
 
vertex_iterator vertices_begin ()
 
vertex_iterator vertices_end ()
 
vertex_const_iterator vertices_begin () const
 
vertex_const_iterator vertices_end () const
 

Protected Attributes

G4MCTSimParticleContainer particleMap
 
G4MCTSimVertexContainer vertexVec
 

Detailed Description

Definition at line 48 of file G4MCTSimEvent.hh.

Member Typedef Documentation

◆ particle_const_iterator

typedef G4MCTSimParticleContainer::const_iterator G4MCTSimEvent::particle_const_iterator

Definition at line 76 of file G4MCTSimEvent.hh.

◆ particle_iterator

typedef G4MCTSimParticleContainer::iterator G4MCTSimEvent::particle_iterator

Definition at line 75 of file G4MCTSimEvent.hh.

◆ vertex_const_iterator

typedef G4MCTSimVertexContainer::const_iterator G4MCTSimEvent::vertex_const_iterator

Definition at line 83 of file G4MCTSimEvent.hh.

◆ vertex_iterator

typedef G4MCTSimVertexContainer::iterator G4MCTSimEvent::vertex_iterator

Definition at line 82 of file G4MCTSimEvent.hh.

Constructor & Destructor Documentation

◆ G4MCTSimEvent() [1/2]

G4MCTSimEvent::G4MCTSimEvent ( )

Definition at line 41 of file G4MCTSimEvent.cc.

43{
44}

◆ ~G4MCTSimEvent()

G4MCTSimEvent::~G4MCTSimEvent ( )

Definition at line 47 of file G4MCTSimEvent.cc.

49{
50 ClearEvent();
51}

◆ G4MCTSimEvent() [2/2]

G4MCTSimEvent::G4MCTSimEvent ( const G4MCTSimEvent right)
inline

Definition at line 94 of file G4MCTSimEvent.hh.

95{
96 *this= right;
97}

Member Function Documentation

◆ AddParticle()

G4bool G4MCTSimEvent::AddParticle ( const G4MCTSimParticle aparticle)

Definition at line 54 of file G4MCTSimEvent.cc.

56{
57 G4MCTSimParticle* qpart= const_cast<G4MCTSimParticle*>(aparticle);
58 int trackID= aparticle-> GetTrackID();
59 int nc= particleMap.count(trackID);
60 if(nc==0) {
61 particleMap.insert(std::make_pair(trackID, qpart));
62 return true;
63 } else {
64 return false;
65 }
66
67}
G4MCTSimParticleContainer particleMap

◆ BuildVertexContainer()

void G4MCTSimEvent::BuildVertexContainer ( )

Definition at line 94 of file G4MCTSimEvent.cc.

96{
97 G4MCTSimParticleContainer::iterator itr;
98 int vid=1;
99 for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
100 G4MCTSimVertex* vertex= itr->second-> GetVertex();
101 if(vertex) {
102 if (vertex-> GetID()<0) { // ID not yet assigned
103 vertex-> SetID(vid);
104 vid++;
105 if (vertex) vertexVec.push_back(vertex);
106 }
107 }
108 }
109}
G4MCTSimVertex * GetVertex(int vid) const
G4MCTSimVertexContainer vertexVec

◆ ClearEvent()

void G4MCTSimEvent::ClearEvent ( )

Definition at line 112 of file G4MCTSimEvent.cc.

114{
115 G4MCTSimParticleContainer::iterator itr;
116 for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
117 delete itr->second;
118 }
119 particleMap.clear();
120
121 G4MCTSimVertexContainer::iterator itrv;
122 for(itrv= vertexVec.begin(); itrv!= vertexVec.end(); ++itrv) {
123 delete (*itrv);
124 }
125 vertexVec.clear();
126}

Referenced by ~G4MCTSimEvent().

◆ FindParticle()

G4MCTSimParticle * G4MCTSimEvent::FindParticle ( int  tid) const

Definition at line 70 of file G4MCTSimEvent.cc.

72{
73 G4MCTSimParticleContainer::const_iterator pos= particleMap.find(tid);
74 if(pos != particleMap.end()) {
75 return pos-> second;
76 } else {
77 return 0;
78 }
79}

◆ GetNofParticles()

int G4MCTSimEvent::GetNofParticles ( ) const
inline

Definition at line 106 of file G4MCTSimEvent.hh.

107{
108 return particleMap.size();
109}

◆ GetNofStoredParticles()

int G4MCTSimEvent::GetNofStoredParticles ( ) const

Definition at line 130 of file G4MCTSimEvent.cc.

132{
133 int n=0;
134 G4MCTSimParticleContainer::const_iterator itr;
135 for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
136 if(itr-> second-> GetStoreFlag()) n++;
137 }
138 return n;
139}

◆ GetNofStoredVertices()

int G4MCTSimEvent::GetNofStoredVertices ( ) const

Definition at line 142 of file G4MCTSimEvent.cc.

144{
145 int n=0;
146 G4MCTSimVertexContainer::const_iterator itr;
147 for(itr= vertexVec.begin(); itr!= vertexVec.end(); ++itr) {
148 if((*itr)->GetStoreFlag()) n++;
149 }
150 return n;
151}

◆ GetNofVertices()

int G4MCTSimEvent::GetNofVertices ( ) const
inline

Definition at line 111 of file G4MCTSimEvent.hh.

112{
113 return vertexVec.size();
114}

◆ GetVertex()

G4MCTSimVertex * G4MCTSimEvent::GetVertex ( int  vid) const

Definition at line 82 of file G4MCTSimEvent.cc.

84{
85 int nv= vertexVec.size();
86 if(vid>=1 && vid<=nv) {
87 return vertexVec[vid-1];
88 } else {
89 return 0;
90 }
91}

Referenced by BuildVertexContainer().

◆ operator=()

const G4MCTSimEvent & G4MCTSimEvent::operator= ( const G4MCTSimEvent right)
inline

Definition at line 99 of file G4MCTSimEvent.hh.

100{
101 particleMap= right.particleMap; // shallow copy
102
103 return *this;
104}

◆ particles_begin() [1/2]

G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_begin ( )
inline

Definition at line 117 of file G4MCTSimEvent.hh.

118{ return particleMap.begin(); }

◆ particles_begin() [2/2]

G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_begin ( ) const
inline

Definition at line 124 of file G4MCTSimEvent.hh.

125{ return particleMap.begin(); }

◆ particles_end() [1/2]

G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_end ( )
inline

Definition at line 120 of file G4MCTSimEvent.hh.

121{ return particleMap.end(); }

◆ particles_end() [2/2]

G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_end ( ) const
inline

Definition at line 127 of file G4MCTSimEvent.hh.

128{ return particleMap.end(); }

◆ Print()

void G4MCTSimEvent::Print ( std::ostream &  ostr = std::cout) const

Definition at line 155 of file G4MCTSimEvent.cc.

157{
158 ostr << "____________________________________________________"
159 "____________________________" << G4endl;
160 ostr << "SimEvent:" << G4endl << G4endl;
161 ostr << "Current Memory Usage: "
162 << particleMap.size() << " particles, "
163 << vertexVec.size() << " vertices."
164 << G4endl;
165 ostr << "trk#<ptrk#: P(Px(GeV), Py, Pz, E ) @PDG %proc\n"
166 << " vtx#- X( X(mm), Y, Z, T(ns)) @vname-#"
167 << G4endl;
168 ostr << "____________________________________________________"
169 "____________________________" << G4endl;
170
171 G4MCTSimParticleContainer::const_iterator itr;
172 for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
173 itr-> second-> PrintSingle(ostr);
174 }
175 ostr << "____________________________________________________"
176 "____________________________" << G4endl;
177}
#define G4endl
Definition: G4ios.hh:52

◆ vertices_begin() [1/2]

G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_begin ( )
inline

Definition at line 130 of file G4MCTSimEvent.hh.

131{ return vertexVec.begin(); }

◆ vertices_begin() [2/2]

G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_begin ( ) const
inline

Definition at line 136 of file G4MCTSimEvent.hh.

137{ return vertexVec.begin(); }

◆ vertices_end() [1/2]

G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_end ( )
inline

Definition at line 133 of file G4MCTSimEvent.hh.

134{ return vertexVec.end(); }

◆ vertices_end() [2/2]

G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_end ( ) const
inline

Definition at line 139 of file G4MCTSimEvent.hh.

140{ return vertexVec.end(); }

Member Data Documentation

◆ particleMap

◆ vertexVec

G4MCTSimVertexContainer G4MCTSimEvent::vertexVec
protected

The documentation for this class was generated from the following files: