Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 //
27 //
28 // MODULE: G4GeneralParticleSourceMessenger.hh
29 //
30 // Version: 2.0
31 // Date: 5/02/04
32 // Author: Fan Lei
33 // Organisation: QinetiQ ltd.
34 // Customer: ESA/ESTEC
35 //
37 //
38 // CHANGE HISTORY
39 // --------------
40 //
41 // Version 2.0, 05/02/2004, Fan Lei, Created.
42 // After changes to version 1.1 as in Geant4 v6.0
43 // - Mutilple particle source definition
44 // - Re-structured commands
45 // - old commonds have been retained for backward compatibility, will be
46 // removed in the future.
47 //
48 // Version 3.0, Aug-Oct 2014, Andrea Dotti
49 // Transformations for thread safety and use in MT application
50 // Messenger is now a singleton w/ explicit Destroy() method for deletion
51 // Note the following: the class should be instantiated only once
52 // by a worker thread. It relies on a new feature of basic messenger class
53 // that allows for UI commands to be created by worker threads but being
54 // executed by master thread. For this reason the messenger itself should
55 // be created once, form here the singleton pattern
57 //
58 //
59 // Class Description:
60 //
61 // The function of the G4GeneralParticleSourceMessenger is to allow the user to
62 // enter commands either in interactive command line mode or through macros to
63 // control the G4GeneralParticleSource.
64 //
66 //
67 // MEMBER FUNCTIONS
68 // ----------------
69 //
70 // G4GeneralParticleSourceMessenger(G4GeneralParticleSource *fPtclGun)
71 // Constructor: Sets up commands.
72 //
73 // ~G4GeneralParticleSourceMessenger()
74 // Destructor: Deletes commands.
75 //
76 // void SetParticleGun(G4SingleParticleSource *fpg) { fParticleGun = fpg; } ;
77 // To selecte the particle gun to be defined/modified.
78 // void SetNewValue(G4UIcommand *command, G4String newValues)
79 // Uses the appropriate methods in the G4GeneralParticleSource to carry out
80 // the user commands.
81 // G4String GetCurrentValue(G4UIcommand *command)
82 // Allows the user to retrieve the current values of parameters.
83 // Not implemented yet.
84 //
86 //
87 #ifndef G4GeneralParticleSourceMessenger_h
88 #define G4GeneralParticleSourceMessenger_h 1
89 
90 #include "G4UImessenger.hh"
91 #include "globals.hh"
92 
93 class G4ParticleTable;
94 class G4UIcommand;
95 class G4UIdirectory;
97 class G4UIcmdWithAString;
99 class G4UIcmdWith3Vector;
102 class G4UIcmdWithADouble;
103 class G4UIcmdWithABool;
105 
108 
131 {
132  public:
133 
134  void SetParticleGun(G4SingleParticleSource *fpg) { fParticleGun = fpg; } ;
135  // Select the particle gun to be defined/modified
136 
137  void SetNewValue(G4UIcommand *command, G4String newValues);
138  // Identifies the command which has been invoked by the user, extracts the
139  // parameters associated with that command (held in newValues), and uses
140  // these values with the appropriate member function of G4GeneralParticleSource.
141 
143 
145  static void Destroy();
146  private:
149 
150  void IonCommand(G4String newValues);
151  void IonLvlCommand(G4String newValues);
152 
153  private:
155  G4SingleParticleSource* fParticleGun;
156  G4ParticleTable* particleTable;
157  G4String histtype;
158 
159  private: //commands
160  G4UIdirectory* gpsDirectory;
161 
162  // multiple source control commands
163  G4UIdirectory *sourceDirectory;
164  G4UIcmdWithADouble *addsourceCmd;
165  G4UIcmdWithoutParameter *listsourceCmd;
166  G4UIcmdWithoutParameter *clearsourceCmd;
167  G4UIcmdWithoutParameter *getsourceCmd;
168  G4UIcmdWithAnInteger *setsourceCmd;
169  G4UIcmdWithADouble *setintensityCmd;
170  G4UIcmdWithAnInteger *deletesourceCmd;
171  G4UIcmdWithABool *multiplevertexCmd;
172  G4UIcmdWithABool *flatsamplingCmd;
173 
174  // positional commands
175  G4UIdirectory *positionDirectory;
176  G4UIcmdWithAString *typeCmd1;
177  G4UIcmdWithAString *shapeCmd1;
178  G4UIcmdWith3VectorAndUnit *centreCmd1;
179  G4UIcmdWith3Vector *posrot1Cmd1;
180  G4UIcmdWith3Vector *posrot2Cmd1;
181  G4UIcmdWithADoubleAndUnit *halfxCmd1;
182  G4UIcmdWithADoubleAndUnit *halfyCmd1;
183  G4UIcmdWithADoubleAndUnit *halfzCmd1;
184  G4UIcmdWithADoubleAndUnit *radiusCmd1;
185  G4UIcmdWithADoubleAndUnit *radius0Cmd1;
186  G4UIcmdWithADoubleAndUnit *possigmarCmd1;
187  G4UIcmdWithADoubleAndUnit *possigmaxCmd1;
188  G4UIcmdWithADoubleAndUnit *possigmayCmd1;
189  G4UIcmdWithADoubleAndUnit *paralpCmd1;
190  G4UIcmdWithADoubleAndUnit *partheCmd1;
191  G4UIcmdWithADoubleAndUnit *parphiCmd1;
192  G4UIcmdWithAString *confineCmd1;
193 
194 // //old ones, will be reomved soon
195 // G4UIcmdWithAString *typeCmd;
196 // G4UIcmdWithAString *shapeCmd;
197 // G4UIcmdWith3VectorAndUnit *centreCmd;
198 // G4UIcmdWith3Vector *posrot1Cmd;
199 // G4UIcmdWith3Vector *posrot2Cmd;
200 // G4UIcmdWithADoubleAndUnit *halfxCmd;
201 // G4UIcmdWithADoubleAndUnit *halfyCmd;
202 // G4UIcmdWithADoubleAndUnit *halfzCmd;
203 // G4UIcmdWithADoubleAndUnit *radiusCmd;
204 // G4UIcmdWithADoubleAndUnit *radius0Cmd;
205 // G4UIcmdWithADoubleAndUnit *possigmarCmd;
206 // G4UIcmdWithADoubleAndUnit *possigmaxCmd;
207 // G4UIcmdWithADoubleAndUnit *possigmayCmd;
208 // G4UIcmdWithADoubleAndUnit *paralpCmd;
209 // G4UIcmdWithADoubleAndUnit *partheCmd;
210 // G4UIcmdWithADoubleAndUnit *parphiCmd;
211 // G4UIcmdWithAString *confineCmd;
212 
213  // angular commands
214  G4UIdirectory* angularDirectory;
215  G4UIcmdWithAString *angtypeCmd1;
216  G4UIcmdWith3Vector *angrot1Cmd1;
217  G4UIcmdWith3Vector *angrot2Cmd1;
218  G4UIcmdWithADoubleAndUnit *minthetaCmd1;
219  G4UIcmdWithADoubleAndUnit *maxthetaCmd1;
220  G4UIcmdWithADoubleAndUnit *minphiCmd1;
221  G4UIcmdWithADoubleAndUnit *maxphiCmd1;
222  G4UIcmdWithADoubleAndUnit *angsigmarCmd1;
223  G4UIcmdWithADoubleAndUnit *angsigmaxCmd1;
224  G4UIcmdWithADoubleAndUnit *angsigmayCmd1;
225  G4UIcmdWith3VectorAndUnit *angfocusCmd;
226  G4UIcmdWithABool *useuserangaxisCmd1;
227  G4UIcmdWithABool *surfnormCmd1;
228 
229  // old ones, will be removed soon
230 // G4UIcmdWithAString *angtypeCmd;
231 // G4UIcmdWith3Vector *angrot1Cmd;
232 // G4UIcmdWith3Vector *angrot2Cmd;
233 // G4UIcmdWithADoubleAndUnit *minthetaCmd;
234 // G4UIcmdWithADoubleAndUnit *maxthetaCmd;
235 // G4UIcmdWithADoubleAndUnit *minphiCmd;
236 // G4UIcmdWithADoubleAndUnit *maxphiCmd;
237 // G4UIcmdWithADoubleAndUnit *angsigmarCmd;
238 // G4UIcmdWithADoubleAndUnit *angsigmaxCmd;
239 // G4UIcmdWithADoubleAndUnit *angsigmayCmd;
240 // G4UIcmdWithABool *useuserangaxisCmd;
241 // G4UIcmdWithABool *surfnormCmd;
242 
243  // energy commands
244  G4UIdirectory* energyDirectory;
245  G4UIcmdWithAString *energytypeCmd1;
246  G4UIcmdWithADoubleAndUnit *eminCmd1;
247  G4UIcmdWithADoubleAndUnit *emaxCmd1;
248  G4UIcmdWithADoubleAndUnit *monoenergyCmd1;
249  G4UIcmdWithADoubleAndUnit *engsigmaCmd1;
250  G4UIcmdWithADouble *alphaCmd1;
251  G4UIcmdWithADouble *tempCmd1;
252  G4UIcmdWithADouble *ezeroCmd1;
253  G4UIcmdWithADouble *gradientCmd1;
254  G4UIcmdWithADouble *interceptCmd1;
255  G4UIcmdWithADouble *arbeintCmd1;
256  G4UIcmdWithoutParameter *calculateCmd1;
257  G4UIcmdWithABool *energyspecCmd1;
258  G4UIcmdWithABool *diffspecCmd1;
259 
260  // old ones, will be removed soon
261 // G4UIcmdWithAString *energytypeCmd;
262 // G4UIcmdWithADoubleAndUnit *eminCmd;
263 // G4UIcmdWithADoubleAndUnit *emaxCmd;
264 // G4UIcmdWithADoubleAndUnit *monoenergyCmd;
265 // G4UIcmdWithADoubleAndUnit *engsigmaCmd;
266 // G4UIcmdWithADouble *alphaCmd;
267 // G4UIcmdWithADouble *tempCmd;
268 // G4UIcmdWithADouble *ezeroCmd;
269 // G4UIcmdWithADouble *gradientCmd;
270 // G4UIcmdWithADouble *interceptCmd;
271 // G4UIcmdWithoutParameter *calculateCmd;
272 // G4UIcmdWithABool *energyspecCmd;
273 // G4UIcmdWithABool *diffspecCmd;
274 
275  // histogram commands
276  G4UIdirectory *histDirectory;
277  // old ones, will be removed soon
278  //G4UIcmdWith3Vector *histpointCmd;
279  //G4UIcmdWithAString *histnameCmd;
280  //G4UIcmdWithAString *arbintCmd;
281  //G4UIcmdWithAString *resethistCmd;
282  G4UIcmdWith3Vector *histpointCmd1;
283  G4UIcmdWithAString *histfileCmd1;
284  G4UIcmdWithAString *histnameCmd1;
285  G4UIcmdWithAString *arbintCmd1;
286  G4UIcmdWithAString *resethistCmd1;
287 
288  G4UIcmdWithAnInteger* verbosityCmd;
289 
290  // Commands from G4ParticleGun
291  G4UIcommand* ionCmd;
292  G4UIcommand* ionLvlCmd;
293  G4UIcmdWithAString* particleCmd;
294  G4UIcmdWithADoubleAndUnit* timeCmd;
295  G4UIcmdWith3Vector* polCmd;
296  G4UIcmdWithAnInteger* numberCmd;
297  G4UIcmdWith3VectorAndUnit* positionCmd;
298  G4UIcmdWith3Vector* directionCmd;
299  G4UIcmdWithADoubleAndUnit* energyCmd;
300  G4UIcmdWithoutParameter* listCmd;
301 
302  private: // for ion shooting
303  G4bool fShootIon;
304  G4int fAtomicNumber;
305  G4int fAtomicMass;
306  G4int fIonCharge;
307  G4double fIonExciteEnergy;
308 
309  G4bool fShootIonL;
310  G4int fAtomicNumberL;
311  G4int fAtomicMassL;
312  G4int fIonChargeL;
313  G4int fIonEnergyLevel;
314 };
315 
316 #endif
317 
static G4GeneralParticleSourceMessenger * GetInstance(G4GeneralParticleSource *)
void SetNewValue(G4UIcommand *command, G4String newValues)
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
void SetParticleGun(G4SingleParticleSource *fpg)
double G4double
Definition: G4Types.hh:76