Geant4  10.00.p01
F02PrimaryGeneratorMessenger.cc
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 //
28 //
29 //
30 // $Id: F02PrimaryGeneratorMessenger.cc 77893 2013-11-29 08:57:22Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
37 
39 #include "G4UIcmdWithAString.hh"
41 #include "G4SystemOfUnits.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
47  : G4UImessenger(),
48  fAction(action),
49  fRndmCmd(0),
50  fSetXVertexCmd(0),
51  fSetYVertexCmd(0),
52  fSetZVertexCmd(0)
53 {
54  fRndmCmd = new G4UIcmdWithAString("/gun/random",this);
55  fRndmCmd->SetGuidance("Shoot randomly the incident particle.");
56  fRndmCmd->SetGuidance(" Choice : on, off(default)");
57  fRndmCmd->SetParameterName("choice",true);
58  fRndmCmd->SetDefaultValue("off");
59  fRndmCmd->SetCandidates("on off");
61 
62  fSetXVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
63  fSetXVertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
64  fSetXVertexCmd->SetParameterName("xv",true);
67 
68  fSetYVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
69  fSetYVertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
70  fSetYVertexCmd->SetParameterName("yv",true);
73 
74  fSetZVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this);
75  fSetZVertexCmd->SetGuidance(" Set z coord. of the primary vertex.");
76  fSetZVertexCmd->SetParameterName("zv",true);
79 
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85 {
86  delete fRndmCmd;
87  delete fSetXVertexCmd;
88  delete fSetYVertexCmd;
89  delete fSetZVertexCmd;
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93 
95  G4String newValue)
96 {
97  if( command == fRndmCmd )
98  { fAction->SetRndmFlag(newValue);}
99  if( command == fSetXVertexCmd )
101  if( command == fSetYVertexCmd )
103  if( command == fSetZVertexCmd )
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
Definition of the F02PrimaryGeneratorAction class.
G4UIcmdWithADoubleAndUnit * fSetZVertexCmd
Definition of the F02PrimaryGeneratorMessenger class.
static G4double GetNewDoubleValue(const char *paramString)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
virtual void SetNewValue(G4UIcommand *, G4String)
void SetDefaultValue(const char *defVal)
G4UIcmdWithADoubleAndUnit * fSetXVertexCmd
void SetDefaultUnit(const char *defUnit)
void SetCandidates(const char *candidateList)
G4UIcmdWithADoubleAndUnit * fSetYVertexCmd
F02PrimaryGeneratorMessenger(F02PrimaryGeneratorAction *)
static const double mm
Definition: G4SIunits.hh:102
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)