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 // G4MCTSimVertex.hh 00027 // 00028 // ==================================================================== 00029 #ifndef MCT_SIM_VERTEX_H 00030 #define MCT_SIM_VERTEX_H 00031 00032 #include "G4Types.hh" 00033 #include <iostream> 00034 #include <vector> 00035 #include <string> 00036 #include "G4ThreeVector.hh" 00037 #include "G4MCTSimParticle.hh" 00038 00039 // ==================================================================== 00040 // 00041 // class definition 00042 // 00043 // ==================================================================== 00044 00045 class G4MCTSimVertex { 00046 private: 00047 int inParticleTrackID; 00048 std::vector<int> outParticleTrackIDList; 00049 00050 int id; // assigned independently from G4 00051 G4ThreeVector position; 00052 double time; 00053 std::string volumeName; 00054 int volumeNumber; 00055 std::string creatorProcessName; 00056 G4bool storeFlag; 00057 00058 public: 00059 G4MCTSimVertex(); 00060 G4MCTSimVertex(const G4ThreeVector& x, double t); 00061 G4MCTSimVertex(const G4ThreeVector& x, double t, 00062 std::string vname, int ncopy, std::string pname); 00063 ~G4MCTSimVertex(); 00064 00065 // copy constructor and assignment operator 00066 G4MCTSimVertex(const G4MCTSimVertex& right); 00067 const G4MCTSimVertex& operator=(const G4MCTSimVertex& right); 00068 00069 // set/get functions 00070 void SetID(int i); 00071 int GetID() const; 00072 00073 void SetPosition(const G4ThreeVector& x); 00074 const G4ThreeVector& GetPosition() const; 00075 00076 void SetTime(double t); 00077 double GetTime() const; 00078 00079 void SetVolumeName(std::string vname); 00080 const std::string& GetVolumeName() const; 00081 00082 void SetVolumeNumber(int n); 00083 int GetVolumeNumber() const; 00084 00085 void SetCreatorProcessName(std::string pname); 00086 const std::string& GetCreatorProcessName() const; 00087 00088 void SetStoreFlag(G4bool q); 00089 G4bool GetStoreFlag() const; 00090 00091 // methods... 00092 void SetInParticle(const G4MCTSimParticle* in); 00093 void SetInParticle(int in); 00094 int GetInParticleTrackID() const; 00095 00096 int GetNofOutParticles() const; 00097 int AddOutParticle(const G4MCTSimParticle* out); 00098 int AddOutParticle(int out); 00099 int GetOutParticleTrackID(int i) const; 00100 00101 void Print(std::ostream& ostr= std::cout) const; 00102 }; 00103 00104 // ==================================================================== 00105 // inline functions 00106 // ==================================================================== 00107 inline G4MCTSimVertex::G4MCTSimVertex(const G4MCTSimVertex& right) 00108 { 00109 *this= right; 00110 } 00111 00112 inline const G4MCTSimVertex& 00113 G4MCTSimVertex::operator=(const G4MCTSimVertex& right) 00114 { 00115 inParticleTrackID= right.inParticleTrackID; 00116 outParticleTrackIDList= right.outParticleTrackIDList; 00117 00118 id= right.id; 00119 position= right.position; 00120 time= right.time; 00121 volumeName= right.volumeName; 00122 volumeNumber= right.volumeNumber; 00123 creatorProcessName= right.creatorProcessName; 00124 00125 return *this; 00126 } 00127 00128 inline void G4MCTSimVertex::SetID(int i) { id= i; } 00129 inline int G4MCTSimVertex::GetID() const { return id; } 00130 00131 inline void G4MCTSimVertex::SetPosition(const G4ThreeVector& x) 00132 { position= x; } 00133 00134 inline const G4ThreeVector& G4MCTSimVertex::GetPosition() const 00135 { return position; } 00136 00137 inline void G4MCTSimVertex::SetTime(double t) 00138 { time= t; } 00139 00140 inline double G4MCTSimVertex::GetTime() const 00141 { return time; } 00142 00143 inline void G4MCTSimVertex::SetVolumeName(std::string vname) 00144 { volumeName= vname; } 00145 00146 inline const std::string& G4MCTSimVertex::GetVolumeName() const 00147 { return volumeName; } 00148 00149 inline void G4MCTSimVertex::SetVolumeNumber(int n) 00150 { volumeNumber= n; } 00151 00152 inline int G4MCTSimVertex::GetVolumeNumber() const 00153 { return volumeNumber; } 00154 00155 inline void G4MCTSimVertex::SetCreatorProcessName(std::string pname) 00156 { creatorProcessName= pname; } 00157 00158 inline const std::string& G4MCTSimVertex::GetCreatorProcessName() const 00159 { return creatorProcessName; } 00160 00161 inline void G4MCTSimVertex::SetStoreFlag(G4bool q) { storeFlag= q; } 00162 00163 inline G4bool G4MCTSimVertex::GetStoreFlag() const { return storeFlag; } 00164 00165 inline void G4MCTSimVertex::SetInParticle(const G4MCTSimParticle* in) 00166 { inParticleTrackID= in-> GetTrackID(); } 00167 00168 inline void G4MCTSimVertex::SetInParticle(int in) 00169 { inParticleTrackID= in; } 00170 00171 inline int G4MCTSimVertex::GetInParticleTrackID() const 00172 { return inParticleTrackID; } 00173 00174 inline int G4MCTSimVertex::GetNofOutParticles() const 00175 { return outParticleTrackIDList.size(); } 00176 00177 inline int G4MCTSimVertex::AddOutParticle(const G4MCTSimParticle* out) 00178 { 00179 outParticleTrackIDList.push_back(out->GetTrackID()); 00180 return outParticleTrackIDList.size(); 00181 } 00182 00183 inline int G4MCTSimVertex::AddOutParticle(int out) 00184 { 00185 outParticleTrackIDList.push_back(out); 00186 return outParticleTrackIDList.size(); 00187 } 00188 00189 inline int G4MCTSimVertex::GetOutParticleTrackID(int i) const 00190 { 00191 int size= outParticleTrackIDList.size(); 00192 if(i>=0 && i< size) return outParticleTrackIDList[i]; 00193 else return 0; 00194 } 00195 00196 #endif