Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
extended
field
field02
src
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
// $Id$
30
//
31
32
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34
35
#include "
F02PrimaryGeneratorMessenger.hh
"
36
#include "
F02PrimaryGeneratorAction.hh
"
37
38
#include "
G4UIcmdWithAString.hh
"
39
#include "
G4UIcmdWithADoubleAndUnit.hh
"
40
#include "
G4SystemOfUnits.hh
"
41
42
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
43
44
F02PrimaryGeneratorMessenger::F02PrimaryGeneratorMessenger
(
45
F02PrimaryGeneratorAction
* action)
46
:
G4UImessenger
(),
47
fAction(action),
48
fRndmCmd(0),
49
fSetXVertexCmd(0),
50
fSetYVertexCmd(0),
51
fSetZVertexCmd(0)
52
{
53
fRndmCmd =
new
G4UIcmdWithAString
(
"/gun/random"
,
this
);
54
fRndmCmd->
SetGuidance
(
"Shoot randomly the incident particle."
);
55
fRndmCmd->
SetGuidance
(
" Choice : on, off(default)"
);
56
fRndmCmd->
SetParameterName
(
"choice"
,
true
);
57
fRndmCmd->
SetDefaultValue
(
"off"
);
58
fRndmCmd->
SetCandidates
(
"on off"
);
59
fRndmCmd->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
60
61
fSetXVertexCmd =
new
G4UIcmdWithADoubleAndUnit
(
"/gun/xvertex"
,
this
);
62
fSetXVertexCmd->
SetGuidance
(
" Set x coord. of the primary vertex."
);
63
fSetXVertexCmd->
SetParameterName
(
"xv"
,
true
);
64
fSetXVertexCmd->
SetDefaultValue
(0.0*
mm
) ;
65
66
fSetYVertexCmd =
new
G4UIcmdWithADoubleAndUnit
(
"/gun/yvertex"
,
this
);
67
fSetYVertexCmd->
SetGuidance
(
" Set y coord. of the primary vertex."
);
68
fSetYVertexCmd->
SetParameterName
(
"yv"
,
true
);
69
fSetYVertexCmd->
SetDefaultValue
(0.0*
mm
) ;
70
71
fSetZVertexCmd =
new
G4UIcmdWithADoubleAndUnit
(
"/gun/zvertex"
,
this
);
72
fSetZVertexCmd->
SetGuidance
(
" Set z coord. of the primary vertex."
);
73
fSetZVertexCmd->
SetParameterName
(
"zv"
,
true
);
74
fSetZVertexCmd->
SetDefaultValue
(0.0*
mm
) ;
75
76
}
77
78
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
79
80
F02PrimaryGeneratorMessenger::~F02PrimaryGeneratorMessenger
()
81
{
82
delete
fRndmCmd;
83
delete
fSetXVertexCmd;
84
delete
fSetYVertexCmd;
85
delete
fSetZVertexCmd;
86
}
87
88
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
89
90
void
F02PrimaryGeneratorMessenger::SetNewValue
(
G4UIcommand
* command,
91
G4String
newValue)
92
{
93
if
( command == fRndmCmd )
94
{ fAction->
SetRndmFlag
(newValue);}
95
if
( command == fSetXVertexCmd)
96
{ fAction->
SetXVertex
(fSetXVertexCmd->
GetNewDoubleValue
(newValue));}
97
if
( command == fSetYVertexCmd)
98
{ fAction->
SetYVertex
(fSetYVertexCmd->
GetNewDoubleValue
(newValue));}
99
if
( command == fSetZVertexCmd)
100
{ fAction->
SetZVertex
(fSetZVertexCmd->
GetNewDoubleValue
(newValue));}
101
}
102
103
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Generated on Sat May 25 2013 14:32:25 for Geant4 by
1.8.4