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 G4MCTSimEvent & operator= (const G4MCTSimEvent &right)
G4bool AddParticle (const G4MCTSimParticle *aparticle)
int GetNofParticles () const
int GetNofVertices () const
int GetNofStoredParticles () const
int GetNofStoredVertices () const
G4MCTSimParticle * FindParticle (int tid) const
G4MCTSimVertex * GetVertex (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.

00043 {
00044 }

G4MCTSimEvent::~G4MCTSimEvent (  ) 

Definition at line 47 of file G4MCTSimEvent.cc.

References ClearEvent().

00049 {
00050   ClearEvent();
00051 }

G4MCTSimEvent::G4MCTSimEvent ( const G4MCTSimEvent &  right  )  [inline]

Definition at line 94 of file G4MCTSimEvent.hh.

00095 {
00096   *this= right;
00097 }


Member Function Documentation

G4bool G4MCTSimEvent::AddParticle ( const G4MCTSimParticle *  aparticle  ) 

Definition at line 54 of file G4MCTSimEvent.cc.

References particleMap.

00056 {
00057   G4MCTSimParticle* qpart= const_cast<G4MCTSimParticle*>(aparticle);
00058   int trackID= aparticle-> GetTrackID();
00059   int nc= particleMap.count(trackID);
00060   if(nc==0) {
00061     particleMap.insert(std::make_pair(trackID, qpart));
00062     return true;
00063   } else {
00064     return false;
00065   }
00066 
00067 }

void G4MCTSimEvent::BuildVertexContainer (  ) 

Definition at line 94 of file G4MCTSimEvent.cc.

References GetVertex(), particleMap, and vertexVec.

00096 {
00097   G4MCTSimParticleContainer::iterator itr;
00098   int vid=1;
00099   for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
00100     G4MCTSimVertex* vertex= itr->second-> GetVertex();    
00101     if(vertex) {      
00102       if (vertex-> GetID()<0) { // ID not yet assigned
00103         vertex-> SetID(vid);
00104         vid++;
00105         if (vertex) vertexVec.push_back(vertex);
00106       }
00107     }
00108   }
00109 }

void G4MCTSimEvent::ClearEvent (  ) 

Definition at line 112 of file G4MCTSimEvent.cc.

References particleMap, and vertexVec.

Referenced by ~G4MCTSimEvent().

00114 {
00115   G4MCTSimParticleContainer::iterator itr;
00116   for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
00117     delete itr->second;
00118   }
00119   particleMap.clear();
00120 
00121   G4MCTSimVertexContainer::iterator itrv;
00122   for(itrv= vertexVec.begin(); itrv!= vertexVec.end(); ++itrv) {
00123     delete (*itrv);
00124   }
00125   vertexVec.clear();
00126 }

G4MCTSimParticle * G4MCTSimEvent::FindParticle ( int  tid  )  const

Definition at line 70 of file G4MCTSimEvent.cc.

00072 {
00073   G4MCTSimParticleContainer::const_iterator pos= particleMap.find(tid);
00074   if(pos != particleMap.end()) {
00075     return pos-> second;
00076   } else {
00077     return 0;
00078   }
00079 }

int G4MCTSimEvent::GetNofParticles (  )  const [inline]

Definition at line 106 of file G4MCTSimEvent.hh.

References particleMap.

00107 {
00108   return particleMap.size();
00109 }

int G4MCTSimEvent::GetNofStoredParticles (  )  const

Definition at line 130 of file G4MCTSimEvent.cc.

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

00132 {
00133   int n=0;
00134   G4MCTSimParticleContainer::const_iterator itr;
00135   for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
00136     if(itr-> second->  GetStoreFlag()) n++;
00137   }
00138   return n;
00139 }

int G4MCTSimEvent::GetNofStoredVertices (  )  const

Definition at line 142 of file G4MCTSimEvent.cc.

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

00144 {
00145  int n=0;
00146   G4MCTSimVertexContainer::const_iterator itr;
00147   for(itr= vertexVec.begin(); itr!= vertexVec.end(); ++itr) {
00148     if((*itr)->GetStoreFlag()) n++;
00149   }
00150   return n;
00151 }

int G4MCTSimEvent::GetNofVertices (  )  const [inline]

Definition at line 111 of file G4MCTSimEvent.hh.

References vertexVec.

00112 {
00113   return vertexVec.size();
00114 }

G4MCTSimVertex * G4MCTSimEvent::GetVertex ( int  vid  )  const

Definition at line 82 of file G4MCTSimEvent.cc.

Referenced by BuildVertexContainer().

00084 {
00085   int nv= vertexVec.size();
00086   if(vid>=1 && vid<=nv) {
00087     return vertexVec[vid-1];
00088   } else {
00089     return 0;
00090   }
00091 }

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

Definition at line 99 of file G4MCTSimEvent.hh.

References particleMap.

00100 {
00101   particleMap= right.particleMap; // shallow copy
00102 
00103   return *this;
00104 }

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

Definition at line 124 of file G4MCTSimEvent.hh.

References particleMap.

00125 { return particleMap.begin(); }

G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_begin (  )  [inline]

Definition at line 117 of file G4MCTSimEvent.hh.

References particleMap.

00118 { return particleMap.begin(); }

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

Definition at line 127 of file G4MCTSimEvent.hh.

References particleMap.

00128 { return particleMap.end(); }

G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_end (  )  [inline]

Definition at line 120 of file G4MCTSimEvent.hh.

References particleMap.

00121 { return particleMap.end(); }

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

Definition at line 155 of file G4MCTSimEvent.cc.

References G4endl.

00157 {
00158   ostr << "____________________________________________________"
00159           "____________________________" << G4endl;
00160   ostr << "SimEvent:" << G4endl << G4endl;
00161   ostr << "Current Memory Usage: " 
00162        << particleMap.size() << " particles, "
00163        << vertexVec.size() <<  " vertices."
00164        << G4endl;                                     
00165   ostr << "trk#<ptrk#: P(Px(GeV),     Py,     Pz,     E ) @PDG     %proc\n"
00166        << "      vtx#- X(    X(mm),        Y,        Z,    T(ns)) @vname-#" 
00167        << G4endl;
00168   ostr << "____________________________________________________"
00169           "____________________________" << G4endl;
00170 
00171   G4MCTSimParticleContainer::const_iterator itr;
00172   for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
00173     itr-> second-> PrintSingle(ostr);
00174   }
00175   ostr << "____________________________________________________"
00176           "____________________________" << G4endl;
00177 }

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

Definition at line 136 of file G4MCTSimEvent.hh.

References vertexVec.

00137 { return vertexVec.begin(); }

G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_begin (  )  [inline]

Definition at line 130 of file G4MCTSimEvent.hh.

References vertexVec.

00131 { return vertexVec.begin(); }

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

Definition at line 139 of file G4MCTSimEvent.hh.

References vertexVec.

00140 { return vertexVec.end(); }

G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_end (  )  [inline]

Definition at line 133 of file G4MCTSimEvent.hh.

References vertexVec.

00134 { return vertexVec.end(); }


Field Documentation

G4MCTSimParticleContainer G4MCTSimEvent::particleMap [protected]

Definition at line 50 of file G4MCTSimEvent.hh.

Referenced by AddParticle(), BuildVertexContainer(), ClearEvent(), GetNofParticles(), GetNofStoredParticles(), operator=(), particles_begin(), and particles_end().

G4MCTSimVertexContainer G4MCTSimEvent::vertexVec [protected]

Definition at line 51 of file G4MCTSimEvent.hh.

Referenced by BuildVertexContainer(), ClearEvent(), GetNofStoredVertices(), GetNofVertices(), vertices_begin(), and vertices_end().


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:28 2013 for Geant4 by  doxygen 1.4.7