Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // Hadrontherapy advanced example for Geant4 27 // See more at: https://twiki.cern.ch/twiki/bi 28 29 #include "PassiveProtonBeamLineMessenger.hh" 30 #include "PassiveProtonBeamLine.hh" 31 #include "G4UIdirectory.hh" 32 #include "G4UIcmdWithADoubleAndUnit.hh" 33 #include "G4UIcmdWithAString.hh" 34 #include "G4SystemOfUnits.hh" 35 36 PassiveProtonBeamLineMessenger::PassivePro 37 :passiveProton(beamLine) 38 39 { 40 changeTheBeamLineDir = new G4UIdirectory(" 41 changeTheBeamLineDir -> SetGuidance("Comma 42 43 changeTheBeamLineNameCmd = new G4UIcmdWith 44 changeTheBeamLineNameCmd -> SetGuidance("I 45 changeTheBeamLineNameCmd -> SetParameterNa 46 changeTheBeamLineNameCmd -> AvailableForSt 47 48 modulatorDir = new G4UIdirectory("/modulat 49 modulatorDir -> SetGuidance("Command to ro 50 51 beamLineDir = new G4UIdirectory("/beamLine 52 beamLineDir -> SetGuidance("set specificat 53 54 rangeShifterDir = new G4UIdirectory("/beam 55 rangeShifterDir -> SetGuidance("set specif 56 57 firstScatteringFoilDir = new G4UIdirectory 58 firstScatteringFoilDir -> SetGuidance("set 59 60 secondScatteringFoilDir = new G4UIdirector 61 secondScatteringFoilDir -> SetGuidance("se 62 63 rangeStopperDir = new G4UIdirectory("/beam 64 rangeStopperDir -> SetGuidance("set specif 65 66 finalCollimatorDir = new G4UIdirectory("/b 67 finalCollimatorDir -> SetGuidance("set spe 68 69 modulatorAngleCmd = new G4UIcmdWithADouble 70 modulatorAngleCmd -> SetGuidance("Set Modu 71 modulatorAngleCmd -> SetParameterName("Siz 72 modulatorAngleCmd -> SetRange("Size>=0."); 73 modulatorAngleCmd -> SetUnitCategory("Angl 74 modulatorAngleCmd -> AvailableForStates(G4 75 76 rangeShifterMatCmd = new G4UIcmdWithAStrin 77 rangeShifterMatCmd -> SetGuidance("Set mat 78 rangeShifterMatCmd -> SetParameterName("ch 79 rangeShifterMatCmd -> AvailableForStates(G 80 81 rangeShifterXSizeCmd = new G4UIcmdWithADou 82 rangeShifterXSizeCmd -> SetGuidance("Set h 83 rangeShifterXSizeCmd -> SetParameterName(" 84 rangeShifterXSizeCmd -> SetDefaultUnit("mm 85 rangeShifterXSizeCmd -> SetUnitCandidates( 86 rangeShifterXSizeCmd -> AvailableForStates 87 88 rangeShifterXPositionCmd = new G4UIcmdWith 89 rangeShifterXPositionCmd -> SetGuidance("S 90 rangeShifterXPositionCmd -> SetParameterNa 91 rangeShifterXPositionCmd -> SetDefaultUnit 92 rangeShifterXPositionCmd -> SetUnitCandida 93 rangeShifterXPositionCmd -> AvailableForSt 94 95 firstScatteringFoilXSizeCmd = new G4UIcmdW 96 firstScatteringFoilXSizeCmd -> SetGuidance 97 firstScatteringFoilXSizeCmd -> SetParamete 98 firstScatteringFoilXSizeCmd -> SetDefaultU 99 firstScatteringFoilXSizeCmd -> SetUnitCand 100 firstScatteringFoilXSizeCmd -> AvailableFo 101 102 secondScatteringFoilXSizeCmd = new G4UIcmd 103 secondScatteringFoilXSizeCmd -> SetGuidanc 104 secondScatteringFoilXSizeCmd -> SetParamet 105 secondScatteringFoilXSizeCmd -> SetDefault 106 secondScatteringFoilXSizeCmd -> SetUnitCan 107 secondScatteringFoilXSizeCmd -> AvailableF 108 109 outerRadiusStopperCmd = new G4UIcmdWithADo 110 outerRadiusStopperCmd -> SetGuidance("Set 111 outerRadiusStopperCmd -> SetParameterName( 112 outerRadiusStopperCmd -> SetDefaultUnit("m 113 outerRadiusStopperCmd -> SetUnitCandidates 114 outerRadiusStopperCmd -> AvailableForState 115 116 innerRadiusFinalCollimatorCmd = new G4UIcm 117 innerRadiusFinalCollimatorCmd -> SetGuidan 118 innerRadiusFinalCollimatorCmd -> SetParame 119 innerRadiusFinalCollimatorCmd -> SetDefaul 120 innerRadiusFinalCollimatorCmd -> SetUnitCa 121 innerRadiusFinalCollimatorCmd -> Available 122 } 123 124 PassiveProtonBeamLineMessenger::~PassiveProton 125 { 126 delete innerRadiusFinalCollimatorCmd; 127 delete outerRadiusStopperCmd; 128 delete secondScatteringFoilXSizeCmd; 129 delete firstScatteringFoilXSizeCmd; 130 delete rangeShifterXPositionCmd; 131 delete rangeShifterXSizeCmd; 132 delete rangeShifterMatCmd; 133 delete modulatorAngleCmd; 134 delete finalCollimatorDir; 135 delete rangeStopperDir; 136 delete secondScatteringFoilDir; 137 delete firstScatteringFoilDir; 138 delete rangeShifterDir; 139 delete beamLineDir; 140 delete modulatorDir; 141 } 142 143 144 145 146 void PassiveProtonBeamLineMessenger::SetNewVal 147 { 148 if( command == modulatorAngleCmd ) 149 { passiveProton -> SetModulatorAngle 150 (modulatorAngleCmd -> GetNewDoubleValue(newV 151 152 else if( command == rangeShifterMatCmd ) 153 { passiveProton -> SetRSMaterial(newValue) 154 155 else if( command == rangeShifterXSizeCmd ) 156 { passiveProton -> SetRangeShifterXSize 157 (rangeShifterXSizeCmd -> GetNewDoubleValue(n 158 159 else if( command == rangeShifterXPositionC 160 { passiveProton -> SetRangeShifterXPositio 161 (rangeShifterXPositionCmd -> GetNewDoubleVal 162 163 else if( command == firstScatteringFoilXSi 164 { passiveProton -> SetFirstScatteringFoilX 165 (firstScatteringFoilXSizeCmd -> GetNewDouble 166 167 else if( command == secondScatteringFoilXS 168 { passiveProton -> SetSecondScatteringFoil 169 (secondScatteringFoilXSizeCmd -> GetNewDoubl 170 171 else if( command == outerRadiusStopperCmd 172 { passiveProton -> SetOuterRadiusStopper( 173 outerRadiusStopperCmd -> GetNewDoubleVal 174 175 else if( command == innerRadiusFinalCollim 176 { passiveProton -> SetInnerRadiusFinalColl 177 (innerRadiusFinalCollimatorCmd -> GetNewDoub 178 } 179 180