Geant4  10.00.p02
G4GeneralParticleSource.hh
Go to the documentation of this file.
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 //
27 //
28 // MODULE: G4GeneralParticleSource.hh
29 //
30 // Version: 2.0
31 // Date: 5/02/04
32 // Author: Fan Lei
33 // Organisation: QinetiQ ltd.
34 // Customer: ESA/ESTEC
35 //
36 // Documentation avaialable at http://reat.space.qinetiq.com/gps
37 // These include:
38 // User Requirement Document (URD)
39 // Software Specification Documents (SSD)
40 // Software User Manual (SUM): on-line version available
41 // Technical Note (TN) on the physics and algorithms
42 //
44 //
45 // CHANGE HISTORY
46 // --------------
47 // 26/10/2004, F Lei
48 // Added the Multiple_vertex capability.
49 // Removed "inline" from all Set/Get methods.
50 //
51 // Version 2.0, 05/02/2004, Fan Lei, Created.
52 // based on version 1.1 in Geant4 v6.0
53 // - Mutilple particle source definition
54 // - Re-structured commands
55 // - Split the task into smaller classes
56 //
57 // - old commonds have been retained for backward compatibility, but will
58 // be removed in the future.
59 //
61 //
62 // Class Description:
63 //
64 // The General Particle Source is designed to replace the G4ParticleGun class.
65 // It is designed to allow specification of mutiple particle sources, each with
66 // independent definitions of particle type, position, direction (or angular)
67 // and energy distributions.
68 //
70 //
71 // MEMBER FUNCTIONS
72 // ----------------
73 //
74 // G4GeneralParticleSource()
75 // Constructor: Initializes variables and instantiates the
76 // Messenger and generator classes
77 //
78 // ~G4GeneralParticleSourceMessenger()
79 // Destructor: deletes Messenger and others
80 //
81 // G4int GetNumberofSource()
82 // Return the number of particle gun defined
83 //
84 // void ListSource()
85 // List the particle guns defined
86 //
87 // void SetCurrentSourceto(G4int)
88 // set the current gun to the specified one so its definition can be changed
89 //
90 // void SetCurrentSourceIntensity(G4double)
91 // change the current particle gun strength
92 //
93 // void SetMultipleVertex(G4bool )
94 // Set if multiple vertex per event.
95 
96 // G4SingleParticleSource* GetCurrentSource()
97 // return the pointer to current particle gun
98 //
99 // G4int GetCurrentSourceIndex()
100 // return the index of the current particle gun
101 //
102 // G4double GetCurrentSourceIntensity()
103 // return the strength of the current gun
104 //
105 // void ClearAll()
106 // remove all defined aprticle gun
107 //
108 // void AddaSource (G4double)
109 // add a new particle gun with the specified strength
110 //
111 // void DeleteaSource(G4int);
112 // delete the specified particle gun
113 //
114 // void SetParticleDefinition ();
115 // G4ParticleDefinition * GetParticleDefinition ()
116 // Get/Set the particle definition of the primary track
117 //
118 // void SetParticleCharge(G4double aCharge)
119 // set the charge state of the primary track
120 //
121 // void SetParticlePolarization (G4ThreeVector aVal)
122 // G4ThreeVector GetParticlePolarization ()
123 // Set/Get the polarization state of the primary track
124 //
125 // void SetParticleTime(G4double aTime) { particle_time = aTime; };
126 // G4double GetParticleTime() { return particle_time; };
127 // Set/Get the Time.
128 //
129 // void SetNumberOfParticles(G4int i)
130 // G4int GetNumberOfParticles()
131 // set/get the number of particles to be generated in the primary track
132 //
133 // G4ThreeVector GetParticlePosition()
134 // G4ThreeVector GetParticleMomentumDirection()
135 // G4double GetParticleEnergy()
136 // get the position, direction, and energy of the current particle
137 //
139 //
140 #ifndef G4GeneralParticleSource_H
141 #define G4GeneralParticleSource_H 1
142 
143 #include "globals.hh"
144 #include <vector>
145 
146 #include "G4Event.hh"
147 #include "G4SingleParticleSource.hh"
148 //
150 
152 {
153  //
154 public:
155 
158 
160 
161  G4int GetNumberofSource() { return G4int(sourceVector.size()); };
162  void ListSource();
163  void SetCurrentSourceto(G4int) ;
168  void ClearAll();
169  void AddaSource (G4double);
170  void DeleteaSource(G4int);
171 
172  // Set the verbosity level.
174 
175  // Set if multiple vertex per event.
177 
178  // set if flat_sampling is applied in multiple source case
179 
180  void SetFlatSampling(G4bool av) {flat_sampling = av; normalised = false;} ;
181 
182  // Set the particle species
183  void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition)
184  {currentSource->SetParticleDefinition(aParticleDefinition); } ;
185 
187 
189 
190  // Set polarization
193 
194  // Set Time.
197 
199  //
204 
205 private:
206 
207  void IntensityNormalization();
208 
209 private:
215  std::vector <G4SingleParticleSource*> sourceVector;
216  std::vector <G4double> sourceIntensity;
217  std::vector <G4double>sourceProbability;
218 
220 
221 };
222 
223 #endif
G4ParticleDefinition * GetParticleDefinition()
void SetParticleTime(G4double aTime)
CLHEP::Hep3Vector G4ThreeVector
std::vector< G4SingleParticleSource * > sourceVector
G4SingleParticleSource * currentSource
G4ParticleDefinition * GetParticleDefinition()
int G4int
Definition: G4Types.hh:78
void SetParticleTime(G4double aTime)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G4ThreeVector GetParticleMomentumDirection()
bool G4bool
Definition: G4Types.hh:79
void SetParticlePolarization(G4ThreeVector aVal)
void SetParticlePolarization(G4ThreeVector aVal)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G4SingleParticleSource * GetCurrentSource()
void SetParticleCharge(G4double aCharge)
G4ThreeVector GetParticleMomentumDirection()
std::vector< G4double > sourceIntensity
G4ThreeVector GetParticlePolarization()
std::vector< G4double > sourceProbability
void SetParticleCharge(G4double aCharge)
double G4double
Definition: G4Types.hh:76
G4GeneralParticleSourceMessenger * theMessenger