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4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/medical/GammaTherapy/src/PrimaryGeneratorMessenger.cc (Version 11.3.0) and /examples/extended/medical/GammaTherapy/src/PrimaryGeneratorMessenger.cc (Version 11.0)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 /// \file medical/GammaTherapy/src/PrimaryGene     27 /// \file medical/GammaTherapy/src/PrimaryGeneratorMessenger.cc
 28 /// \brief Implementation of the PrimaryGenera     28 /// \brief Implementation of the PrimaryGeneratorMessenger class
 29 //                                                 29 //
 30                                                    30 
 31 //--------------------------------------------     31 //---------------------------------------------------------------------------
 32 //                                                 32 //
 33 // ClassName:   PrimaryGeneratorMessenger          33 // ClassName:   PrimaryGeneratorMessenger
 34 //                                                 34 //
 35 // Description: Definition of physics list par     35 // Description: Definition of physics list parameters
 36 //                                                 36 //
 37 // Author:      V.Ivanchenko 26/09/00              37 // Author:      V.Ivanchenko 26/09/00
 38 //                                                 38 //
 39 //--------------------------------------------     39 //----------------------------------------------------------------------------
 40 //                                                 40 //
 41                                                    41 
 42 //....oooOO0OOooo........oooOO0OOooo........oo     42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 43 //....oooOO0OOooo........oooOO0OOooo........oo     43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 44                                                    44 
 45 #include "PrimaryGeneratorMessenger.hh"            45 #include "PrimaryGeneratorMessenger.hh"
 46                                                << 
 47 #include "PrimaryGeneratorAction.hh"               46 #include "PrimaryGeneratorAction.hh"
 48 #include "Run.hh"                              << 
 49                                                << 
 50 #include "G4RunManager.hh"                         47 #include "G4RunManager.hh"
                                                   >>  48 #include "Run.hh"
 51 #include "G4UImanager.hh"                          49 #include "G4UImanager.hh"
 52                                                    50 
 53 //....oooOO0OOooo........oooOO0OOooo........oo     51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 54                                                    52 
 55 PrimaryGeneratorMessenger::PrimaryGeneratorMes <<  53 PrimaryGeneratorMessenger::PrimaryGeneratorMessenger(
                                                   >>  54                            PrimaryGeneratorAction* gen):
                                                   >>  55   fGen(gen)
 56 {                                                  56 {
 57   fVerbose = gen->GetVerbose();                    57   fVerbose = gen->GetVerbose();
 58   if (fVerbose) G4cout << "PrimaryGeneratorMes <<  58   if(fVerbose) G4cout << "PrimaryGeneratorMessenger: Construct " << G4endl;
 59                                                    59 
 60   fBeamXCmd = new G4UIcmdWithADoubleAndUnit("/ <<  60   fBeamXCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamX",this);
 61   fBeamXCmd->SetGuidance("Set X position of th     61   fBeamXCmd->SetGuidance("Set X position of the center of the beam.");
 62   fBeamXCmd->SetParameterName("beamX", true);  <<  62   fBeamXCmd->SetParameterName("beamX",true);
 63   fBeamXCmd->SetUnitCategory("Length");            63   fBeamXCmd->SetUnitCategory("Length");
 64   fBeamXCmd->AvailableForStates(G4State_PreIni <<  64   fBeamXCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 65                                                    65 
 66   fBeamYCmd = new G4UIcmdWithADoubleAndUnit("/ <<  66   fBeamYCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamY",this);
 67   fBeamYCmd->SetGuidance("Set Y position of th     67   fBeamYCmd->SetGuidance("Set Y position of the center of the beam.");
 68   fBeamYCmd->SetParameterName("beamY", true);  <<  68   fBeamYCmd->SetParameterName("beamY",true);
 69   fBeamYCmd->SetUnitCategory("Length");            69   fBeamYCmd->SetUnitCategory("Length");
 70   fBeamYCmd->AvailableForStates(G4State_PreIni <<  70   fBeamYCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 71                                                    71 
 72   fBeamZCmd = new G4UIcmdWithADoubleAndUnit("/ <<  72   fBeamZCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamZ",this);
 73   fBeamZCmd->SetGuidance("Set Z of the entry p     73   fBeamZCmd->SetGuidance("Set Z of the entry point of the beam.");
 74   fBeamZCmd->SetParameterName("beamZ", true);  <<  74   fBeamZCmd->SetParameterName("beamZ",true);
 75   fBeamZCmd->SetUnitCategory("Length");            75   fBeamZCmd->SetUnitCategory("Length");
 76   fBeamZCmd->AvailableForStates(G4State_PreIni <<  76   fBeamZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 77                                                    77 
 78   fBeamECmd = new G4UIcmdWithADoubleAndUnit("/ <<  78   fBeamECmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamE",this);
 79   fBeamECmd->SetGuidance("Set the beam kinetic     79   fBeamECmd->SetGuidance("Set the beam kinetic energy");
 80   fBeamECmd->SetParameterName("beamE", false); <<  80   fBeamECmd->SetParameterName("beamE",false);
 81   fBeamECmd->SetUnitCategory("Energy");            81   fBeamECmd->SetUnitCategory("Energy");
 82   fBeamECmd->AvailableForStates(G4State_PreIni <<  82   fBeamECmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 83                                                    83 
 84   fSigmaXCmd = new G4UIcmdWithADoubleAndUnit(" <<  84   fSigmaXCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaX",this);
 85   fSigmaXCmd->SetGuidance("Set the beam Gussia     85   fSigmaXCmd->SetGuidance("Set the beam Gussian width for X");
 86   fSigmaXCmd->SetParameterName("sigmaX", false <<  86   fSigmaXCmd->SetParameterName("sigmaX",false);
 87   fSigmaXCmd->SetUnitCategory("Length");           87   fSigmaXCmd->SetUnitCategory("Length");
 88   fSigmaXCmd->AvailableForStates(G4State_PreIn <<  88   fSigmaXCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 89                                                    89 
 90   fSigmaYCmd = new G4UIcmdWithADoubleAndUnit(" <<  90   fSigmaYCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaY",this);
 91   fSigmaYCmd->SetGuidance("Set the beam Gussia     91   fSigmaYCmd->SetGuidance("Set the beam Gussian width for Y");
 92   fSigmaYCmd->SetParameterName("sigmaY", false <<  92   fSigmaYCmd->SetParameterName("sigmaY",false);
 93   fSigmaYCmd->SetUnitCategory("Length");           93   fSigmaYCmd->SetUnitCategory("Length");
 94   fSigmaYCmd->AvailableForStates(G4State_PreIn <<  94   fSigmaYCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 95                                                    95 
 96   fSigmaZCmd = new G4UIcmdWithADoubleAndUnit(" <<  96   fSigmaZCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaZ",this);
 97   fSigmaZCmd->SetGuidance("Set the beam Gussia     97   fSigmaZCmd->SetGuidance("Set the beam Gussian width for Y");
 98   fSigmaZCmd->SetParameterName("sigmaZ", false <<  98   fSigmaZCmd->SetParameterName("sigmaZ",false);
 99   fSigmaZCmd->SetUnitCategory("Length");           99   fSigmaZCmd->SetUnitCategory("Length");
100   fSigmaZCmd->AvailableForStates(G4State_PreIn << 100   fSigmaZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
101                                                   101 
102   fSigmaECmd = new G4UIcmdWithADoubleAndUnit(" << 102   fSigmaECmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaE",this);
103   fSigmaECmd->SetGuidance("Set the beam Gussia    103   fSigmaECmd->SetGuidance("Set the beam Gussian width for energy");
104   fSigmaECmd->SetParameterName("sigmaE", false << 104   fSigmaECmd->SetParameterName("sigmaE",false);
105   fSigmaECmd->SetUnitCategory("Energy");          105   fSigmaECmd->SetUnitCategory("Energy");
106   fSigmaECmd->AvailableForStates(G4State_PreIn << 106   fSigmaECmd->AvailableForStates(G4State_PreInit,G4State_Idle);
107                                                   107 
108   fRandCmd = new G4UIcmdWithAString("/testem/g << 108   fRandCmd = new G4UIcmdWithAString("/testem/gun",this);
109   fRandCmd->SetGuidance("Set the name of the r    109   fRandCmd->SetGuidance("Set the name of the random distribution (gauss,flat)");
110   fRandCmd->SetParameterName("rand", false);   << 110   fRandCmd->SetParameterName("rand",false);
111   fRandCmd->AvailableForStates(G4State_PreInit << 111   fRandCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
112                                                   112 
113   fMaxThetaCmd = new G4UIcmdWithADoubleAndUnit << 113   fMaxThetaCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/maxTheta",this);
114   fMaxThetaCmd->SetGuidance("Set the beam maxT    114   fMaxThetaCmd->SetGuidance("Set the beam maxTheta in degrees.");
115   fMaxThetaCmd->SetParameterName("maxTheta", f << 115   fMaxThetaCmd->SetParameterName("maxTheta",false);
116   fMaxThetaCmd->SetUnitCategory("Angle");         116   fMaxThetaCmd->SetUnitCategory("Angle");
117   fMaxThetaCmd->AvailableForStates(G4State_Pre << 117   fMaxThetaCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
118                                                << 118   
119   fThetaCmd = new G4UIcmdWithADoubleAndUnit("/ << 119   fThetaCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaTheta",this);
120   fThetaCmd->SetGuidance("Set the beam sigmaTh    120   fThetaCmd->SetGuidance("Set the beam sigmaTheta in degrees.");
121   fThetaCmd->SetParameterName("sigmaTheta", fa << 121   fThetaCmd->SetParameterName("sigmaTheta",false);
122   fThetaCmd->SetUnitCategory("Angle");            122   fThetaCmd->SetUnitCategory("Angle");
123   fThetaCmd->AvailableForStates(G4State_PreIni << 123   fThetaCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
124 }                                                 124 }
125                                                   125 
126 //....oooOO0OOooo........oooOO0OOooo........oo    126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
127                                                   127 
128 PrimaryGeneratorMessenger::~PrimaryGeneratorMe    128 PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger()
129 {                                                 129 {
130   delete fBeamXCmd;                               130   delete fBeamXCmd;
131   delete fBeamYCmd;                               131   delete fBeamYCmd;
132   delete fBeamZCmd;                               132   delete fBeamZCmd;
133                                                   133 
134   delete fSigmaXCmd;                              134   delete fSigmaXCmd;
135   delete fSigmaYCmd;                              135   delete fSigmaYCmd;
136   delete fSigmaZCmd;                              136   delete fSigmaZCmd;
137   delete fSigmaECmd;                              137   delete fSigmaECmd;
138                                                   138 
139   delete fBeamECmd;                               139   delete fBeamECmd;
140   delete fRandCmd;                                140   delete fRandCmd;
141   delete fMaxThetaCmd;                            141   delete fMaxThetaCmd;
142   delete fThetaCmd;                               142   delete fThetaCmd;
143 }                                                 143 }
144                                                   144 
145 //....oooOO0OOooo........oooOO0OOooo........oo    145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
146                                                   146 
147 void PrimaryGeneratorMessenger::SetNewValue(G4 << 147 void PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
                                                   >> 148                                             G4String newValue)
148 {                                                 149 {
149   if (fVerbose) G4cout << "PrimaryGeneratorMes << 150   if(fVerbose)  
150                                                << 151     G4cout << "PrimaryGeneratorMessenger: Next command value = "
151   if (command == fBeamXCmd) {                  << 152            << newValue << G4endl;
152     fGen->SetBeamX(fBeamXCmd->GetNewDoubleValu << 153 
153   }                                            << 154   if(command == fBeamXCmd)
154   if (command == fBeamYCmd) {                  << 155     {fGen->SetBeamX(fBeamXCmd->GetNewDoubleValue(newValue));}
155     fGen->SetBeamY(fBeamYCmd->GetNewDoubleValu << 156   if(command == fBeamYCmd)
156   }                                            << 157     {fGen->SetBeamY(fBeamYCmd->GetNewDoubleValue(newValue));}
157   if (command == fBeamZCmd) {                  << 158   if(command == fBeamZCmd)
158     fGen->SetBeamZ(fBeamZCmd->GetNewDoubleValu << 159     {fGen->SetBeamZ(fBeamZCmd->GetNewDoubleValue(newValue));}
159   }                                            << 160   if(command == fSigmaXCmd)
160   if (command == fSigmaXCmd) {                 << 161     {fGen->SetBeamSigmaX(fSigmaXCmd->GetNewDoubleValue(newValue));}
161     fGen->SetBeamSigmaX(fSigmaXCmd->GetNewDoub << 162   if(command == fSigmaYCmd)
162   }                                            << 163     {fGen->SetBeamSigmaY(fSigmaYCmd->GetNewDoubleValue(newValue));}
163   if (command == fSigmaYCmd) {                 << 164   if(command == fSigmaZCmd)
164     fGen->SetBeamSigmaY(fSigmaYCmd->GetNewDoub << 165     {fGen->SetBeamSigmaZ(fSigmaZCmd->GetNewDoubleValue(newValue));}
165   }                                            << 166   if(command == fSigmaECmd)
166   if (command == fSigmaZCmd) {                 << 167     {fGen->SetBeamSigmaE(fSigmaECmd->GetNewDoubleValue(newValue));}
167     fGen->SetBeamSigmaZ(fSigmaZCmd->GetNewDoub << 168   if(command == fBeamECmd) {
168   }                                            << 
169   if (command == fSigmaECmd) {                 << 
170     fGen->SetBeamSigmaE(fSigmaECmd->GetNewDoub << 
171   }                                            << 
172   if (command == fBeamECmd) {                  << 
173     G4double e = fBeamECmd->GetNewDoubleValue(    169     G4double e = fBeamECmd->GetNewDoubleValue(newValue);
174     fGen->SetBeamEnergy(e);                       170     fGen->SetBeamEnergy(e);
175   }                                               171   }
176   if (command == fMaxThetaCmd) {               << 172   if(command == fMaxThetaCmd)
177     fGen->SetBeamMinCosTheta(std::cos(fMaxThet << 173     {fGen->SetBeamMinCosTheta(
178   }                                            << 174                      std::cos(fMaxThetaCmd->GetNewDoubleValue(newValue)));}
179   if (command == fThetaCmd) {                  << 175   if(command == fThetaCmd)
180     fGen->SetSigmaTheta(fThetaCmd->GetNewDoubl << 176     {fGen->SetSigmaTheta(fThetaCmd->GetNewDoubleValue(newValue));}
181   }                                            << 177   if(command == fRandCmd)
182   if (command == fRandCmd) {                   << 178     {fGen->SetRandom(newValue);}
183     fGen->SetRandom(newValue);                 << 
184   }                                            << 
185                                                   179 
186   if (fVerbose) G4cout << "PrimaryGeneratorMes << 180 
187 }                                              << 181   if(fVerbose) G4cout << "PrimaryGeneratorMessenger: O'K " << G4endl;
                                                   >> 182   }
188                                                   183 
189 //....oooOO0OOooo........oooOO0OOooo........oo    184 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 185 
190                                                   186