Geant4  10.02.p01
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 
180 {
181  //
182  public:
183 
186 
188 
190  void ListSource();
191  void SetCurrentSourceto(G4int) ;
194  {return GPSData->GetCurrentSource();}
196  { return GPSData->GetCurrentSourceIdx(); }
199  void ClearAll();
200  void AddaSource (G4double);
201  void DeleteaSource(G4int);
202 
203  // Set the verbosity level.
205 
206  // Set if multiple vertex per event.
208 
209  // set if flat_sampling is applied in multiple source case
210 
212 
213  // Set the particle species
214  void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition)
215  {GPSData->GetCurrentSource()->SetParticleDefinition(aParticleDefinition); } ;
216 
219 
221  { GPSData->GetCurrentSource()->SetParticleCharge(aCharge); } ;
222 
223  // Set polarization
228 
229  // Set Time.
231  { GPSData->GetCurrentSource()->SetParticleTime(aTime); };
233  { return GPSData->GetCurrentSource()->GetParticleTime(); };
234 
237  //
246 
247 private:
248 
249  void IntensityNormalization();
250 
251 private:
252  //Helper boolean, used to reduce number of locks
253  //at run time (see GeneratePrimaryVertex)
255 
256  //Note this is a shared resource among MT workers
258  //Note this is a shared resource among MT workers
260 
261 };
262 
263 #endif
G4GeneralParticleSourceData * GPSData
void SetParticleTime(G4double aTime)
G4ThreeVector GetParticlePosition() const
G4ThreeVector GetParticlePolarization() const
CLHEP::Hep3Vector G4ThreeVector
Andrea Dotti Feb 2015 GPS messenger design requires some explanation for what distributions parameter...
Andrea Dotti Feb 2015 Important: This is a shared class between threads.
G4ThreeVector GetParticlePosition() const
int G4int
Definition: G4Types.hh:78
void SetParticleTime(G4double aTime)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G4ThreeVector GetParticleMomentumDirection() const
G4ThreeVector GetParticlePolarization() const
bool G4bool
Definition: G4Types.hh:79
void SetParticlePolarization(G4ThreeVector aVal)
void SetParticlePolarization(G4ThreeVector aVal)
G4double GetIntensity(G4int idx) const
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G4double GetCurrentSourceIntensity() const
void SetParticleCharge(G4double aCharge)
G4ParticleDefinition * GetParticleDefinition() const
Andrea Dotti Feb 2015 GPS messenger design requires some explanation for what distributions parameter...
G4ThreeVector GetParticleMomentumDirection() const
G4SingleParticleSource * GetCurrentSource(G4int idx)
G4double GetParticleEnergy() const
G4SingleParticleSource * GetCurrentSource() const
void SetParticleCharge(G4double aCharge)
double G4double
Definition: G4Types.hh:76
G4GeneralParticleSourceMessenger * theMessenger
G4ParticleDefinition * GetParticleDefinition() const