00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // G4MCTSimEvent.hh 00027 // 00028 // ==================================================================== 00029 #ifndef MCT_SIM_EVENT_H 00030 #define MCT_SIM_EVENT_H 00031 00032 #include "G4Types.hh" 00033 #include <iostream> 00034 #include <vector> 00035 #include <map> 00036 00037 // ==================================================================== 00038 // 00039 // class definition 00040 // 00041 // ==================================================================== 00042 class G4MCTSimParticle; 00043 class G4MCTSimVertex; 00044 00045 typedef std::map<int, G4MCTSimParticle*> G4MCTSimParticleContainer; 00046 typedef std::vector<G4MCTSimVertex*> G4MCTSimVertexContainer; 00047 00048 class G4MCTSimEvent { 00049 protected: 00050 G4MCTSimParticleContainer particleMap; 00051 G4MCTSimVertexContainer vertexVec; 00052 00053 public: 00054 G4MCTSimEvent(); 00055 ~G4MCTSimEvent(); 00056 00057 // copy constructor and assignment operator 00058 G4MCTSimEvent(const G4MCTSimEvent& right); 00059 const G4MCTSimEvent& operator=(const G4MCTSimEvent& right); 00060 00061 // methods... 00062 G4bool AddParticle(const G4MCTSimParticle* aparticle); 00063 int GetNofParticles() const; 00064 int GetNofVertices() const; 00065 int GetNofStoredParticles() const; 00066 int GetNofStoredVertices() const; 00067 G4MCTSimParticle* FindParticle(int tid) const; 00068 G4MCTSimVertex* GetVertex(int vid) const; 00069 00070 void BuildVertexContainer(); 00071 void ClearEvent(); 00072 void Print(std::ostream& ostr= std::cout) const; 00073 00074 // iterators 00075 typedef G4MCTSimParticleContainer::iterator particle_iterator; 00076 typedef G4MCTSimParticleContainer::const_iterator particle_const_iterator; 00077 particle_iterator particles_begin(); 00078 particle_iterator particles_end(); 00079 particle_const_iterator particles_begin() const; 00080 particle_const_iterator particles_end() const; 00081 00082 typedef G4MCTSimVertexContainer::iterator vertex_iterator; 00083 typedef G4MCTSimVertexContainer::const_iterator vertex_const_iterator; 00084 vertex_iterator vertices_begin(); 00085 vertex_iterator vertices_end(); 00086 vertex_const_iterator vertices_begin() const; 00087 vertex_const_iterator vertices_end() const; 00088 }; 00089 00090 // ==================================================================== 00091 // inline functions 00092 // ==================================================================== 00093 00094 inline G4MCTSimEvent::G4MCTSimEvent(const G4MCTSimEvent& right) 00095 { 00096 *this= right; 00097 } 00098 00099 inline const G4MCTSimEvent& G4MCTSimEvent::operator=(const G4MCTSimEvent& right) 00100 { 00101 particleMap= right.particleMap; // shallow copy 00102 00103 return *this; 00104 } 00105 00106 inline int G4MCTSimEvent::GetNofParticles() const 00107 { 00108 return particleMap.size(); 00109 } 00110 00111 inline int G4MCTSimEvent::GetNofVertices() const 00112 { 00113 return vertexVec.size(); 00114 } 00115 00116 // iterators 00117 inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_begin() 00118 { return particleMap.begin(); } 00119 00120 inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_end() 00121 { return particleMap.end(); } 00122 00123 inline G4MCTSimEvent::particle_const_iterator 00124 G4MCTSimEvent::particles_begin() const 00125 { return particleMap.begin(); } 00126 00127 inline G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_end() const 00128 { return particleMap.end(); } 00129 00130 inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_begin() 00131 { return vertexVec.begin(); } 00132 00133 inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_end() 00134 { return vertexVec.end(); } 00135 00136 inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_begin() const 00137 { return vertexVec.begin(); } 00138 00139 inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_end() const 00140 { return vertexVec.end(); } 00141 00142 #endif