Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

typedef G4MCTSimParticleContainer::const_iterator G4MCTSimEvent::particle_const_iterator

Definition at line 76 of file G4MCTSimEvent.hh.

typedef G4MCTSimParticleContainer::iterator G4MCTSimEvent::particle_iterator

Definition at line 75 of file G4MCTSimEvent.hh.

typedef G4MCTSimVertexContainer::const_iterator G4MCTSimEvent::vertex_const_iterator

Definition at line 83 of file G4MCTSimEvent.hh.

typedef G4MCTSimVertexContainer::iterator G4MCTSimEvent::vertex_iterator

Definition at line 82 of file G4MCTSimEvent.hh.

Constructor & Destructor Documentation

G4MCTSimEvent::G4MCTSimEvent ( )

Definition at line 41 of file G4MCTSimEvent.cc.

43 {
44 }
G4MCTSimEvent::~G4MCTSimEvent ( )

Definition at line 47 of file G4MCTSimEvent.cc.

49 {
50  ClearEvent();
51 }

Here is the call graph for this function:

G4MCTSimEvent::G4MCTSimEvent ( const G4MCTSimEvent right)
inline

Definition at line 94 of file G4MCTSimEvent.hh.

95 {
96  *this= right;
97 }

Member Function Documentation

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
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 }
G4MCTSimVertexContainer vertexVec
G4MCTSimParticleContainer particleMap
G4MCTSimVertex * GetVertex(int vid) const

Here is the call graph for this function:

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 }
G4MCTSimVertexContainer vertexVec
G4MCTSimParticleContainer particleMap

Here is the caller graph for this function:

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 }
static constexpr double second
Definition: G4SIunits.hh:157
G4MCTSimParticleContainer particleMap
static const G4double pos
int G4MCTSimEvent::GetNofParticles ( ) const
inline

Definition at line 106 of file G4MCTSimEvent.hh.

107 {
108  return particleMap.size();
109 }
G4MCTSimParticleContainer particleMap
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 }
static constexpr double second
Definition: G4SIunits.hh:157
G4MCTSimParticleContainer particleMap
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 }
G4MCTSimVertexContainer vertexVec
int G4MCTSimEvent::GetNofVertices ( ) const
inline

Definition at line 111 of file G4MCTSimEvent.hh.

112 {
113  return vertexVec.size();
114 }
G4MCTSimVertexContainer vertexVec
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 }
G4MCTSimVertexContainer vertexVec

Here is the caller graph for this function:

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 }
G4MCTSimParticleContainer particleMap
G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_begin ( )
inline

Definition at line 117 of file G4MCTSimEvent.hh.

118 { return particleMap.begin(); }
G4MCTSimParticleContainer particleMap
G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_begin ( ) const
inline

Definition at line 124 of file G4MCTSimEvent.hh.

125 { return particleMap.begin(); }
G4MCTSimParticleContainer particleMap
G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_end ( )
inline

Definition at line 120 of file G4MCTSimEvent.hh.

121 { return particleMap.end(); }
G4MCTSimParticleContainer particleMap
G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_end ( ) const
inline

Definition at line 127 of file G4MCTSimEvent.hh.

128 { return particleMap.end(); }
G4MCTSimParticleContainer particleMap
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 }
static constexpr double second
Definition: G4SIunits.hh:157
G4MCTSimVertexContainer vertexVec
G4MCTSimParticleContainer particleMap
#define G4endl
Definition: G4ios.hh:61
G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_begin ( )
inline

Definition at line 130 of file G4MCTSimEvent.hh.

131 { return vertexVec.begin(); }
G4MCTSimVertexContainer vertexVec
G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_begin ( ) const
inline

Definition at line 136 of file G4MCTSimEvent.hh.

137 { return vertexVec.begin(); }
G4MCTSimVertexContainer vertexVec
G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_end ( )
inline

Definition at line 133 of file G4MCTSimEvent.hh.

134 { return vertexVec.end(); }
G4MCTSimVertexContainer vertexVec
G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_end ( ) const
inline

Definition at line 139 of file G4MCTSimEvent.hh.

140 { return vertexVec.end(); }
G4MCTSimVertexContainer vertexVec

Member Data Documentation

G4MCTSimParticleContainer G4MCTSimEvent::particleMap
protected

Definition at line 50 of file G4MCTSimEvent.hh.

G4MCTSimVertexContainer G4MCTSimEvent::vertexVec
protected

Definition at line 51 of file G4MCTSimEvent.hh.


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