Geant4  10.01
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 //
60 // 25/03/2014, Andrew Green
61 // Various changes to use the new G4GeneralParticleSourceData class, mostly
62 // just transparent wrappers around the thread safe object.
63 //
65 //
66 // Class Description:
67 //
68 // The General Particle Source is designed to replace the G4ParticleGun class.
69 // It is designed to allow specification of mutiple particle sources, each with
70 // independent definitions of particle type, position, direction (or angular)
71 // and energy distributions.
72 //
74 //
75 // MEMBER FUNCTIONS
76 // ----------------
77 //
78 // G4GeneralParticleSource()
79 // Constructor: Initializes variables and instantiates the
80 // Messenger and generator classes
81 //
82 // ~G4GeneralParticleSourceMessenger()
83 // Destructor: deletes Messenger and others
84 //
85 // G4int GetNumberofSource()
86 // Return the number of particle gun defined
87 //
88 // void ListSource()
89 // List the particle guns defined
90 //
91 // void SetCurrentSourceto(G4int)
92 // set the current gun to the specified one so its definition can be changed
93 //
94 // void SetCurrentSourceIntensity(G4double)
95 // change the current particle gun strength
96 //
97 // void SetMultipleVertex(G4bool )
98 // Set if multiple vertex per event.
99 
100 // G4SingleParticleSource* GetCurrentSource()
101 // return the pointer to current particle gun
102 //
103 // G4int GetCurrentSourceIndex()
104 // return the index of the current particle gun
105 //
106 // G4double GetCurrentSourceIntensity()
107 // return the strength of the current gun
108 //
109 // void ClearAll()
110 // remove all defined aprticle gun
111 //
112 // void AddaSource (G4double)
113 // add a new particle gun with the specified strength
114 //
115 // void DeleteaSource(G4int);
116 // delete the specified particle gun
117 //
118 // void SetParticleDefinition ();
119 // G4ParticleDefinition * GetParticleDefinition ()
120 // Get/Set the particle definition of the primary track
121 //
122 // void SetParticleCharge(G4double aCharge)
123 // set the charge state of the primary track
124 //
125 // void SetParticlePolarization (G4ThreeVector aVal)
126 // G4ThreeVector GetParticlePolarization ()
127 // Set/Get the polarization state of the primary track
128 //
129 // void SetParticleTime(G4double aTime) { particle_time = aTime; };
130 // G4double GetParticleTime() { return particle_time; };
131 // Set/Get the Time.
132 //
133 // void SetNumberOfParticles(G4int i)
134 // G4int GetNumberOfParticles()
135 // set/get the number of particles to be generated in the primary track
136 //
137 // G4ThreeVector GetParticlePosition()
138 // G4ThreeVector GetParticleMomentumDirection()
139 // G4double GetParticleEnergy()
140 // get the position, direction, and energy of the current particle
141 //
143 //
144 #ifndef G4GeneralParticleSource_H
145 #define G4GeneralParticleSource_H 1
146 
147 #include "globals.hh"
148 #include <vector>
149 
150 #include "G4Event.hh"
151 #include "G4SingleParticleSource.hh"
152 //
154 
156 
158 
160 {
161  //
162  public:
163 
166 
168 
170  void ListSource();
171  void SetCurrentSourceto(G4int) ;
176  void ClearAll();
177  void AddaSource (G4double);
178  void DeleteaSource(G4int);
179 
180  // Set the verbosity level.
182 
183  // Set if multiple vertex per event.
185 
186  // set if flat_sampling is applied in multiple source case
187 
189 
190  // Set the particle species
191  void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition)
192  {currentSource->SetParticleDefinition(aParticleDefinition); } ;
193 
195 
197 
198  // Set polarization
201 
202  // Set Time.
205 
207  //
212 
213 private:
214 
215  void IntensityNormalization();
216 
217 private:
223  std::vector <G4SingleParticleSource*> sourceVector;
224  std::vector <G4double> sourceIntensity;
225  std::vector <G4double> sourceProbability;
226 
228  //Note this will be a shared resource among MT
230 
231 };
232 
233 #endif
G4ParticleDefinition * GetParticleDefinition()
G4GeneralParticleSourceData * GPSData
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)
G4double GetIntensity(G4int idx) const
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