Geant4
10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GeneralParticleSourceMessenger.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
// G4GeneralParticleSourceMessenger
27
//
28
// Class Description:
29
//
30
// The function of the G4GeneralParticleSourceMessenger is to allow the user to
31
// enter commands either in interactive command line mode or through macros to
32
// control the G4GeneralParticleSource.
33
34
// Author: Fan Lei, QinetiQ ltd.
35
// Customer: ESA/ESTEC
36
// History:
37
// - Version 2.0, 05/02/2004, Fan Lei - Created.
38
// Multiple particle source definition
39
// - Version 2.1, 20/03/2014, Andrew Green - Modifications for MT
40
// Added a check to force only one thread to parse the macro file.
41
// This information is fed into the GPS which now has a split mechanism
42
// for the large data (hence need to only read in 1 thread)
43
// - Version 3.0, Aug-Oct 2014, Andrea Dotti
44
// Transformations for thread safety and use in MT application
45
// Messenger is now a singleton w/ explicit Destroy() method for deletion
46
// Note the following: the class should be instantiated only once
47
// by a worker thread. It relies on a new feature of basic messenger class
48
// that allows for UI commands to be created by worker threads but being
49
// executed by master thread. For this reason the messenger itself should
50
// be created once, form here the singleton pattern
51
// --------------------------------------------------------------------
52
#ifndef G4GeneralParticleSourceMessenger_hh
53
#define G4GeneralParticleSourceMessenger_hh 1
54
55
#include "
G4UImessenger.hh
"
56
#include "
globals.hh
"
57
58
class
G4ParticleTable
;
59
class
G4UIcommand
;
60
class
G4UIdirectory
;
61
class
G4UIcmdWithoutParameter
;
62
class
G4UIcmdWithAString
;
63
class
G4UIcmdWithADoubleAndUnit
;
64
class
G4UIcmdWith3Vector
;
65
class
G4UIcmdWith3VectorAndUnit
;
66
class
G4UIcmdWithAnInteger
;
67
class
G4UIcmdWithADouble
;
68
class
G4UIcmdWithABool
;
69
class
G4UIcmdWithoutParameter
;
70
71
class
G4SingleParticleSource
;
72
class
G4GeneralParticleSource
;
73
74
class
G4GeneralParticleSourceMessenger
:
public
G4UImessenger
75
{
76
public
:
77
78
void
SetParticleGun
(
G4SingleParticleSource
*fpg) { fParticleGun = fpg; } ;
79
// Select the particle gun to be defined/modified
80
81
void
SetNewValue
(
G4UIcommand
* command,
G4String
newValues);
82
// Identifies the command which has been invoked by the user, extracts the
83
// parameters associated with that command (held in newValues), and uses
84
// these values with the appropriate member function of
85
// G4GeneralParticleSource
86
87
G4String
GetCurrentValue
(
G4UIcommand
* command);
88
// Allows the user to retrieve the current values of parameters.
89
// NOT yet implemented!
90
91
static
G4GeneralParticleSourceMessenger
*
GetInstance
(
G4GeneralParticleSource
*);
92
static
void
Destroy
();
93
94
private
:
95
96
G4GeneralParticleSourceMessenger
(
G4GeneralParticleSource
*);
97
// Constructor: sets up commands
98
~G4GeneralParticleSourceMessenger
();
99
// Destructor: deletes commands
100
101
void
IonCommand(
G4String
newValues);
102
void
IonLvlCommand(
G4String
newValues);
103
104
private
:
105
106
G4GeneralParticleSource
* fGPS =
nullptr
;
107
G4SingleParticleSource
* fParticleGun =
nullptr
;
108
G4ParticleTable
* particleTable =
nullptr
;
109
G4String
histtype;
110
111
G4UIdirectory
* gpsDirectory;
112
113
// Multiple source control commands
114
//
115
G4UIdirectory
*sourceDirectory;
116
G4UIcmdWithADouble
*addsourceCmd;
117
G4UIcmdWithoutParameter
*listsourceCmd;
118
G4UIcmdWithoutParameter
*clearsourceCmd;
119
G4UIcmdWithoutParameter
*getsourceCmd;
120
G4UIcmdWithAnInteger
*setsourceCmd;
121
G4UIcmdWithADouble
*setintensityCmd;
122
G4UIcmdWithAnInteger
*deletesourceCmd;
123
G4UIcmdWithABool
*multiplevertexCmd;
124
G4UIcmdWithABool
*flatsamplingCmd;
125
126
// Positional commands
127
//
128
G4UIdirectory
*positionDirectory;
129
G4UIcmdWithAString
*typeCmd1;
130
G4UIcmdWithAString
*shapeCmd1;
131
G4UIcmdWith3VectorAndUnit
*centreCmd1;
132
G4UIcmdWith3Vector
*posrot1Cmd1;
133
G4UIcmdWith3Vector
*posrot2Cmd1;
134
G4UIcmdWithADoubleAndUnit
*halfxCmd1;
135
G4UIcmdWithADoubleAndUnit
*halfyCmd1;
136
G4UIcmdWithADoubleAndUnit
*halfzCmd1;
137
G4UIcmdWithADoubleAndUnit
*radiusCmd1;
138
G4UIcmdWithADoubleAndUnit
*radius0Cmd1;
139
G4UIcmdWithADoubleAndUnit
*possigmarCmd1;
140
G4UIcmdWithADoubleAndUnit
*possigmaxCmd1;
141
G4UIcmdWithADoubleAndUnit
*possigmayCmd1;
142
G4UIcmdWithADoubleAndUnit
*paralpCmd1;
143
G4UIcmdWithADoubleAndUnit
*partheCmd1;
144
G4UIcmdWithADoubleAndUnit
*parphiCmd1;
145
G4UIcmdWithAString
*confineCmd1;
146
147
// Angular commands
148
//
149
G4UIdirectory
* angularDirectory;
150
G4UIcmdWithAString
*angtypeCmd1;
151
G4UIcmdWith3Vector
*angrot1Cmd1;
152
G4UIcmdWith3Vector
*angrot2Cmd1;
153
G4UIcmdWithADoubleAndUnit
*minthetaCmd1;
154
G4UIcmdWithADoubleAndUnit
*maxthetaCmd1;
155
G4UIcmdWithADoubleAndUnit
*minphiCmd1;
156
G4UIcmdWithADoubleAndUnit
*maxphiCmd1;
157
G4UIcmdWithADoubleAndUnit
*angsigmarCmd1;
158
G4UIcmdWithADoubleAndUnit
*angsigmaxCmd1;
159
G4UIcmdWithADoubleAndUnit
*angsigmayCmd1;
160
G4UIcmdWith3VectorAndUnit
*angfocusCmd;
161
G4UIcmdWithABool
*useuserangaxisCmd1;
162
G4UIcmdWithABool
*surfnormCmd1;
163
164
// Energy commands
165
//
166
G4UIdirectory
* energyDirectory;
167
G4UIcmdWithAString
*energytypeCmd1;
168
G4UIcmdWithADoubleAndUnit
*eminCmd1;
169
G4UIcmdWithADoubleAndUnit
*emaxCmd1;
170
G4UIcmdWithADoubleAndUnit
*monoenergyCmd1;
171
G4UIcmdWithADoubleAndUnit
*engsigmaCmd1;
172
G4UIcmdWithADouble
*alphaCmd1;
173
G4UIcmdWithADouble
*tempCmd1;
174
G4UIcmdWithADouble
*ezeroCmd1;
175
G4UIcmdWithADouble
*gradientCmd1;
176
G4UIcmdWithADouble
*interceptCmd1;
177
G4UIcmdWithADouble
*arbeintCmd1;
178
G4UIcmdWithoutParameter
*calculateCmd1;
179
G4UIcmdWithABool
*energyspecCmd1;
180
G4UIcmdWithABool
*diffspecCmd1;
181
G4UIcmdWithABool
*applyEnergyWeightCmd1;
182
183
// Histogram commands
184
//
185
G4UIdirectory
*histDirectory;
186
G4UIcmdWith3Vector
*histpointCmd1;
187
G4UIcmdWithAString
*histfileCmd1;
188
G4UIcmdWithAString
*histnameCmd1;
189
G4UIcmdWithAString
*arbintCmd1;
190
G4UIcmdWithAString
*resethistCmd1;
191
192
G4UIcmdWithAnInteger
* verbosityCmd;
193
194
// Commands from G4ParticleGun
195
//
196
G4UIcommand
* ionCmd;
197
G4UIcommand
* ionLvlCmd;
198
G4UIcmdWithAString
* particleCmd;
199
G4UIcmdWithADoubleAndUnit
* timeCmd;
200
G4UIcmdWith3Vector
* polCmd;
201
G4UIcmdWithAnInteger
* numberCmd;
202
G4UIcmdWith3VectorAndUnit
* positionCmd;
203
G4UIcmdWith3Vector
* directionCmd;
204
G4UIcmdWithADoubleAndUnit
* energyCmd;
205
G4UIcmdWithoutParameter
* listCmd;
206
207
// For ion shooting
208
//
209
G4bool
fShootIon =
false
;
210
211
G4int
fAtomicNumber = 0;
212
G4int
fAtomicMass = 0;
213
G4int
fIonCharge = 0;
214
G4double
fIonExciteEnergy = 0.0;
215
216
G4int
fAtomicNumberL = 0;
217
G4int
fAtomicMassL = 0;
218
G4int
fIonChargeL = 0;
219
G4int
fIonEnergyLevel = 0;
220
221
/** Andrea Dotti Feb 2015
222
* GPS messenger design requires some explanation for what distributions
223
* parameters are concerned : Each thread has its own GPS
224
* since primary generation is a user action.
225
* However to save memory the underlying structures that provide the
226
* GPS functionalities ( the G4SPS*Distribution classes and the
227
* G4SPSRandomGenerator class)
228
* are shared among threads. This implies that modifying parameters of sources
229
* requires some attention:
230
* 1- Only one thread should change source parameters.
231
* 2- Changing of parameters can happen only between runs, when is guaranteed
232
* that no thread is accessing them
233
* 2- UI commands require that even if messenger is instantiated in a thread
234
* the commands are executed in the master (this is possible since V10.1)
235
* The simplest solution is to use UI commands to change GPS parameters and
236
* avoid C++ APIs. If this is inevitable a simple solution is to instantiate
237
* an instance of G4GeneralParticleSource explicitly in the master thread
238
* (for example in G4VUserActionInitialization::BuildForMaster() and set the
239
* defaults parameter there).
240
*/
241
242
};
243
244
#endif
G4double
double G4double
Definition:
G4Types.hh:83
G4bool
bool G4bool
Definition:
G4Types.hh:86
G4int
int G4int
Definition:
G4Types.hh:85
G4UImessenger.hh
G4GeneralParticleSourceMessenger
Definition:
G4GeneralParticleSourceMessenger.hh:75
G4GeneralParticleSourceMessenger::GetInstance
static G4GeneralParticleSourceMessenger * GetInstance(G4GeneralParticleSource *)
Definition:
G4GeneralParticleSourceMessenger.cc:65
G4GeneralParticleSourceMessenger::GetCurrentValue
G4String GetCurrentValue(G4UIcommand *command)
Definition:
G4GeneralParticleSourceMessenger.cc:1485
G4GeneralParticleSourceMessenger::SetParticleGun
void SetParticleGun(G4SingleParticleSource *fpg)
Definition:
G4GeneralParticleSourceMessenger.hh:78
G4GeneralParticleSourceMessenger::SetNewValue
void SetNewValue(G4UIcommand *command, G4String newValues)
Definition:
G4GeneralParticleSourceMessenger.cc:690
G4GeneralParticleSourceMessenger::Destroy
static void Destroy()
Definition:
G4GeneralParticleSourceMessenger.cc:73
G4GeneralParticleSource
Definition:
G4GeneralParticleSource.hh:59
G4ParticleTable
Definition:
G4ParticleTable.hh:60
G4SingleParticleSource
Definition:
G4SingleParticleSource.hh:71
G4String
Definition:
G4String.hh:53
G4UIcmdWith3VectorAndUnit
Definition:
G4UIcmdWith3VectorAndUnit.hh:43
G4UIcmdWith3Vector
Definition:
G4UIcmdWith3Vector.hh:43
G4UIcmdWithABool
Definition:
G4UIcmdWithABool.hh:46
G4UIcmdWithADoubleAndUnit
Definition:
G4UIcmdWithADoubleAndUnit.hh:42
G4UIcmdWithADouble
Definition:
G4UIcmdWithADouble.hh:42
G4UIcmdWithAString
Definition:
G4UIcmdWithAString.hh:43
G4UIcmdWithAnInteger
Definition:
G4UIcmdWithAnInteger.hh:42
G4UIcmdWithoutParameter
Definition:
G4UIcmdWithoutParameter.hh:42
G4UIcommand
Definition:
G4UIcommand.hh:52
G4UIdirectory
Definition:
G4UIdirectory.hh:42
G4UImessenger
Definition:
G4UImessenger.hh:47
globals.hh
geant4-v10.7.0
source
event
include
G4GeneralParticleSourceMessenger.hh
Generated by
1.9.6