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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/advanced/hadrontherapy/src/PassiveProtonBeamLineMessenger.cc (Version 11.3.0) and /examples/advanced/hadrontherapy/src/PassiveProtonBeamLineMessenger.cc (Version 9.5.p1)


  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 // Hadrontherapy advanced example for Geant4   <<  26 // This is the *BASIC* version of Hadrontherapy, a Geant4-based application
 27 // See more at: https://twiki.cern.ch/twiki/bi <<  27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
                                                   >>  28 //
                                                   >>  29 // Visit the Hadrontherapy web site (http://www.lns.infn.it/link/Hadrontherapy) to request 
                                                   >>  30 // the *COMPLETE* version of this program, together with its documentation;
                                                   >>  31 // Hadrontherapy (both basic and full version) are supported by the Italian INFN
                                                   >>  32 // Institute in the framework of the MC-INFN Group
                                                   >>  33 //
                                                   >>  34 
 28                                                    35 
 29 #include "PassiveProtonBeamLineMessenger.hh"       36 #include "PassiveProtonBeamLineMessenger.hh"
 30 #include "PassiveProtonBeamLine.hh"                37 #include "PassiveProtonBeamLine.hh"
 31 #include "G4UIdirectory.hh"                        38 #include "G4UIdirectory.hh"
 32 #include "G4UIcmdWithADoubleAndUnit.hh"            39 #include "G4UIcmdWithADoubleAndUnit.hh"
 33 #include "G4UIcmdWithAString.hh"                   40 #include "G4UIcmdWithAString.hh"
 34 #include "G4SystemOfUnits.hh"                  <<  41 
 35                                                    42 
 36     PassiveProtonBeamLineMessenger::PassivePro     43     PassiveProtonBeamLineMessenger::PassiveProtonBeamLineMessenger(PassiveProtonBeamLine* beamLine)
 37 :passiveProton(beamLine)                           44 :passiveProton(beamLine)
 38                                                    45 
 39 {                                                  46 {
 40     changeTheBeamLineDir = new G4UIdirectory("     47     changeTheBeamLineDir = new G4UIdirectory("/ChangeBeamLine/");
 41     changeTheBeamLineDir -> SetGuidance("Comma     48     changeTheBeamLineDir -> SetGuidance("Command to change the transport beam line");
 42                                                    49 
 43     changeTheBeamLineNameCmd = new G4UIcmdWith     50     changeTheBeamLineNameCmd = new G4UIcmdWithAString("/ChangeBeamLine/beamLineName",this);
 44     changeTheBeamLineNameCmd -> SetGuidance("I     51     changeTheBeamLineNameCmd -> SetGuidance("Insert the name of the beam line you want simulate");
 45     changeTheBeamLineNameCmd -> SetParameterNa     52     changeTheBeamLineNameCmd -> SetParameterName("List",false);
 46     changeTheBeamLineNameCmd -> AvailableForSt     53     changeTheBeamLineNameCmd -> AvailableForStates(G4State_PreInit); 
 47                                                    54 
 48     modulatorDir = new G4UIdirectory("/modulat     55     modulatorDir = new G4UIdirectory("/modulator/");
 49     modulatorDir -> SetGuidance("Command to ro     56     modulatorDir -> SetGuidance("Command to rotate the modulator wheel");
 50                                                    57 
 51     beamLineDir = new G4UIdirectory("/beamLine     58     beamLineDir = new G4UIdirectory("/beamLine/");
 52     beamLineDir -> SetGuidance("set specificat     59     beamLineDir -> SetGuidance("set specification of range shifter");  
 53                                                    60 
 54     rangeShifterDir = new G4UIdirectory("/beam     61     rangeShifterDir = new G4UIdirectory("/beamLine/RangeShifter/");
 55     rangeShifterDir -> SetGuidance("set specif     62     rangeShifterDir -> SetGuidance("set specification of range shifter");  
 56                                                    63 
 57     firstScatteringFoilDir = new G4UIdirectory     64     firstScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil1/");
 58     firstScatteringFoilDir -> SetGuidance("set     65     firstScatteringFoilDir -> SetGuidance("set specification of first scattering foil");  
 59                                                    66 
 60     secondScatteringFoilDir = new G4UIdirector     67     secondScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil2/");
 61     secondScatteringFoilDir -> SetGuidance("se     68     secondScatteringFoilDir -> SetGuidance("set specification of second scattering foil");  
 62                                                    69 
 63     rangeStopperDir = new G4UIdirectory("/beam     70     rangeStopperDir = new G4UIdirectory("/beamLine/Stopper/");
 64     rangeStopperDir -> SetGuidance("set specif     71     rangeStopperDir -> SetGuidance("set specification of stopper");  
 65                                                    72 
 66     finalCollimatorDir = new G4UIdirectory("/b     73     finalCollimatorDir = new G4UIdirectory("/beamLine/FinalCollimator/");
 67     finalCollimatorDir -> SetGuidance("set spe     74     finalCollimatorDir -> SetGuidance("set specification of final collimator");  
 68                                                    75 
 69     modulatorAngleCmd = new G4UIcmdWithADouble     76     modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
 70     modulatorAngleCmd -> SetGuidance("Set Modu     77     modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
 71     modulatorAngleCmd -> SetParameterName("Siz     78     modulatorAngleCmd -> SetParameterName("Size",false);
 72     modulatorAngleCmd -> SetRange("Size>=0.");     79     modulatorAngleCmd -> SetRange("Size>=0.");
 73     modulatorAngleCmd -> SetUnitCategory("Angl     80     modulatorAngleCmd -> SetUnitCategory("Angle");  
 74     modulatorAngleCmd -> AvailableForStates(G4     81     modulatorAngleCmd -> AvailableForStates(G4State_Idle);
 75                                                    82 
 76     rangeShifterMatCmd = new G4UIcmdWithAStrin     83     rangeShifterMatCmd = new G4UIcmdWithAString("/beamLine/RangeShifter/RSMat",this);
 77     rangeShifterMatCmd -> SetGuidance("Set mat     84     rangeShifterMatCmd -> SetGuidance("Set material of range shifter");
 78     rangeShifterMatCmd -> SetParameterName("ch     85     rangeShifterMatCmd -> SetParameterName("choice",false);
 79     rangeShifterMatCmd -> AvailableForStates(G     86     rangeShifterMatCmd -> AvailableForStates(G4State_Idle);
 80                                                    87 
 81     rangeShifterXSizeCmd = new G4UIcmdWithADou     88     rangeShifterXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/thickness",this);
 82     rangeShifterXSizeCmd -> SetGuidance("Set h     89     rangeShifterXSizeCmd -> SetGuidance("Set half of the thickness of range shifter along X axis");
 83     rangeShifterXSizeCmd -> SetParameterName("     90     rangeShifterXSizeCmd -> SetParameterName("Size",false);
 84     rangeShifterXSizeCmd -> SetDefaultUnit("mm     91     rangeShifterXSizeCmd -> SetDefaultUnit("mm");  
 85     rangeShifterXSizeCmd -> SetUnitCandidates(     92     rangeShifterXSizeCmd -> SetUnitCandidates("mm cm m");  
 86     rangeShifterXSizeCmd -> AvailableForStates     93     rangeShifterXSizeCmd -> AvailableForStates(G4State_Idle);
 87                                                    94 
 88     rangeShifterXPositionCmd = new G4UIcmdWith     95     rangeShifterXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/position",this);
 89     rangeShifterXPositionCmd -> SetGuidance("S     96     rangeShifterXPositionCmd -> SetGuidance("Set position of range shifter");
 90     rangeShifterXPositionCmd -> SetParameterNa     97     rangeShifterXPositionCmd -> SetParameterName("Size",false);
 91     rangeShifterXPositionCmd -> SetDefaultUnit     98     rangeShifterXPositionCmd -> SetDefaultUnit("mm");  
 92     rangeShifterXPositionCmd -> SetUnitCandida     99     rangeShifterXPositionCmd -> SetUnitCandidates("mm cm m");  
 93     rangeShifterXPositionCmd -> AvailableForSt    100     rangeShifterXPositionCmd -> AvailableForStates(G4State_Idle);
 94                                                   101 
 95     firstScatteringFoilXSizeCmd = new G4UIcmdW    102     firstScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil1/thickness",this);
 96     firstScatteringFoilXSizeCmd -> SetGuidance    103     firstScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of first scattering foil");
 97     firstScatteringFoilXSizeCmd -> SetParamete    104     firstScatteringFoilXSizeCmd -> SetParameterName("Size",false);
 98     firstScatteringFoilXSizeCmd -> SetDefaultU    105     firstScatteringFoilXSizeCmd -> SetDefaultUnit("mm");  
 99     firstScatteringFoilXSizeCmd -> SetUnitCand    106     firstScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");  
100     firstScatteringFoilXSizeCmd -> AvailableFo    107     firstScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
101                                                   108 
102     secondScatteringFoilXSizeCmd = new G4UIcmd    109     secondScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil2/thickness",this);
103     secondScatteringFoilXSizeCmd -> SetGuidanc    110     secondScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of second scattering foil");
104     secondScatteringFoilXSizeCmd -> SetParamet    111     secondScatteringFoilXSizeCmd -> SetParameterName("Size",false);
105     secondScatteringFoilXSizeCmd -> SetDefault    112     secondScatteringFoilXSizeCmd -> SetDefaultUnit("mm");  
106     secondScatteringFoilXSizeCmd -> SetUnitCan    113     secondScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");  
107     secondScatteringFoilXSizeCmd -> AvailableF    114     secondScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
108                                                   115 
109     outerRadiusStopperCmd = new G4UIcmdWithADo    116     outerRadiusStopperCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/Stopper/outRadius",this);
110     outerRadiusStopperCmd -> SetGuidance("Set     117     outerRadiusStopperCmd -> SetGuidance("Set size of outer radius");
111     outerRadiusStopperCmd -> SetParameterName(    118     outerRadiusStopperCmd -> SetParameterName("Size",false);
112     outerRadiusStopperCmd -> SetDefaultUnit("m    119     outerRadiusStopperCmd -> SetDefaultUnit("mm");  
113     outerRadiusStopperCmd -> SetUnitCandidates    120     outerRadiusStopperCmd -> SetUnitCandidates("mm cm m");  
114     outerRadiusStopperCmd -> AvailableForState    121     outerRadiusStopperCmd -> AvailableForStates(G4State_Idle);
115                                                   122 
116     innerRadiusFinalCollimatorCmd = new G4UIcm    123     innerRadiusFinalCollimatorCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimator/halfInnerRad",this);
117     innerRadiusFinalCollimatorCmd -> SetGuidan    124     innerRadiusFinalCollimatorCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
118     innerRadiusFinalCollimatorCmd -> SetParame    125     innerRadiusFinalCollimatorCmd -> SetParameterName("Size",false);
119     innerRadiusFinalCollimatorCmd -> SetDefaul    126     innerRadiusFinalCollimatorCmd -> SetDefaultUnit("mm");  
120     innerRadiusFinalCollimatorCmd -> SetUnitCa    127     innerRadiusFinalCollimatorCmd -> SetUnitCandidates("mm cm m");  
121     innerRadiusFinalCollimatorCmd -> Available    128     innerRadiusFinalCollimatorCmd -> AvailableForStates(G4State_Idle);
122 }                                                 129 }
123                                                   130 
124 PassiveProtonBeamLineMessenger::~PassiveProton    131 PassiveProtonBeamLineMessenger::~PassiveProtonBeamLineMessenger()
125 {                                                 132 { 
126     delete innerRadiusFinalCollimatorCmd;         133     delete innerRadiusFinalCollimatorCmd;  
127     delete outerRadiusStopperCmd;                 134     delete outerRadiusStopperCmd;  
128     delete secondScatteringFoilXSizeCmd;          135     delete secondScatteringFoilXSizeCmd; 
129     delete firstScatteringFoilXSizeCmd;           136     delete firstScatteringFoilXSizeCmd; 
130     delete rangeShifterXPositionCmd;              137     delete rangeShifterXPositionCmd;
131     delete rangeShifterXSizeCmd;                  138     delete rangeShifterXSizeCmd;
132     delete rangeShifterMatCmd;                    139     delete rangeShifterMatCmd;
133     delete modulatorAngleCmd;                     140     delete modulatorAngleCmd;
134     delete finalCollimatorDir;                    141     delete finalCollimatorDir; 
135     delete rangeStopperDir;                       142     delete rangeStopperDir;
136     delete secondScatteringFoilDir;               143     delete secondScatteringFoilDir;
137     delete firstScatteringFoilDir;                144     delete firstScatteringFoilDir; 
138     delete rangeShifterDir;                       145     delete rangeShifterDir;  
139     delete beamLineDir;                           146     delete beamLineDir; 
140     delete modulatorDir;                          147     delete modulatorDir;   
141 }                                                 148 }
142                                                   149 
143                                                   150 
144                                                   151 
145                                                   152 
146 void PassiveProtonBeamLineMessenger::SetNewVal    153 void PassiveProtonBeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
147 {                                                 154 { 
148     if( command == modulatorAngleCmd )            155     if( command == modulatorAngleCmd )
149     { passiveProton -> SetModulatorAngle          156     { passiveProton -> SetModulatorAngle
150   (modulatorAngleCmd -> GetNewDoubleValue(newV    157   (modulatorAngleCmd -> GetNewDoubleValue(newValue));}
151                                                   158 
152     else if( command == rangeShifterMatCmd )      159     else if( command == rangeShifterMatCmd )
153     { passiveProton -> SetRSMaterial(newValue)    160     { passiveProton -> SetRSMaterial(newValue);}
154                                                   161 
155     else if( command == rangeShifterXSizeCmd )    162     else if( command == rangeShifterXSizeCmd )
156     { passiveProton -> SetRangeShifterXSize       163     { passiveProton -> SetRangeShifterXSize
157   (rangeShifterXSizeCmd -> GetNewDoubleValue(n    164   (rangeShifterXSizeCmd -> GetNewDoubleValue(newValue));}
158                                                   165 
159     else if( command == rangeShifterXPositionC    166     else if( command == rangeShifterXPositionCmd )
160     { passiveProton -> SetRangeShifterXPositio    167     { passiveProton -> SetRangeShifterXPosition
161   (rangeShifterXPositionCmd -> GetNewDoubleVal    168   (rangeShifterXPositionCmd -> GetNewDoubleValue(newValue));}
162                                                   169 
163     else if( command == firstScatteringFoilXSi    170     else if( command == firstScatteringFoilXSizeCmd )
164     { passiveProton -> SetFirstScatteringFoilX    171     { passiveProton -> SetFirstScatteringFoilXSize
165   (firstScatteringFoilXSizeCmd -> GetNewDouble    172   (firstScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
166                                                   173 
167     else if( command == secondScatteringFoilXS    174     else if( command == secondScatteringFoilXSizeCmd )
168     { passiveProton -> SetSecondScatteringFoil    175     { passiveProton -> SetSecondScatteringFoilXSize
169   (secondScatteringFoilXSizeCmd -> GetNewDoubl    176   (secondScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
170                                                   177 
171     else if( command == outerRadiusStopperCmd     178     else if( command == outerRadiusStopperCmd )
172     { passiveProton -> SetOuterRadiusStopper(     179     { passiveProton -> SetOuterRadiusStopper(
173       outerRadiusStopperCmd -> GetNewDoubleVal    180       outerRadiusStopperCmd -> GetNewDoubleValue(newValue));}
174                                                   181 
175     else if( command == innerRadiusFinalCollim    182     else if( command == innerRadiusFinalCollimatorCmd )
176     { passiveProton -> SetInnerRadiusFinalColl    183     { passiveProton -> SetInnerRadiusFinalCollimator
177   (innerRadiusFinalCollimatorCmd -> GetNewDoub    184   (innerRadiusFinalCollimatorCmd -> GetNewDoubleValue(newValue));}
178 }                                                 185 }
179                                                   186 
180                                                   187