Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F01PrimaryGeneratorMessenger.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: F01PrimaryGeneratorMessenger.cc 77881 2013-11-29 08:37:53Z 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);
65  fSetXVertexCmd->SetDefaultValue(0.0*mm);
66  fSetXVertexCmd->SetDefaultUnit("mm");
67 
68  fSetYVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
69  fSetYVertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
70  fSetYVertexCmd->SetParameterName("yv",true);
71  fSetYVertexCmd->SetDefaultValue(0.0*mm);
72  fSetYVertexCmd->SetDefaultUnit("mm");
73 
74  fSetZVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this);
75  fSetZVertexCmd->SetGuidance(" Set z coord. of the primary vertex.");
76  fSetZVertexCmd->SetParameterName("zv",true);
77  fSetZVertexCmd->SetDefaultValue(0.0*mm);
78  fSetZVertexCmd->SetDefaultUnit("mm");
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 )
100  { fAction->SetXVertex(fSetXVertexCmd->GetNewDoubleValue(newValue));}
101  if( command == fSetYVertexCmd )
102  { fAction->SetYVertex(fSetYVertexCmd->GetNewDoubleValue(newValue));}
103  if( command == fSetZVertexCmd )
104  { fAction->SetZVertex(fSetZVertexCmd->GetNewDoubleValue(newValue));}
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static constexpr double mm
Definition: G4SIunits.hh:115
Definition of the F01PrimaryGeneratorAction class.
static G4double GetNewDoubleValue(const char *paramString)
Definition of the F01PrimaryGeneratorMessenger class.
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
virtual void SetNewValue(G4UIcommand *, G4String)
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void SetCandidates(const char *candidateList)
F01PrimaryGeneratorMessenger(F01PrimaryGeneratorAction *)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)