[807] | 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: HadrontherapyPrimaryGeneratorMessenger.cc; May 2005 |
---|
| 27 | // ---------------------------------------------------------------------------- |
---|
| 28 | // GEANT 4 - Hadrontherapy example |
---|
| 29 | // ---------------------------------------------------------------------------- |
---|
| 30 | // Code developed by: |
---|
| 31 | // |
---|
| 32 | // G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a) |
---|
| 33 | // |
---|
| 34 | // (a) Laboratori Nazionali del Sud |
---|
| 35 | // of the National Institute for Nuclear Physics, Catania, Italy |
---|
| 36 | // (b) National Institute for Nuclear Physics Section of Genova, genova, Italy |
---|
| 37 | // |
---|
| 38 | // * cirrone@lns.infn.it |
---|
| 39 | // ---------------------------------------------------------------------------- |
---|
| 40 | |
---|
| 41 | #include "HadrontherapyPrimaryGeneratorMessenger.hh" |
---|
| 42 | #include "HadrontherapyPrimaryGeneratorAction.hh" |
---|
| 43 | #include "G4UIdirectory.hh" |
---|
| 44 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
| 45 | #include "G4UIcmdWithADouble.hh" |
---|
| 46 | |
---|
| 47 | HadrontherapyPrimaryGeneratorMessenger::HadrontherapyPrimaryGeneratorMessenger( |
---|
| 48 | HadrontherapyPrimaryGeneratorAction* HadrontherapyGun) |
---|
| 49 | :HadrontherapyAction(HadrontherapyGun) |
---|
| 50 | { |
---|
| 51 | // |
---|
| 52 | // Definition of the interactive commands to modify the parameters of the |
---|
| 53 | // generation of primary particles |
---|
| 54 | // |
---|
| 55 | beamParametersDir = new G4UIdirectory("/beam/"); |
---|
| 56 | beamParametersDir -> SetGuidance("set parameters of beam"); |
---|
| 57 | |
---|
| 58 | EnergyDir = new G4UIdirectory("/beam/energy/"); |
---|
| 59 | EnergyDir -> SetGuidance ("set energy of beam"); |
---|
| 60 | |
---|
| 61 | particlePositionDir = new G4UIdirectory("/beam/position/"); |
---|
| 62 | particlePositionDir -> SetGuidance ("set position of particle"); |
---|
| 63 | |
---|
| 64 | MomentumDir = new G4UIdirectory("/beam/momentum/"); |
---|
| 65 | MomentumDir -> SetGuidance ("set momentum of particle "); |
---|
| 66 | |
---|
| 67 | sigmaMomentumYCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaY",this); |
---|
| 68 | sigmaMomentumYCmd -> SetGuidance("set sigma momentum y"); |
---|
| 69 | sigmaMomentumYCmd -> SetParameterName("momentum",false); |
---|
| 70 | sigmaMomentumYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 71 | |
---|
| 72 | sigmaMomentumZCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaZ",this); |
---|
| 73 | sigmaMomentumZCmd -> SetGuidance("set sigma momentum z"); |
---|
| 74 | sigmaMomentumZCmd -> SetParameterName("momentum",false); |
---|
| 75 | sigmaMomentumZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 76 | |
---|
| 77 | meanKineticEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/meanEnergy",this); |
---|
| 78 | meanKineticEnergyCmd -> SetGuidance("set mean Kinetic energy"); |
---|
| 79 | meanKineticEnergyCmd -> SetParameterName("Energy",false); |
---|
| 80 | meanKineticEnergyCmd -> SetDefaultUnit("MeV"); |
---|
| 81 | meanKineticEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV"); |
---|
| 82 | meanKineticEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 83 | |
---|
| 84 | sigmaEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/sigmaEnergy",this); |
---|
| 85 | sigmaEnergyCmd -> SetGuidance("set sigma energy"); |
---|
| 86 | sigmaEnergyCmd -> SetParameterName("Energy",false); |
---|
| 87 | sigmaEnergyCmd -> SetDefaultUnit("keV"); |
---|
| 88 | sigmaEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV"); |
---|
| 89 | sigmaEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 90 | |
---|
| 91 | XpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Xposition",this); |
---|
| 92 | XpositionCmd -> SetGuidance("set x coordinate of particle"); |
---|
| 93 | XpositionCmd -> SetParameterName("position",false); |
---|
| 94 | XpositionCmd -> SetDefaultUnit("mm"); |
---|
| 95 | XpositionCmd -> SetUnitCandidates("mm cm m"); |
---|
| 96 | XpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 97 | |
---|
| 98 | YpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition",this); |
---|
| 99 | YpositionCmd -> SetGuidance("set y coordinate of particle"); |
---|
| 100 | YpositionCmd -> SetParameterName("position",false); |
---|
| 101 | YpositionCmd -> SetDefaultUnit("mm"); |
---|
| 102 | YpositionCmd -> SetUnitCandidates("mm cm m"); |
---|
| 103 | YpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 104 | |
---|
| 105 | sigmaYCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition/sigmaY",this); |
---|
| 106 | sigmaYCmd -> SetGuidance("set sigma y"); |
---|
| 107 | sigmaYCmd -> SetParameterName("position",false); |
---|
| 108 | sigmaYCmd -> SetDefaultUnit("mm"); |
---|
| 109 | sigmaYCmd -> SetUnitCandidates("mm cm m"); |
---|
| 110 | sigmaYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 111 | |
---|
| 112 | ZpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition",this); |
---|
| 113 | ZpositionCmd -> SetGuidance("set z coordinate of particle"); |
---|
| 114 | ZpositionCmd -> SetParameterName("position",false); |
---|
| 115 | ZpositionCmd -> SetDefaultUnit("mm"); |
---|
| 116 | ZpositionCmd -> SetUnitCandidates("mm cm m"); |
---|
| 117 | ZpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 118 | |
---|
| 119 | sigmaZCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition/sigmaZ",this); |
---|
| 120 | sigmaZCmd -> SetGuidance("set sigma z"); |
---|
| 121 | sigmaZCmd -> SetParameterName("position",false); |
---|
| 122 | sigmaZCmd -> SetDefaultUnit("mm"); |
---|
| 123 | sigmaZCmd -> SetUnitCandidates("mm cm m"); |
---|
| 124 | sigmaZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | HadrontherapyPrimaryGeneratorMessenger::~HadrontherapyPrimaryGeneratorMessenger() |
---|
| 128 | { |
---|
| 129 | delete beamParametersDir; |
---|
| 130 | delete EnergyDir; |
---|
| 131 | delete meanKineticEnergyCmd; |
---|
| 132 | delete sigmaEnergyCmd; |
---|
| 133 | delete particlePositionDir; |
---|
| 134 | delete MomentumDir; |
---|
| 135 | delete XpositionCmd; |
---|
| 136 | delete YpositionCmd; |
---|
| 137 | delete ZpositionCmd; |
---|
| 138 | delete sigmaYCmd; |
---|
| 139 | delete sigmaZCmd; |
---|
| 140 | delete sigmaMomentumYCmd; |
---|
| 141 | delete sigmaMomentumZCmd; |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | void HadrontherapyPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) |
---|
| 145 | { |
---|
| 146 | if ( command == meanKineticEnergyCmd ) |
---|
| 147 | { HadrontherapyAction -> SetmeanKineticEnergy(meanKineticEnergyCmd |
---|
| 148 | -> GetNewDoubleValue(newValue));} |
---|
| 149 | if ( command == sigmaEnergyCmd ) |
---|
| 150 | { HadrontherapyAction -> SetsigmaEnergy(sigmaEnergyCmd |
---|
| 151 | -> GetNewDoubleValue(newValue));} |
---|
| 152 | if ( command == XpositionCmd ) |
---|
| 153 | { HadrontherapyAction -> SetXposition(XpositionCmd |
---|
| 154 | -> GetNewDoubleValue(newValue));} |
---|
| 155 | |
---|
| 156 | if ( command == YpositionCmd ) |
---|
| 157 | { HadrontherapyAction -> SetYposition(YpositionCmd |
---|
| 158 | -> GetNewDoubleValue(newValue));} |
---|
| 159 | |
---|
| 160 | if ( command == ZpositionCmd ) |
---|
| 161 | { HadrontherapyAction -> SetZposition(ZpositionCmd |
---|
| 162 | -> GetNewDoubleValue(newValue));} |
---|
| 163 | |
---|
| 164 | if ( command == sigmaYCmd ) |
---|
| 165 | { HadrontherapyAction -> SetsigmaY(sigmaYCmd |
---|
| 166 | -> GetNewDoubleValue(newValue));} |
---|
| 167 | |
---|
| 168 | if ( command == sigmaZCmd ) |
---|
| 169 | { HadrontherapyAction -> SetsigmaZ(sigmaZCmd |
---|
| 170 | -> GetNewDoubleValue(newValue));} |
---|
| 171 | |
---|
| 172 | if ( command == sigmaMomentumYCmd ) |
---|
| 173 | { HadrontherapyAction -> SetsigmaMomentumY(sigmaMomentumYCmd |
---|
| 174 | -> GetNewDoubleValue(newValue));} |
---|
| 175 | |
---|
| 176 | if ( command == sigmaMomentumZCmd ) |
---|
| 177 | { HadrontherapyAction -> SetsigmaMomentumZ(sigmaMomentumZCmd |
---|
| 178 | -> GetNewDoubleValue(newValue));} |
---|
| 179 | } |
---|