Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/extended/medical/GammaTherapy/src/PrimaryGeneratorMessenger.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file PrimaryGeneratorMessenger.cc
0027 /// \brief Implementation of the PrimaryGeneratorMessenger class
0028 
0029 //---------------------------------------------------------------------------
0030 //
0031 // ClassName:   PrimaryGeneratorMessenger
0032 //
0033 // Description: Definition of physics list parameters
0034 //
0035 // Author:      V.Ivanchenko 26/09/00
0036 //
0037 //----------------------------------------------------------------------------
0038 //
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0042 
0043 #include "PrimaryGeneratorMessenger.hh"
0044 
0045 #include "PrimaryGeneratorAction.hh"
0046 #include "Run.hh"
0047 
0048 #include "G4RunManager.hh"
0049 #include "G4UImanager.hh"
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0052 
0053 PrimaryGeneratorMessenger::PrimaryGeneratorMessenger(PrimaryGeneratorAction* gen) : fGen(gen)
0054 {
0055   fVerbose = gen->GetVerbose();
0056   if (fVerbose) G4cout << "PrimaryGeneratorMessenger: Construct " << G4endl;
0057 
0058   fBeamXCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamX", this);
0059   fBeamXCmd->SetGuidance("Set X position of the center of the beam.");
0060   fBeamXCmd->SetParameterName("beamX", true);
0061   fBeamXCmd->SetUnitCategory("Length");
0062   fBeamXCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0063 
0064   fBeamYCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamY", this);
0065   fBeamYCmd->SetGuidance("Set Y position of the center of the beam.");
0066   fBeamYCmd->SetParameterName("beamY", true);
0067   fBeamYCmd->SetUnitCategory("Length");
0068   fBeamYCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0069 
0070   fBeamZCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamZ", this);
0071   fBeamZCmd->SetGuidance("Set Z of the entry point of the beam.");
0072   fBeamZCmd->SetParameterName("beamZ", true);
0073   fBeamZCmd->SetUnitCategory("Length");
0074   fBeamZCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075 
0076   fBeamECmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/beamE", this);
0077   fBeamECmd->SetGuidance("Set the beam kinetic energy");
0078   fBeamECmd->SetParameterName("beamE", false);
0079   fBeamECmd->SetUnitCategory("Energy");
0080   fBeamECmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0081 
0082   fSigmaXCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaX", this);
0083   fSigmaXCmd->SetGuidance("Set the beam Gussian width for X");
0084   fSigmaXCmd->SetParameterName("sigmaX", false);
0085   fSigmaXCmd->SetUnitCategory("Length");
0086   fSigmaXCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0087 
0088   fSigmaYCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaY", this);
0089   fSigmaYCmd->SetGuidance("Set the beam Gussian width for Y");
0090   fSigmaYCmd->SetParameterName("sigmaY", false);
0091   fSigmaYCmd->SetUnitCategory("Length");
0092   fSigmaYCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0093 
0094   fSigmaZCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaZ", this);
0095   fSigmaZCmd->SetGuidance("Set the beam Gussian width for Y");
0096   fSigmaZCmd->SetParameterName("sigmaZ", false);
0097   fSigmaZCmd->SetUnitCategory("Length");
0098   fSigmaZCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0099 
0100   fSigmaECmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaE", this);
0101   fSigmaECmd->SetGuidance("Set the beam Gussian width for energy");
0102   fSigmaECmd->SetParameterName("sigmaE", false);
0103   fSigmaECmd->SetUnitCategory("Energy");
0104   fSigmaECmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0105 
0106   fRandCmd = new G4UIcmdWithAString("/testem/gun", this);
0107   fRandCmd->SetGuidance("Set the name of the random distribution (gauss,flat)");
0108   fRandCmd->SetParameterName("rand", false);
0109   fRandCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0110 
0111   fMaxThetaCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/maxTheta", this);
0112   fMaxThetaCmd->SetGuidance("Set the beam maxTheta in degrees.");
0113   fMaxThetaCmd->SetParameterName("maxTheta", false);
0114   fMaxThetaCmd->SetUnitCategory("Angle");
0115   fMaxThetaCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0116 
0117   fThetaCmd = new G4UIcmdWithADoubleAndUnit("/testem/gun/sigmaTheta", this);
0118   fThetaCmd->SetGuidance("Set the beam sigmaTheta in degrees.");
0119   fThetaCmd->SetParameterName("sigmaTheta", false);
0120   fThetaCmd->SetUnitCategory("Angle");
0121   fThetaCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0122 }
0123 
0124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0125 
0126 PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger()
0127 {
0128   delete fBeamXCmd;
0129   delete fBeamYCmd;
0130   delete fBeamZCmd;
0131 
0132   delete fSigmaXCmd;
0133   delete fSigmaYCmd;
0134   delete fSigmaZCmd;
0135   delete fSigmaECmd;
0136 
0137   delete fBeamECmd;
0138   delete fRandCmd;
0139   delete fMaxThetaCmd;
0140   delete fThetaCmd;
0141 }
0142 
0143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0144 
0145 void PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0146 {
0147   if (fVerbose) G4cout << "PrimaryGeneratorMessenger: Next command value = " << newValue << G4endl;
0148 
0149   if (command == fBeamXCmd) {
0150     fGen->SetBeamX(fBeamXCmd->GetNewDoubleValue(newValue));
0151   }
0152   if (command == fBeamYCmd) {
0153     fGen->SetBeamY(fBeamYCmd->GetNewDoubleValue(newValue));
0154   }
0155   if (command == fBeamZCmd) {
0156     fGen->SetBeamZ(fBeamZCmd->GetNewDoubleValue(newValue));
0157   }
0158   if (command == fSigmaXCmd) {
0159     fGen->SetBeamSigmaX(fSigmaXCmd->GetNewDoubleValue(newValue));
0160   }
0161   if (command == fSigmaYCmd) {
0162     fGen->SetBeamSigmaY(fSigmaYCmd->GetNewDoubleValue(newValue));
0163   }
0164   if (command == fSigmaZCmd) {
0165     fGen->SetBeamSigmaZ(fSigmaZCmd->GetNewDoubleValue(newValue));
0166   }
0167   if (command == fSigmaECmd) {
0168     fGen->SetBeamSigmaE(fSigmaECmd->GetNewDoubleValue(newValue));
0169   }
0170   if (command == fBeamECmd) {
0171     G4double e = fBeamECmd->GetNewDoubleValue(newValue);
0172     fGen->SetBeamEnergy(e);
0173   }
0174   if (command == fMaxThetaCmd) {
0175     fGen->SetBeamMinCosTheta(std::cos(fMaxThetaCmd->GetNewDoubleValue(newValue)));
0176   }
0177   if (command == fThetaCmd) {
0178     fGen->SetSigmaTheta(fThetaCmd->GetNewDoubleValue(newValue));
0179   }
0180   if (command == fRandCmd) {
0181     fGen->SetRandom(newValue);
0182   }
0183 
0184   if (fVerbose) G4cout << "PrimaryGeneratorMessenger: O'K " << G4endl;
0185 }
0186 
0187 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....