Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/medical/GammaTherapy/src/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 // $Id: PrimaryGeneratorMessenger.cc 103795 2017-04-27 13:38:36Z gcosmo $
27 //
30 //
31 
32 //---------------------------------------------------------------------------
33 //
34 // ClassName: PrimaryGeneratorMessenger
35 //
36 // Description: Definition of physics list parameters
37 //
38 // Author: V.Ivanchenko 26/09/00
39 //
40 //----------------------------------------------------------------------------
41 //
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45 
46 #include "PrimaryGeneratorMessenger.hh"
47 #include "PrimaryGeneratorAction.hh"
48 #include "G4RunManager.hh"
49 #include "Run.hh"
50 #include "G4UImanager.hh"
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
53 
56  fGen(gen)
57 {
58  fVerbose = gen->GetVerbose();
59  if(fVerbose) G4cout << "PrimaryGeneratorMessenger: Construct " << G4endl;
60 
61  fBeamXCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamX",this);
62  fBeamXCmd->SetGuidance("Set X position of the center of the beam.");
63  fBeamXCmd->SetParameterName("beamX",true);
64  fBeamXCmd->SetUnitCategory("Length");
66 
67  fBeamYCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamY",this);
68  fBeamYCmd->SetGuidance("Set Y position of the center of the beam.");
69  fBeamYCmd->SetParameterName("beamY",true);
70  fBeamYCmd->SetUnitCategory("Length");
72 
73  fBeamZCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamZ",this);
74  fBeamZCmd->SetGuidance("Set Z of the entry point of the beam.");
75  fBeamZCmd->SetParameterName("beamZ",true);
76  fBeamZCmd->SetUnitCategory("Length");
78 
79  fBeamECmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamE",this);
80  fBeamECmd->SetGuidance("Set the beam kinetic energy");
81  fBeamECmd->SetParameterName("beamE",false);
82  fBeamECmd->SetUnitCategory("Energy");
84 
85  fSigmaXCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaX",this);
86  fSigmaXCmd->SetGuidance("Set the beam Gussian width for X");
87  fSigmaXCmd->SetParameterName("sigmaX",false);
88  fSigmaXCmd->SetUnitCategory("Length");
90 
91  fSigmaYCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaY",this);
92  fSigmaYCmd->SetGuidance("Set the beam Gussian width for Y");
93  fSigmaYCmd->SetParameterName("sigmaY",false);
94  fSigmaYCmd->SetUnitCategory("Length");
96 
97  fSigmaZCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaZ",this);
98  fSigmaZCmd->SetGuidance("Set the beam Gussian width for Y");
99  fSigmaZCmd->SetParameterName("sigmaZ",false);
100  fSigmaZCmd->SetUnitCategory("Length");
102 
103  fSigmaECmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaE",this);
104  fSigmaECmd->SetGuidance("Set the beam Gussian width for energy");
105  fSigmaECmd->SetParameterName("sigmaE",false);
106  fSigmaECmd->SetUnitCategory("Energy");
108 
109  fRandCmd = new G4UIcmdWithAString("/testem/gun",this);
110  fRandCmd->SetGuidance("Set the name of the random distribution (gauss,flat)");
111  fRandCmd->SetParameterName("rand",false);
113 
114  fMaxThetaCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/maxTheta",this);
115  fMaxThetaCmd->SetGuidance("Set the beam maxTheta in degrees.");
116  fMaxThetaCmd->SetParameterName("maxTheta",false);
117  fMaxThetaCmd->SetUnitCategory("Angle");
119 
120  fThetaCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaTheta",this);
121  fThetaCmd->SetGuidance("Set the beam sigmaTheta in degrees.");
122  fThetaCmd->SetParameterName("sigmaTheta",false);
123  fThetaCmd->SetUnitCategory("Angle");
125 }
126 
127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
128 
130 {
131  delete fBeamXCmd;
132  delete fBeamYCmd;
133  delete fBeamZCmd;
134 
135  delete fSigmaXCmd;
136  delete fSigmaYCmd;
137  delete fSigmaZCmd;
138  delete fSigmaECmd;
139 
140  delete fBeamECmd;
141  delete fRandCmd;
142  delete fMaxThetaCmd;
143  delete fThetaCmd;
144 }
145 
146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
147 
149  G4String newValue)
150 {
151  if(fVerbose)
152  G4cout << "PrimaryGeneratorMessenger: Next command value = "
153  << newValue << G4endl;
154 
155  if(command == fBeamXCmd)
156  {fGen->SetBeamX(fBeamXCmd->GetNewDoubleValue(newValue));}
157  if(command == fBeamYCmd)
158  {fGen->SetBeamY(fBeamYCmd->GetNewDoubleValue(newValue));}
159  if(command == fBeamZCmd)
160  {fGen->SetBeamZ(fBeamZCmd->GetNewDoubleValue(newValue));}
161  if(command == fSigmaXCmd)
163  if(command == fSigmaYCmd)
165  if(command == fSigmaZCmd)
167  if(command == fSigmaECmd)
169  if(command == fBeamECmd) {
170  G4double e = fBeamECmd->GetNewDoubleValue(newValue);
171  fGen->SetBeamEnergy(e);
172  }
173  if(command == fMaxThetaCmd)
175  std::cos(fMaxThetaCmd->GetNewDoubleValue(newValue)));}
176  if(command == fThetaCmd)
178  if(command == fRandCmd)
179  {fGen->SetRandom(newValue);}
180 
181 
182  if(fVerbose) G4cout << "PrimaryGeneratorMessenger: O'K " << G4endl;
183  }
184 
185 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
186 
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
#define G4endl
Definition: G4ios.hh:61
static G4double GetNewDoubleValue(const char *paramString)
double G4double
Definition: G4Types.hh:76
void SetUnitCategory(const char *unitCategory)
The primary generator action class with particle gun.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4GLOB_DLL std::ostream G4cout
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:242