[816] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | |
---|
| 27 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 28 | // |
---|
| 29 | // MODULE: G4SingleParticleSource.hh |
---|
| 30 | // |
---|
| 31 | // Version: 1.0 |
---|
| 32 | // Date: 5/02/04 |
---|
| 33 | // Author: Fan Lei |
---|
| 34 | // Organisation: QinetiQ ltd. |
---|
| 35 | // Customer: ESA/ESTEC |
---|
| 36 | // |
---|
| 37 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 38 | // |
---|
| 39 | // CHANGE HISTORY |
---|
| 40 | // -------------- |
---|
| 41 | // |
---|
| 42 | // Version 1.0, 05/02/2004, Fan Lei, Created. |
---|
| 43 | // Based on the G4GeneralParticleSource class in Geant4 v6.0 |
---|
| 44 | // |
---|
| 45 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 46 | // |
---|
| 47 | // Class Description: |
---|
| 48 | // |
---|
| 49 | // The Single Particle Source is designed to extend the functionality of the |
---|
| 50 | // G4ParticleGun class. It is designed to allow specification of input |
---|
| 51 | // particles in terms of position, direction (or angular) and energy |
---|
| 52 | // distributions. It is used by the General Particle source class |
---|
| 53 | // and it is derived from G4VPrimaryGenerator. |
---|
| 54 | // |
---|
| 55 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 56 | // |
---|
| 57 | // MEMBER FUNCTIONS |
---|
| 58 | // ---------------- |
---|
| 59 | // |
---|
| 60 | // G4SingleParticleSource () |
---|
| 61 | // Constructor: Initializes variables and instantiates the |
---|
| 62 | // Messenger and Navigator classes |
---|
| 63 | // |
---|
| 64 | // ~G4SingleParticleSource () |
---|
| 65 | // Destructor: deletes Messenger and prints out run information. |
---|
| 66 | // |
---|
| 67 | // void GeneratePrimaryVertex(G4Event *evt) |
---|
| 68 | // Generate the particles initial parameters. |
---|
| 69 | // |
---|
| 70 | // G4SPSPosDistribution* GetPosDist() |
---|
| 71 | // Return a pointer to the position distribution generator |
---|
| 72 | // |
---|
| 73 | // G4SPSAngDistribution* GetAngDist() |
---|
| 74 | // Return a pointer to the angular distribution generator |
---|
| 75 | // |
---|
| 76 | // G4SPSEneDistribution* GetEneDist() |
---|
| 77 | // Return a pointer to the energy distribution generator |
---|
| 78 | // |
---|
| 79 | // G4SPSRandomGenerator* GetBiasRndm() {return biasRndm;}; |
---|
| 80 | // Return a pointer to the biased random number generator |
---|
| 81 | // |
---|
| 82 | // void SetVerbosity(G4int); |
---|
| 83 | // Set the verbosity level. |
---|
| 84 | // |
---|
| 85 | // void SetParticleDefinition (); |
---|
| 86 | // G4ParticleDefinition * GetParticleDefinition () |
---|
| 87 | // Get/Set the particle definition of the primary track |
---|
| 88 | // |
---|
| 89 | // void SetParticleCharge(G4double aCharge) |
---|
| 90 | // set the charge state of the primary track |
---|
| 91 | // |
---|
| 92 | // inline void SetParticlePolarization (G4ThreeVector aVal) |
---|
| 93 | // inline G4ThreeVector GetParticlePolarization () |
---|
| 94 | // Set/Get the polarization state of the primary track |
---|
| 95 | // |
---|
| 96 | // inline void SetParticleTime(G4double aTime) { particle_time = aTime; }; |
---|
| 97 | // inline G4double GetParticleTime() { return particle_time; }; |
---|
| 98 | // Set/Get the Time. |
---|
| 99 | // |
---|
| 100 | // inline void SetNumberOfParticles(G4int i) |
---|
| 101 | // inline G4int GetNumberOfParticles() |
---|
| 102 | // set/get the number of particles to be generated in the primary track |
---|
| 103 | // |
---|
| 104 | // inline G4ThreeVector GetParticlePosition() |
---|
| 105 | // inline G4ThreeVector GetParticleMomentumDirection() |
---|
| 106 | // inline G4double GetParticleEnergy() |
---|
| 107 | // get the position, direction, and energy of the current particle |
---|
| 108 | // |
---|
| 109 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 110 | // |
---|
| 111 | #ifndef G4SingleParticleSource_h |
---|
| 112 | #define G4SingleParticleSource_h 1 |
---|
| 113 | |
---|
| 114 | #include "G4VPrimaryGenerator.hh" |
---|
| 115 | #include "G4ParticleMomentum.hh" |
---|
| 116 | #include "G4ParticleDefinition.hh" |
---|
| 117 | // |
---|
| 118 | #include "G4SPSPosDistribution.hh" |
---|
| 119 | #include "G4SPSAngDistribution.hh" |
---|
| 120 | #include "G4SPSEneDistribution.hh" |
---|
| 121 | #include "G4SPSRandomGenerator.hh" |
---|
| 122 | |
---|
| 123 | class G4SingleParticleSource : public G4VPrimaryGenerator |
---|
| 124 | { |
---|
| 125 | public: |
---|
| 126 | G4SingleParticleSource (); |
---|
| 127 | ~G4SingleParticleSource (); |
---|
| 128 | void GeneratePrimaryVertex(G4Event *evt); |
---|
| 129 | // |
---|
| 130 | G4SPSPosDistribution* GetPosDist() {return posGenerator;}; |
---|
| 131 | G4SPSAngDistribution* GetAngDist() {return angGenerator;}; |
---|
| 132 | G4SPSEneDistribution* GetEneDist() {return eneGenerator;}; |
---|
| 133 | G4SPSRandomGenerator* GetBiasRndm() {return biasRndm;}; |
---|
| 134 | |
---|
| 135 | // Set the verbosity level. |
---|
| 136 | void SetVerbosity(G4int); |
---|
| 137 | |
---|
| 138 | // Set the particle species |
---|
| 139 | void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition); |
---|
| 140 | inline G4ParticleDefinition * GetParticleDefinition () { return particle_definition;} ; |
---|
| 141 | |
---|
| 142 | inline void SetParticleCharge(G4double aCharge) { particle_charge = aCharge; } ; |
---|
| 143 | |
---|
| 144 | // Set polarization |
---|
| 145 | inline void SetParticlePolarization (G4ThreeVector aVal) {particle_polarization = aVal;}; |
---|
| 146 | inline G4ThreeVector GetParticlePolarization () {return particle_polarization;}; |
---|
| 147 | |
---|
| 148 | // Set Time. |
---|
| 149 | inline void SetParticleTime(G4double aTime) { particle_time = aTime; }; |
---|
| 150 | inline G4double GetParticleTime() { return particle_time; }; |
---|
| 151 | |
---|
| 152 | inline void SetNumberOfParticles(G4int i) { NumberOfParticlesToBeGenerated = i; }; |
---|
| 153 | // |
---|
| 154 | inline G4int GetNumberOfParticles() { return NumberOfParticlesToBeGenerated; }; |
---|
| 155 | inline G4ThreeVector GetParticlePosition() { return particle_position;}; |
---|
| 156 | inline G4ThreeVector GetParticleMomentumDirection() { return particle_momentum_direction;}; |
---|
| 157 | inline G4double GetParticleEnergy() {return particle_energy;}; |
---|
| 158 | |
---|
| 159 | private: |
---|
| 160 | |
---|
| 161 | G4SPSPosDistribution* posGenerator; |
---|
| 162 | G4SPSAngDistribution* angGenerator; |
---|
| 163 | G4SPSEneDistribution* eneGenerator; |
---|
| 164 | G4SPSRandomGenerator* biasRndm; |
---|
| 165 | // |
---|
| 166 | // Other particle properties |
---|
| 167 | G4int NumberOfParticlesToBeGenerated; |
---|
| 168 | G4ParticleDefinition * particle_definition; |
---|
| 169 | G4ParticleMomentum particle_momentum_direction; |
---|
| 170 | G4double particle_energy; |
---|
| 171 | G4double particle_charge; |
---|
| 172 | G4ThreeVector particle_position; |
---|
| 173 | G4double particle_time; |
---|
| 174 | G4ThreeVector particle_polarization; |
---|
| 175 | G4double particle_weight; |
---|
| 176 | |
---|
| 177 | // Verbosity |
---|
| 178 | G4int verbosityLevel; |
---|
| 179 | |
---|
| 180 | }; |
---|
| 181 | |
---|
| 182 | |
---|
| 183 | #endif |
---|
| 184 | |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | |
---|