Geant4-11
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//
26// G4GeneralParticleSource
27//
28// Class Description:
29//
30// The General Particle Source is designed to replace the G4ParticleGun class.
31// It is designed to allow specification of mutiple particle sources, each with
32// independent definitions of particle type, position, direction (or angular)
33// and energy distributions.
34
35// Author: Fan Lei, QinetiQ ltd
36// Customer: ESA/ESTEC
37// Version: 2.0
38// History:
39// - 05/02/2004, F.Lei - Version 2.0. Created.
40// - 26/10/2004, F.Lei - Added the Multiple_vertex capability.
41// - 25/03/2014, A.Green - Various changes to use the new class
42// G4GeneralParticleSourceData, mostly just transparent wrappers
43// around the thread safe object.
44// --------------------------------------------------------------------
45#ifndef G4GeneralParticleSource_hh
46#define G4GeneralParticleSource_hh 1
47
48#include "globals.hh"
49#include <vector>
50
51#include "G4Event.hh"
55
57
59{
60 public:
61
63 // Initialize variables and instantiates the messenger and
64 // generator classes
65
67 // Delete messenger and others
68
70
72 // Return the number of particle gun defined
73
74 void ListSource();
75 // List the particle guns defined
76
78 // Set the current gun to the specified one so its definition
79 // can be changed
80
82 // Change the current particle gun strength
83
85 { return GPSData->GetCurrentSource(); }
86 // Return the pointer to current particle gun
88 { return GPSData->GetCurrentSourceIdx(); }
89 // Return the index of the current particle gun
92 // Return the strength of the current gun
93
94 void ClearAll();
95 // Remove all defined particle gun
96 void AddaSource (G4double);
97 // Add a new particle gun with the specified strength
98 void DeleteaSource(G4int);
99 // Delete the specified particle gun
100
102 // Set the verbosity level.
103
105 // Set if multiple vertex per event.
106
107 inline void SetFlatSampling(G4bool av)
108 { GPSData->SetFlatSampling(av); normalised = false;}
109 // Set if flat_sampling is applied in multiple source case
110
115 // Set/Get the particle definition of the primary track
116
117 inline void SetParticleCharge(G4double aCharge)
119 // Set the charge state of the primary track
120
125 // Set/Get polarization state of the primary track
126
127 inline void SetParticleTime(G4double aTime)
131 // Set/Get the Time.
132
137 // Set/Get the number of particles to be generated in the primary track
138
145 // Get the position, direction, and energy of the current particle
146
147 private:
148
150
151 private:
152
154 // Helper Boolean, used to reduce number of locks
155 // at run time (see GeneratePrimaryVertex)
156
158 // Note this is a shared resource among MT workers
160 // Note this is a shared resource among MT workers
161
183};
184
185#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4SingleParticleSource * GetCurrentSource(G4int idx)
G4double GetIntensity(G4int idx) const
void SetParticleTime(G4double aTime)
void SetParticleDefinition(G4ParticleDefinition *aPDef)
G4GeneralParticleSourceData * GPSData
G4double GetCurrentSourceIntensity() const
G4SingleParticleSource * GetCurrentSource() const
G4ThreeVector GetParticleMomentumDirection() const
G4ThreeVector GetParticlePolarization() const
void SetParticlePolarization(G4ThreeVector aVal)
void SetParticleCharge(G4double aCharge)
G4GeneralParticleSourceMessenger * theMessenger
G4ParticleDefinition * GetParticleDefinition() const
G4ThreeVector GetParticlePosition() const
G4ThreeVector GetParticlePosition() const
void SetParticleTime(G4double aTime)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
const G4ThreeVector & GetParticlePolarization() const
G4ThreeVector GetParticleMomentumDirection() const
void SetParticlePolarization(const G4ThreeVector &aVal)
void SetParticleCharge(G4double aCharge)
G4ParticleDefinition * GetParticleDefinition() const