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 00028 // 00029 // MODULE: G4SingleParticleSource.hh 00030 // 00031 // Version: 1.0 00032 // Date: 5/02/04 00033 // Author: Fan Lei 00034 // Organisation: QinetiQ ltd. 00035 // Customer: ESA/ESTEC 00036 // 00038 // 00039 // CHANGE HISTORY 00040 // -------------- 00041 // 00042 // Version 1.0, 05/02/2004, Fan Lei, Created. 00043 // Based on the G4GeneralParticleSource class in Geant4 v6.0 00044 // 00046 // 00047 // Class Description: 00048 // 00049 // The Single Particle Source is designed to extend the functionality of the 00050 // G4ParticleGun class. It is designed to allow specification of input 00051 // particles in terms of position, direction (or angular) and energy 00052 // distributions. It is used by the General Particle source class 00053 // and it is derived from G4VPrimaryGenerator. 00054 // 00056 // 00057 // MEMBER FUNCTIONS 00058 // ---------------- 00059 // 00060 // G4SingleParticleSource () 00061 // Constructor: Initializes variables and instantiates the 00062 // Messenger and Navigator classes 00063 // 00064 // ~G4SingleParticleSource () 00065 // Destructor: deletes Messenger and prints out run information. 00066 // 00067 // void GeneratePrimaryVertex(G4Event *evt) 00068 // Generate the particles initial parameters. 00069 // 00070 // G4SPSPosDistribution* GetPosDist() 00071 // Return a pointer to the position distribution generator 00072 // 00073 // G4SPSAngDistribution* GetAngDist() 00074 // Return a pointer to the angular distribution generator 00075 // 00076 // G4SPSEneDistribution* GetEneDist() 00077 // Return a pointer to the energy distribution generator 00078 // 00079 // G4SPSRandomGenerator* GetBiasRndm() {return biasRndm;}; 00080 // Return a pointer to the biased random number generator 00081 // 00082 // void SetVerbosity(G4int); 00083 // Set the verbosity level. 00084 // 00085 // void SetParticleDefinition (); 00086 // G4ParticleDefinition * GetParticleDefinition () 00087 // Get/Set the particle definition of the primary track 00088 // 00089 // void SetParticleCharge(G4double aCharge) 00090 // set the charge state of the primary track 00091 // 00092 // inline void SetParticlePolarization (G4ThreeVector aVal) 00093 // inline G4ThreeVector GetParticlePolarization () 00094 // Set/Get the polarization state of the primary track 00095 // 00096 // inline void SetParticleTime(G4double aTime) { particle_time = aTime; }; 00097 // inline G4double GetParticleTime() { return particle_time; }; 00098 // Set/Get the Time. 00099 // 00100 // inline void SetNumberOfParticles(G4int i) 00101 // inline G4int GetNumberOfParticles() 00102 // set/get the number of particles to be generated in the primary track 00103 // 00104 // inline G4ThreeVector GetParticlePosition() 00105 // inline G4ThreeVector GetParticleMomentumDirection() 00106 // inline G4double GetParticleEnergy() 00107 // get the position, direction, and energy of the current particle 00108 // 00110 // 00111 #ifndef G4SingleParticleSource_h 00112 #define G4SingleParticleSource_h 1 00113 00114 #include "G4VPrimaryGenerator.hh" 00115 #include "G4ParticleMomentum.hh" 00116 #include "G4ParticleDefinition.hh" 00117 // 00118 #include "G4SPSPosDistribution.hh" 00119 #include "G4SPSAngDistribution.hh" 00120 #include "G4SPSEneDistribution.hh" 00121 #include "G4SPSRandomGenerator.hh" 00122 00123 class G4SingleParticleSource: public G4VPrimaryGenerator { 00124 public: 00125 G4SingleParticleSource(); 00126 ~G4SingleParticleSource(); 00127 void GeneratePrimaryVertex(G4Event *evt); 00128 // 00129 G4SPSPosDistribution* GetPosDist() { 00130 return posGenerator; 00131 } 00132 ; 00133 G4SPSAngDistribution* GetAngDist() { 00134 return angGenerator; 00135 } 00136 ; 00137 G4SPSEneDistribution* GetEneDist() { 00138 return eneGenerator; 00139 } 00140 ; 00141 G4SPSRandomGenerator* GetBiasRndm() { 00142 return biasRndm; 00143 } 00144 ; 00145 00146 // Set the verbosity level. 00147 void SetVerbosity(G4int); 00148 00149 // Set the particle species 00150 void SetParticleDefinition(G4ParticleDefinition * aParticleDefinition); 00151 inline G4ParticleDefinition * GetParticleDefinition() { 00152 return particle_definition; 00153 } 00154 ; 00155 00156 inline void SetParticleCharge(G4double aCharge) { 00157 particle_charge = aCharge; 00158 } 00159 ; 00160 00161 // Set polarization 00162 inline void SetParticlePolarization(G4ThreeVector aVal) { 00163 particle_polarization = aVal; 00164 } 00165 ; 00166 inline G4ThreeVector GetParticlePolarization() { 00167 return particle_polarization; 00168 } 00169 ; 00170 00171 // Set Time. 00172 inline void SetParticleTime(G4double aTime) { 00173 particle_time = aTime; 00174 } 00175 ; 00176 inline G4double GetParticleTime() { 00177 return particle_time; 00178 } 00179 ; 00180 00181 inline void SetNumberOfParticles(G4int i) { 00182 NumberOfParticlesToBeGenerated = i; 00183 } 00184 ; 00185 // 00186 inline G4int GetNumberOfParticles() { 00187 return NumberOfParticlesToBeGenerated; 00188 } 00189 ; 00190 inline G4ThreeVector GetParticlePosition() { 00191 return particle_position; 00192 } 00193 ; 00194 inline G4ThreeVector GetParticleMomentumDirection() { 00195 return particle_momentum_direction; 00196 } 00197 ; 00198 inline G4double GetParticleEnergy() { 00199 return particle_energy; 00200 } 00201 ; 00202 00203 private: 00204 00205 G4SPSPosDistribution* posGenerator; 00206 G4SPSAngDistribution* angGenerator; 00207 G4SPSEneDistribution* eneGenerator; 00208 G4SPSRandomGenerator* biasRndm; 00209 // 00210 // Other particle properties 00211 G4int NumberOfParticlesToBeGenerated; 00212 G4ParticleDefinition * particle_definition; 00213 G4ParticleMomentum particle_momentum_direction; 00214 G4double particle_energy; 00215 G4double particle_charge; 00216 G4ThreeVector particle_position; 00217 G4double particle_time; 00218 G4ThreeVector particle_polarization; 00219 G4double particle_weight; 00220 00221 // Verbosity 00222 G4int verbosityLevel; 00223 00224 }; 00225 00226 #endif 00227