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 "LaserDrivenBeamLineMessenger.hh" 30 #include "LaserDrivenBeamLine.hh" 31 #include "G4UIdirectory.hh" 32 #include "G4UIcmdWithADoubleAndUnit.hh" 33 #include "G4UIcmdWithoutParameter.hh" 34 #include "G4UIcmdWithAString.hh" 35 #include "G4SystemOfUnits.hh" 36 37 ////////////////////////////////////////////// 38 LaserDrivenBeamLineMessenger::LaserDrivenBeamL 39 :laserDrivenMessengerPointer(laserDriven) 40 { 41 // Messenger directories for the Energy Select 42 laserDrivenDir = new G4UIdirectory("/LaserDr 43 laserDrivenDir -> SetGuidance("The Laser Dri 44 45 // Messenger directories for the Energy Sele 46 energySelectorDir = new G4UIdirectory("/Lase 47 energySelectorDir -> SetGuidance("The Energy 48 49 FcollimatorDir = new G4UIdirectory("/LaserD 50 FcollimatorDir -> SetGuidance("Define geomet 51 52 ScollimatorDir = new G4UIdirectory("/LaserD 53 ScollimatorDir -> SetGuidance("Define geomet 54 55 slitDir = new G4UIdirectory("/LaserDriven/E 56 slitDir -> SetGuidance("Define geometrical c 57 58 // Messenger directories for the Quadrupole m 59 quadrupoleDir = new G4UIdirectory("/LaserDri 60 quadrupoleDir -> SetGuidance("The Quadrupole 61 62 relativePosDir = new G4UIdirectory("/LaserDr 63 relativePosDir -> SetGuidance("Define the x 64 65 // ESS DISABLE 66 DisableESSCmd = new G4UIcmdWithoutParameter( 67 DisableESSCmd -> SetGuidance("Disable the En 68 DisableESSCmd -> SetGuidance("This command M 69 DisableESSCmd -> AvailableForStates(G4State_ 70 71 // THE FIRST ESS COLLIMATOR 72 // 73 // Diameter of the first collimator 74 FcollimatorRadiusCmd = new G4UIcmdWithADoubl 75 FcollimatorRadiusCmd -> SetGuidance("Set the 76 FcollimatorRadiusCmd -> SetParameterName("Si 77 FcollimatorRadiusCmd -> SetDefaultUnit("mm") 78 FcollimatorRadiusCmd -> SetUnitCandidates("m 79 FcollimatorRadiusCmd -> AvailableForStates(G 80 81 // Thickness of the first collimator 82 FcollimatorThicknessCmd = new G4UIcmdWithADo 83 FcollimatorThicknessCmd -> SetGuidance("Set 84 FcollimatorThicknessCmd -> SetParameterName( 85 FcollimatorThicknessCmd -> SetDefaultUnit("m 86 FcollimatorThicknessCmd -> SetUnitCandidates 87 FcollimatorThicknessCmd -> AvailableForState 88 89 // Z Position of the first collimator hole 90 FcollimatorZpositionCmd = new G4UIcmdWithADo 91 FcollimatorZpositionCmd -> SetGuidance("Set 92 FcollimatorZpositionCmd -> SetParameterName( 93 FcollimatorZpositionCmd -> SetDefaultUnit("m 94 FcollimatorZpositionCmd -> SetUnitCandidates 95 FcollimatorZpositionCmd -> AvailableForState 96 97 // THE SECOND ESS COLLIMATOR 98 // 99 // Diameter of the second collimator 100 ScollimatorRadiusCmd = new G4UIcmdWithADoubl 101 ScollimatorRadiusCmd -> SetGuidance("Set the 102 ScollimatorRadiusCmd -> SetParameterName("Si 103 ScollimatorRadiusCmd -> SetDefaultUnit("mm") 104 ScollimatorRadiusCmd -> SetUnitCandidates("m 105 ScollimatorRadiusCmd -> AvailableForStates(G 106 107 // Thickness of the second collimator 108 ScollimatorThicknessCmd = new G4UIcmdWithADo 109 ScollimatorThicknessCmd -> SetGuidance("Set 110 ScollimatorThicknessCmd -> SetParameterName( 111 ScollimatorThicknessCmd -> SetDefaultUnit("m 112 ScollimatorThicknessCmd -> SetUnitCandidates 113 ScollimatorThicknessCmd -> AvailableForState 114 115 // Z Position of the second collimator hole 116 ScollimatorZpositionCmd = new G4UIcmdWithADo 117 ScollimatorZpositionCmd -> SetGuidance("Set 118 ScollimatorZpositionCmd -> SetParameterName( 119 ScollimatorZpositionCmd -> SetDefaultUnit("m 120 ScollimatorZpositionCmd -> SetUnitCandidates 121 ScollimatorZpositionCmd -> AvailableForState 122 123 // THE SLIT 124 // 125 // Thickness Slit 126 SlitThicknessCmd = new G4UIcmdWithADoubleAnd 127 SlitThicknessCmd -> SetGuidance("Set the X d 128 SlitThicknessCmd -> SetParameterName("Size", 129 SlitThicknessCmd -> SetDefaultUnit("mm"); 130 SlitThicknessCmd -> SetUnitCandidates("mm cm 131 SlitThicknessCmd -> AvailableForStates(G4Sta 132 133 //Hole dimension of the Slit (in Y direction 134 holeSlitDimensionYCmd = new G4UIcmdWithADoub 135 holeSlitDimensionYCmd -> SetGuidance("Set th 136 holeSlitDimensionYCmd -> SetParameterName("S 137 holeSlitDimensionYCmd -> SetDefaultUnit("mm" 138 holeSlitDimensionYCmd -> SetUnitCandidates(" 139 holeSlitDimensionYCmd -> AvailableForStates( 140 141 // Hole dimension of the Slit (in Z directio 142 holeSlitDimensionZCmd = new G4UIcmdWithADoub 143 holeSlitDimensionZCmd -> SetGuidance("Set th 144 holeSlitDimensionZCmd -> SetParameterName("S 145 holeSlitDimensionZCmd -> SetDefaultUnit("mm" 146 holeSlitDimensionZCmd -> SetUnitCandidates(" 147 holeSlitDimensionZCmd -> AvailableForStates( 148 149 // Hole position of the Slit (in Z direction 150 slitHolePositionZCmd = new G4UIcmdWithADoubl 151 slitHolePositionZCmd -> SetGuidance("Set the 152 slitHolePositionZCmd -> SetParameterName("Si 153 slitHolePositionZCmd -> SetDefaultUnit("mm") 154 slitHolePositionZCmd -> SetUnitCandidates("m 155 slitHolePositionZCmd -> AvailableForStates(G 156 157 // Quadrupole system DISABLE 158 DisableQuadsCmd = new G4UIcmdWithoutParamet 159 DisableQuadsCmd -> SetGuidance("Disable the 160 DisableQuadsCmd -> SetGuidance("This comman 161 DisableQuadsCmd -> AvailableForStates(G4Sta 162 } 163 164 ////////////////////////////////////////////// 165 LaserDrivenBeamLineMessenger::~LaserDrivenBeam 166 { 167 168 delete laserDrivenDir; 169 delete energySelectorDir; 170 delete FcollimatorDir; 171 delete ScollimatorDir; 172 delete slitDir; 173 delete quadrupoleDir; 174 delete relativePosDir; 175 delete DisableESSCmd; 176 delete FcollimatorRadiusCmd; 177 delete FcollimatorThicknessCmd; 178 delete FcollimatorZpositionCmd; 179 delete ScollimatorRadiusCmd; 180 delete ScollimatorThicknessCmd; 181 delete ScollimatorZpositionCmd; 182 183 delete SlitThicknessCmd; 184 delete holeSlitDimensionYCmd; 185 delete holeSlitDimensionZCmd; 186 delete slitHolePositionZCmd; 187 188 delete DisableQuadsCmd; 189 190 } 191 ////////////////////////////////////////////// 192 void LaserDrivenBeamLineMessenger::SetNewValue 193 { 194 if (command == DisableESSCmd) 195 { 196 laserDrivenMessengerPointer -> RemoveESS 197 } 198 if( command == FcollimatorRadiusCmd ) 199 { 200 laserDrivenMessengerPointer -> SetFirstC 201 (FcollimatorRadiusCmd -> GetNewDoubleValue(n 202 } 203 else if( command == FcollimatorThicknessCmd 204 { 205 laserDrivenMessengerPointer -> SetFirstC 206 (FcollimatorThicknessCmd -> GetNewDoubleValu 207 } 208 else if( command == FcollimatorZpositionCmd 209 { 210 laserDrivenMessengerPointer -> SetFirstC 211 (FcollimatorZpositionCmd -> GetNewDoubleValu 212 } 213 else if( command == ScollimatorRadiusCmd ) 214 { 215 laserDrivenMessengerPointer -> SetSecond 216 (ScollimatorRadiusCmd -> GetNewDoubleValue(n 217 } 218 else if( command == ScollimatorThicknessCmd 219 { 220 laserDrivenMessengerPointer -> SetSecond 221 (ScollimatorThicknessCmd -> GetNewDoubleValu 222 } 223 else if( command == ScollimatorZpositionCmd 224 { 225 laserDrivenMessengerPointer -> SetSecond 226 (ScollimatorZpositionCmd -> GetNewDoubleValu 227 } 228 else if( command == SlitThicknessCmd ) 229 { 230 laserDrivenMessengerPointer -> SetThickn 231 (SlitThicknessCmd -> GetNewDoubleValue(newVa 232 } 233 else if( command == holeSlitDimensionYCmd ) 234 { 235 laserDrivenMessengerPointer -> SetSlitHo 236 (holeSlitDimensionYCmd -> GetNewDoubleValue( 237 } 238 else if( command == holeSlitDimensionZCmd ) 239 { 240 laserDrivenMessengerPointer -> SetSlitHo 241 (holeSlitDimensionZCmd -> GetNewDoubleValue( 242 } 243 else if( command == slitHolePositionZCmd ) 244 { 245 laserDrivenMessengerPointer -> SetSlitHo 246 (slitHolePositionZCmd -> GetNewDoubleValue(n 247 } 248 else if (command==DisableQuadsCmd) 249 { 250 laserDrivenMessengerPointer -> RemoveQua 251 } 252 253 } 254 255