Geant4-11
Public Types | Public Member Functions | Protected Attributes
G4MCTSimEvent Class Reference

#include <G4MCTSimEvent.hh>

Public Types

using particle_const_iterator = G4MCTSimParticleContainer::const_iterator
 
using particle_iterator = G4MCTSimParticleContainer::iterator
 
using vertex_const_iterator = G4MCTSimVertexContainer::const_iterator
 
using vertex_iterator = G4MCTSimVertexContainer::iterator
 

Public Member Functions

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

Protected Attributes

G4MCTSimParticleContainer particleMap
 
G4MCTSimVertexContainer vertexVec
 

Detailed Description

Definition at line 45 of file G4MCTSimEvent.hh.

Member Typedef Documentation

◆ particle_const_iterator

using G4MCTSimEvent::particle_const_iterator = G4MCTSimParticleContainer::const_iterator

Definition at line 70 of file G4MCTSimEvent.hh.

◆ particle_iterator

using G4MCTSimEvent::particle_iterator = G4MCTSimParticleContainer::iterator

Definition at line 69 of file G4MCTSimEvent.hh.

◆ vertex_const_iterator

using G4MCTSimEvent::vertex_const_iterator = G4MCTSimVertexContainer::const_iterator

Definition at line 77 of file G4MCTSimEvent.hh.

◆ vertex_iterator

using G4MCTSimEvent::vertex_iterator = G4MCTSimVertexContainer::iterator

Definition at line 76 of file G4MCTSimEvent.hh.

Constructor & Destructor Documentation

◆ G4MCTSimEvent() [1/2]

G4MCTSimEvent::G4MCTSimEvent ( )

Definition at line 37 of file G4MCTSimEvent.cc.

38{
39}

◆ ~G4MCTSimEvent()

G4MCTSimEvent::~G4MCTSimEvent ( )

Definition at line 42 of file G4MCTSimEvent.cc.

43{
44 ClearEvent();
45}

References ClearEvent().

◆ G4MCTSimEvent() [2/2]

G4MCTSimEvent::G4MCTSimEvent ( const G4MCTSimEvent right)
inline

Definition at line 93 of file G4MCTSimEvent.hh.

94{
95 *this = right;
96}

Member Function Documentation

◆ AddParticle()

G4bool G4MCTSimEvent::AddParticle ( const G4MCTSimParticle aparticle)

Definition at line 48 of file G4MCTSimEvent.cc.

50{
51 G4MCTSimParticle* qpart = const_cast<G4MCTSimParticle*>(aparticle);
52 G4int trackID = aparticle->GetTrackID();
53 G4int nc = particleMap.count(trackID);
54 if(nc == 0)
55 {
56 particleMap.insert(std::make_pair(trackID, qpart));
57 return true;
58 }
59 else
60 {
61 return false;
62 }
63}
int G4int
Definition: G4Types.hh:85
G4MCTSimParticleContainer particleMap
G4int GetTrackID() const

References G4MCTSimParticle::GetTrackID(), and particleMap.

◆ BuildVertexContainer()

void G4MCTSimEvent::BuildVertexContainer ( )

Definition at line 94 of file G4MCTSimEvent.cc.

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

References G4MCTSimVertex::GetID(), particleMap, G4MCTSimVertex::SetID(), and vertexVec.

◆ ClearEvent()

void G4MCTSimEvent::ClearEvent ( )

Definition at line 115 of file G4MCTSimEvent.cc.

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

References particleMap, and vertexVec.

Referenced by G4MCTEvent::ClearEvent(), and ~G4MCTSimEvent().

◆ FindParticle()

G4MCTSimParticle * G4MCTSimEvent::FindParticle ( G4int  tid) const

Definition at line 66 of file G4MCTSimEvent.cc.

67{
68 G4MCTSimParticleContainer::const_iterator pos = particleMap.find(tid);
69 if(pos != particleMap.cend())
70 {
71 return pos->second;
72 }
73 else
74 {
75 return nullptr;
76 }
77}
static const G4double pos

References particleMap, and pos.

◆ GetNofParticles()

G4int G4MCTSimEvent::GetNofParticles ( ) const
inline

Definition at line 105 of file G4MCTSimEvent.hh.

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

References particleMap.

◆ GetNofStoredParticles()

G4int G4MCTSimEvent::GetNofStoredParticles ( ) const

Definition at line 133 of file G4MCTSimEvent.cc.

134{
135 G4int n = 0;
136 G4MCTSimParticleContainer::const_iterator itr;
137 for(itr = particleMap.cbegin(); itr != particleMap.cend(); ++itr)
138 {
139 if(itr->second->GetStoreFlag())
140 ++n;
141 }
142 return n;
143}

References CLHEP::detail::n, and particleMap.

◆ GetNofStoredVertices()

G4int G4MCTSimEvent::GetNofStoredVertices ( ) const

Definition at line 146 of file G4MCTSimEvent.cc.

147{
148 G4int n = 0;
149 G4MCTSimVertexContainer::const_iterator itr;
150 for(itr = vertexVec.cbegin(); itr != vertexVec.cend(); ++itr)
151 {
152 if((*itr)->GetStoreFlag())
153 ++n;
154 }
155 return n;
156}

References CLHEP::detail::n, and vertexVec.

◆ GetNofVertices()

G4int G4MCTSimEvent::GetNofVertices ( ) const
inline

Definition at line 110 of file G4MCTSimEvent.hh.

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

References vertexVec.

◆ GetVertex()

G4MCTSimVertex * G4MCTSimEvent::GetVertex ( G4int  vid) const

Definition at line 80 of file G4MCTSimEvent.cc.

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

References vertexVec.

◆ operator=()

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

Definition at line 98 of file G4MCTSimEvent.hh.

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

References particleMap.

◆ particles_begin() [1/2]

G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_begin ( )
inline

Definition at line 116 of file G4MCTSimEvent.hh.

117{
118 return particleMap.begin();
119}

References particleMap.

◆ particles_begin() [2/2]

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

Definition at line 126 of file G4MCTSimEvent.hh.

128{
129 return particleMap.cbegin();
130}

References particleMap.

◆ particles_end() [1/2]

G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_end ( )
inline

Definition at line 121 of file G4MCTSimEvent.hh.

122{
123 return particleMap.end();
124}

References particleMap.

◆ particles_end() [2/2]

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

Definition at line 132 of file G4MCTSimEvent.hh.

134{
135 return particleMap.cend();
136}

References particleMap.

◆ Print()

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

Definition at line 159 of file G4MCTSimEvent.cc.

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

References G4endl, particleMap, and vertexVec.

Referenced by G4MCTEvent::Print().

◆ vertices_begin() [1/2]

G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_begin ( )
inline

Definition at line 138 of file G4MCTSimEvent.hh.

139{
140 return vertexVec.begin();
141}

References vertexVec.

◆ vertices_begin() [2/2]

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

Definition at line 148 of file G4MCTSimEvent.hh.

150{
151 return vertexVec.cbegin();
152}

References vertexVec.

◆ vertices_end() [1/2]

G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_end ( )
inline

Definition at line 143 of file G4MCTSimEvent.hh.

144{
145 return vertexVec.end();
146}

References vertexVec.

◆ vertices_end() [2/2]

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

Definition at line 154 of file G4MCTSimEvent.hh.

155{
156 return vertexVec.cend();
157}

References vertexVec.

Field Documentation

◆ particleMap

G4MCTSimParticleContainer G4MCTSimEvent::particleMap
protected

◆ vertexVec

G4MCTSimVertexContainer G4MCTSimEvent::vertexVec
protected

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