Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:31

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 // This is the *BASIC* version of IORT, a Geant4-based application
0027 //
0028 // Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
0029 // Contributor Authors: S.Guatelli(e)
0030 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
0031 //    
0032 //   (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
0033 //   (b) IBFM-CNR , Segrate (Milano), Italy
0034 //   (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
0035 //   (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
0036 //   (e) University of Wollongong, Australia
0037 //
0038 //   *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
0039 //////////////////////////////////////////////////////////////////////////////////////////////
0040 
0041 #include "IORTPrimaryGeneratorMessenger.hh"
0042 #include "IORTPrimaryGeneratorAction.hh"
0043 #include "G4UIdirectory.hh"
0044 #include "G4UIcmdWithADoubleAndUnit.hh"
0045 #include "G4UIcmdWithADouble.hh"
0046 
0047 IORTPrimaryGeneratorMessenger::IORTPrimaryGeneratorMessenger(
0048                                              IORTPrimaryGeneratorAction* IORTGun)
0049 :IORTAction(IORTGun)
0050 { 
0051   //
0052   // Definition of the interactive commands to modify the parameters of the
0053   // generation of primary particles
0054   // 
0055  beamParametersDir = new G4UIdirectory("/beam/");
0056  beamParametersDir -> SetGuidance("set parameters of beam");
0057  
0058  EnergyDir = new G4UIdirectory("/beam/energy/");  
0059  EnergyDir -> SetGuidance ("set energy of beam");  
0060 
0061  particlePositionDir = new G4UIdirectory("/beam/position/");  
0062  particlePositionDir -> SetGuidance ("set position of particle");  
0063 
0064  
0065 
0066  
0067  MomentumDir = new G4UIdirectory("/beam/momentum/");  
0068  MomentumDir -> SetGuidance ("set momentum of particle "); 
0069 
0070 
0071  ThetaCmd = new G4UIcmdWithADoubleAndUnit("/beam/momentum/Theta",this);
0072  ThetaCmd -> SetGuidance("set Theta");
0073  ThetaCmd -> SetParameterName("Theta",false);
0074  ThetaCmd -> SetDefaultUnit("deg");
0075  ThetaCmd -> SetUnitCandidates("deg rad");
0076  ThetaCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);  
0077 
0078 
0079 /*  
0080  sigmaMomentumYCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaY",this);
0081  sigmaMomentumYCmd -> SetGuidance("set sigma momentum y");
0082  sigmaMomentumYCmd -> SetParameterName("momentum",false);
0083  sigmaMomentumYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
0084 
0085  sigmaMomentumZCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaZ",this);
0086  sigmaMomentumZCmd -> SetGuidance("set sigma momentum z");
0087  sigmaMomentumZCmd -> SetParameterName("momentum",false);
0088  sigmaMomentumZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
0089  */
0090  meanKineticEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/meanEnergy",this);
0091  meanKineticEnergyCmd -> SetGuidance("set mean Kinetic energy");
0092  meanKineticEnergyCmd -> SetParameterName("Energy",false);
0093  meanKineticEnergyCmd -> SetDefaultUnit("MeV");
0094  meanKineticEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
0095  meanKineticEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
0096  
0097  sigmaEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/sigmaEnergy",this);
0098  sigmaEnergyCmd -> SetGuidance("set sigma energy");
0099  sigmaEnergyCmd -> SetParameterName("Energy",false);
0100  sigmaEnergyCmd -> SetDefaultUnit("keV");
0101  sigmaEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
0102  sigmaEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
0103  
0104  XpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Xposition",this);
0105  XpositionCmd -> SetGuidance("set x coordinate of particle");
0106  XpositionCmd -> SetParameterName("position",false);
0107  XpositionCmd -> SetDefaultUnit("mm");
0108  XpositionCmd -> SetUnitCandidates("mm cm m");
0109  XpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
0110 
0111  YpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition",this);
0112  YpositionCmd -> SetGuidance("set y coordinate of particle");
0113  YpositionCmd -> SetParameterName("position",false);
0114  YpositionCmd -> SetDefaultUnit("mm");
0115  YpositionCmd -> SetUnitCandidates("mm cm m");
0116  YpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
0117 
0118  sigmaYCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition/sigmaY",this);
0119  sigmaYCmd -> SetGuidance("set sigma y");
0120  sigmaYCmd -> SetParameterName("position",false);
0121  sigmaYCmd -> SetDefaultUnit("mm");
0122  sigmaYCmd -> SetUnitCandidates("mm cm m");
0123  sigmaYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
0124 
0125  ZpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition",this);
0126  ZpositionCmd -> SetGuidance("set z coordinate of particle");
0127  ZpositionCmd -> SetParameterName("position",false);
0128  ZpositionCmd -> SetDefaultUnit("mm");
0129  ZpositionCmd -> SetUnitCandidates("mm cm m");
0130  ZpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
0131 
0132  sigmaZCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition/sigmaZ",this);
0133  sigmaZCmd -> SetGuidance("set sigma z");
0134  sigmaZCmd -> SetParameterName("position",false);
0135  sigmaZCmd -> SetDefaultUnit("mm");
0136  sigmaZCmd -> SetUnitCandidates("mm cm m");
0137  sigmaZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
0138 }
0139 
0140 IORTPrimaryGeneratorMessenger::~IORTPrimaryGeneratorMessenger()
0141 {
0142   delete beamParametersDir;
0143   delete EnergyDir;
0144   delete meanKineticEnergyCmd;  
0145   delete sigmaEnergyCmd;
0146   delete particlePositionDir;
0147   delete MomentumDir;
0148   delete XpositionCmd; 
0149   delete YpositionCmd; 
0150   delete ZpositionCmd; 
0151   delete sigmaYCmd; 
0152   delete sigmaZCmd; 
0153   delete ThetaCmd;   
0154 //  delete sigmaMomentumYCmd; 
0155 //  delete sigmaMomentumZCmd; 
0156 }  
0157 
0158 void IORTPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)                
0159 {
0160   if ( command == meanKineticEnergyCmd )                                                                        
0161     { IORTAction -> SetmeanKineticEnergy(meanKineticEnergyCmd
0162                           -> GetNewDoubleValue(newValue));}
0163   if ( command == sigmaEnergyCmd )                                                                        
0164     { IORTAction -> SetsigmaEnergy(sigmaEnergyCmd
0165                         -> GetNewDoubleValue(newValue));}
0166   if ( command == XpositionCmd )                                                                        
0167     { IORTAction -> SetXposition(XpositionCmd
0168                       -> GetNewDoubleValue(newValue));}
0169 
0170   if ( command == YpositionCmd )                                                                        
0171     { IORTAction -> SetYposition(YpositionCmd
0172                       -> GetNewDoubleValue(newValue));}
0173 
0174   if ( command == ZpositionCmd )                                                                        
0175     { IORTAction -> SetZposition(ZpositionCmd
0176                       -> GetNewDoubleValue(newValue));}
0177 
0178   if ( command == sigmaYCmd )                                                                        
0179     { IORTAction -> SetsigmaY(sigmaYCmd
0180                        -> GetNewDoubleValue(newValue));}
0181 
0182   if ( command == sigmaZCmd )                                                                        
0183     { IORTAction -> SetsigmaZ(sigmaZCmd
0184                        -> GetNewDoubleValue(newValue));}
0185 
0186 if ( command == ThetaCmd )                                                                        
0187     { IORTAction -> SetTheta(ThetaCmd
0188                        -> GetNewDoubleValue(newValue));}
0189 
0190 
0191 /*
0192   if ( command == sigmaMomentumYCmd )                                                                        
0193     { IORTAction -> SetsigmaMomentumY(sigmaMomentumYCmd
0194                            -> GetNewDoubleValue(newValue));}
0195 
0196   if ( command == sigmaMomentumZCmd )                                                                        
0197     { IORTAction -> SetsigmaMomentumZ(sigmaMomentumZCmd
0198                            -> GetNewDoubleValue(newValue));}
0199 */
0200 }