Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Em10PrimaryGeneratorMessenger.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 //
26 /// \file electromagnetic/TestEm10/src/Em10PrimaryGeneratorMessenger.cc
27 /// \brief Implementation of the Em10PrimaryGeneratorMessenger class
28 //
29 //
30 // $Id: Em10PrimaryGeneratorMessenger.cc 67268 2013-02-13 11:38:40Z ihrivnac $
31 //
32 //
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36 
38 
40 #include "G4UIcmdWithAString.hh"
42 #include "G4SystemOfUnits.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45 
47 :G4UImessenger(),Em10Action(Em10Gun)
48 {
49  RndmCmd = new G4UIcmdWithAString("/gun/random",this);
50  RndmCmd->SetGuidance("Shoot randomly the incident particle.");
51  RndmCmd->SetGuidance(" Choice : on, off(default)");
52  RndmCmd->SetParameterName("choice",true);
53  RndmCmd->SetDefaultValue("off");
54  RndmCmd->SetCandidates("on off");
56 
57  setxvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
58  setxvertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
59  setxvertexCmd->SetParameterName("xv",true);
60  setxvertexCmd->SetDefaultValue(0.0*mm) ;
61 
62  setyvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
63  setyvertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
64  setyvertexCmd->SetParameterName("yv",true);
65  setyvertexCmd->SetDefaultValue(0.0*mm) ;
66 
67  setzvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this);
68  setzvertexCmd->SetGuidance(" Set z coord. of the primary vertex.");
69  setzvertexCmd->SetParameterName("zv",true);
70  setzvertexCmd->SetDefaultValue(0.0*mm) ;
71 
72 }
73 
74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
75 
77 {
78  delete RndmCmd;
79  delete setxvertexCmd;
80  delete setyvertexCmd;
81  delete setzvertexCmd;
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
85 
87 {
88  if( command == RndmCmd )
89  { Em10Action->SetRndmFlag(newValue);}
90  if( command == setxvertexCmd)
91  { Em10Action->Setxvertex(setxvertexCmd->GetNewDoubleValue(newValue));}
92  if( command == setyvertexCmd)
93  { Em10Action->Setyvertex(setyvertexCmd->GetNewDoubleValue(newValue));}
94  if( command == setzvertexCmd)
95  { Em10Action->Setzvertex(setzvertexCmd->GetNewDoubleValue(newValue));}
96 }
97 
98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
99 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4double GetNewDoubleValue(const char *paramString)
Definition of the Em10PrimaryGeneratorAction class.
Em10PrimaryGeneratorMessenger(Em10PrimaryGeneratorAction *)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetNewValue(G4UIcommand *, G4String)
Definition of the Em10PrimaryGeneratorMessenger class.
void SetDefaultValue(const char *defVal)
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)