Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
extended/medical/GammaTherapy/src/PrimaryGeneratorMessenger.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 // $Id: PrimaryGeneratorMessenger.cc 67994 2013-03-13 11:05:39Z gcosmo $
27 //
28 /// \file medical/GammaTherapy/src/PrimaryGeneratorMessenger.cc
29 /// \brief Implementation of the PrimaryGeneratorMessenger class
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 "Histo.hh"
49 #include "G4UImanager.hh"
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52 
55  fGen(gen)
56 {
57  if(1 < (Histo::GetPointer())->GetVerbose()) {
58  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");
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");
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");
77 
78  fSigmaXCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaX",this);
79  fSigmaXCmd->SetGuidance("Set the beam Gussian width for X");
80  fSigmaXCmd->SetParameterName("sigmaX",false);
81  fSigmaXCmd->SetUnitCategory("Length");
83 
84  fSigmaYCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaY",this);
85  fSigmaYCmd->SetGuidance("Set the beam Gussian width for Y");
86  fSigmaYCmd->SetParameterName("sigmaY",false);
87  fSigmaYCmd->SetUnitCategory("Length");
89 
90  fSigmaZCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaZ",this);
91  fSigmaZCmd->SetGuidance("Set the beam Gussian width for Y");
92  fSigmaZCmd->SetParameterName("sigmaZ",false);
93  fSigmaZCmd->SetUnitCategory("Length");
95 
96  fSigmaECmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaE",this);
97  fSigmaECmd->SetGuidance("Set the beam Gussian width for energy");
98  fSigmaECmd->SetParameterName("sigmaE",false);
99  fSigmaECmd->SetUnitCategory("Energy");
101 
102  fBeamECmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamE",this);
103  fBeamECmd->SetGuidance("Set the beam kinetic energy");
104  fBeamECmd->SetParameterName("beamE",false);
105  fBeamECmd->SetUnitCategory("Energy");
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);
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");
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");
124 }
125 
126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
127 
129 {
130  delete fBeamXCmd;
131  delete fBeamYCmd;
132  delete fBeamZCmd;
133  delete fSigmaXCmd;
134  delete fSigmaYCmd;
135  delete fSigmaZCmd;
136  delete fSigmaECmd;
137  delete fBeamECmd;
138  delete fMaxThetaCmd;
139  delete fThetaCmd;
140  delete fRandCmd;
141 }
142 
143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
144 
146  G4String newValue)
147 {
148 
149  if(1 < (Histo::GetPointer())->GetVerbose()) {
150  G4cout << "PrimaryGeneratorMessenger: Next command value = "
151  << newValue << G4endl;
152  }
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  Histo* theHisto = Histo::GetPointer();
172  if(theHisto->GetMaxEnergy() == 0.0) theHisto->SetMaxEnergy(e);
173  }
174  if(command == fMaxThetaCmd)
175  {fGen->SetBeamMinCosTheta(std::cos(fMaxThetaCmd->GetNewDoubleValue(newValue)));}
176  if(command == fThetaCmd)
177  {fGen->SetSigmaTheta(fThetaCmd->GetNewDoubleValue(newValue));}
178  if(command == fRandCmd)
179  {fGen->SetRandom(newValue);}
180 
181 
182  if(1 < (Histo::GetPointer())->GetVerbose())
183  {G4cout << "PrimaryGeneratorMessenger: O'K " << G4endl;}
184  }
185 
186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
187 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static Histo * GetPointer()
G4double GetMaxEnergy() const
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
G4GLOB_DLL std::ostream G4cout
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetMaxEnergy(G4double val)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)