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[ 10.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/advanced/hadrontherapy/src/HadrontherapyPrimaryGeneratorMessenger.cc (Version 11.3.0) and /examples/advanced/hadrontherapy/src/HadrontherapyPrimaryGeneratorMessenger.cc (Version 8.0)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
                                                   >>  22 // $Id: HadrontherapyPrimaryGeneratorMessenger.cc; May 2005
                                                   >>  23 // ----------------------------------------------------------------------------
                                                   >>  24 //                 GEANT 4 - Hadrontherapy example
                                                   >>  25 // ----------------------------------------------------------------------------
                                                   >>  26 // Code developed by:
 25 //                                                 27 //
 26 // Hadrontherapy advanced example for Geant4   <<  28 // G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
 27 // See more at: https://twiki.cern.ch/twiki/bi <<  29 // 
                                                   >>  30 // (a) Laboratori Nazionali del Sud 
                                                   >>  31 //     of the National Institute for Nuclear Physics, Catania, Italy
                                                   >>  32 // (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
                                                   >>  33 // 
                                                   >>  34 // * cirrone@lns.infn.it
                                                   >>  35 // ----------------------------------------------------------------------------
 28                                                    36 
 29 #include "HadrontherapyPrimaryGeneratorMesseng     37 #include "HadrontherapyPrimaryGeneratorMessenger.hh"
 30 #include "HadrontherapyPrimaryGeneratorAction.     38 #include "HadrontherapyPrimaryGeneratorAction.hh"
 31 #include "G4UIdirectory.hh"                        39 #include "G4UIdirectory.hh"
                                                   >>  40 #include "G4UIcmdWithAString.hh"
 32 #include "G4UIcmdWithADoubleAndUnit.hh"            41 #include "G4UIcmdWithADoubleAndUnit.hh"
 33 #include "G4UIcmdWithADouble.hh"                   42 #include "G4UIcmdWithADouble.hh"
 34 #include "G4SystemOfUnits.hh"                  << 
 35 #include "G4UIcmdWithAString.hh"               << 
 36 #include "G4UIcmdWithAnInteger.hh"             << 
 37 #include "G4UIcmdWithABool.hh"                 << 
 38                                                    43 
 39 HadrontherapyPrimaryGeneratorMessenger::Hadron     44 HadrontherapyPrimaryGeneratorMessenger::HadrontherapyPrimaryGeneratorMessenger(
 40                                                <<  45                                              HadrontherapyPrimaryGeneratorAction* HadrontherapyGun)
 41 :HadrontherapyAction(HadrontherapyGun)             46 :HadrontherapyAction(HadrontherapyGun)
 42 {                                              <<  47 { 
 43                                                <<  48  beamParametersDir = new G4UIdirectory("/beam/");
 44     changeTheSource = new G4UIdirectory("/prim <<  49  beamParametersDir -> SetGuidance("set parameters of beam");
 45     changeTheSource -> SetGuidance("Command to <<  50  
 46                                                <<  51  EnergyDir = new G4UIdirectory("/beam/energy/");  
 47     NewSource = new G4UIcmdWithABool("/primary <<  52  EnergyDir -> SetGuidance ("set energy of beam");  
 48     NewSource -> SetParameterName("NewSource " <<  53 
 49     NewSource -> SetDefaultValue("false");     <<  54  particlePositionDir = new G4UIdirectory("/beam/position/");  
 50     NewSource -> SetGuidance("Set if you want  <<  55  particlePositionDir -> SetGuidance ("set position of particle");  
 51                              "\n[usage]: /prim <<  56 
 52     NewSource -> AvailableForStates(G4State_Id <<  57  MomentumDir = new G4UIdirectory("/beam/momentum/");  
 53                                                <<  58  MomentumDir -> SetGuidance ("set momentum of particle ");  
 54                                                <<  59 
 55     calculatedPhaseSpaceFileIN=new G4UIcmdWith <<  60  sigmaMomentumYCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaY",this);
 56     calculatedPhaseSpaceFileIN->SetDefaultValu <<  61  sigmaMomentumYCmd -> SetGuidance("set sigma momentum y");
 57     calculatedPhaseSpaceFileIN->SetGuidance("f <<  62  sigmaMomentumYCmd -> SetParameterName("momentum",false);
 58                                                <<  63  sigmaMomentumYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
 59                                                <<  64 
 60                                                <<  65 
                                                   >>  66  sigmaMomentumZCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaZ",this);
                                                   >>  67  sigmaMomentumZCmd -> SetGuidance("set sigma momentum z");
                                                   >>  68  sigmaMomentumZCmd -> SetParameterName("momentum",false);
                                                   >>  69  sigmaMomentumZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);   
                                                   >>  70 
                                                   >>  71 
                                                   >>  72  meanKineticEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/meanEnergy",this);
                                                   >>  73  meanKineticEnergyCmd->SetGuidance("set mean Kinetic energy");
                                                   >>  74  meanKineticEnergyCmd->SetParameterName("Energy",false);
                                                   >>  75  meanKineticEnergyCmd->SetDefaultUnit("MeV");
                                                   >>  76  meanKineticEnergyCmd->SetUnitCandidates("eV keV MeV GeV TeV");
                                                   >>  77  meanKineticEnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle);   
                                                   >>  78 
                                                   >>  79  
                                                   >>  80  sigmaEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/sigmaEnergy",this);
                                                   >>  81  sigmaEnergyCmd->SetGuidance("set sigma energy");
                                                   >>  82  sigmaEnergyCmd->SetParameterName("Energy",false);
                                                   >>  83  sigmaEnergyCmd->SetDefaultUnit("keV");
                                                   >>  84  sigmaEnergyCmd->SetUnitCandidates("eV keV MeV GeV TeV");
                                                   >>  85  sigmaEnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle);   
                                                   >>  86  
                                                   >>  87 
                                                   >>  88  XpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Xposition",this);
                                                   >>  89  XpositionCmd->SetGuidance("set x coordinate of particle");
                                                   >>  90  XpositionCmd->SetParameterName("position",false);
                                                   >>  91  XpositionCmd->SetDefaultUnit("mm");
                                                   >>  92  XpositionCmd->SetUnitCandidates("mm cm m");
                                                   >>  93  XpositionCmd->AvailableForStates(G4State_PreInit,G4State_Idle);   
                                                   >>  94 
                                                   >>  95 
                                                   >>  96  YpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition",this);
                                                   >>  97  YpositionCmd->SetGuidance("set y coordinate of particle");
                                                   >>  98  YpositionCmd->SetParameterName("position",false);
                                                   >>  99  YpositionCmd->SetDefaultUnit("mm");
                                                   >> 100  YpositionCmd->SetUnitCandidates("mm cm m");
                                                   >> 101  YpositionCmd->AvailableForStates(G4State_PreInit,G4State_Idle);   
                                                   >> 102 
                                                   >> 103  sigmaYCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition/sigmaY",this);
                                                   >> 104  sigmaYCmd->SetGuidance("set sigma y");
                                                   >> 105  sigmaYCmd->SetParameterName("position",false);
                                                   >> 106  sigmaYCmd->SetDefaultUnit("mm");
                                                   >> 107  sigmaYCmd->SetUnitCandidates("mm cm m");
                                                   >> 108  sigmaYCmd->AvailableForStates(G4State_PreInit,G4State_Idle);   
                                                   >> 109 
                                                   >> 110 
                                                   >> 111  ZpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition",this);
                                                   >> 112  ZpositionCmd->SetGuidance("set z coordinate of particle");
                                                   >> 113  ZpositionCmd->SetParameterName("position",false);
                                                   >> 114  ZpositionCmd->SetDefaultUnit("mm");
                                                   >> 115  ZpositionCmd->SetUnitCandidates("mm cm m");
                                                   >> 116  ZpositionCmd->AvailableForStates(G4State_PreInit,G4State_Idle);   
                                                   >> 117 
                                                   >> 118  sigmaZCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition/sigmaZ",this);sigmaZCmd->SetGuidance("set sigma z");
                                                   >> 119  sigmaZCmd->SetParameterName("position",false);
                                                   >> 120  sigmaZCmd->SetDefaultUnit("mm");
                                                   >> 121  sigmaZCmd->SetUnitCandidates("mm cm m");
                                                   >> 122  sigmaZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);   
 61 }                                                 123 }
 62                                                   124 
 63 HadrontherapyPrimaryGeneratorMessenger::~Hadro    125 HadrontherapyPrimaryGeneratorMessenger::~HadrontherapyPrimaryGeneratorMessenger()
 64 {                                                 126 {
 65                                                << 127   delete beamParametersDir;
 66     delete NewSource;                          << 128   delete EnergyDir;
 67     delete changeTheSource;                    << 129   delete meanKineticEnergyCmd;  
 68     delete calculatedPhaseSpaceFileIN;         << 130   delete sigmaEnergyCmd;
 69                                                << 131   delete particlePositionDir;
 70                                                << 132   delete MomentumDir;
 71 }                                              << 133   delete XpositionCmd; 
 72                                                << 134   delete YpositionCmd; 
 73                                                << 135   delete ZpositionCmd; 
 74 void HadrontherapyPrimaryGeneratorMessenger::S << 136   delete sigmaYCmd; 
                                                   >> 137   delete sigmaZCmd; 
                                                   >> 138   delete sigmaMomentumYCmd; 
                                                   >> 139   delete sigmaMomentumZCmd; 
                                                   >> 140 }  
 75                                                   141 
                                                   >> 142 void HadrontherapyPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)                
 76 {                                                 143 {
 77     if (command == calculatedPhaseSpaceFileIN) << 144   if ( command == meanKineticEnergyCmd )                                                                        
 78     {                                          << 145     { HadrontherapyAction -> SetmeanKineticEnergy(meanKineticEnergyCmd
 79         HadrontherapyAction->setCalculatedPhas << 146               ->GetNewDoubleValue(newValue));}
 80     }                                          << 147   if ( command == sigmaEnergyCmd )                                                                        
 81                                                << 148     { HadrontherapyAction -> SetsigmaEnergy(sigmaEnergyCmd
 82     if (command == NewSource)                  << 149               ->GetNewDoubleValue(newValue));}
 83     {                                          << 150   if ( command == XpositionCmd )                                                                        
 84         HadrontherapyAction->setNewSource(NewS << 151     { HadrontherapyAction -> SetXposition(XpositionCmd
 85                                                << 152             ->GetNewDoubleValue(newValue));}
 86     }                                          << 153 
 87                                                << 154   if ( command == YpositionCmd )                                                                        
 88 }                                              << 155     { HadrontherapyAction -> SetYposition(YpositionCmd
 89                                                << 156             ->GetNewDoubleValue(newValue));}
 90                                                << 157 
 91                                                << 158   if ( command == ZpositionCmd )                                                                        
                                                   >> 159     { HadrontherapyAction -> SetZposition(ZpositionCmd
                                                   >> 160             ->GetNewDoubleValue(newValue));}
                                                   >> 161 
                                                   >> 162   if ( command == sigmaYCmd )                                                                        
                                                   >> 163     { HadrontherapyAction -> SetsigmaY(sigmaYCmd
                                                   >> 164                ->GetNewDoubleValue(newValue));}
                                                   >> 165 
                                                   >> 166   if ( command == sigmaZCmd )                                                                        
                                                   >> 167     { HadrontherapyAction -> SetsigmaZ(sigmaZCmd
                                                   >> 168                ->GetNewDoubleValue(newValue));}
                                                   >> 169 
                                                   >> 170   if ( command == sigmaMomentumYCmd )                                                                        
                                                   >> 171     { HadrontherapyAction -> SetsigmaMomentumY(sigmaMomentumYCmd
                                                   >> 172                  ->GetNewDoubleValue(newValue));}
                                                   >> 173 
                                                   >> 174   if ( command == sigmaMomentumZCmd )                                                                        
                                                   >> 175     { HadrontherapyAction -> SetsigmaMomentumZ(sigmaMomentumZCmd
                                                   >> 176                  ->GetNewDoubleValue(newValue));}
                                                   >> 177 }                 
 92                                                   178