ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PrimaryGeneratorMessenger.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PrimaryGeneratorMessenger.cc
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
//
29
//
30
31
//---------------------------------------------------------------------------
32
//
33
// ClassName: PrimaryGeneratorMessenger
34
//
35
// Description: Definition of physics list parameters
36
//
37
// Author: V.Ivanchenko 26/09/00
38
//
39
//----------------------------------------------------------------------------
40
//
41
42
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
43
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44
45
#include "PrimaryGeneratorMessenger.hh"
46
#include "PrimaryGeneratorAction.hh"
47
#include "
G4RunManager.hh
"
48
#include "Run.hh"
49
#include "
G4UImanager.hh
"
50
51
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52
53
PrimaryGeneratorMessenger::PrimaryGeneratorMessenger
(
54
PrimaryGeneratorAction
* gen):
55
fGen(gen)
56
{
57
fVerbose
= gen->
GetVerbose
();
58
if
(
fVerbose
)
G4cout
<<
"PrimaryGeneratorMessenger: Construct "
<<
G4endl
;
59
60
fBeamXCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/beamX"
,
this
);
61
fBeamXCmd
->
SetGuidance
(
"Set X position of the center of the beam."
);
62
fBeamXCmd
->
SetParameterName
(
"beamX"
,
true
);
63
fBeamXCmd
->
SetUnitCategory
(
"Length"
);
64
fBeamXCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
65
66
fBeamYCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/beamY"
,
this
);
67
fBeamYCmd
->
SetGuidance
(
"Set Y position of the center of the beam."
);
68
fBeamYCmd
->
SetParameterName
(
"beamY"
,
true
);
69
fBeamYCmd
->
SetUnitCategory
(
"Length"
);
70
fBeamYCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
71
72
fBeamZCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/beamZ"
,
this
);
73
fBeamZCmd
->
SetGuidance
(
"Set Z of the entry point of the beam."
);
74
fBeamZCmd
->
SetParameterName
(
"beamZ"
,
true
);
75
fBeamZCmd
->
SetUnitCategory
(
"Length"
);
76
fBeamZCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
77
78
fBeamECmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/beamE"
,
this
);
79
fBeamECmd
->
SetGuidance
(
"Set the beam kinetic energy"
);
80
fBeamECmd
->
SetParameterName
(
"beamE"
,
false
);
81
fBeamECmd
->
SetUnitCategory
(
"Energy"
);
82
fBeamECmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
83
84
fSigmaXCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/sigmaX"
,
this
);
85
fSigmaXCmd
->
SetGuidance
(
"Set the beam Gussian width for X"
);
86
fSigmaXCmd
->
SetParameterName
(
"sigmaX"
,
false
);
87
fSigmaXCmd
->
SetUnitCategory
(
"Length"
);
88
fSigmaXCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
89
90
fSigmaYCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/sigmaY"
,
this
);
91
fSigmaYCmd
->
SetGuidance
(
"Set the beam Gussian width for Y"
);
92
fSigmaYCmd
->
SetParameterName
(
"sigmaY"
,
false
);
93
fSigmaYCmd
->
SetUnitCategory
(
"Length"
);
94
fSigmaYCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
95
96
fSigmaZCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/sigmaZ"
,
this
);
97
fSigmaZCmd
->
SetGuidance
(
"Set the beam Gussian width for Y"
);
98
fSigmaZCmd
->
SetParameterName
(
"sigmaZ"
,
false
);
99
fSigmaZCmd
->
SetUnitCategory
(
"Length"
);
100
fSigmaZCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
101
102
fSigmaECmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/sigmaE"
,
this
);
103
fSigmaECmd
->
SetGuidance
(
"Set the beam Gussian width for energy"
);
104
fSigmaECmd
->
SetParameterName
(
"sigmaE"
,
false
);
105
fSigmaECmd
->
SetUnitCategory
(
"Energy"
);
106
fSigmaECmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
107
108
fRandCmd
=
new
G4UIcmdWithAString
(
"/testem/gun"
,
this
);
109
fRandCmd
->
SetGuidance
(
"Set the name of the random distribution (gauss,flat)"
);
110
fRandCmd
->
SetParameterName
(
"rand"
,
false
);
111
fRandCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
112
113
fMaxThetaCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/maxTheta"
,
this
);
114
fMaxThetaCmd
->
SetGuidance
(
"Set the beam maxTheta in degrees."
);
115
fMaxThetaCmd
->
SetParameterName
(
"maxTheta"
,
false
);
116
fMaxThetaCmd
->
SetUnitCategory
(
"Angle"
);
117
fMaxThetaCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
118
119
fThetaCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/gun/sigmaTheta"
,
this
);
120
fThetaCmd
->
SetGuidance
(
"Set the beam sigmaTheta in degrees."
);
121
fThetaCmd
->
SetParameterName
(
"sigmaTheta"
,
false
);
122
fThetaCmd
->
SetUnitCategory
(
"Angle"
);
123
fThetaCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
124
}
125
126
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
127
128
PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger
()
129
{
130
delete
fBeamXCmd
;
131
delete
fBeamYCmd
;
132
delete
fBeamZCmd
;
133
134
delete
fSigmaXCmd
;
135
delete
fSigmaYCmd
;
136
delete
fSigmaZCmd
;
137
delete
fSigmaECmd
;
138
139
delete
fBeamECmd
;
140
delete
fRandCmd
;
141
delete
fMaxThetaCmd
;
142
delete
fThetaCmd
;
143
}
144
145
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
146
147
void
PrimaryGeneratorMessenger::SetNewValue
(
G4UIcommand
* command,
148
G4String
newValue)
149
{
150
if
(
fVerbose
)
151
G4cout
<<
"PrimaryGeneratorMessenger: Next command value = "
152
<< newValue <<
G4endl
;
153
154
if
(command ==
fBeamXCmd
)
155
{
fGen
->
SetBeamX
(
fBeamXCmd
->
GetNewDoubleValue
(newValue));}
156
if
(command ==
fBeamYCmd
)
157
{
fGen
->
SetBeamY
(
fBeamYCmd
->
GetNewDoubleValue
(newValue));}
158
if
(command ==
fBeamZCmd
)
159
{
fGen
->
SetBeamZ
(
fBeamZCmd
->
GetNewDoubleValue
(newValue));}
160
if
(command ==
fSigmaXCmd
)
161
{
fGen
->
SetBeamSigmaX
(
fSigmaXCmd
->
GetNewDoubleValue
(newValue));}
162
if
(command ==
fSigmaYCmd
)
163
{
fGen
->
SetBeamSigmaY
(
fSigmaYCmd
->
GetNewDoubleValue
(newValue));}
164
if
(command ==
fSigmaZCmd
)
165
{
fGen
->
SetBeamSigmaZ
(
fSigmaZCmd
->
GetNewDoubleValue
(newValue));}
166
if
(command ==
fSigmaECmd
)
167
{
fGen
->
SetBeamSigmaE
(
fSigmaECmd
->
GetNewDoubleValue
(newValue));}
168
if
(command ==
fBeamECmd
) {
169
G4double
e
=
fBeamECmd
->
GetNewDoubleValue
(newValue);
170
fGen
->
SetBeamEnergy
(e);
171
}
172
if
(command ==
fMaxThetaCmd
)
173
{
fGen
->
SetBeamMinCosTheta
(
174
std::cos(
fMaxThetaCmd
->
GetNewDoubleValue
(newValue)));}
175
if
(command ==
fThetaCmd
)
176
{
fGen
->
SetSigmaTheta
(
fThetaCmd
->
GetNewDoubleValue
(newValue));}
177
if
(command ==
fRandCmd
)
178
{
fGen
->
SetRandom
(newValue);}
179
180
181
if
(
fVerbose
)
G4cout
<<
"PrimaryGeneratorMessenger: O'K "
<<
G4endl
;
182
}
183
184
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
185
geant4
tree
geant4-10.6-release
examples
extended
medical
GammaTherapy
src
PrimaryGeneratorMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:54
using
1.8.2 with
ECCE GitHub integration