Geant4 Cross Reference |
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 // Hadrontherapy advanced example for Geant4 27 // See more at: https://twiki.cern.ch/twiki/bi 27 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy 28 28 29 #include "globals.hh" 29 #include "globals.hh" 30 #include "G4SystemOfUnits.hh" 30 #include "G4SystemOfUnits.hh" 31 #include "G4Box.hh" 31 #include "G4Box.hh" 32 #include "G4Tubs.hh" 32 #include "G4Tubs.hh" 33 #include "G4Sphere.hh" 33 #include "G4Sphere.hh" 34 #include "G4NistManager.hh" 34 #include "G4NistManager.hh" 35 #include "G4NistElementBuilder.hh" 35 #include "G4NistElementBuilder.hh" 36 #include "G4VisAttributes.hh" 36 #include "G4VisAttributes.hh" 37 #include "G4Colour.hh" 37 #include "G4Colour.hh" 38 #include "G4RunManager.hh" 38 #include "G4RunManager.hh" 39 #include "G4LogicalVolume.hh" 39 #include "G4LogicalVolume.hh" 40 #include "G4PVPlacement.hh" 40 #include "G4PVPlacement.hh" 41 #include "G4RotationMatrix.hh" 41 #include "G4RotationMatrix.hh" 42 #include "HadrontherapyDetectorConstruction.hh 42 #include "HadrontherapyDetectorConstruction.hh" 43 #include "LaserDrivenBeamLine.hh" 43 #include "LaserDrivenBeamLine.hh" 44 #include "LaserDrivenBeamLineMessenger.hh" 44 #include "LaserDrivenBeamLineMessenger.hh" 45 // 45 // 46 #include "G4PhysicalConstants.hh" 46 #include "G4PhysicalConstants.hh" 47 #include "G4ThreeVector.hh" 47 #include "G4ThreeVector.hh" 48 #include "G4Material.hh" 48 #include "G4Material.hh" 49 // 49 // 50 #include "G4FieldManager.hh" 50 #include "G4FieldManager.hh" 51 #include "G4MagIntegratorStepper.hh" 51 #include "G4MagIntegratorStepper.hh" 52 #include "G4Mag_UsualEqRhs.hh" 52 #include "G4Mag_UsualEqRhs.hh" 53 #include "G4ExplicitEuler.hh" 53 #include "G4ExplicitEuler.hh" 54 #include "G4ChordFinder.hh" 54 #include "G4ChordFinder.hh" 55 //#include "G4TransportationManager.hh" 55 //#include "G4TransportationManager.hh" 56 #include "G4EqMagElectricField.hh" 56 #include "G4EqMagElectricField.hh" 57 #include "G4UniformMagField.hh" 57 #include "G4UniformMagField.hh" 58 #include "G4PropagatorInField.hh" 58 #include "G4PropagatorInField.hh" 59 #include "G4VisCommandsViewer.hh" 59 #include "G4VisCommandsViewer.hh" 60 #include "G4UImanager.hh" 60 #include "G4UImanager.hh" 61 #include "G4ExplicitEuler.hh" 61 #include "G4ExplicitEuler.hh" 62 #include "G4ImplicitEuler.hh" 62 #include "G4ImplicitEuler.hh" 63 #include "G4SimpleRunge.hh" 63 #include "G4SimpleRunge.hh" 64 #include "G4SimpleHeum.hh" 64 #include "G4SimpleHeum.hh" 65 #include "G4ClassicalRK4.hh" 65 #include "G4ClassicalRK4.hh" 66 #include "G4HelixExplicitEuler.hh" 66 #include "G4HelixExplicitEuler.hh" 67 #include "G4HelixImplicitEuler.hh" 67 #include "G4HelixImplicitEuler.hh" 68 #include "G4HelixSimpleRunge.hh" 68 #include "G4HelixSimpleRunge.hh" 69 #include "G4CashKarpRKF45.hh" 69 #include "G4CashKarpRKF45.hh" 70 #include "G4RKG3_Stepper.hh" 70 #include "G4RKG3_Stepper.hh" 71 #include "G4MagIntegratorDriver.hh" << 72 #include "G4SubtractionSolid.hh" 71 #include "G4SubtractionSolid.hh" 73 72 74 // << 73 // 75 #include "G4UniformElectricField.hh" 74 #include "G4UniformElectricField.hh" 76 #include "G4ElectricField.hh" 75 #include "G4ElectricField.hh" 77 #include "HadrontherapyElectricTabulatedField3 76 #include "HadrontherapyElectricTabulatedField3D.hh" 78 77 79 #include "HadrontherapyMagneticField3D.hh" 78 #include "HadrontherapyMagneticField3D.hh" 80 // 79 // 81 //G4bool LaserDrivenBeamLine::doCalculation = 80 //G4bool LaserDrivenBeamLine::doCalculation = false; 82 ////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////////// 83 LaserDrivenBeamLine::LaserDrivenBeamLine(): 82 LaserDrivenBeamLine::LaserDrivenBeamLine(): 84 hadrontherapydetectorconstruction(0), physicTr << 83 hadrontherapydetectorconstruction(0), physicTreatmentRoom(0), 85 PFirstTriplet(0),PSecondTriplet(0),PThirdTripl 84 PFirstTriplet(0),PSecondTriplet(0),PThirdTriplet(0),PFourthTriplet(0), physicFirstQuad(0),physicSecondQuad(0),physicThirdQuad(0),physicFourthQuad(0), 86 solidExternalChamber(0),logicExternalChamber(0 85 solidExternalChamber(0),logicExternalChamber(0),physicExternalChamber(0), 87 solidInternalChamber(0),logicInternalChamber(0 86 solidInternalChamber(0),logicInternalChamber(0),physicInternalChamber(0), 88 solidCollimator(0),logicCollimator(0),physicCo 87 solidCollimator(0),logicCollimator(0),physicCollimator(0), 89 solidCollimatorHole(0),logicCollimatorHole(0), 88 solidCollimatorHole(0),logicCollimatorHole(0),physicCollimatorHole(0), 90 solidFinalCollimator(0), logicFinalCollimator( 89 solidFinalCollimator(0), logicFinalCollimator(0),physicFinalCollimator(0), 91 solidFinalCollimatorHole(0),logicFinalCollimat 90 solidFinalCollimatorHole(0),logicFinalCollimatorHole(0),physicFinalCollimatorHole(0), 92 solidExternalMagnet_1(0),logicExternalMagnet_1 91 solidExternalMagnet_1(0),logicExternalMagnet_1(0),physicExternalMagnet_1(0), physicExternalMagnet_1Down(0), 93 solidMagnet_1(0),logicMagnet_1(0),physicMagnet 92 solidMagnet_1(0),logicMagnet_1(0),physicMagnet_1Right(0),physicMagnet_1Left(0), solidExternalMagnet_2(0),logicExternalMagnet_2(0), 94 physicExternalMagnet_2(0),physicExternalMagnet 93 physicExternalMagnet_2(0),physicExternalMagnet_2Down(0),solidMagnet_2(0),logicMagnet_2(0),physicMagnet_2Right(0),physicMagnet_2Left(0), solidExternalMagnet_3(0),logicExternalMagnet_3(0),physicExternalMagnet_3(0),physicExternalMagnet_3Down(0), 95 solidMagnet_3(0),logicMagnet_3(0),physicMagnet 94 solidMagnet_3(0),logicMagnet_3(0),physicMagnet_3Right(0),physicMagnet_3Left(0), 96 solidExternalMagnet_4(0),logicExternalMagnet_4 95 solidExternalMagnet_4(0),logicExternalMagnet_4(0),physicExternalMagnet_4(0),physicExternalMagnet_4Down(0), 97 solidMagnet_4(0),logicMagnet_4(0),physicMagnet 96 solidMagnet_4(0),logicMagnet_4(0),physicMagnet_4Right(0),physicMagnet_4Left(0), 98 solidExternalSlit(0), logicExternalSlit(0), ph 97 solidExternalSlit(0), logicExternalSlit(0), physicExternalSlit(0), 99 solidInternalSlit(0),logicInternalSlit(0),phys 98 solidInternalSlit(0),logicInternalSlit(0),physicInternalSlit(0), 100 physicExitPipe(0),physicExitWindow(0),physicEx << 99 physicExitPipe(0),physicExitWindow(0),physicExithole(0),physicEntrancePipe(0),physicEntrancehole(0) 101 { 100 { 102 laserDrivenMessenger = new LaserDrivenBeam 101 laserDrivenMessenger = new LaserDrivenBeamLineMessenger(this); 103 102 104 //***************************** PW ******* 103 //***************************** PW *************************************** 105 104 106 static G4String ROGeometryName = "Detector 105 static G4String ROGeometryName = "DetectorROGeometry"; 107 RO = new HadrontherapyDetectorROGeometry(R 106 RO = new HadrontherapyDetectorROGeometry(ROGeometryName); 108 107 109 G4cout << "Going to register Parallel worl 108 G4cout << "Going to register Parallel world..."; 110 RegisterParallelWorld(RO); 109 RegisterParallelWorld(RO); 111 G4cout << "... done" << G4endl; 110 G4cout << "... done" << G4endl; 112 //***************************** PW ******* 111 //***************************** PW *************************************** 113 } 112 } 114 113 115 ////////////////////////////////////////////// 114 ///////////////////////////////////////////////////////////////////////////// 116 LaserDrivenBeamLine::~LaserDrivenBeamLine() 115 LaserDrivenBeamLine::~LaserDrivenBeamLine() 117 { 116 { 118 //delete laserDrivenMessenger; 117 //delete laserDrivenMessenger; 119 delete hadrontherapydetectorconstruction; << 118 delete hadrontherapydetectorconstruction; 120 } 119 } 121 120 122 ////////////////////////////////////////////// 121 ///////////////////////////////////////////////////////////////////////////// 123 G4VPhysicalVolume* LaserDrivenBeamLine::Constr 122 G4VPhysicalVolume* LaserDrivenBeamLine::Construct() 124 { 123 { 125 // Sets default geometry and materials 124 // Sets default geometry and materials 126 SetDefaultDimensions(); 125 SetDefaultDimensions(); 127 126 128 // Construct the energyselector (magnetic 127 // Construct the energyselector (magnetic part and slit) and detector plane 129 ConstructLaserDrivenBeamLine(); 128 ConstructLaserDrivenBeamLine(); 130 129 131 //***************************** PW ******* 130 //***************************** PW *************************************** 132 if (!hadrontherapydetectorconstruction) 131 if (!hadrontherapydetectorconstruction) 133 132 134 //***************************** PW *** << 133 //***************************** PW *************************************** 135 134 136 // HadrontherapyDetectorConstruction b << 135 // HadrontherapyDetectorConstruction builds ONLY the phantom and the detector with its associated ROGeometry 137 hadrontherapydetectorconstruction = ne << 136 hadrontherapydetectorconstruction = new HadrontherapyDetectorConstruction(physicTreatmentRoom); 138 G4cout<<"HadrontherapyDetectorConstruction 137 G4cout<<"HadrontherapyDetectorConstruction"<<G4endl; 139 //***************************** PW ******* 138 //***************************** PW *************************************** 140 139 141 hadrontherapydetectorconstruction->Initial 140 hadrontherapydetectorconstruction->InitializeDetectorROGeometry(RO,hadrontherapydetectorconstruction->GetDetectorToWorldPosition()); 142 141 143 //***************************** PW ******* 142 //***************************** PW *************************************** 144 return physicTreatmentRoom; 143 return physicTreatmentRoom; 145 } 144 } 146 ////////////////////////////////////////////// 145 ///////////////////////////////////////////////////////////////////////////// 147 void LaserDrivenBeamLine::SetDefaultDimensions 146 void LaserDrivenBeamLine::SetDefaultDimensions() 148 { 147 { 149 ////////////////////////////////////////// 148 /////////////////////////////////////////////////////////////////////// 150 // Definition of the colour sets 149 // Definition of the colour sets 151 white = new G4VisAttributes( G4Colour(1.,1 150 white = new G4VisAttributes( G4Colour(1.,1.,1., 0.2)); 152 white -> SetVisibility(true); 151 white -> SetVisibility(true); 153 white -> SetForceSolid(true); 152 white -> SetForceSolid(true); 154 white -> SetForceWireframe(true); 153 white -> SetForceWireframe(true); 155 << 154 156 blue = new G4VisAttributes(G4Colour(0. ,0. 155 blue = new G4VisAttributes(G4Colour(0. ,0. ,1.)); 157 blue -> SetVisibility(true); 156 blue -> SetVisibility(true); 158 //blue -> SetForceSolid(true); 157 //blue -> SetForceSolid(true); 159 << 158 160 gray = new G4VisAttributes( G4Colour(0.5, 159 gray = new G4VisAttributes( G4Colour(0.5, 0.5, 0.5, 0.5 )); 161 gray-> SetVisibility(true); 160 gray-> SetVisibility(true); 162 gray-> SetForceSolid(true); 161 gray-> SetForceSolid(true); 163 162 164 red = new G4VisAttributes(G4Colour(1. ,0. 163 red = new G4VisAttributes(G4Colour(1. ,0. ,0., 0.2)); 165 red-> SetVisibility(true); 164 red-> SetVisibility(true); 166 red-> SetForceSolid(true); 165 red-> SetForceSolid(true); 167 //red -> SetForceWireframe(true); 166 //red -> SetForceWireframe(true); 168 << 167 169 yellow = new G4VisAttributes(G4Colour(1., 168 yellow = new G4VisAttributes(G4Colour(1., 1., 0., 0.2)); 170 yellow-> SetVisibility(true); 169 yellow-> SetVisibility(true); 171 yellow-> SetForceSolid(true); 170 yellow-> SetForceSolid(true); 172 << 171 173 green = new G4VisAttributes( G4Colour(25/2 172 green = new G4VisAttributes( G4Colour(25/255. , 255/255. , 25/255., 0.4)); 174 green -> SetVisibility(true); 173 green -> SetVisibility(true); 175 green -> SetForceWireframe(true); 174 green -> SetForceWireframe(true); 176 green -> SetForceSolid(true); 175 green -> SetForceSolid(true); 177 176 178 black = new G4VisAttributes( G4Colour(255/ 177 black = new G4VisAttributes( G4Colour(255/255. , 255/255., 255/255.)); 179 black -> SetVisibility(true); 178 black -> SetVisibility(true); 180 black -> SetForceSolid(true); 179 black -> SetForceSolid(true); 181 << 180 182 darkGreen = new G4VisAttributes( G4Colour( 181 darkGreen = new G4VisAttributes( G4Colour(0/255. , 100/255. , 0/255.)); 183 darkGreen -> SetVisibility(true); 182 darkGreen -> SetVisibility(true); 184 darkGreen -> SetForceSolid(true); 183 darkGreen -> SetForceSolid(true); 185 << 184 186 darkOrange3 = new G4VisAttributes( G4Colou 185 darkOrange3 = new G4VisAttributes( G4Colour(205/255. , 102/255. , 000/255., 0.7)); 187 darkOrange3 -> SetVisibility(true); 186 darkOrange3 -> SetVisibility(true); 188 darkOrange3 -> SetForceSolid(true); 187 darkOrange3 -> SetForceSolid(true); 189 188 190 skyBlue = new G4VisAttributes( G4Colour(13 189 skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255., 0.1)); 191 skyBlue -> SetVisibility(true); 190 skyBlue -> SetVisibility(true); 192 skyBlue -> SetForceSolid(true); 191 skyBlue -> SetForceSolid(true); 193 192 194 // DEFAULT DIMENSIONS AND POSITIONS ARE PR 193 // DEFAULT DIMENSIONS AND POSITIONS ARE PROVIDED HERE. 195 /////////////////////// Exit Window ////// 194 /////////////////////// Exit Window /////////////////////////////////////////////// 196 G4double defaultInnerRadiusExitWindow=0. * 195 G4double defaultInnerRadiusExitWindow=0. *mm; 197 InnerRadiusExitWindow=defaultInnerRadiusEx 196 InnerRadiusExitWindow=defaultInnerRadiusExitWindow; 198 197 199 G4double defaultExternalRadiusExitWindow=5 198 G4double defaultExternalRadiusExitWindow=55*mm; 200 ExternalRadiusExitWindow=defaultExternalRa 199 ExternalRadiusExitWindow=defaultExternalRadiusExitWindow; 201 200 202 G4double defaultExitWindowThickness=25 *um 201 G4double defaultExitWindowThickness=25 *um; 203 ExitWindowThickness=defaultExitWindowThick 202 ExitWindowThickness=defaultExitWindowThickness; 204 203 205 G4double defaultExitWindowXPosition=-ExitW 204 G4double defaultExitWindowXPosition=-ExitWindowThickness/2.; 206 ExitWindowXPosition=defaultExitWindowXPosi 205 ExitWindowXPosition=defaultExitWindowXPosition; 207 206 208 G4double defaultExitWindowYPosition=0.; 207 G4double defaultExitWindowYPosition=0.; 209 ExitWindowYPosition=defaultExitWindowYPosi 208 ExitWindowYPosition=defaultExitWindowYPosition; 210 209 211 G4double defaultExitWindowZPosition=0.0*mm 210 G4double defaultExitWindowZPosition=0.0*mm; 212 ExitWindowZPosition=defaultExitWindowZPosi 211 ExitWindowZPosition=defaultExitWindowZPosition; 213 212 214 G4double defaultStartAngleExitWindow = 0.0 213 G4double defaultStartAngleExitWindow = 0.0 *deg; 215 startAngleExitWindow = defaultStartAngleEx 214 startAngleExitWindow = defaultStartAngleExitWindow; 216 << 215 217 G4double defaultSpanningAngleExitWindow = 216 G4double defaultSpanningAngleExitWindow = 360.*deg; 218 spanningAngleExitWindow = defaultSpanningA 217 spanningAngleExitWindow = defaultSpanningAngleExitWindow; 219 ////////////////////////////// Exit pipe / 218 ////////////////////////////// Exit pipe //////////////////////////////// 220 G4double defaultExitPipeheight=105. *mm; 219 G4double defaultExitPipeheight=105. *mm; 221 ExitPipeheight=defaultExitPipeheight; 220 ExitPipeheight=defaultExitPipeheight; 222 221 223 G4double defaultInnerRadiusExitPipe=50. *m 222 G4double defaultInnerRadiusExitPipe=50. *mm; 224 InnerRadiusExitPipe=defaultInnerRadiusExit 223 InnerRadiusExitPipe=defaultInnerRadiusExitPipe; 225 224 226 G4double defaultExternalRadiusExitPipe=55 225 G4double defaultExternalRadiusExitPipe=55 *mm; 227 ExternalRadiusExitPipe=defaultExternalRadi 226 ExternalRadiusExitPipe=defaultExternalRadiusExitPipe; 228 227 229 G4double defaultExitPipeXPosition=-ExitPip 228 G4double defaultExitPipeXPosition=-ExitPipeheight/2-ExitWindowThickness; 230 ExitPipeXPosition=defaultExitPipeXPosition 229 ExitPipeXPosition=defaultExitPipeXPosition; 231 230 232 G4double defaultExitPipeYPosition=0; 231 G4double defaultExitPipeYPosition=0; 233 ExitPipeYPosition=defaultExitPipeYPosition 232 ExitPipeYPosition=defaultExitPipeYPosition; 234 233 235 G4double defaultExitPipeZPosition=0.0*mm; 234 G4double defaultExitPipeZPosition=0.0*mm; 236 ExitPipeZPosition=defaultExitPipeZPosition 235 ExitPipeZPosition=defaultExitPipeZPosition; 237 236 238 G4double defaultStartAngleExitPipe = 0.0 * 237 G4double defaultStartAngleExitPipe = 0.0 *deg; 239 startAngleExitPipe = defaultStartAngleExit 238 startAngleExitPipe = defaultStartAngleExitPipe; 240 << 239 241 G4double defaultSpanningAngleExitPipe = 36 240 G4double defaultSpanningAngleExitPipe = 360.*deg; 242 spanningAngleExitPipe = defaultSpanningAng 241 spanningAngleExitPipe = defaultSpanningAngleExitPipe; 243 ////////////////////////////////////////// 242 //////////////////////////////////////////////// Vacuum chamber ////////////////////////////// 244 G4double defaultExternalChamberXSize = 79. << 243 G4double defaultExternalChamberXSize = 79.6*cm; 245 externalChamberXSize = defaultExternalCham 244 externalChamberXSize = defaultExternalChamberXSize; 246 << 245 247 G4double defaultExternalChamberYSize = 50. 246 G4double defaultExternalChamberYSize = 50. *cm; 248 externalChamberYSize = defaultExternalCham 247 externalChamberYSize = defaultExternalChamberYSize; 249 << 248 250 G4double defaultExternalChamberZSize = 50. 249 G4double defaultExternalChamberZSize = 50. *cm; 251 externalChamberZSize = defaultExternalCham 250 externalChamberZSize = defaultExternalChamberZSize; 252 << 251 253 G4double defaultExternalChamberXPosition = 252 G4double defaultExternalChamberXPosition = -(externalChamberXSize/2.+ExitPipeheight/2.)+ ExitPipeXPosition; 254 externalChamberXPosition = defaultExternal 253 externalChamberXPosition = defaultExternalChamberXPosition; 255 << 254 256 G4double defaultExternalChamberYPosition = 255 G4double defaultExternalChamberYPosition = 0.0 *mm; 257 externalChamberYPosition = defaultExternal 256 externalChamberYPosition = defaultExternalChamberYPosition; 258 << 257 259 G4double defaultExternalChamberZPosition = 258 G4double defaultExternalChamberZPosition = 0.0 *mm; 260 externalChamberZPosition = defaultExternal 259 externalChamberZPosition = defaultExternalChamberZPosition; 261 << 260 262 // Defaults of the internal chamber dimens 261 // Defaults of the internal chamber dimensions 263 // The position of its center is in the ce 262 // The position of its center is in the center 264 // of the internal chamber while the dimen 263 // of the internal chamber while the dimension are 265 // authomatically calculated respect to th 264 // authomatically calculated respect to the external chamber ones 266 G4double defaultVaccumChamberWallThickness 265 G4double defaultVaccumChamberWallThickness=5 *mm; 267 VaccumChamberWallThickness=defaultVaccumCh 266 VaccumChamberWallThickness=defaultVaccumChamberWallThickness; 268 267 269 G4double defaultInternalChamberXSize =exte 268 G4double defaultInternalChamberXSize =externalChamberXSize - 2*VaccumChamberWallThickness; 270 internalChamberXSize = defaultInternalCham 269 internalChamberXSize = defaultInternalChamberXSize; 271 << 270 272 G4double defaultInternalChamberYSize =exte 271 G4double defaultInternalChamberYSize =externalChamberYSize - 2*VaccumChamberWallThickness; 273 internalChamberYSize = defaultInternalCham 272 internalChamberYSize = defaultInternalChamberYSize; 274 << 273 275 G4double defaultInternalChamberZSize = ext 274 G4double defaultInternalChamberZSize = externalChamberZSize - 2*VaccumChamberWallThickness; 276 internalChamberZSize = defaultInternalCham 275 internalChamberZSize = defaultInternalChamberZSize; 277 /////////////////////// Exit hole in vesse 276 /////////////////////// Exit hole in vessel /////////////////////////////////////////////// 278 G4double defaultInnerRadiusExithole=0.*mm; 277 G4double defaultInnerRadiusExithole=0.*mm; 279 InnerRadiusExithole=defaultInnerRadiusExit 278 InnerRadiusExithole=defaultInnerRadiusExithole; 280 279 281 G4double defaultExternalRadiusExithole=50. 280 G4double defaultExternalRadiusExithole=50.*mm; 282 ExternalRadiusExithole=defaultExternalRadi 281 ExternalRadiusExithole=defaultExternalRadiusExithole; 283 282 284 G4double defaultExitholeThickness=VaccumCh 283 G4double defaultExitholeThickness=VaccumChamberWallThickness; 285 ExitholeThickness=defaultExitholeThickness 284 ExitholeThickness=defaultExitholeThickness; 286 285 287 G4double defaultExitholeXPosition=(externa 286 G4double defaultExitholeXPosition=(externalChamberXSize/2.-ExitholeThickness/2.); 288 ExitholeXPosition=defaultExitholeXPosition 287 ExitholeXPosition=defaultExitholeXPosition; 289 288 290 G4double defaultExitholeYPosition=0.; 289 G4double defaultExitholeYPosition=0.; 291 ExitholeYPosition=defaultExitholeYPosition 290 ExitholeYPosition=defaultExitholeYPosition; 292 291 293 G4double defaultExitholeZPosition=0.*mm; 292 G4double defaultExitholeZPosition=0.*mm; 294 ExitholeZPosition=defaultExitholeZPosition 293 ExitholeZPosition=defaultExitholeZPosition; 295 294 296 G4double defaultStartAngleExithole = 0.0 * 295 G4double defaultStartAngleExithole = 0.0 *deg; 297 startAngleExithole= defaultStartAngleExith 296 startAngleExithole= defaultStartAngleExithole; 298 << 297 299 G4double defaultSpanningAngleExithole = 36 298 G4double defaultSpanningAngleExithole = 360.*deg; 300 spanningAngleExithole = defaultSpanningAng 299 spanningAngleExithole = defaultSpanningAngleExithole; 301 /////////////////////////////////Final col 300 /////////////////////////////////Final collimator ////////////////////////////// 302 // The Final Collimator is located after 301 // The Final Collimator is located after the 4th magnet 303 G4double defaultExitholeToFinalCollimator= 302 G4double defaultExitholeToFinalCollimator=70 *mm; 304 ExitholeToFinalCollimator=defaultExitholeT 303 ExitholeToFinalCollimator=defaultExitholeToFinalCollimator; 305 304 306 defaultInnerRadiusFinalCollimator = 0.0 *m 305 defaultInnerRadiusFinalCollimator = 0.0 *mm; 307 innerRadiusFinalCollimator = defaultInnerR 306 innerRadiusFinalCollimator = defaultInnerRadiusFinalCollimator; 308 307 309 defaultOuterRadiusFinalCollimator = 2.50 * 308 defaultOuterRadiusFinalCollimator = 2.50 *mm; 310 outerRadiusFinalCollimator = defaultOuterR 309 outerRadiusFinalCollimator = defaultOuterRadiusFinalCollimator; 311 310 312 defaultFinalCollimatorThickness = 3.0 *mm; 311 defaultFinalCollimatorThickness = 3.0 *mm; 313 FinalCollimatorThickness = defaultFinalCol 312 FinalCollimatorThickness = defaultFinalCollimatorThickness; 314 << 313 315 defaultStartAngleFinalCollimator = 0.0 *de 314 defaultStartAngleFinalCollimator = 0.0 *deg; 316 startAngleFinalCollimator = defaultStartAn 315 startAngleFinalCollimator = defaultStartAngleFinalCollimator; 317 << 316 318 defaultSpanningAngleFinalCollimator = 360. 317 defaultSpanningAngleFinalCollimator = 360.*deg; 319 spanningAngleFinalCollimator = defaultSpan 318 spanningAngleFinalCollimator = defaultSpanningAngleFinalCollimator; 320 << 319 321 defaultFinalCollimatorXPosition = internal 320 defaultFinalCollimatorXPosition = internalChamberXSize/2.-ExitholeToFinalCollimator-FinalCollimatorThickness/2.; 322 collimatorFinalBox_XPosition=defaultFinalC 321 collimatorFinalBox_XPosition=defaultFinalCollimatorXPosition; 323 FinalcollimatorXPosition = 0.0*mm; //HOLE 322 FinalcollimatorXPosition = 0.0*mm; //HOLE IN THE FINAL COLLIMATOR 324 << 323 325 defaultFinalCollimatorYPosition = 0.0*mm; 324 defaultFinalCollimatorYPosition = 0.0*mm; 326 collimatorFinalBox_YPosition=defaultFinalC 325 collimatorFinalBox_YPosition=defaultFinalCollimatorYPosition; 327 FinalcollimatorYPosition = defaultFinalCol 326 FinalcollimatorYPosition = defaultFinalCollimatorYPosition; 328 << 327 329 defaultFinalCollimatorZPosition = 0.0*mm; 328 defaultFinalCollimatorZPosition = 0.0*mm; 330 collimatorFinalBox_ZPosition=0.0*mm; 329 collimatorFinalBox_ZPosition=0.0*mm; 331 FinalcollimatorZPosition =defaultFinalColl 330 FinalcollimatorZPosition =defaultFinalCollimatorZPosition; 332 331 333 defaultThicknessCollimator =3.0 *mm; 332 defaultThicknessCollimator =3.0 *mm; 334 collimatorFinalBoxXSize=defaultFinalCollim 333 collimatorFinalBoxXSize=defaultFinalCollimatorThickness; 335 collimatorFinalBoxYSize=82.0*mm; 334 collimatorFinalBoxYSize=82.0*mm; 336 collimatorFinalBoxZSize=210.0*mm; 335 collimatorFinalBoxZSize=210.0*mm; 337 //////////////////ooooooooooOOOOOOOO000000 336 //////////////////ooooooooooOOOOOOOO000000000000OOOOOOOOOOOOooooooooooo///////////////// 338 337 339 //Magnet characteristics 338 //Magnet characteristics 340 G4double defaultExternalMagnet_XSize = 88. 339 G4double defaultExternalMagnet_XSize = 88.0*mm; 341 G4double defaultExternalMagnet_YSizeTotal= 340 G4double defaultExternalMagnet_YSizeTotal=87.*mm; 342 G4double defaultInternalMagnet_YSize = 10. 341 G4double defaultInternalMagnet_YSize = 10. *mm; 343 G4double defaultExternalMagnet_YSize =(def 342 G4double defaultExternalMagnet_YSize =(defaultExternalMagnet_YSizeTotal-defaultInternalMagnet_YSize)/2.; 344 G4double defaultExternalMagnet_ZSize = 104 343 G4double defaultExternalMagnet_ZSize = 104 *mm; 345 344 346 G4double defaultExternalMagnet_YPosition = 345 G4double defaultExternalMagnet_YPosition =defaultInternalMagnet_YSize/2.+defaultExternalMagnet_YSize/2.; 347 G4double defaultExternalMagnet_ZPosition = 346 G4double defaultExternalMagnet_ZPosition = 0.0 *mm; 348 347 349 G4double defaultMagnet_XSize=defaultExtern 348 G4double defaultMagnet_XSize=defaultExternalMagnet_XSize; 350 G4double defaultMagnet_YSize=defaultExtern 349 G4double defaultMagnet_YSize=defaultExternalMagnet_YSizeTotal; 351 G4double defaultMagnet_ZSize=19*mm; 350 G4double defaultMagnet_ZSize=19*mm; 352 351 353 // Defaults of the external part of the ma 352 // Defaults of the external part of the magnet 4: 354 G4double defaultFinalCollimatorToMagnet4=2 353 G4double defaultFinalCollimatorToMagnet4=25.*mm; 355 FinalCollimatorToMagnet4=defaultFinalColli 354 FinalCollimatorToMagnet4=defaultFinalCollimatorToMagnet4; 356 355 357 externalMagnet_4XSize = defaultExternalMag 356 externalMagnet_4XSize = defaultExternalMagnet_XSize; 358 externalMagnet_4YSize = defaultExternalMag 357 externalMagnet_4YSize = defaultExternalMagnet_YSize; 359 externalMagnet_4ZSize = defaultExternalMag 358 externalMagnet_4ZSize = defaultExternalMagnet_ZSize; 360 << 359 361 Magnet_4XSize=defaultMagnet_XSize; 360 Magnet_4XSize=defaultMagnet_XSize; 362 Magnet_4YSize=defaultMagnet_YSize; 361 Magnet_4YSize=defaultMagnet_YSize; 363 Magnet_4ZSize=defaultMagnet_ZSize; 362 Magnet_4ZSize=defaultMagnet_ZSize; 364 363 365 G4double defaultExternalMagnet_4XPosition 364 G4double defaultExternalMagnet_4XPosition = -(FinalCollimatorThickness/2.+FinalCollimatorToMagnet4+defaultExternalMagnet_XSize/2.)+ collimatorFinalBox_XPosition; 366 externalMagnet_4XPosition = defaultExterna 365 externalMagnet_4XPosition = defaultExternalMagnet_4XPosition; 367 << 366 368 externalMagnet_4YPosition = defaultExterna 367 externalMagnet_4YPosition = defaultExternalMagnet_YPosition; 369 externalMagnet_4ZPosition = defaultExterna 368 externalMagnet_4ZPosition = defaultExternalMagnet_ZPosition; 370 << 369 371 Magnet_4XPosition=externalMagnet_4XPositio 370 Magnet_4XPosition=externalMagnet_4XPosition; 372 Magnet_4YPosition=0.0*mm; 371 Magnet_4YPosition=0.0*mm; 373 Magnet_4ZPosition=(defaultExternalMagnet_Z 372 Magnet_4ZPosition=(defaultExternalMagnet_ZSize+defaultMagnet_ZSize)/2.; 374 //////////////////ooooooooooOOOOOOOO000000 373 //////////////////ooooooooooOOOOOOOO000000000000OOOOOOOOOOOOooooooooooo///////////////// 375 // Defaults of the external part of the ma 374 // Defaults of the external part of the magnet 3: 376 externalMagnet_3XSize = defaultExternalMag 375 externalMagnet_3XSize = defaultExternalMagnet_XSize; 377 externalMagnet_3YSize = defaultExternalMag 376 externalMagnet_3YSize = defaultExternalMagnet_YSize; 378 externalMagnet_3ZSize = defaultExternalMag 377 externalMagnet_3ZSize = defaultExternalMagnet_ZSize; 379 378 380 Magnet_3XSize=defaultMagnet_XSize; 379 Magnet_3XSize=defaultMagnet_XSize; 381 Magnet_3YSize=defaultMagnet_YSize; 380 Magnet_3YSize=defaultMagnet_YSize; 382 Magnet_3ZSize=defaultMagnet_ZSize; 381 Magnet_3ZSize=defaultMagnet_ZSize; 383 382 384 G4double defaultMagnet4ToMagnet3=65.*mm; / 383 G4double defaultMagnet4ToMagnet3=65.*mm; //85.*mm ANTONELLA 385 Magnet4ToMagnet3=defaultMagnet4ToMagnet3; 384 Magnet4ToMagnet3=defaultMagnet4ToMagnet3; 386 385 387 G4double defaultExternalMagnet_3XPosition 386 G4double defaultExternalMagnet_3XPosition =-(Magnet4ToMagnet3+defaultExternalMagnet_XSize/2.+defaultExternalMagnet_XSize/2.)+externalMagnet_4XPosition; 388 externalMagnet_3XPosition = defaultExterna 387 externalMagnet_3XPosition = defaultExternalMagnet_3XPosition; 389 << 388 390 externalMagnet_3YPosition =defaultExternal 389 externalMagnet_3YPosition =defaultExternalMagnet_YPosition; 391 externalMagnet_3ZPosition = defaultExterna 390 externalMagnet_3ZPosition = defaultExternalMagnet_ZPosition; 392 391 393 << 392 394 Magnet_3XPosition=externalMagnet_3XPositio 393 Magnet_3XPosition=externalMagnet_3XPosition; 395 Magnet_3YPosition=0.0*mm; 394 Magnet_3YPosition=0.0*mm; 396 Magnet_3ZPosition=(defaultExternalMagnet_Z 395 Magnet_3ZPosition=(defaultExternalMagnet_ZSize+defaultMagnet_ZSize)/2.; 397 //////////////////ooooooooooOOOOOOOO000000 396 //////////////////ooooooooooOOOOOOOO000000000000OOOOOOOOOOOOooooooooooo///////////////// 398 // Defaults of the external part of the ma 397 // Defaults of the external part of the magnet 2: 399 externalMagnet_2XSize = defaultExternalMag 398 externalMagnet_2XSize = defaultExternalMagnet_XSize; 400 externalMagnet_2YSize = defaultExternalMag 399 externalMagnet_2YSize = defaultExternalMagnet_YSize; 401 externalMagnet_2ZSize = defaultExternalMag 400 externalMagnet_2ZSize = defaultExternalMagnet_ZSize; 402 401 403 Magnet_2XSize=defaultMagnet_XSize; 402 Magnet_2XSize=defaultMagnet_XSize; 404 Magnet_2YSize=defaultMagnet_YSize; 403 Magnet_2YSize=defaultMagnet_YSize; 405 Magnet_2ZSize=defaultMagnet_ZSize; 404 Magnet_2ZSize=defaultMagnet_ZSize; 406 405 407 G4double defaultMagnet3ToMagnet2=10 *mm; 406 G4double defaultMagnet3ToMagnet2=10 *mm; 408 Magnet3ToMagnet2=defaultMagnet3ToMagnet2; 407 Magnet3ToMagnet2=defaultMagnet3ToMagnet2; 409 408 410 G4double defaultExternalMagnet_2XPosition 409 G4double defaultExternalMagnet_2XPosition =-(Magnet3ToMagnet2+defaultExternalMagnet_XSize/2.+defaultExternalMagnet_XSize/2.)+externalMagnet_3XPosition; 411 externalMagnet_2XPosition = defaultExterna 410 externalMagnet_2XPosition = defaultExternalMagnet_2XPosition; 412 << 411 413 externalMagnet_2YPosition = defaultExterna 412 externalMagnet_2YPosition = defaultExternalMagnet_YPosition; 414 externalMagnet_2ZPosition = defaultExterna 413 externalMagnet_2ZPosition = defaultExternalMagnet_ZPosition; 415 << 414 416 Magnet_2XPosition=externalMagnet_2XPositio 415 Magnet_2XPosition=externalMagnet_2XPosition; 417 Magnet_2YPosition=0.0*mm; 416 Magnet_2YPosition=0.0*mm; 418 Magnet_2ZPosition=(defaultExternalMagnet_Z 417 Magnet_2ZPosition=(defaultExternalMagnet_ZSize+defaultMagnet_ZSize)/2.; 419 //////////////////ooooooooooOOOOOOOO000000 418 //////////////////ooooooooooOOOOOOOO000000000000OOOOOOOOOOOOooooooooooo///////////////// 420 // Defaults of the external part of the ma 419 // Defaults of the external part of the magnet 1: 421 externalMagnet_1XSize=defaultExternalMagne 420 externalMagnet_1XSize=defaultExternalMagnet_XSize; 422 externalMagnet_1YSize = defaultExternalMag 421 externalMagnet_1YSize = defaultExternalMagnet_YSize; 423 externalMagnet_1ZSize = defaultExternalMag 422 externalMagnet_1ZSize = defaultExternalMagnet_ZSize; 424 423 425 Magnet_1XSize=defaultMagnet_XSize; 424 Magnet_1XSize=defaultMagnet_XSize; 426 Magnet_1YSize=defaultMagnet_YSize; 425 Magnet_1YSize=defaultMagnet_YSize; 427 Magnet_1ZSize=defaultMagnet_ZSize; 426 Magnet_1ZSize=defaultMagnet_ZSize; 428 427 429 G4double defaultMagnet2ToMagnet1=85 *mm; 428 G4double defaultMagnet2ToMagnet1=85 *mm; 430 Magnet2ToMagnet1=defaultMagnet2ToMagnet1; 429 Magnet2ToMagnet1=defaultMagnet2ToMagnet1; 431 430 432 G4double defaultExternalMagnet_1XPosition 431 G4double defaultExternalMagnet_1XPosition = -(Magnet2ToMagnet1+defaultExternalMagnet_XSize/2.+defaultExternalMagnet_XSize/2.)+externalMagnet_2XPosition; 433 externalMagnet_1XPosition = defaultExterna 432 externalMagnet_1XPosition = defaultExternalMagnet_1XPosition; 434 << 433 435 externalMagnet_1YPosition = defaultExterna 434 externalMagnet_1YPosition = defaultExternalMagnet_YPosition; 436 externalMagnet_1ZPosition = defaultExterna 435 externalMagnet_1ZPosition = defaultExternalMagnet_ZPosition; 437 << 436 438 Magnet_1XPosition=defaultExternalMagnet_1X 437 Magnet_1XPosition=defaultExternalMagnet_1XPosition; 439 Magnet_1YPosition=0.0*mm; 438 Magnet_1YPosition=0.0*mm; 440 Magnet_1ZPosition=(defaultExternalMagnet_Z 439 Magnet_1ZPosition=(defaultExternalMagnet_ZSize+defaultMagnet_ZSize)/2.; 441 440 442 // Defaults of the external part of the Sl 441 // Defaults of the external part of the Slit 443 G4double defaultExternalSlitXSize = 8.0 *m << 442 G4double defaultExternalSlitXSize = 8.0 *mm; 444 externalSlitXSize = defaultExternalSlitXSi 443 externalSlitXSize = defaultExternalSlitXSize; 445 << 444 446 G4double defaultExternalSlitYSize = 82. *m 445 G4double defaultExternalSlitYSize = 82. *mm; 447 externalSlitYSize = defaultExternalSlitYSi 446 externalSlitYSize = defaultExternalSlitYSize; 448 << 447 449 G4double defaultExternalSlitZSize = 210. * 448 G4double defaultExternalSlitZSize = 210. *mm; 450 externalSlitZSize = defaultExternalSlitZSi 449 externalSlitZSize = defaultExternalSlitZSize; 451 << 450 452 G4double defaultExternalSlitXPosition = -( 451 G4double defaultExternalSlitXPosition = -(Magnet3ToMagnet2/2.+defaultExternalMagnet_XSize/2.)+externalMagnet_3XPosition; 453 externalSlitXPosition = defaultExternalSli 452 externalSlitXPosition = defaultExternalSlitXPosition; 454 << 453 455 G4double defaultExternalSlitYPosition = 0. 454 G4double defaultExternalSlitYPosition = 0.0 *mm; 456 externalSlitYPosition = defaultExternalSli 455 externalSlitYPosition = defaultExternalSlitYPosition; 457 << 456 458 G4double defaultExternalSlitZPosition = 0. 457 G4double defaultExternalSlitZPosition = 0.0 *mm; 459 externalSlitZPosition = defaultExternalSli 458 externalSlitZPosition = defaultExternalSlitZPosition; 460 << 459 461 // Defaults of the internal part of the Sl 460 // Defaults of the internal part of the Slit: 462 internalSlitXSize = defaultExternalSlitXSi 461 internalSlitXSize = defaultExternalSlitXSize; 463 << 462 464 G4double defaultInternalSlitYSize = 3 *mm; 463 G4double defaultInternalSlitYSize = 3 *mm; 465 internalSlitYSize = defaultInternalSlitYSi 464 internalSlitYSize = defaultInternalSlitYSize; 466 << 465 467 G4double defaultInternalSlitZSize = 3 *mm; 466 G4double defaultInternalSlitZSize = 3 *mm; 468 internalSlitZSize = defaultInternalSlitZSi 467 internalSlitZSize = defaultInternalSlitZSize; 469 << 468 470 G4double defaultInternalSlitXPosition = 0. 469 G4double defaultInternalSlitXPosition = 0.0 *mm; 471 internalSlitXPosition = defaultInternalSli 470 internalSlitXPosition = defaultInternalSlitXPosition; 472 << 471 473 G4double defaultInternalSlitYPosition = 0. 472 G4double defaultInternalSlitYPosition = 0.0 *mm; 474 internalSlitYPosition = defaultInternalSli 473 internalSlitYPosition = defaultInternalSlitYPosition; 475 << 474 476 G4double defaultInternalSlitZPosition = 40 475 G4double defaultInternalSlitZPosition = 40.0 *mm; 477 internalSlitZPosition = defaultInternalSli 476 internalSlitZPosition = defaultInternalSlitZPosition; 478 477 479 // Defaults of the particle collimator (Fi 478 // Defaults of the particle collimator (First collimator). 480 // The Collimator should be located before 479 // The Collimator should be located before the 1st magnet 481 // 480 // 482 defaultInnerRadiusCollimator = 0.0 *mm; 481 defaultInnerRadiusCollimator = 0.0 *mm; 483 innerRadiusCollimator = defaultInnerRadius 482 innerRadiusCollimator = defaultInnerRadiusCollimator; 484 483 485 defaultOuterRadiusCollimator = 2.5 *mm; << 484 defaultOuterRadiusCollimator = 2.5 *mm; 486 outerRadiusCollimator = defaultOuterRadius 485 outerRadiusCollimator = defaultOuterRadiusCollimator; 487 486 488 thicknessCollimator = defaultThicknessColl 487 thicknessCollimator = defaultThicknessCollimator; 489 << 488 490 defaultStartAngleCollimator = 0.0 *deg; 489 defaultStartAngleCollimator = 0.0 *deg; 491 startAngleCollimator = defaultStartAngleCo 490 startAngleCollimator = defaultStartAngleCollimator; 492 << 491 493 defaultSpanningAngleCollimator = 360.*deg; 492 defaultSpanningAngleCollimator = 360.*deg; 494 spanningAngleCollimator = defaultSpanningA 493 spanningAngleCollimator = defaultSpanningAngleCollimator; 495 494 496 G4double defultMagnet1ToFirstCollimator=25 << 495 G4double defultMagnet1ToFirstCollimator=25.*mm; 497 Magnet1ToFirstCollimator=defultMagnet1ToFi 496 Magnet1ToFirstCollimator=defultMagnet1ToFirstCollimator; 498 497 499 defaultCollimatorXPosition = -(thicknessCo 498 defaultCollimatorXPosition = -(thicknessCollimator/2.+Magnet1ToFirstCollimator+defaultExternalMagnet_XSize/2.)+externalMagnet_1XPosition; 500 collimatorBox_XPosition=defaultCollimatorX 499 collimatorBox_XPosition=defaultCollimatorXPosition; 501 collimatorXPosition = 0.0*mm; 500 collimatorXPosition = 0.0*mm; 502 << 501 503 defaultCollimatorYPosition = 0.0*mm; 502 defaultCollimatorYPosition = 0.0*mm; 504 collimatorBox_YPosition=defaultCollimatorY 503 collimatorBox_YPosition=defaultCollimatorYPosition; 505 collimatorYPosition = 0.0*mm; 504 collimatorYPosition = 0.0*mm; 506 << 505 507 defaultCollimatorZPosition = 0.0*mm; 506 defaultCollimatorZPosition = 0.0*mm; 508 collimatorBox_ZPosition=defaultCollimatorZ 507 collimatorBox_ZPosition=defaultCollimatorZPosition; 509 collimatorZPosition = 0.*mm; 508 collimatorZPosition = 0.*mm; 510 509 511 collimatorBoxYSize=82.0* mm; << 510 collimatorBoxYSize=82.0* mm; 512 collimatorBoxZSize=210.0* mm; 511 collimatorBoxZSize=210.0* mm; 513 512 514 //////////////////// Entrance Hole /////// 513 //////////////////// Entrance Hole ////////////////////////////////// 515 G4double defaultInnerRadiusEntrancehole=0. 514 G4double defaultInnerRadiusEntrancehole=0. *mm; 516 InnerRadiusEntrancehole=defaultInnerRadius 515 InnerRadiusEntrancehole=defaultInnerRadiusEntrancehole; 517 516 518 G4double defaultExternalRadiusEntrancehole 517 G4double defaultExternalRadiusEntrancehole=50.*mm; 519 ExternalRadiusEntrancehole=defaultExternal 518 ExternalRadiusEntrancehole=defaultExternalRadiusEntrancehole; 520 519 521 G4double defaultEntranceholeThickness=Vacc 520 G4double defaultEntranceholeThickness=VaccumChamberWallThickness; 522 EntranceholeThickness=defaultEntranceholeT 521 EntranceholeThickness=defaultEntranceholeThickness; 523 522 524 G4double defaultEntranceholeXPosition=-(ex 523 G4double defaultEntranceholeXPosition=-(externalChamberXSize/2.-EntranceholeThickness/2.); 525 EntranceholeXPosition=defaultEntranceholeX 524 EntranceholeXPosition=defaultEntranceholeXPosition; 526 << 525 527 G4double defaultEntranceholeQuadXPosition= 526 G4double defaultEntranceholeQuadXPosition=+(externalChamberXSize/2.-EntranceholeThickness/2.); 528 EntranceholeQuadXPosition=defaultEntranceh 527 EntranceholeQuadXPosition=defaultEntranceholeQuadXPosition; 529 << 528 530 G4double defaultEntranceholeYPosition=0.; 529 G4double defaultEntranceholeYPosition=0.; 531 EntranceholeYPosition=defaultEntranceholeY 530 EntranceholeYPosition=defaultEntranceholeYPosition; 532 531 533 G4double defaultEntranceholeZPosition=0.0* 532 G4double defaultEntranceholeZPosition=0.0*mm; 534 EntranceholeZPosition=defaultEntranceholeZ 533 EntranceholeZPosition=defaultEntranceholeZPosition; 535 534 536 G4double defaultStartAngleEntrancehole= 0. 535 G4double defaultStartAngleEntrancehole= 0.0 *deg; 537 startAngleEntrancehole= defaultStartAngleE 536 startAngleEntrancehole= defaultStartAngleEntrancehole; 538 << 537 539 G4double defaultSpanningAngleEntrancehole= 538 G4double defaultSpanningAngleEntrancehole= 360.*deg; 540 spanningAngleEntrancehole=defaultSpanningA 539 spanningAngleEntrancehole=defaultSpanningAngleEntrancehole; 541 540 542 ///////////////// Entrance Pipe/////////// 541 ///////////////// Entrance Pipe///////////////////////////////////////////// 543 542 544 G4double defaultEntrancePipeheight=105. *m 543 G4double defaultEntrancePipeheight=105. *mm; 545 EntrancePipeheight=defaultEntrancePipeheig 544 EntrancePipeheight=defaultEntrancePipeheight; 546 545 547 G4double defaultInnerRadiusEntrancePipe=50 546 G4double defaultInnerRadiusEntrancePipe=50. *mm; 548 InnerRadiusEntrancePipe=defaultInnerRadius 547 InnerRadiusEntrancePipe=defaultInnerRadiusEntrancePipe; 549 548 550 G4double defaultExternalRadiusEntrancePipe 549 G4double defaultExternalRadiusEntrancePipe=55 *mm; 551 ExternalRadiusEntrancePipe=defaultExternal 550 ExternalRadiusEntrancePipe=defaultExternalRadiusEntrancePipe; 552 551 553 G4double defaultEntrancePipeXPosition=-Ent 552 G4double defaultEntrancePipeXPosition=-EntrancePipeheight/2-externalChamberXSize/2+externalChamberXPosition; 554 EntrancePipeXPosition=defaultEntrancePipeX 553 EntrancePipeXPosition=defaultEntrancePipeXPosition; 555 554 556 G4double defaultEntrancePipeYPosition=0; 555 G4double defaultEntrancePipeYPosition=0; 557 EntrancePipeYPosition=defaultEntrancePipeY 556 EntrancePipeYPosition=defaultEntrancePipeYPosition; 558 557 559 G4double defaultEntrancePipeZPosition=0.0* 558 G4double defaultEntrancePipeZPosition=0.0*mm; 560 EntrancePipeZPosition=defaultEntrancePipeZ 559 EntrancePipeZPosition=defaultEntrancePipeZPosition; 561 560 562 G4double defaultStartAngleEntrancePipe= 0. 561 G4double defaultStartAngleEntrancePipe= 0.0 *deg; 563 startAngleEntrancePipe= defaultStartAngleE 562 startAngleEntrancePipe= defaultStartAngleEntrancePipe; 564 << 563 565 G4double defaultSpanningAngleEntrancePipe= 564 G4double defaultSpanningAngleEntrancePipe= 360.*deg; 566 spanningAngleEntrancePipe=defaultSpanningA 565 spanningAngleEntrancePipe=defaultSpanningAngleEntrancePipe; 567 566 568 /////////////////////////////////////Quadr << 567 /////////////////////////////////////Quadrupole////////////////////////////////// 569 G4double defaultQuadChamberWallPosX=-(exte 568 G4double defaultQuadChamberWallPosX=-(externalChamberXSize/2.)-EntrancePipeheight/2.+EntrancePipeXPosition; 570 QuadChamberWallPosX=defaultQuadChamberWall 569 QuadChamberWallPosX=defaultQuadChamberWallPosX; 571 G4double defaultQuadChamberWallPosY=0.0*cm 570 G4double defaultQuadChamberWallPosY=0.0*cm; 572 QuadChamberWallPosY=defaultQuadChamberWall 571 QuadChamberWallPosY=defaultQuadChamberWallPosY; 573 G4double defaultQuadChamberWallPosZ=0.0*cm 572 G4double defaultQuadChamberWallPosZ=0.0*cm; 574 QuadChamberWallPosZ=defaultQuadChamberWall 573 QuadChamberWallPosZ=defaultQuadChamberWallPosZ; 575 << 574 576 G4double defaultInnerRadiusQuad=10.0*mm; 575 G4double defaultInnerRadiusQuad=10.0*mm; 577 InnerRadiusQuad=defaultInnerRadiusQuad; 576 InnerRadiusQuad=defaultInnerRadiusQuad; 578 577 579 G4double defaultInnerRadiusTriplet=0.0*mm; 578 G4double defaultInnerRadiusTriplet=0.0*mm; 580 InnerRadiusTriplet=defaultInnerRadiusTripl 579 InnerRadiusTriplet=defaultInnerRadiusTriplet; 581 580 582 G4double defaultExternalRadiusQuad=30.0*mm 581 G4double defaultExternalRadiusQuad=30.0*mm; 583 ExternalRadiusQuad=defaultExternalRadiusQu 582 ExternalRadiusQuad=defaultExternalRadiusQuad; 584 583 585 G4double defaultFirstQuadThickness=80.0*mm 584 G4double defaultFirstQuadThickness=80.0*mm; 586 FirstQuadThickness=defaultFirstQuadThickne 585 FirstQuadThickness=defaultFirstQuadThickness; 587 G4double defaultSecondQuadThickness=40.0*m 586 G4double defaultSecondQuadThickness=40.0*mm; 588 SecondQuadThickness=defaultSecondQuadThick 587 SecondQuadThickness=defaultSecondQuadThickness; 589 G4double defaultThirdQuadThickness=40.0*mm 588 G4double defaultThirdQuadThickness=40.0*mm; 590 ThirdQuadThickness=defaultThirdQuadThickne 589 ThirdQuadThickness=defaultThirdQuadThickness; 591 G4double defaultFourthQuadThickness=80.0*m 590 G4double defaultFourthQuadThickness=80.0*mm; 592 FourthQuadThickness=defaultFourthQuadThick 591 FourthQuadThickness=defaultFourthQuadThickness; 593 592 594 G4double defaultStartAngleQuad = 0.0 *deg; 593 G4double defaultStartAngleQuad = 0.0 *deg; 595 startAngleQuad = defaultStartAngleQuad; 594 startAngleQuad = defaultStartAngleQuad; 596 << 595 597 G4double defaultSpanningAngleQuad = 360.*d 596 G4double defaultSpanningAngleQuad = 360.*deg; 598 spanningAngleQuad = defaultSpanningAngleQu 597 spanningAngleQuad = defaultSpanningAngleQuad; 599 << 598 600 G4double distancefromQuadChamber=100.0*mm; 599 G4double distancefromQuadChamber=100.0*mm; 601 G4double defaultFourthQuadXPosition= inter 600 G4double defaultFourthQuadXPosition= internalChamberXSize/2.-distancefromQuadChamber-FourthQuadThickness/2.; 602 FourthQuadXPosition=defaultFourthQuadXPosi 601 FourthQuadXPosition=defaultFourthQuadXPosition; 603 FourthQXPosition=0.0*mm; 602 FourthQXPosition=0.0*mm; 604 603 605 G4double distanceFQuadTQuad=100.0*mm; 604 G4double distanceFQuadTQuad=100.0*mm; 606 G4double defaultThirdQuadXPosition=-ThirdQ 605 G4double defaultThirdQuadXPosition=-ThirdQuadThickness/2.-distanceFQuadTQuad-FourthQuadThickness/2.+FourthQuadXPosition; 607 ThirdQuadXPosition=defaultThirdQuadXPositi 606 ThirdQuadXPosition=defaultThirdQuadXPosition; 608 ThirdQXPosition=0.0*mm; 607 ThirdQXPosition=0.0*mm; 609 << 608 610 G4double distanceTQuadSQuad=100.0*mm; 609 G4double distanceTQuadSQuad=100.0*mm; 611 G4double defaultSecondQuadXPosition=-Secon 610 G4double defaultSecondQuadXPosition=-SecondQuadThickness/2.-distanceTQuadSQuad-ThirdQuadThickness/2.+ThirdQuadXPosition; 612 SecondQuadXPosition=defaultSecondQuadXPosi 611 SecondQuadXPosition=defaultSecondQuadXPosition; 613 SecondQXPosition=0.0*mm; 612 SecondQXPosition=0.0*mm; 614 << 613 615 G4double distanceSQuadFQuad=100.0*mm; 614 G4double distanceSQuadFQuad=100.0*mm; 616 G4double defaultFirstQuadXPosition=-FirstQ 615 G4double defaultFirstQuadXPosition=-FirstQuadThickness/2.-distanceSQuadFQuad-SecondQuadThickness/2.+SecondQuadXPosition; 617 FirstQuadXPosition=defaultFirstQuadXPositi 616 FirstQuadXPosition=defaultFirstQuadXPosition; 618 FirstQXPosition=0.0*mm; 617 FirstQXPosition=0.0*mm; 619 << 618 620 G4double defaultQuadYPosition=0.0*mm; 619 G4double defaultQuadYPosition=0.0*mm; 621 QuadYPosition=defaultQuadYPosition; 620 QuadYPosition=defaultQuadYPosition; 622 QYPosition=defaultQuadYPosition; 621 QYPosition=defaultQuadYPosition; 623 622 624 G4double defaultQuadTZPosition= 0.*mm; << 623 G4double defaultQuadTZPosition= 0.*mm; 625 QuadZPosition=defaultQuadTZPosition; 624 QuadZPosition=defaultQuadTZPosition; 626 G4double defaultQuadZPosition=0.0*mm; 625 G4double defaultQuadZPosition=0.0*mm; 627 QZPosition=defaultQuadZPosition; 626 QZPosition=defaultQuadZPosition; 628 627 629 // DEFAULT DEFINITION OF THE MATERIALS 628 // DEFAULT DEFINITION OF THE MATERIALS 630 // All elements and compound definition fo 629 // All elements and compound definition follows the NIST database 631 630 632 //ELEMENTS 631 //ELEMENTS 633 G4bool isotopes = false; 632 G4bool isotopes = false; 634 G4Element* zincNist = G4NistManager::Insta 633 G4Element* zincNist = G4NistManager::Instance()->FindOrBuildElement("Zn"); 635 G4Element* copperNist = G4NistManager::Ins 634 G4Element* copperNist = G4NistManager::Instance()->FindOrBuildElement("Cu"); 636 635 637 //COMPOUNDS 636 //COMPOUNDS 638 G4Material* ironNist = G4NistManager::Inst 637 G4Material* ironNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Fe", isotopes); 639 G4Material* aluminiumNist = G4NistManager: 638 G4Material* aluminiumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al"); 640 G4Material* kaptonNist = G4NistManager::In 639 G4Material* kaptonNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON", isotopes); 641 //G4Material* waterNist = G4NistManager::I 640 //G4Material* waterNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER", isotopes); 642 G4Material* stainless_steelNist = G4NistMa 641 G4Material* stainless_steelNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_STAINLESS-STEEL", isotopes); 643 << 642 644 // Elements and compunds not pre-defined i 643 // Elements and compunds not pre-defined in Geant4 645 G4double d; // Density 644 G4double d; // Density 646 G4int nComponents;// Number of components 645 G4int nComponents;// Number of components 647 G4double fractionmass; // Fraction in mass 646 G4double fractionmass; // Fraction in mass of an element in a material 648 d = 8.40*g/cm3; 647 d = 8.40*g/cm3; 649 nComponents = 2; 648 nComponents = 2; 650 G4Material* brass = new G4Material("Brass" 649 G4Material* brass = new G4Material("Brass", d, nComponents); 651 brass -> AddElement(zincNist, fractionmass 650 brass -> AddElement(zincNist, fractionmass = 30 *perCent); 652 brass -> AddElement(copperNist, fractionma 651 brass -> AddElement(copperNist, fractionmass = 70 *perCent); 653 652 654 G4double atomicNumber = 1.; 653 G4double atomicNumber = 1.; 655 G4double massOfMole = 1.008*g/mole; 654 G4double massOfMole = 1.008*g/mole; 656 d = 1.e-25*g/cm3; 655 d = 1.e-25*g/cm3; 657 G4double temperature = 2.73*kelvin; 656 G4double temperature = 2.73*kelvin; 658 G4double pressure = 3.e-18*pascal; 657 G4double pressure = 3.e-18*pascal; 659 G4Material* vacuum = new G4Material("inter 658 G4Material* vacuum = new G4Material("interGalactic", atomicNumber,massOfMole, d, kStateGas,temperature, pressure); 660 659 661 //***************************** PW ******* 660 //***************************** PW *************************************** 662 661 663 // DetectorROGeometry Material 662 // DetectorROGeometry Material 664 new G4Material("dummyMat", 1., 1.*g/mole, 663 new G4Material("dummyMat", 1., 1.*g/mole, 1.*g/cm3); 665 664 666 //***************************** PW ******* 665 //***************************** PW *************************************** 667 << 666 668 // MATERIAL ASSIGNMENT 667 // MATERIAL ASSIGNMENT 669 MotherMaterial=vacuum; 668 MotherMaterial=vacuum; 670 QuadMaterial=ironNist; 669 QuadMaterial=ironNist; 671 externalChamberMaterial = stainless_steelN 670 externalChamberMaterial = stainless_steelNist; 672 internalChamberMaterial = vacuum; 671 internalChamberMaterial = vacuum; 673 collimatorMaterial = aluminiumNist; 672 collimatorMaterial = aluminiumNist; 674 collimatorHoleMaterial=vacuum; 673 collimatorHoleMaterial=vacuum; 675 FinalcollimatorMaterial=aluminiumNist; 674 FinalcollimatorMaterial=aluminiumNist; 676 FinalcollimatorHoleMaterial=vacuum; 675 FinalcollimatorHoleMaterial=vacuum; 677 WindowMaterial=kaptonNist; 676 WindowMaterial=kaptonNist; 678 PipeMaterial=stainless_steelNist; 677 PipeMaterial=stainless_steelNist; 679 << 678 680 externalMagnet_1Material = ironNist; 679 externalMagnet_1Material = ironNist; 681 externalMagnet_2Material = ironNist; 680 externalMagnet_2Material = ironNist; 682 externalMagnet_3Material = ironNist; 681 externalMagnet_3Material = ironNist; 683 externalMagnet_4Material = ironNist; 682 externalMagnet_4Material = ironNist; 684 << 683 685 externalSlitMaterial = brass; 684 externalSlitMaterial = brass; 686 internalSlitMaterial =vacuum; 685 internalSlitMaterial =vacuum; 687 << 686 688 //FC Material << 687 //FC Material 689 << 688 690 KaptonEntranceWindowMaterial=kaptonNist; 689 KaptonEntranceWindowMaterial=kaptonNist; 691 GuardRingMaterial=stainless_steelNist; 690 GuardRingMaterial=stainless_steelNist; 692 FaradayCupBottomMaterial=aluminiumNist; 691 FaradayCupBottomMaterial=aluminiumNist; 693 CupMaterial=FaradayCupBottomMaterial; 692 CupMaterial=FaradayCupBottomMaterial; 694 MassRingMaterial=GuardRingMaterial; 693 MassRingMaterial=GuardRingMaterial; 695 << 694 696 } 695 } 697 696 698 ////////////////////////////////////////////// 697 ///////////////////////////////////////////////////////////////////////////// 699 void LaserDrivenBeamLine::ConstructLaserDriven 698 void LaserDrivenBeamLine::ConstructLaserDrivenBeamLine() 700 { 699 { 701 // ----------------------------- 700 // ----------------------------- 702 // Treatment room - World volume 701 // Treatment room - World volume 703 //------------------------------ 702 //------------------------------ 704 << 703 705 const G4double worldX = 800.0 *cm; 704 const G4double worldX = 800.0 *cm; 706 const G4double worldY = 400.0 *cm; 705 const G4double worldY = 400.0 *cm; 707 const G4double worldZ = 400.0 *cm; 706 const G4double worldZ = 400.0 *cm; 708 707 709 solidTreatmentRoom = new G4Box("TreatmentR 708 solidTreatmentRoom = new G4Box("TreatmentRoom", 710 worldX, 709 worldX, 711 worldY, 710 worldY, 712 worldZ); 711 worldZ); 713 << 712 714 logicTreatmentRoom = new G4LogicalVolume(s 713 logicTreatmentRoom = new G4LogicalVolume(solidTreatmentRoom, 715 M 714 MotherMaterial, 716 " 715 "logicTreatmentRoom", 717 0 716 0, 718 0 717 0, 719 0 718 0); 720 << 719 721 physicTreatmentRoom = new G4PVPlacement(0, 720 physicTreatmentRoom = new G4PVPlacement(0, 722 G4 721 G4ThreeVector(), 723 "p 722 "physicalTreatmentRoom", 724 lo 723 logicTreatmentRoom, 725 0, 724 0, 726 fa 725 false, 727 0) 726 0); 728 << 727 729 << 728 730 // The treatment room is invisible in the 729 // The treatment room is invisible in the Visualisation 731 logicTreatmentRoom -> SetVisAttributes (G4 << 730 logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::Invisible); 732 << 731 733 // The various components of the energysel 732 // The various components of the energyselector are constructed calling 734 // the following methods 733 // the following methods 735 734 736 // This method constructs the chamber wher 735 // This method constructs the chamber where the energyselector is located 737 EnergySelectorChamber(); 736 EnergySelectorChamber(); 738 // This method construct the exit window 737 // This method construct the exit window 739 ExitWindow(); << 738 ExitWindow(); 740 // This method construct the exit pipe 739 // This method construct the exit pipe 741 ExitPipe(); << 740 ExitPipe(); 742 // This method construct the exit hole 741 // This method construct the exit hole 743 Exithole(); 742 Exithole(); 744 << 743 745 // This method constructs a circular colli 744 // This method constructs a circular collimator of variable thickness and 746 // aperture. It is placed befor the magnet 745 // aperture. It is placed befor the magnet to collimate particles caming from the 747 // plasma; 746 // plasma; 748 Collimator(); 747 Collimator(); 749 << 748 750 // This method constructs the magnet 1 and 749 // This method constructs the magnet 1 and its associated magnetic field 751 Magnet_1(); 750 Magnet_1(); 752 << 751 753 // This method constructs the magnet 2 and 752 // This method constructs the magnet 2 and its associated magnetic field 754 Magnet_2(); << 753 Magnet_2(); 755 754 756 // This method constructs the magnet 3 and 755 // This method constructs the magnet 3 and its associated magnetic field 757 Magnet_3(); << 756 Magnet_3(); 758 757 759 // This method constructs the magnet 4 and 758 // This method constructs the magnet 4 and its associated magnetic field 760 Magnet_4(); << 759 Magnet_4(); 761 << 760 762 // The selection slit is a square hole mov 761 // The selection slit is a square hole moveable inside a metallic plate 763 Slit(); << 762 Slit(); 764 << 765 FinalCollimator(); << 766 763 767 // This method construct the quadrupoles << 764 FinalCollimator(); 768 Quadrupole(); << 765 769 // This method construct the entrance hole << 766 // This method construct the quadrupoles 770 Entrancehole(); << 767 Quadrupole(); >> 768 // This method construct the entrance hole >> 769 Entrancehole(); 771 // This method construct the entrance pipe 770 // This method construct the entrance pipe 772 EntrancePipe(); << 771 EntrancePipe(); 773 << 772 774 FaradayCup(); << 773 FaradayCup(); 775 << 774 776 } 775 } 777 776 778 //....oooOO0OOooo........oooOO0OOooo........oo 777 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 779 778 780 void LaserDrivenBeamLine::ConstructSDandField( 779 void LaserDrivenBeamLine::ConstructSDandField() 781 { << 780 { 782 G4double minEps=1.0e-5; // Minimum & va << 781 G4double minEps=1.0e-5; // Minimum & value for smallest steps 783 G4double maxEps=1.0e-4; << 782 G4double maxEps=1.0e-4; 784 G4bool allLocal = true; 783 G4bool allLocal = true; 785 // G4int nvar = 8; For pure magnetic fiel << 784 // G4int nvar = 8; For pure magnetic field, the number of integration variables is the default! 786 << 785 787 //....oooOO0OOooo..........ENERGY SELECTOR << 786 //....oooOO0OOooo..........ENERGY SELECTOR SYSTEM FIELD..........oooOO0OOooo.... 788 if(logicInternalChamber){G4double xOffset << 787 if(logicInternalChamber){G4double xOffset =(internalChamberXSize/2.0)+externalSlitXPosition; 789 PurgMagField = new HadrontherapyMagnet << 788 PurgMagField = new HadrontherapyMagneticField3D("field/ESSMagneticField.TABLE", xOffset); 790 pFieldMgr =new G4FieldManager(); << 789 pFieldMgr =new G4FieldManager(); 791 pFieldMgr -> SetDetectorField(PurgMagF << 790 pFieldMgr -> SetDetectorField(PurgMagField); 792 G4cout << "DeltaStep "<< pFieldMgr -> << 791 G4cout << "DeltaStep "<< pFieldMgr -> GetDeltaOneStep()/mm <<"mm" <<endl; 793 pFieldMgr -> CreateChordFinder(PurgMag << 792 pFieldMgr -> CreateChordFinder(PurgMagField); 794 fEquation = new G4Mag_UsualEqRhs(PurgM << 793 fEquation = new G4Mag_UsualEqRhs(PurgMagField); 795 fstepper = new G4ClassicalRK4(fEquatio << 794 fstepper = new G4ClassicalRK4(fEquation); 796 //////fstepper = new G4HelixImplicitEu << 795 //////fstepper = new G4HelixImplicitEuler(fEquation); 797 pIntgrDriver = new G4MagInt_Driver(1*m << 796 pIntgrDriver = new G4MagInt_Driver(1*mm,fstepper,fstepper-> GetNumberOfVariables()); 798 //the first parameter is the minimum s << 797 //the first parameter is the minimum step 799 pChordFinder = new G4ChordFinder(pIntg << 798 pChordFinder = new G4ChordFinder(pIntgrDriver); 800 pFieldMgr->SetChordFinder(pChordFinder << 799 pFieldMgr->SetChordFinder(pChordFinder); 801 pFieldMgr->SetMinimumEpsilonStep(minEp << 800 pFieldMgr->SetMinimumEpsilonStep(minEps); 802 pFieldMgr->SetMaximumEpsilonStep(maxEp << 801 pFieldMgr->SetMaximumEpsilonStep(maxEps); 803 pFieldMgr->SetDeltaOneStep(0.5e-3*mm); << 802 pFieldMgr->SetDeltaOneStep(0.5e-3*mm);//default value of DeltaChord is 0.25 mm 804 logicInternalChamber -> SetFieldManage << 803 logicInternalChamber -> SetFieldManager(pFieldMgr, allLocal);} 805 //....oooOO0OOooo..........QUADS FIELDS... << 804 //....oooOO0OOooo..........QUADS FIELDS..........oooOO0OOooo.... 806 //....oooOO0OOooo..........FOURTH QUAD FIE << 805 //....oooOO0OOooo..........FOURTH QUAD FIELD..........oooOO0OOooo.... 807 if(LFourthTriplet){G4double xOffsetFQ =-(Q << 806 if(LFourthTriplet){G4double xOffsetFQ =-(QuadChamberWallPosX+FourthQuadXPosition); 808 PurgMagFieldQuadFourth = new Hadronthe << 807 PurgMagFieldQuadFourth = new HadrontherapyMagneticField3D("field/Quad80MagneticField.TABLE", xOffsetFQ); 809 pFieldMgrQuadFourth = new G4FieldMana << 808 pFieldMgrQuadFourth = new G4FieldManager(); 810 pFieldMgrQuadFourth -> SetDetectorFiel << 809 pFieldMgrQuadFourth -> SetDetectorField(PurgMagFieldQuadFourth); 811 << 810 812 pFieldMgrQuadFourth -> CreateChordFind << 811 pFieldMgrQuadFourth -> CreateChordFinder(PurgMagFieldQuadFourth); 813 fEquationQuadFourth = new G4Mag_UsualE << 812 fEquationQuadFourth = new G4Mag_UsualEqRhs(PurgMagFieldQuadFourth); 814 fstepperQuadFourth = new G4ClassicalRK << 813 fstepperQuadFourth = new G4ClassicalRK4(fEquationQuadFourth); 815 pIntgrDriverQuadFourth = new G4MagInt_ << 814 pIntgrDriverQuadFourth = new G4MagInt_Driver(1*mm,fstepperQuadFourth,fstepperQuadFourth-> GetNumberOfVariables()); 816 //the first parameter is the minimum s << 815 //the first parameter is the minimum step 817 pChordFinderQuadFourth = new G4ChordFi << 816 pChordFinderQuadFourth = new G4ChordFinder(pIntgrDriverQuadFourth); 818 pFieldMgrQuadFourth->SetChordFinder(pC << 817 pFieldMgrQuadFourth->SetChordFinder(pChordFinderQuadFourth); 819 pFieldMgrQuadFourth->SetMinimumEpsilon << 818 pFieldMgrQuadFourth->SetMinimumEpsilonStep(minEps); 820 pFieldMgrQuadFourth->SetMaximumEpsilon << 819 pFieldMgrQuadFourth->SetMaximumEpsilonStep(maxEps); 821 pFieldMgrQuadFourth->SetDeltaOneStep(0 << 820 pFieldMgrQuadFourth->SetDeltaOneStep(0.5e-3*mm);//default value of DeltaChord is 0.25 mm 822 LFourthTriplet -> SetFieldManager(pFie << 821 LFourthTriplet -> SetFieldManager(pFieldMgrQuadFourth, allLocal);} 823 //....oooOO0OOooo..........THIRD QUAD FIEL << 822 //....oooOO0OOooo..........THIRD QUAD FIELD..........oooOO0OOooo.... 824 if(LThirdTriplet){ G4double xOffsetTQ =-(Q 823 if(LThirdTriplet){ G4double xOffsetTQ =-(QuadChamberWallPosX+ThirdQuadXPosition); 825 PurgMagFieldQuadThird = new Hadronther << 824 PurgMagFieldQuadThird = new HadrontherapyMagneticField3D("field/Quad40MagneticField.TABLE", xOffsetTQ); 826 pFieldMgrQuadThird = new G4FieldManag << 825 pFieldMgrQuadThird = new G4FieldManager(); 827 pFieldMgrQuadThird -> SetDetectorField << 826 pFieldMgrQuadThird -> SetDetectorField(PurgMagFieldQuadThird); 828 pFieldMgrQuadThird -> CreateChordFinde << 827 pFieldMgrQuadThird -> CreateChordFinder(PurgMagFieldQuadThird); 829 fEquationQuadThird = new G4Mag_UsualEq << 828 fEquationQuadThird = new G4Mag_UsualEqRhs(PurgMagFieldQuadThird); 830 fstepperQuadThird = new G4ClassicalRK4 << 829 fstepperQuadThird = new G4ClassicalRK4(fEquationQuadThird); 831 pIntgrDriverQuadThird = new G4MagInt_D << 830 pIntgrDriverQuadThird = new G4MagInt_Driver(1*mm,fstepperQuadThird,fstepperQuadThird-> GetNumberOfVariables()); 832 //the first parameter is the minimum s << 831 //the first parameter is the minimum step 833 pChordFinderQuadThird = new G4ChordFin << 832 pChordFinderQuadThird = new G4ChordFinder(pIntgrDriverQuadThird); 834 pFieldMgrQuadThird->SetChordFinder(pCh << 833 pFieldMgrQuadThird->SetChordFinder(pChordFinderQuadThird); 835 pFieldMgrQuadThird->SetMinimumEpsilonS << 834 pFieldMgrQuadThird->SetMinimumEpsilonStep(minEps); 836 pFieldMgrQuadThird->SetMaximumEpsilonS << 835 pFieldMgrQuadThird->SetMaximumEpsilonStep(maxEps); 837 pFieldMgrQuadThird->SetDeltaOneStep(0. << 836 pFieldMgrQuadThird->SetDeltaOneStep(0.5e-3*mm);//default value of DeltaChord is 0.25 mm 838 LThirdTriplet -> SetFieldManager(pFiel << 837 LThirdTriplet -> SetFieldManager(pFieldMgrQuadThird, allLocal);} 839 //....oooOO0OOooo..........SECOND QUAD FIE << 838 //....oooOO0OOooo..........SECOND QUAD FIELD..........oooOO0OOooo.... 840 if(LSecondTriplet){G4double xOffsetSQ =-(Q << 839 if(LSecondTriplet){G4double xOffsetSQ =-(QuadChamberWallPosX+SecondQuadXPosition); 841 PurgMagFieldQuadSecond = new Hadronthe << 840 PurgMagFieldQuadSecond = new HadrontherapyMagneticField3D("field/Quad40MagneticField.TABLE", xOffsetSQ); 842 pFieldMgrQuadSecond = new G4FieldMana << 841 pFieldMgrQuadSecond = new G4FieldManager(); 843 pFieldMgrQuadSecond -> SetDetectorFiel << 842 pFieldMgrQuadSecond -> SetDetectorField(PurgMagFieldQuadSecond); 844 pFieldMgrQuadSecond -> CreateChordFind << 843 pFieldMgrQuadSecond -> CreateChordFinder(PurgMagFieldQuadSecond); 845 fEquationQuadSecond = new G4Mag_UsualE << 844 fEquationQuadSecond = new G4Mag_UsualEqRhs(PurgMagFieldQuadSecond); 846 fstepperQuadSecond = new G4ClassicalRK << 845 fstepperQuadSecond = new G4ClassicalRK4(fEquationQuadSecond); 847 pIntgrDriverQuadSecond = new G4MagInt_ << 846 pIntgrDriverQuadSecond = new G4MagInt_Driver(1*mm,fstepperQuadSecond,fstepperQuadSecond-> GetNumberOfVariables()); 848 //the first parameter is the minimum s << 847 //the first parameter is the minimum step 849 pChordFinderQuadSecond = new G4ChordFi << 848 pChordFinderQuadSecond = new G4ChordFinder(pIntgrDriverQuadSecond); 850 pFieldMgrQuadSecond->SetChordFinder(pC << 849 pFieldMgrQuadSecond->SetChordFinder(pChordFinderQuadSecond); 851 pFieldMgrQuadSecond->SetMinimumEpsilon << 850 pFieldMgrQuadSecond->SetMinimumEpsilonStep(minEps); 852 pFieldMgrQuadSecond->SetMaximumEpsilon << 851 pFieldMgrQuadSecond->SetMaximumEpsilonStep(maxEps); 853 pFieldMgrQuadSecond->SetDeltaOneStep(0 << 852 pFieldMgrQuadSecond->SetDeltaOneStep(0.5e-3*mm);//default value of DeltaChord is 0.25 mm 854 LSecondTriplet -> SetFieldManager(pFie << 853 LSecondTriplet -> SetFieldManager(pFieldMgrQuadSecond, allLocal);} 855 //....oooOO0OOooo..........FIRST QUAD FIEL << 854 //....oooOO0OOooo..........FIRST QUAD FIELD..........oooOO0OOooo.... 856 if(LFirstTriplet) {G4double xOffsetFirstQ << 855 if(LFirstTriplet) {G4double xOffsetFirstQ =-(QuadChamberWallPosX+FirstQuadXPosition); 857 PurgMagFieldQuadFirst = new Hadronther << 856 PurgMagFieldQuadFirst = new HadrontherapyMagneticField3D("field/Quad80MagneticField.TABLE", xOffsetFirstQ); 858 pFieldMgrQuadFirst = new G4FieldManag << 857 pFieldMgrQuadFirst = new G4FieldManager(); 859 pFieldMgrQuadFirst -> SetDetectorField << 858 pFieldMgrQuadFirst -> SetDetectorField(PurgMagFieldQuadFirst); 860 pFieldMgrQuadFirst -> CreateChordFinde << 859 pFieldMgrQuadFirst -> CreateChordFinder(PurgMagFieldQuadFirst); 861 fEquationQuadFirst = new G4Mag_UsualEq << 860 fEquationQuadFirst = new G4Mag_UsualEqRhs(PurgMagFieldQuadFirst); 862 fstepperQuadFirst = new G4ClassicalRK4 << 861 fstepperQuadFirst = new G4ClassicalRK4(fEquationQuadFirst); 863 pIntgrDriverQuadFirst = new G4MagInt_D << 862 pIntgrDriverQuadFirst = new G4MagInt_Driver(1*mm,fstepperQuadFirst,fstepperQuadFirst-> GetNumberOfVariables()); 864 //the first parameter is the minimum s << 863 //the first parameter is the minimum step 865 pChordFinderQuadFirst = new G4ChordFin << 864 pChordFinderQuadFirst = new G4ChordFinder(pIntgrDriverQuadFirst); 866 pFieldMgrQuadFirst->SetChordFinder(pCh << 865 pFieldMgrQuadFirst->SetChordFinder(pChordFinderQuadFirst); 867 pFieldMgrQuadFirst->SetMinimumEpsilonS << 866 pFieldMgrQuadFirst->SetMinimumEpsilonStep(minEps); 868 pFieldMgrQuadFirst->SetMaximumEpsilonS << 867 pFieldMgrQuadFirst->SetMaximumEpsilonStep(maxEps); 869 pFieldMgrQuadFirst->SetDeltaOneStep(0. << 868 pFieldMgrQuadFirst->SetDeltaOneStep(0.5e-3*mm);//default value of DeltaChord is 0.25 mm 870 LFirstTriplet -> SetFieldManager(pFiel << 869 LFirstTriplet -> SetFieldManager(pFieldMgrQuadFirst, allLocal);} 871 //....oooOO0OOooo..........FARADAY CUP FIE << 870 //....oooOO0OOooo..........FARADAY CUP FIELD..........oooOO0OOooo.... 872 if(logicVirtualMag) {G4double exOffset= -2 << 871 if(logicVirtualMag) {G4double exOffset= -20*cm; 873 G4double eyOffset= 0*cm; << 872 G4double eyOffset= 0*cm; 874 G4double ezOffset= 0*cm; << 873 G4double ezOffset= 0*cm; 875 G4FieldManager *pEFieldmanager = new G << 874 G4FieldManager *pEFieldmanager = new G4FieldManager(); 876 G4ElectricField *ElectricField = new H << 875 G4ElectricField *ElectricField = new HadrontherapyElectricTabulatedField3D("field/ElectricFieldFC-600V.TABLE", exOffset, eyOffset, ezOffset); 877 // UNIFORM FIELD << 876 // UNIFORM FIELD 878 // G4ElectroMagneticField* ElectricFie << 877 // G4ElectroMagneticField* ElectricField = new G4UniformElectricField(G4ThreeVector(0.0, 10.0*volt/m, 0.0)); //G4UniformElectricField 879 // The following is only for global fi << 878 // The following is only for global field in the whole geometry 880 //pEFieldmanager = G4TransportationMan << 879 //pEFieldmanager = G4TransportationManager::GetTransportationManager() -> GetFieldManager(); 881 << 880 882 const G4int nvarElectric=8; // The Eq << 881 const G4int nvarElectric=8; // The Equation of motion for Electric (or combined Electric/Magnetic) 883 // field requires 8 integration variab << 882 // field requires 8 integration variables 884 << 883 885 G4EqMagElectricField *fLocalEquation = << 884 G4EqMagElectricField *fLocalEquation = new G4EqMagElectricField(ElectricField); 886 G4MagIntegratorStepper* fLocalStepper << 885 G4MagIntegratorStepper* fLocalStepper = new G4ClassicalRK4(fLocalEquation, nvarElectric); 887 G4MagInt_Driver *pIntgrDriver_E = new << 886 G4MagInt_Driver *pIntgrDriver_E = new G4MagInt_Driver(0.02*mm, fLocalStepper, fLocalStepper -> GetNumberOfVariables() ); 888 G4ChordFinder *fLocalChordFinder = new << 887 G4ChordFinder *fLocalChordFinder = new G4ChordFinder(pIntgrDriver_E); 889 pEFieldmanager -> SetDetectorField(Ele << 888 pEFieldmanager -> SetDetectorField(ElectricField); 890 pEFieldmanager -> SetChordFinder(fLoca << 889 pEFieldmanager -> SetChordFinder(fLocalChordFinder); 891 //G4double deltainter=0.0001*mm; << 890 //G4double deltainter=0.0001*mm; 892 //G4double missdist=0.1*mm; << 891 //G4double missdist=0.1*mm; 893 //pEFieldmanager->SetDeltaIntersection << 892 //pEFieldmanager->SetDeltaIntersection(deltainter); 894 //fLocalChordFinder->SetDeltaChord(mis << 893 //fLocalChordFinder->SetDeltaChord(missdist); 895 pEFieldmanager->SetMinimumEpsilonStep( << 894 pEFieldmanager->SetMinimumEpsilonStep(minEps); 896 pEFieldmanager->SetMaximumEpsilonStep( << 895 pEFieldmanager->SetMaximumEpsilonStep(maxEps); 897 pEFieldmanager->SetDeltaOneStep( 0.5e- << 896 pEFieldmanager->SetDeltaOneStep( 0.5e-3 * mm ); 898 //pEFieldmanager -> SetFieldChangesEne << 897 //pEFieldmanager -> SetFieldChangesEnergy(true); 899 logicVirtualMag -> SetFieldManager(pEF << 898 logicVirtualMag -> SetFieldManager(pEFieldmanager, allLocal);} 900 //....oooOO0OOooo....................oooOO << 899 //....oooOO0OOooo....................oooOO0OOooo.... 901 G4cout<<" //....oooOO0OOooo.......... FIEL << 900 G4cout<<" //....oooOO0OOooo.......... FIELDS HAVE BEEN IMPLEMENTED..........oooOO0OOooo...."<<G4endl; 902 return; << 901 return; 903 } 902 } 904 903 905 ////////////////////////////////////////////// 904 ///////////////////////////////////////////////////////////////////////////// 906 void LaserDrivenBeamLine::FaradayCup() 905 void LaserDrivenBeamLine::FaradayCup() 907 { 906 { 908 /// FC sizes /// << 907 /// FC sizes /// 909 << 908 910 G4double InnerRadiusFC=25*mm; << 909 G4double InnerRadiusFC=25*mm; 911 G4double OuterRadiusFC=45*mm; << 910 G4double OuterRadiusFC=45*mm; 912 G4double MassRingThickness=5*mm; << 911 G4double MassRingThickness=5*mm; 913 G4double GuardRingThickness=180*mm; << 912 G4double GuardRingThickness=180*mm; 914 G4double FaradayCupBottomThickness=120*mm; << 913 G4double FaradayCupBottomThickness=120*mm; 915 G4double CupThickness=10*cm; << 914 G4double CupThickness=10*cm; 916 G4double KaptonEntranceWindowThickness=25* << 915 G4double KaptonEntranceWindowThickness=25*um; 917 << 916 918 /// Virtual Volumes /// << 917 /// Virtual Volumes /// 919 << 918 920 G4double VirtualWindowThickness=1.*um ; << 919 G4double VirtualWindowThickness=1.*um ; 921 G4double VirtualMiddleThickness= 1.*um ; << 920 G4double VirtualMiddleThickness= 1.*um ; 922 G4double VirtualBottomThickness= 1. *um ; << 921 G4double VirtualBottomThickness= 1. *um ; 923 G4double VirtualOverBottomThickness=1. *um << 922 G4double VirtualOverBottomThickness=1. *um ; 924 G4double VirtualLateralLength=FaradayCupBo << 923 G4double VirtualLateralLength=FaradayCupBottomThickness+CupThickness+VirtualBottomThickness; 925 << 924 926 << 925 927 //// Position //// << 926 //// Position //// 928 << 927 929 G4double virtualMagPosX=31*cm; << 928 G4double virtualMagPosX=31*cm; 930 G4double FC_XOffset=20*cm; << 929 G4double FC_XOffset=20*cm; 931 G4double KaptonEntranceWindowPosX=-virtual << 930 G4double KaptonEntranceWindowPosX=-virtualMagPosX+KaptonEntranceWindowThickness/2+FC_XOffset; 932 G4double MassRingPosX=KaptonEntranceWindow << 931 G4double MassRingPosX=KaptonEntranceWindowPosX+KaptonEntranceWindowThickness/2+MassRingThickness/2; 933 G4double VirtualWindowPosX=MassRingPosX+Ma << 932 G4double VirtualWindowPosX=MassRingPosX+MassRingThickness/2+VirtualWindowThickness/2; 934 G4double GuardRingPosX=MassRingPosX+MassRi << 933 G4double GuardRingPosX=MassRingPosX+MassRingThickness/2+GuardRingThickness/2+2*mm; 935 G4double VirtualMiddlePosX=GuardRingPosX+G << 934 G4double VirtualMiddlePosX=GuardRingPosX+GuardRingThickness/2+VirtualMiddleThickness/2; 936 G4double FaradayCupBottomPosX=GuardRingPos << 935 G4double FaradayCupBottomPosX=GuardRingPosX+GuardRingThickness/2+FaradayCupBottomThickness/2+1*cm; 937 G4double VirtualBottomPosX=FaradayCupBotto << 936 G4double VirtualBottomPosX=FaradayCupBottomPosX+FaradayCupBottomThickness/2+VirtualBottomThickness/2; 938 G4double CupPosX=VirtualBottomPosX+Virtual << 937 G4double CupPosX=VirtualBottomPosX+VirtualBottomThickness/2+CupThickness/2; 939 G4double VirtualOverBottomPosX=CupPosX+Cup << 938 G4double VirtualOverBottomPosX=CupPosX+CupThickness/2+VirtualOverBottomThickness/2; 940 G4double VirtualLateralPosX=GuardRingPosX+ << 939 G4double VirtualLateralPosX=GuardRingPosX+GuardRingThickness/2+1*cm+(FaradayCupBottomThickness+CupThickness+VirtualBottomThickness)/2; 941 G4double phi = 90. *deg; << 940 G4double phi = 90. *deg; 942 G4RotationMatrix rm; << 941 G4RotationMatrix rm; 943 rm.rotateY(phi); << 942 rm.rotateY(phi); 944 << 945 virtualMag= new G4Box("virtualMag", 31.*cm << 946 943 >> 944 virtualMag= new G4Box("virtualMag", 31.*cm, 6*cm, 6*cm ); >> 945 947 logicVirtualMag= new G4LogicalVolume( virt 946 logicVirtualMag= new G4LogicalVolume( virtualMag, 948 inter 947 internalChamberMaterial, 949 "LVir 948 "LVirtualMag", 950 0,0,0 949 0,0,0); 951 physicVirtualMag = new G4PVPlacement(0, << 950 physicVirtualMag = new G4PVPlacement(0, 952 G4Thr << 951 G4ThreeVector(virtualMagPosX, 0.*cm, 0*mm), 953 "PVir 952 "PVirtualMag", 954 logic 953 logicVirtualMag, 955 physi 954 physicTreatmentRoom, 956 true, 955 true, 0); 957 956 958 << 957 959 logicVirtualMag -> SetVisAttributes(blue); << 958 logicVirtualMag -> SetVisAttributes(blue); 960 << 959 961 //// BeveledCylinder //// << 960 //// BeveledCylinder //// 962 << 961 963 G4RotationMatrix *Rot= new G4RotationMatri << 962 G4RotationMatrix *Rot= new G4RotationMatrix; 964 Rot->rotateX(14*deg); << 963 Rot->rotateX(14*deg); 965 G4ThreeVector trans(0.,22.5*mm,-15*mm); << 964 G4ThreeVector trans(0.,22.5*mm,-15*mm); 966 Cylinder= new G4Tubs("cylinder",20*mm,22.5 << 965 Cylinder= new G4Tubs("cylinder",20*mm,22.5*mm,90*mm,0.,2*pi); 967 Box= new G4Box("Box",22.5*mm,22.5*mm,90*mm << 966 Box= new G4Box("Box",22.5*mm,22.5*mm,90*mm); 968 << 967 969 G4SubtractionSolid* BeveledCylinder=new G4 << 968 G4SubtractionSolid* BeveledCylinder=new G4SubtractionSolid("Cylinder-Box", 970 << 969 Cylinder, 971 << 970 Box, 972 << 971 Rot, 973 << 972 trans); 974 << 973 975 logicBeveledCylinder= new G4LogicalVolume << 974 logicBeveledCylinder= new G4LogicalVolume (BeveledCylinder, 976 << 975 GuardRingMaterial, 977 << 976 "LBeveledCylinder", 978 << 977 0,0,0); 979 << 978 980 physicBeveledCylinder =new G4PVPlacement(G << 979 physicBeveledCylinder =new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(GuardRingPosX,0,0)), 981 " << 980 "physicBeveledCylinder", 982 l << 981 logicBeveledCylinder, 983 p << 982 physicVirtualMag, 984 t << 983 true,0); 985 << 984 986 logicBeveledCylinder->SetVisAttributes(gre << 985 logicBeveledCylinder->SetVisAttributes(green); 987 << 986 988 << 987 989 ///// KaptonEntranceWindow ///// << 988 ///// KaptonEntranceWindow ///// 990 << 989 991 KaptonEntranceWindow= new G4Tubs("KaptonEn << 990 KaptonEntranceWindow= new G4Tubs("KaptonEntranceWindow", 992 0, << 991 0, 993 OuterRadi << 992 OuterRadiusFC, 994 KaptonEnt << 993 KaptonEntranceWindowThickness/2, 995 0*deg,360 << 994 0*deg,360*deg); 996 << 995 997 logicKaptonEntranceWindow=new G4LogicalVol << 996 logicKaptonEntranceWindow=new G4LogicalVolume( KaptonEntranceWindow, 998 << 997 // internalChamberMaterial, for track control 999 << 998 KaptonEntranceWindowMaterial, 1000 << 999 "LKaptonEntranceWindow", 1001 << 1000 0,0,0); 1002 << 1001 1003 physicKaptonEntranceWindow=new G4PVPlacem << 1002 physicKaptonEntranceWindow=new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(KaptonEntranceWindowPosX,0,0)), 1004 << 1003 "PhysicEntranceWindow", 1005 << 1004 logicKaptonEntranceWindow, 1006 << 1005 physicVirtualMag,true,0); 1007 logicKaptonEntranceWindow -> SetVisAttrib << 1006 logicKaptonEntranceWindow -> SetVisAttributes(gray); 1008 << 1007 1009 ////// MassRing ///// << 1008 ////// MassRing ///// 1010 << 1009 1011 MassRing=new G4Tubs ("MassRing", << 1010 MassRing=new G4Tubs ("MassRing", 1012 InnerRadiusFC, << 1011 InnerRadiusFC, 1013 OuterRadiusFC, << 1012 OuterRadiusFC, 1014 MassRingThickness/2, << 1013 MassRingThickness/2, 1015 0*deg,360*deg); << 1014 0*deg,360*deg); 1016 << 1015 1017 logicMassRing=new G4LogicalVolume( << 1016 logicMassRing=new G4LogicalVolume( MassRing, 1018 MassRin << 1017 MassRingMaterial, 1019 "logicM << 1018 "logicMassRing", 1020 0,0,0); << 1019 0,0,0); 1021 << 1020 1022 physicMassRing=new G4PVPlacement( << 1021 physicMassRing=new G4PVPlacement( G4Transform3D(rm,G4ThreeVector(MassRingPosX,0,0)), 1023 << 1024 "PhysicM << 1025 << 1026 physicVi << 1027 true,0); << 1028 logicMassRing -> SetVisAttributes(green); << 1029 << 1030 << 1031 << 1032 << 1033 ///// VirtualWindow ///// << 1034 << 1035 << 1036 VirtualWindow=new G4Tubs("VirtualWindow", << 1037 0, << 1038 OuterRadiusFC, << 1039 VirtualWindowThi << 1040 0*deg,360*deg); << 1041 << 1042 logicVirtualWindow=new G4LogicalVolume( << 1043 in << 1044 "l << 1045 0, << 1046 << 1047 physicVirtualWindow=new G4PVPlacement( << 1048 << 1049 "Ph << 1050 log << 1051 phy << 1052 tru << 1053 logicVirtualWindow->SetVisAttributes (G4V << 1054 << 1055 ///// GuardRing ///// << 1056 << 1057 GuardRing=new G4Tubs ("GuardRing", << 1058 InnerRadiusFC, << 1059 OuterRadiusFC, << 1060 GuardRingThickness/ << 1061 0*deg,360*deg); << 1062 << 1063 logicGuardRing=new G4LogicalVolume( << 1064 GuardR << 1065 "logic << 1066 0,0,0) << 1067 << 1068 physicGuardRing=new G4PVPlacement(G4Trans << 1069 << 1070 "Physic << 1071 1022 1072 physicV << 1023 "PhysicMassRing",logicMassRing, 1073 true,0) << 1024 1074 logicGuardRing -> SetVisAttributes(red); << 1025 physicVirtualMag, 1075 << 1026 true,0); 1076 << 1027 logicMassRing -> SetVisAttributes(green); 1077 /////VirtualMiddle ///// << 1028 1078 << 1029 1079 << 1030 1080 VirtualMiddle=new G4Tubs ("VirtualMiddle" << 1031 1081 0, << 1032 ///// VirtualWindow ///// 1082 OuterRadiusFC, << 1033 1083 VirtualMiddleTh << 1034 1084 0*deg,360*deg); << 1035 VirtualWindow=new G4Tubs("VirtualWindow", 1085 << 1036 0, 1086 logicVirtualMiddle=new G4LogicalVolume( << 1037 OuterRadiusFC, 1087 in << 1038 VirtualWindowThickness/2, 1088 "l << 1039 0*deg,360*deg); 1089 0, << 1040 1090 << 1041 logicVirtualWindow=new G4LogicalVolume( VirtualWindow, 1091 physicVirtualMiddle=new G4PVPlacement(G4T << 1042 internalChamberMaterial, 1092 << 1043 "logicVirtualWindow", 1093 "Ph << 1044 0,0,0); 1094 << 1045 1095 phy << 1046 physicVirtualWindow=new G4PVPlacement( G4Transform3D(rm,G4ThreeVector(VirtualWindowPosX,0,0)), 1096 tru << 1047 1097 << 1048 "PhysicVirtualWindow", 1098 logicVirtualMiddle->SetVisAttributes (G4V << 1049 logicVirtualWindow, 1099 << 1050 physicVirtualMag, 1100 ///// FaradayCupBottom ///// << 1051 true,0); 1101 << 1052 logicVirtualWindow->SetVisAttributes (G4VisAttributes::Invisible); 1102 FaradayCupBottom=new G4Tubs ("FaradayCupB << 1053 1103 InnerRadiusF << 1054 ///// GuardRing ///// 1104 OuterRadiusF << 1055 1105 FaradayCupBo << 1056 GuardRing=new G4Tubs ("GuardRing", 1106 0*deg,360*de << 1057 InnerRadiusFC, 1107 << 1058 OuterRadiusFC, 1108 logicFaradayCupBottom=new G4LogicalVolume << 1059 GuardRingThickness/2, 1109 << 1060 0*deg,360*deg); 1110 << 1061 1111 << 1062 logicGuardRing=new G4LogicalVolume( GuardRing, 1112 << 1063 GuardRingMaterial, 1113 physicFaradayCupBottom=new G4PVPlacement( << 1064 "logicGuardRing", 1114 << 1065 0,0,0); 1115 << 1066 1116 << 1067 physicGuardRing=new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(GuardRingPosX,0,0)), 1117 logicFaradayCupBottom -> SetVisAttributes << 1068 1118 << 1069 "PhysicGuardRing", logicGuardRing, 1119 << 1070 1120 ///// Virtual Bottom ////// << 1071 physicVirtualMag, 1121 << 1072 true,0); 1122 VirtualBottom=new G4Tubs ("VirtualBottom" << 1073 logicGuardRing -> SetVisAttributes(red); 1123 0, << 1074 1124 OuterRadiusFC, << 1075 1125 VirtualBottomTh << 1076 /////VirtualMiddle ///// 1126 0*deg,360*deg); << 1077 1127 << 1078 1128 logicVirtualBottom=new G4LogicalVolume( << 1079 VirtualMiddle=new G4Tubs ("VirtualMiddle", 1129 in << 1080 0, 1130 "l << 1081 OuterRadiusFC, 1131 0, << 1082 VirtualMiddleThickness/2, 1132 << 1083 0*deg,360*deg); 1133 physicVirtualBottom=new G4PVPlacement(G4T << 1084 1134 "Ph << 1085 logicVirtualMiddle=new G4LogicalVolume( VirtualMiddle, 1135 log << 1086 internalChamberMaterial, 1136 phy << 1087 "logicVirtualMiddle", 1137 tru << 1088 0,0,0); 1138 << 1089 1139 logicVirtualBottom->SetVisAttributes (G4V << 1090 physicVirtualMiddle=new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(VirtualMiddlePosX,0,0)), 1140 << 1091 1141 ///// Cup ///// << 1092 "PhysicVirtualMiddle", logicVirtualMiddle, 1142 << 1093 1143 Cup=new G4Tubs ("Cup", << 1094 physicVirtualMag, 1144 0, << 1095 true,0); 1145 OuterRadiusFC, << 1096 1146 CupThickness/2, << 1097 logicVirtualMiddle->SetVisAttributes (G4VisAttributes::Invisible); 1147 0*deg,360*deg); << 1098 1148 << 1099 ///// FaradayCupBottom ///// 1149 logicCup=new G4LogicalVolume( << 1100 1150 CupMaterial, << 1101 FaradayCupBottom=new G4Tubs ("FaradayCupBottom", 1151 "logicCup", << 1102 InnerRadiusFC, 1152 0,0,0); << 1103 OuterRadiusFC, 1153 << 1104 FaradayCupBottomThickness/2, 1154 physicCup=new G4PVPlacement(G4Transform3D << 1105 0*deg,360*deg); 1155 "PhysicCup", << 1106 1156 << 1107 logicFaradayCupBottom=new G4LogicalVolume( FaradayCupBottom, 1157 physicVirtual << 1108 FaradayCupBottomMaterial, 1158 true,0); << 1109 "logicFaradayCupBottom", 1159 << 1110 0,0,0); 1160 logicCup -> SetVisAttributes(darkGreen); << 1111 1161 << 1112 physicFaradayCupBottom=new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(FaradayCupBottomPosX,0,0)), 1162 << 1113 "PhysicFaradayCupBottom",logicFaradayCupBottom, 1163 ///// Virtual OverBottom ///// << 1114 physicVirtualMag, 1164 << 1115 true,0); 1165 VirtualOverBottom=new G4Tubs ("VirtualOve << 1116 logicFaradayCupBottom -> SetVisAttributes(yellow); 1166 0, << 1117 1167 OuterRadius << 1118 1168 VirtualOver << 1119 ///// Virtual Bottom ////// 1169 0*deg,360*d << 1120 1170 << 1121 VirtualBottom=new G4Tubs ("VirtualBottom", 1171 logicVirtualOverBottom=new G4LogicalVolum << 1122 0, 1172 << 1123 OuterRadiusFC, 1173 << 1124 VirtualBottomThickness/2, 1174 << 1125 0*deg,360*deg); 1175 << 1126 1176 physicVirtualOverBottom=new G4PVPlacement << 1127 logicVirtualBottom=new G4LogicalVolume( VirtualBottom, 1177 << 1128 internalChamberMaterial, 1178 << 1129 "logicVirtualBottom", 1179 << 1130 0,0,0); 1180 << 1131 1181 logicVirtualOverBottom->SetVisAttributes << 1132 physicVirtualBottom=new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(VirtualBottomPosX,0,0)), 1182 << 1133 "PhysicVirtualBottom", 1183 << 1134 logicVirtualBottom, 1184 ///// Virtual Lateral ///// << 1135 physicVirtualMag, 1185 << 1136 true,0); 1186 << 1137 1187 VirtualLateral=new G4Tubs ("VirtualLatera << 1138 logicVirtualBottom->SetVisAttributes (G4VisAttributes::Invisible); 1188 OuterRadiusFC, << 1139 1189 OuterRadiusFC+ << 1140 ///// Cup ///// 1190 VirtualLateral << 1141 1191 0*deg,360*deg) << 1142 Cup=new G4Tubs ("Cup", 1192 << 1143 0, 1193 logicVirtualLateral=new G4LogicalVolume( << 1144 OuterRadiusFC, 1194 i << 1145 CupThickness/2, 1195 " << 1146 0*deg,360*deg); 1196 0 << 1147 1197 << 1148 logicCup=new G4LogicalVolume( Cup, 1198 physicVirtualLateral=new G4PVPlacement(G4 << 1149 CupMaterial, 1199 "V << 1150 "logicCup", 1200 << 1151 0,0,0); 1201 ph << 1152 1202 tr << 1153 physicCup=new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(CupPosX,0,0)), 1203 << 1154 "PhysicCup", logicCup, 1204 << 1155 1205 << 1156 physicVirtualMag, 1206 logicVirtualLateral->SetVisAttributes (G4 << 1157 true,0); 1207 } << 1158 >> 1159 logicCup -> SetVisAttributes(darkGreen); >> 1160 >> 1161 >> 1162 ///// Virtual OverBottom ///// >> 1163 >> 1164 VirtualOverBottom=new G4Tubs ("VirtualOverBottom", >> 1165 0, >> 1166 OuterRadiusFC, >> 1167 VirtualOverBottomThickness/2, >> 1168 0*deg,360*deg); >> 1169 >> 1170 logicVirtualOverBottom=new G4LogicalVolume( VirtualOverBottom, >> 1171 internalChamberMaterial, >> 1172 "logicVirtualOverBottom", >> 1173 0,0,0); >> 1174 >> 1175 physicVirtualOverBottom=new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(VirtualOverBottomPosX,0,0)), >> 1176 "PhysicVirtualOverBottom",logicVirtualOverBottom, >> 1177 >> 1178 physicVirtualMag, >> 1179 true,0); >> 1180 logicVirtualOverBottom->SetVisAttributes (G4VisAttributes::Invisible); >> 1181 >> 1182 >> 1183 ///// Virtual Lateral ///// >> 1184 >> 1185 >> 1186 VirtualLateral=new G4Tubs ("VirtualLateral", >> 1187 OuterRadiusFC, >> 1188 OuterRadiusFC+1*um,// the VirtualLateralThickness is 1*um >> 1189 VirtualLateralLength/2, >> 1190 0*deg,360*deg); >> 1191 >> 1192 logicVirtualLateral=new G4LogicalVolume( VirtualLateral, >> 1193 internalChamberMaterial, >> 1194 "logicVirtualLateral", >> 1195 0,0,0); >> 1196 >> 1197 physicVirtualLateral=new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(VirtualLateralPosX,0,0)), >> 1198 "VirtualLateral",logicVirtualLateral, >> 1199 >> 1200 physicVirtualMag, >> 1201 true,0); >> 1202 >> 1203 >> 1204 >> 1205 logicVirtualLateral->SetVisAttributes (G4VisAttributes::Invisible); >> 1206 } 1208 1207 1209 ///////////////////////////////////////////// 1208 ///////////////////////////////////////////////////////////////////////////// 1210 void LaserDrivenBeamLine::Quadrupole() 1209 void LaserDrivenBeamLine::Quadrupole() 1211 { 1210 { 1212 // To rotate the quadrupoles putting thei 1211 // To rotate the quadrupoles putting their axis (along X direction) parallel to the beam axis 1213 G4double phi = 90. *deg; 1212 G4double phi = 90. *deg; 1214 G4RotationMatrix rm; 1213 G4RotationMatrix rm; 1215 rm.rotateY(phi); 1214 rm.rotateY(phi); 1216 1215 1217 SQuadChamberWall = new G4Box("solidQuadCh 1216 SQuadChamberWall = new G4Box("solidQuadChamberWall",externalChamberXSize/2., externalChamberYSize/2.,externalChamberZSize/2.); 1218 1217 1219 LQuadChamberWall = new G4LogicalVolume(SQ 1218 LQuadChamberWall = new G4LogicalVolume(SQuadChamberWall, externalChamberMaterial,"logicQuadChamberWall"); 1220 << 1219 1221 PQuadChamberWall = new G4PVPlacement(0, G 1220 PQuadChamberWall = new G4PVPlacement(0, G4ThreeVector(QuadChamberWallPosX, QuadChamberWallPosY, QuadChamberWallPosZ), 1222 "phy << 1221 "physQuadChamberWall", LQuadChamberWall,physicTreatmentRoom, false, 0); 1223 << 1224 1222 >> 1223 1225 SQuadChamber = new G4Box("solidQuadChambe 1224 SQuadChamber = new G4Box("solidQuadChamber", internalChamberXSize/2., internalChamberYSize/2.,internalChamberZSize/2.); 1226 1225 1227 LQuadChamber = new G4LogicalVolume(SQuadC 1226 LQuadChamber = new G4LogicalVolume(SQuadChamber, internalChamberMaterial,"logicQuadChamber"); 1228 << 1227 1229 PQuadChamber = new G4PVPlacement(0, G4Thr 1228 PQuadChamber = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), 1230 "physQua << 1229 "physQuadChamber", LQuadChamber,PQuadChamberWall, false, 0); 1231 << 1230 1232 LQuadChamberWall -> SetVisAttributes(red) << 1231 LQuadChamberWall -> SetVisAttributes(red); 1233 LQuadChamber -> SetVisAttributes(white); 1232 LQuadChamber -> SetVisAttributes(white); 1234 ///////////----------------------------Fo << 1233 ///////////----------------------------Fourth Quadrupole----------------------------///////// 1235 SFourthTriplet = new G4Tubs("SolidTQuad", 1234 SFourthTriplet = new G4Tubs("SolidTQuad", InnerRadiusTriplet, ExternalRadiusQuad,((FourthQuadThickness/2.)+1*mm), 1236 startAngleQua << 1235 startAngleQuad, spanningAngleQuad); 1237 << 1236 1238 LFourthTriplet = new G4LogicalVolume(SFou 1237 LFourthTriplet = new G4LogicalVolume(SFourthTriplet, internalChamberMaterial,"LogicTQuad", 0, 0, 0); 1239 << 1238 1240 PFourthTriplet = new G4PVPlacement(G4Tran 1239 PFourthTriplet = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(FourthQuadXPosition, QuadYPosition, QuadZPosition)), 1241 "PhysF << 1240 "PhysFourthTQuad", LFourthTriplet, PQuadChamber, false, 0); 1242 1241 1243 solidFourthQuad = new G4Tubs("SolidQuad", 1242 solidFourthQuad = new G4Tubs("SolidQuad", InnerRadiusQuad, ExternalRadiusQuad, FourthQuadThickness/2., 1244 startAngleQu << 1243 startAngleQuad, spanningAngleQuad); 1245 << 1244 1246 logicFourthQuad = new G4LogicalVolume(sol 1245 logicFourthQuad = new G4LogicalVolume(solidFourthQuad, QuadMaterial, "LogicQuad", 0, 0, 0); 1247 << 1246 1248 physicFourthQuad = new G4PVPlacement(0, G 1247 physicFourthQuad = new G4PVPlacement(0, G4ThreeVector(FourthQXPosition, QYPosition, QZPosition), 1249 "Phy << 1248 "PhysFourthQuad",logicFourthQuad, PFourthTriplet, false, 0); 1250 1249 1251 LFourthTriplet -> SetVisAttributes(yellow 1250 LFourthTriplet -> SetVisAttributes(yellow); 1252 logicFourthQuad -> SetVisAttributes(green 1251 logicFourthQuad -> SetVisAttributes(green); 1253 ///////////----------------------------Th << 1252 ///////////----------------------------Third Quadrupole----------------------------///////// 1254 SThirdTriplet = new G4Tubs("SolidTTQuad", 1253 SThirdTriplet = new G4Tubs("SolidTTQuad", InnerRadiusTriplet, ExternalRadiusQuad, (ThirdQuadThickness/2.)+1*mm, 1255 startAngleQuad 1254 startAngleQuad, spanningAngleQuad); 1256 << 1255 1257 LThirdTriplet = new G4LogicalVolume(SThir 1256 LThirdTriplet = new G4LogicalVolume(SThirdTriplet, internalChamberMaterial,"LogicTTQuad", 0, 0, 0); 1258 << 1257 1259 PThirdTriplet = new G4PVPlacement(G4Trans 1258 PThirdTriplet = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(ThirdQuadXPosition, QuadYPosition, QuadZPosition)), 1260 "PhysTh 1259 "PhysThirdTQuad",LThirdTriplet,PQuadChamber, false, 0); 1261 1260 1262 solidThirdQuad = new G4Tubs("SolidTQuad", 1261 solidThirdQuad = new G4Tubs("SolidTQuad", InnerRadiusQuad, ExternalRadiusQuad, ThirdQuadThickness/2., 1263 startAngleQua 1262 startAngleQuad, spanningAngleQuad); 1264 << 1263 1265 logicThirdQuad = new G4LogicalVolume(soli 1264 logicThirdQuad = new G4LogicalVolume(solidThirdQuad, QuadMaterial, "LogicTQuad", 0, 0, 0); 1266 << 1265 1267 physicThirdQuad = new G4PVPlacement(0, G4 1266 physicThirdQuad = new G4PVPlacement(0, G4ThreeVector(ThirdQXPosition, QYPosition, QZPosition), 1268 "Phys 1267 "PhysThirdQuad",logicThirdQuad, PThirdTriplet, false, 0); 1269 1268 1270 LThirdTriplet -> SetVisAttributes(yellow) 1269 LThirdTriplet -> SetVisAttributes(yellow); 1271 logicThirdQuad -> SetVisAttributes(green) 1270 logicThirdQuad -> SetVisAttributes(green); 1272 ///////////----------------------------Se << 1271 ///////////----------------------------Second Quadrupole----------------------------///////// 1273 SSecondTriplet = new G4Tubs("SolidTSQuad" 1272 SSecondTriplet = new G4Tubs("SolidTSQuad", InnerRadiusTriplet, ExternalRadiusQuad, (SecondQuadThickness/2.)+1*mm, 1274 startAngleQua 1273 startAngleQuad, spanningAngleQuad); 1275 << 1274 1276 LSecondTriplet = new G4LogicalVolume(SSec 1275 LSecondTriplet = new G4LogicalVolume(SSecondTriplet, internalChamberMaterial,"LogicTSQuad", 0, 0, 0); 1277 << 1276 1278 PSecondTriplet = new G4PVPlacement(G4Tran 1277 PSecondTriplet = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(SecondQuadXPosition, QuadYPosition, QuadZPosition)), 1279 "PhysS 1278 "PhysSecondTQuad", LSecondTriplet, PQuadChamber, false, 0); 1280 << 1279 1281 solidSecondQuad = new G4Tubs("SolidSQuad" 1280 solidSecondQuad = new G4Tubs("SolidSQuad", InnerRadiusQuad, ExternalRadiusQuad, SecondQuadThickness/2., 1282 startAngleQu 1281 startAngleQuad, spanningAngleQuad); 1283 << 1282 1284 logicSecondQuad = new G4LogicalVolume(sol 1283 logicSecondQuad = new G4LogicalVolume(solidSecondQuad, QuadMaterial, "LogicSQuad", 0, 0, 0); 1285 << 1284 1286 physicSecondQuad = new G4PVPlacement(0, G 1285 physicSecondQuad = new G4PVPlacement(0, G4ThreeVector(SecondQXPosition, QYPosition, QZPosition), 1287 "Phy 1286 "PhysSecondQuad", logicSecondQuad, PSecondTriplet, false, 0); 1288 1287 1289 LSecondTriplet -> SetVisAttributes(yellow 1288 LSecondTriplet -> SetVisAttributes(yellow); 1290 logicSecondQuad -> SetVisAttributes(green 1289 logicSecondQuad -> SetVisAttributes(green); 1291 ///////////----------------------------Fi << 1290 ///////////----------------------------First Quadrupole----------------------------///////// 1292 SFirstTriplet = new G4Tubs("SolidTQuad", 1291 SFirstTriplet = new G4Tubs("SolidTQuad", InnerRadiusTriplet, ExternalRadiusQuad, (FirstQuadThickness/2.)+1*mm, 1293 startAngleQuad 1292 startAngleQuad, spanningAngleQuad); 1294 << 1293 1295 LFirstTriplet = new G4LogicalVolume(SFirs 1294 LFirstTriplet = new G4LogicalVolume(SFirstTriplet, internalChamberMaterial,"LogicTQuad", 0, 0, 0); 1296 << 1295 1297 PFirstTriplet = new G4PVPlacement(G4Trans 1296 PFirstTriplet = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(FirstQuadXPosition, QuadYPosition, QuadZPosition)), 1298 "PhysFi 1297 "PhysFirstTQuad", LFirstTriplet, PQuadChamber, false, 0); 1299 1298 1300 solidFirstQuad = new G4Tubs("SolidQuad", 1299 solidFirstQuad = new G4Tubs("SolidQuad", InnerRadiusQuad, ExternalRadiusQuad, FirstQuadThickness/2., 1301 startAngleQua 1300 startAngleQuad, spanningAngleQuad); 1302 << 1301 1303 logicFirstQuad = new G4LogicalVolume(soli 1302 logicFirstQuad = new G4LogicalVolume(solidFirstQuad, QuadMaterial, "LogicQuad", 0, 0, 0); 1304 << 1303 1305 physicFirstQuad = new G4PVPlacement(0, G4 1304 physicFirstQuad = new G4PVPlacement(0, G4ThreeVector(FirstQXPosition, QYPosition, QZPosition), 1306 "Phys 1305 "PhysFirstQuad",logicFirstQuad, PFirstTriplet, false, 0); 1307 1306 1308 LFirstTriplet -> SetVisAttributes(yellow) 1307 LFirstTriplet -> SetVisAttributes(yellow); 1309 logicFirstQuad -> SetVisAttributes(green) 1308 logicFirstQuad -> SetVisAttributes(green); 1310 } 1309 } 1311 1310 1312 ///////////////////////////////////////////// 1311 ///////////////////////////////////////////////////////////////////////////// 1313 void LaserDrivenBeamLine::EnergySelectorChamb 1312 void LaserDrivenBeamLine::EnergySelectorChamber() 1314 { 1313 { 1315 // The whole energyselector is mounted in 1314 // The whole energyselector is mounted inside a 1316 // a vacuum chamber (called 'ExternalCha 1315 // a vacuum chamber (called 'ExternalChamber') 1317 // inside which a vacuum box is inserted. 1316 // inside which a vacuum box is inserted. 1318 << 1317 1319 solidExternalChamber = new G4Box("Externa 1318 solidExternalChamber = new G4Box("ExternalChamber", 1320 external 1319 externalChamberXSize/2.0, 1321 external 1320 externalChamberYSize/2.0, 1322 external 1321 externalChamberZSize/2.0); 1323 << 1322 1324 logicExternalChamber = new G4LogicalVolum 1323 logicExternalChamber = new G4LogicalVolume(solidExternalChamber, 1325 1324 externalChamberMaterial, 1326 1325 "ExternalChamber"); 1327 << 1326 1328 physicExternalChamber = new G4PVPlacement 1327 physicExternalChamber = new G4PVPlacement(0, 1329 1328 G4ThreeVector(externalChamberXPosition, 1330 1329 externalChamberYPosition, 1331 1330 externalChamberZPosition), 1332 1331 "ExternalChamber", 1333 1332 logicExternalChamber, 1334 1333 physicTreatmentRoom, 1335 1334 false, 1336 1335 0); 1337 << 1336 1338 // Visualisation of the External part 1337 // Visualisation of the External part 1339 logicExternalChamber -> SetVisAttributes( 1338 logicExternalChamber -> SetVisAttributes(red); 1340 1339 1341 // This is a vacuum box inside the steel 1340 // This is a vacuum box inside the steel box 1342 solidInternalChamber = new G4Box("SIntern 1341 solidInternalChamber = new G4Box("SInternalChamber", 1343 internal 1342 internalChamberXSize/2.0, 1344 internal 1343 internalChamberYSize/2.0, 1345 internal 1344 internalChamberZSize/2.0); 1346 << 1345 1347 logicInternalChamber = new G4LogicalVolum 1346 logicInternalChamber = new G4LogicalVolume(solidInternalChamber, 1348 1347 internalChamberMaterial, 1349 1348 "LInternalChamber"); 1350 << 1349 1351 physicInternalChamber = new G4PVPlacement 1350 physicInternalChamber = new G4PVPlacement(0, 1352 1351 G4ThreeVector(0,0,0), 1353 1352 "InternalChamber", 1354 1353 logicInternalChamber, 1355 1354 physicExternalChamber, 1356 1355 false, 1357 1356 0); 1358 logicInternalChamber -> SetVisAttributes( 1357 logicInternalChamber -> SetVisAttributes(white); 1359 } 1358 } 1360 1359 1361 ///////////////////////////////////////////// 1360 //////////////////////////////////////////////////// Entrance pipe /////////////////////// 1362 void LaserDrivenBeamLine::EntrancePipe() 1361 void LaserDrivenBeamLine::EntrancePipe() 1363 { 1362 { 1364 // To rotate the EntrancePipe putting its 1363 // To rotate the EntrancePipe putting its axis (along X direction) parallel to the beam axis 1365 G4double phi = 90. *deg; 1364 G4double phi = 90. *deg; 1366 G4RotationMatrix rm; 1365 G4RotationMatrix rm; 1367 rm.rotateY(phi); 1366 rm.rotateY(phi); 1368 << 1367 1369 solidEntrancePipe = new G4Tubs("EntranceP 1368 solidEntrancePipe = new G4Tubs("EntrancePipe", 1370 InnerRadiu 1369 InnerRadiusEntrancePipe, 1371 ExternalRa 1370 ExternalRadiusEntrancePipe, 1372 EntrancePi 1371 EntrancePipeheight/2., 1373 startAngle 1372 startAngleEntrancePipe, 1374 spanningAn 1373 spanningAngleEntrancePipe); 1375 << 1374 1376 logicEntrancePipe = new G4LogicalVolume(s 1375 logicEntrancePipe = new G4LogicalVolume(solidEntrancePipe, 1377 P 1376 PipeMaterial, 1378 " 1377 "EntrancePipe", 1379 0 1378 0, 1380 0 1379 0, 1381 0 1380 0); 1382 << 1381 1383 physicEntrancePipe = new G4PVPlacement(G4 1382 physicEntrancePipe = new G4PVPlacement(G4Transform3D(rm, 1384 1383 G4ThreeVector(EntrancePipeXPosition, 1385 1384 EntrancePipeYPosition, 1386 1385 EntrancePipeZPosition)), 1387 "E 1386 "EntrancePipe", 1388 lo 1387 logicEntrancePipe, 1389 ph 1388 physicTreatmentRoom, 1390 fa 1389 false, 1391 0) 1390 0); 1392 << 1391 1393 logicEntrancePipe -> SetVisAttributes(red 1392 logicEntrancePipe -> SetVisAttributes(red); 1394 1393 1395 } 1394 } 1396 1395 1397 ///////////////////////////////////////////// 1396 //////////////////////////////////////////////////// Entrance hole /////////////////////// 1398 void LaserDrivenBeamLine::Entrancehole() 1397 void LaserDrivenBeamLine::Entrancehole() 1399 { 1398 { 1400 // To rotate the ExitPipe putting its axi 1399 // To rotate the ExitPipe putting its axis (along X direction) parallel to the beam axis 1401 G4double phi = 90. *deg; 1400 G4double phi = 90. *deg; 1402 G4RotationMatrix rm; 1401 G4RotationMatrix rm; 1403 rm.rotateY(phi); 1402 rm.rotateY(phi); 1404 << 1403 1405 solidEntrancehole = new G4Tubs("Entranceh 1404 solidEntrancehole = new G4Tubs("Entrancehole", 1406 InnerRadiu 1405 InnerRadiusEntrancehole, 1407 ExternalRa 1406 ExternalRadiusEntrancehole, 1408 Entranceho 1407 EntranceholeThickness/2., 1409 startAngle 1408 startAngleEntrancehole, 1410 spanningAn 1409 spanningAngleEntrancehole); 1411 << 1410 1412 logicEntrancehole = new G4LogicalVolume(s 1411 logicEntrancehole = new G4LogicalVolume(solidEntrancehole, 1413 i 1412 internalChamberMaterial, 1414 " 1413 "Entrancehole", 1415 0 1414 0, 1416 0 1415 0, 1417 0 1416 0); 1418 //the hole in the energy selector chamber << 1417 //the hole in the energy selector chamber 1419 physicEntranceholeESSChamber = new G4PVPl 1418 physicEntranceholeESSChamber = new G4PVPlacement(G4Transform3D(rm, 1420 << 1419 G4ThreeVector(EntranceholeXPosition, 1421 << 1420 EntranceholeYPosition, 1422 << 1421 EntranceholeZPosition)), 1423 << 1422 "Entrancehole", 1424 << 1423 logicEntrancehole, 1425 << 1424 physicExternalChamber, 1426 << 1425 false, 1427 << 1426 0); 1428 //the hole in the quadrupoles chamber << 1427 //the hole in the quadrupoles chamber 1429 physicEntrancehole = new G4PVPlacement(G4 1428 physicEntrancehole = new G4PVPlacement(G4Transform3D(rm, 1430 1429 G4ThreeVector(EntranceholeQuadXPosition, 1431 1430 EntranceholeYPosition, 1432 1431 EntranceholeZPosition)), 1433 "E 1432 "EntranceholeQuad", 1434 lo 1433 logicEntrancehole, 1435 PQ 1434 PQuadChamberWall, 1436 fa 1435 false, 1437 0) 1436 0); 1438 << 1437 1439 logicEntrancehole -> SetVisAttributes(sky 1438 logicEntrancehole -> SetVisAttributes(skyBlue); 1440 1439 1441 1440 1442 } 1441 } 1443 ///////////////////////////////////////////// 1442 ///////////////////////////////////////////////////////////////////////////// 1444 void LaserDrivenBeamLine::Collimator() 1443 void LaserDrivenBeamLine::Collimator() 1445 { 1444 { 1446 // To rotate the collimator putting its a 1445 // To rotate the collimator putting its axis (along X direction) parallel to the beam axis 1447 G4double phi = 90. *deg; 1446 G4double phi = 90. *deg; 1448 G4RotationMatrix rm; 1447 G4RotationMatrix rm; 1449 rm.rotateY(phi); 1448 rm.rotateY(phi); 1450 //8x82x210 mm are the collimator default 1449 //8x82x210 mm are the collimator default dimensions 1451 solidCollimator = new G4Box("collimator", 1450 solidCollimator = new G4Box("collimator", 1452 thicknessColl << 1451 thicknessCollimator/2.0, 1453 collimatorBox 1452 collimatorBoxYSize/2.0, 1454 collimatorBox 1453 collimatorBoxZSize/2.0); 1455 1454 1456 logicCollimator = new G4LogicalVolume(sol 1455 logicCollimator = new G4LogicalVolume(solidCollimator, 1457 col 1456 collimatorMaterial, 1458 "co 1457 "collimator"); 1459 << 1458 1460 physicCollimator = new G4PVPlacement(0, 1459 physicCollimator = new G4PVPlacement(0, 1461 G4Th 1460 G4ThreeVector(collimatorBox_XPosition, 1462 1461 collimatorBox_YPosition, 1463 1462 collimatorBox_ZPosition), 1464 "col 1463 "collimator", 1465 logi 1464 logicCollimator, 1466 phys 1465 physicInternalChamber, 1467 fals 1466 false, 1468 0); 1467 0); 1469 1468 1470 logicCollimator -> SetVisAttributes(darkO 1469 logicCollimator -> SetVisAttributes(darkOrange3); 1471 1470 1472 solidCollimatorHole = new G4Tubs("Collima 1471 solidCollimatorHole = new G4Tubs("CollimatorHole", 1473 innerRad 1472 innerRadiusCollimator, 1474 outerRad 1473 outerRadiusCollimator, 1475 thicknes 1474 thicknessCollimator/2., 1476 startAng 1475 startAngleCollimator, 1477 spanning 1476 spanningAngleCollimator); 1478 << 1477 1479 logicCollimatorHole = new G4LogicalVolume 1478 logicCollimatorHole = new G4LogicalVolume(solidCollimatorHole, 1480 1479 collimatorHoleMaterial, 1481 1480 "CollimatorHole", 1482 1481 0, 1483 1482 0, 1484 1483 0); 1485 << 1484 1486 physicCollimatorHole = new G4PVPlacement( 1485 physicCollimatorHole = new G4PVPlacement(G4Transform3D(rm, 1487 1486 G4ThreeVector(collimatorXPosition, 1488 1487 collimatorYPosition, 1489 1488 collimatorZPosition)), 1490 1489 "CollimatorHole", 1491 1490 logicCollimatorHole, 1492 1491 physicCollimator, 1493 1492 false, 1494 1493 0); 1495 << 1494 1496 logicCollimatorHole -> SetVisAttributes(s 1495 logicCollimatorHole -> SetVisAttributes(skyBlue); 1497 } 1496 } 1498 1497 1499 ///////////////////////////////////////////// 1498 ///////////////////////////////////////////////////////////////////////////// 1500 // Magnet number 1 1499 // Magnet number 1 1501 void LaserDrivenBeamLine::Magnet_1() 1500 void LaserDrivenBeamLine::Magnet_1() 1502 { // The positions of the external and inter 1501 { // The positions of the external and internal partes are given as respect the external chamber. 1503 solidExternalMagnet_1 = new G4Box("SolidE 1502 solidExternalMagnet_1 = new G4Box("SolidExternalMagnet_1", 1504 externa 1503 externalMagnet_1XSize/2.0, 1505 externa 1504 externalMagnet_1YSize/2.0, 1506 externa 1505 externalMagnet_1ZSize/2.0); 1507 << 1506 1508 logicExternalMagnet_1 = new G4LogicalVolu 1507 logicExternalMagnet_1 = new G4LogicalVolume(solidExternalMagnet_1, 1509 1508 externalMagnet_1Material, 1510 1509 "LogicExternalMagnet_1"); 1511 << 1510 1512 physicExternalMagnet_1 = new G4PVPlacemen 1511 physicExternalMagnet_1 = new G4PVPlacement(0, 1513 1512 G4ThreeVector(externalMagnet_1XPosition, 1514 1513 externalMagnet_2YPosition, 1515 1514 externalMagnet_2ZPosition), 1516 1515 "PhysicExternalMagnet_1", 1517 1516 logicExternalMagnet_1, 1518 1517 physicInternalChamber, 1519 1518 false, 1520 1519 0); 1521 physicExternalMagnet_1Down = new G4PVPlac 1520 physicExternalMagnet_1Down = new G4PVPlacement(0, 1522 1521 G4ThreeVector(externalMagnet_1XPosition, 1523 1522 -externalMagnet_2YPosition, 1524 1523 externalMagnet_2ZPosition), 1525 1524 "PhysicExternalMagnet_1Down", 1526 1525 logicExternalMagnet_1, 1527 1526 physicInternalChamber, 1528 1527 false, 1529 1528 0); 1530 1529 1531 1530 1532 logicExternalMagnet_1 -> SetVisAttributes 1531 logicExternalMagnet_1 -> SetVisAttributes(gray); 1533 1532 1534 // The right and left part of the magnet 1533 // The right and left part of the magnet 1535 solidMagnet_1 = new G4Box("SolidMagnet_1" 1534 solidMagnet_1 = new G4Box("SolidMagnet_1", 1536 Magnet_1XSize/2 1535 Magnet_1XSize/2.0, 1537 Magnet_1YSize/2 1536 Magnet_1YSize/2.0, 1538 Magnet_1ZSize/2 1537 Magnet_1ZSize/2.0); 1539 << 1538 1540 logicMagnet_1 = new G4LogicalVolume(solid 1539 logicMagnet_1 = new G4LogicalVolume(solidMagnet_1, 1541 exter 1540 externalMagnet_1Material, 1542 "Logi 1541 "LogicMagnet_1"); 1543 << 1542 1544 physicMagnet_1Right = new G4PVPlacement(0 1543 physicMagnet_1Right = new G4PVPlacement(0, 1545 G 1544 G4ThreeVector(Magnet_1XPosition,Magnet_1YPosition, 1546 1545 Magnet_1ZPosition), 1547 " 1546 "PhysicMagnet_1Right", 1548 l 1547 logicMagnet_1, 1549 p 1548 physicInternalChamber, 1550 f 1549 false, 1551 0 1550 0); 1552 physicMagnet_1Left = new G4PVPlacement(0, 1551 physicMagnet_1Left = new G4PVPlacement(0, 1553 G4 1552 G4ThreeVector(Magnet_1XPosition,Magnet_1YPosition, 1554 1553 -Magnet_1ZPosition), 1555 "P 1554 "PhysicMagnet_1Left", 1556 lo 1555 logicMagnet_1, 1557 ph 1556 physicInternalChamber, 1558 fa 1557 false, 1559 0) 1558 0); 1560 1559 1561 logicMagnet_1 -> SetVisAttributes(gray); 1560 logicMagnet_1 -> SetVisAttributes(gray); 1562 } 1561 } 1563 1562 1564 ///////////////////////////////////////////// 1563 ///////////////////////////////////////////////////////////////////////////// 1565 // Magnet number 2 1564 // Magnet number 2 1566 void LaserDrivenBeamLine::Magnet_2() 1565 void LaserDrivenBeamLine::Magnet_2() 1567 { // The position of the external part are gi 1566 { // The position of the external part are given as respect the external chamber. 1568 << 1567 1569 solidExternalMagnet_2 = new G4Box("SolidE 1568 solidExternalMagnet_2 = new G4Box("SolidExternalMagnet_2", 1570 externa 1569 externalMagnet_2XSize/2.0, 1571 externa 1570 externalMagnet_2YSize/2.0, 1572 externa 1571 externalMagnet_2ZSize/2.0); 1573 << 1572 1574 logicExternalMagnet_2 = new G4LogicalVolu 1573 logicExternalMagnet_2 = new G4LogicalVolume(solidExternalMagnet_2, 1575 1574 externalMagnet_2Material, 1576 1575 "LogicExternalMagnet_2"); 1577 << 1576 1578 physicExternalMagnet_2 = new G4PVPlacemen 1577 physicExternalMagnet_2 = new G4PVPlacement(0, 1579 1578 G4ThreeVector(externalMagnet_2XPosition, 1580 1579 externalMagnet_2YPosition, 1581 1580 (externalMagnet_2ZPosition+32*mm)), 1582 1581 "PhysicExternalMagnet_2", 1583 1582 logicExternalMagnet_2, 1584 1583 physicInternalChamber, 1585 1584 false, 1586 1585 0); 1587 1586 1588 physicExternalMagnet_2Down = new G4PVPlac 1587 physicExternalMagnet_2Down = new G4PVPlacement(0, 1589 1588 G4ThreeVector(externalMagnet_2XPosition, 1590 1589 -externalMagnet_2YPosition, 1591 1590 (externalMagnet_2ZPosition+32*mm)), 1592 1591 "PhysicExternalMagnet_2Down", 1593 1592 logicExternalMagnet_2, 1594 1593 physicInternalChamber, 1595 1594 false, 1596 1595 0); 1597 1596 1598 1597 1599 logicExternalMagnet_2 -> SetVisAttributes 1598 logicExternalMagnet_2 -> SetVisAttributes(gray); 1600 << 1599 1601 // The right and left part of the magnet 1600 // The right and left part of the magnet 1602 solidMagnet_2 = new G4Box("SolidMagnet_2" 1601 solidMagnet_2 = new G4Box("SolidMagnet_2", 1603 Magnet_2XSize/2 1602 Magnet_2XSize/2.0, 1604 Magnet_2YSize/2 1603 Magnet_2YSize/2.0, 1605 Magnet_2ZSize/2 1604 Magnet_2ZSize/2.0); 1606 << 1605 1607 logicMagnet_2 = new G4LogicalVolume(solid 1606 logicMagnet_2 = new G4LogicalVolume(solidMagnet_2, 1608 exter 1607 externalMagnet_2Material, 1609 "Logi 1608 "LogicMagnet_2"); 1610 << 1609 1611 physicMagnet_2Right = new G4PVPlacement(0 1610 physicMagnet_2Right = new G4PVPlacement(0, 1612 G 1611 G4ThreeVector(Magnet_2XPosition,Magnet_2YPosition, 1613 1612 (Magnet_2ZPosition)+32*mm), 1614 " 1613 "PhysicMagnet_2Right", 1615 l 1614 logicMagnet_2, 1616 p 1615 physicInternalChamber, 1617 f 1616 false, 1618 0 1617 0); 1619 physicMagnet_2Left = new G4PVPlacement(0, 1618 physicMagnet_2Left = new G4PVPlacement(0, 1620 G4 1619 G4ThreeVector(Magnet_2XPosition,Magnet_2YPosition, 1621 << 1620 (-(Magnet_2ZPosition)+32*mm)), 1622 "P 1621 "PhysicMagnet_2Left", 1623 lo 1622 logicMagnet_2, 1624 ph 1623 physicInternalChamber, 1625 fa 1624 false, 1626 0) 1625 0); 1627 logicMagnet_2 -> SetVisAttributes(gray); 1626 logicMagnet_2 -> SetVisAttributes(gray); 1628 } 1627 } 1629 1628 1630 ///////////////////////////////////////////// 1629 ///////////////////////////////////////////////////////////////////////////// 1631 // Magnet number 3 1630 // Magnet number 3 1632 void LaserDrivenBeamLine::Magnet_3() 1631 void LaserDrivenBeamLine::Magnet_3() 1633 { // The position of the external part are gi 1632 { // The position of the external part are given as respect the external chamber. 1634 << 1633 1635 solidExternalMagnet_3 = new G4Box("SolidE 1634 solidExternalMagnet_3 = new G4Box("SolidExternalMagnet_3", 1636 externa 1635 externalMagnet_3XSize/2.0, 1637 externa 1636 externalMagnet_3YSize/2.0, 1638 externa 1637 externalMagnet_3ZSize/2.0); 1639 << 1638 1640 logicExternalMagnet_3 = new G4LogicalVolu 1639 logicExternalMagnet_3 = new G4LogicalVolume(solidExternalMagnet_3, 1641 1640 externalMagnet_3Material, 1642 1641 "LogicExternalMagnet_3"); 1643 << 1642 1644 physicExternalMagnet_3 = new G4PVPlacemen 1643 physicExternalMagnet_3 = new G4PVPlacement(0, 1645 1644 G4ThreeVector((externalMagnet_3XPosition), 1646 1645 externalMagnet_3YPosition, 1647 1646 (externalMagnet_3ZPosition+32*mm)), 1648 1647 "PhysicExternalMagnet_3", 1649 1648 logicExternalMagnet_3, 1650 1649 physicInternalChamber, 1651 1650 false, 1652 1651 0); 1653 1652 1654 physicExternalMagnet_3Down = new G4PVPlac 1653 physicExternalMagnet_3Down = new G4PVPlacement(0, 1655 1654 G4ThreeVector((externalMagnet_3XPosition), 1656 1655 -externalMagnet_3YPosition, 1657 << 1656 (externalMagnet_3ZPosition+32*mm)), 1658 1657 "PhysicExternalMagnet_3Down", 1659 1658 logicExternalMagnet_3, 1660 1659 physicInternalChamber, 1661 1660 false, 1662 1661 0); 1663 1662 1664 logicExternalMagnet_3 -> SetVisAttributes 1663 logicExternalMagnet_3 -> SetVisAttributes(gray); 1665 1664 1666 // The right and left part of the magnet 1665 // The right and left part of the magnet 1667 solidMagnet_3 = new G4Box("SolidMagnet_3" 1666 solidMagnet_3 = new G4Box("SolidMagnet_3", 1668 Magnet_3XSize/2 1667 Magnet_3XSize/2.0, 1669 Magnet_3YSize/2 1668 Magnet_3YSize/2.0, 1670 Magnet_3ZSize/2 1669 Magnet_3ZSize/2.0); 1671 << 1670 1672 logicMagnet_3 = new G4LogicalVolume(solid 1671 logicMagnet_3 = new G4LogicalVolume(solidMagnet_3, 1673 exter 1672 externalMagnet_3Material, 1674 "Logi 1673 "LogicMagnet_3"); 1675 << 1674 1676 physicMagnet_3Right = new G4PVPlacement(0 1675 physicMagnet_3Right = new G4PVPlacement(0, 1677 G 1676 G4ThreeVector(Magnet_3XPosition,Magnet_3YPosition, 1678 1677 (Magnet_3ZPosition+32*mm)), 1679 " 1678 "PhysicMagnet_3Right", 1680 l 1679 logicMagnet_3, 1681 p 1680 physicInternalChamber, 1682 f 1681 false, 1683 0 1682 0); 1684 physicMagnet_3Left = new G4PVPlacement(0, 1683 physicMagnet_3Left = new G4PVPlacement(0, 1685 G4 1684 G4ThreeVector(Magnet_3XPosition,Magnet_3YPosition, 1686 1685 (-(Magnet_3ZPosition)+32*mm)), 1687 "P 1686 "PhysicMagnet_3Left", 1688 lo 1687 logicMagnet_3, 1689 ph 1688 physicInternalChamber, 1690 fa 1689 false, 1691 0) 1690 0); 1692 logicMagnet_3 -> SetVisAttributes(gray); 1691 logicMagnet_3 -> SetVisAttributes(gray); 1693 1692 1694 } 1693 } 1695 1694 1696 ///////////////////////////////////////////// 1695 ///////////////////////////////////////////////////////////////////////////// 1697 // Magnet number 4 1696 // Magnet number 4 1698 void LaserDrivenBeamLine::Magnet_4() 1697 void LaserDrivenBeamLine::Magnet_4() 1699 { // The position of the external part are gi 1698 { // The position of the external part are given as respect the external chamber. 1700 << 1699 1701 solidExternalMagnet_4 = new G4Box("SolidE 1700 solidExternalMagnet_4 = new G4Box("SolidExternalMagnet_4", 1702 externa 1701 externalMagnet_4XSize/2.0, 1703 externa 1702 externalMagnet_4YSize/2.0, 1704 externa 1703 externalMagnet_4ZSize/2.0); 1705 << 1704 1706 logicExternalMagnet_4 = new G4LogicalVolu 1705 logicExternalMagnet_4 = new G4LogicalVolume(solidExternalMagnet_4, 1707 1706 externalMagnet_4Material, 1708 1707 "LogicExternalMagnet_4"); 1709 << 1708 1710 physicExternalMagnet_4 = new G4PVPlacemen 1709 physicExternalMagnet_4 = new G4PVPlacement(0, 1711 1710 G4ThreeVector(externalMagnet_4XPosition, 1712 1711 externalMagnet_4YPosition, 1713 1712 externalMagnet_4ZPosition), 1714 1713 "PhysicExternalMagnet_4", 1715 1714 logicExternalMagnet_4, 1716 1715 physicInternalChamber, 1717 1716 false, 1718 1717 0); 1719 1718 1720 physicExternalMagnet_4Down = new G4PVPlac 1719 physicExternalMagnet_4Down = new G4PVPlacement(0, 1721 1720 G4ThreeVector(externalMagnet_4XPosition, 1722 1721 -externalMagnet_4YPosition, 1723 1722 externalMagnet_4ZPosition), 1724 1723 "PhysicExternalMagnet_4Down", 1725 1724 logicExternalMagnet_4, 1726 1725 physicInternalChamber, 1727 1726 false, 1728 1727 0); 1729 1728 1730 logicExternalMagnet_4 -> SetVisAttributes 1729 logicExternalMagnet_4 -> SetVisAttributes(gray); 1731 << 1730 1732 // The right and left part of the magnet 1731 // The right and left part of the magnet 1733 solidMagnet_4 = new G4Box("SolidMagnet_4" 1732 solidMagnet_4 = new G4Box("SolidMagnet_4", 1734 Magnet_4XSize/2 1733 Magnet_4XSize/2.0, 1735 Magnet_4YSize/2 1734 Magnet_4YSize/2.0, 1736 Magnet_4ZSize/2 1735 Magnet_4ZSize/2.0); 1737 << 1736 1738 logicMagnet_4 = new G4LogicalVolume(solid 1737 logicMagnet_4 = new G4LogicalVolume(solidMagnet_4, 1739 exter 1738 externalMagnet_4Material, 1740 "Logi 1739 "LogicMagnet_4"); 1741 << 1740 1742 physicMagnet_4Right = new G4PVPlacement(0 1741 physicMagnet_4Right = new G4PVPlacement(0, 1743 G 1742 G4ThreeVector(Magnet_4XPosition,Magnet_4YPosition, 1744 1743 Magnet_4ZPosition), 1745 " 1744 "PhysicMagnet_4Right", 1746 l 1745 logicMagnet_4, 1747 p 1746 physicInternalChamber, 1748 f 1747 false, 1749 0 1748 0); 1750 physicMagnet_4Left = new G4PVPlacement(0, 1749 physicMagnet_4Left = new G4PVPlacement(0, 1751 G4 1750 G4ThreeVector(Magnet_4XPosition,Magnet_4YPosition, 1752 1751 -Magnet_4ZPosition), 1753 "P 1752 "PhysicMagnet_4Left", 1754 lo 1753 logicMagnet_4, 1755 ph 1754 physicInternalChamber, 1756 fa 1755 false, 1757 0) 1756 0); 1758 logicMagnet_4 -> SetVisAttributes(gray); 1757 logicMagnet_4 -> SetVisAttributes(gray); 1759 } 1758 } 1760 1759 1761 ///////////////////////////////////////////// 1760 ///////////////////////////////////////////////////////////////////////////// 1762 // Slit 1761 // Slit 1763 void LaserDrivenBeamLine::Slit() 1762 void LaserDrivenBeamLine::Slit() 1764 { 1763 { 1765 solidExternalSlit = new G4Box("ExternalSl 1764 solidExternalSlit = new G4Box("ExternalSlit", 1766 externalSli 1765 externalSlitXSize/2.0, 1767 externalSli 1766 externalSlitYSize/2.0, 1768 externalSli 1767 externalSlitZSize/2.0); 1769 << 1768 1770 logicExternalSlit = new G4LogicalVolume(s 1769 logicExternalSlit = new G4LogicalVolume(solidExternalSlit, 1771 e 1770 externalSlitMaterial, 1772 " 1771 "ExternalSlit"); 1773 << 1772 1774 physicExternalSlit = new G4PVPlacement(0, 1773 physicExternalSlit = new G4PVPlacement(0, 1775 G4 1774 G4ThreeVector(externalSlitXPosition, 1776 1775 externalSlitYPosition, 1777 1776 externalSlitZPosition), 1778 "E 1777 "ExternalSlit", 1779 lo 1778 logicExternalSlit, 1780 ph 1779 physicInternalChamber, 1781 fa 1780 false, 1782 0) 1781 0); 1783 1782 1784 logicExternalSlit -> SetVisAttributes(gre 1783 logicExternalSlit -> SetVisAttributes(green); 1785 // The hole 1784 // The hole 1786 solidInternalSlit = new G4Box("InternalSl 1785 solidInternalSlit = new G4Box("InternalSlit", 1787 internalSli 1786 internalSlitXSize/2.0, 1788 internalSli 1787 internalSlitYSize/2.0, 1789 internalSli 1788 internalSlitZSize/2.0); 1790 << 1789 1791 logicInternalSlit = new G4LogicalVolume(s 1790 logicInternalSlit = new G4LogicalVolume(solidInternalSlit, 1792 i 1791 internalSlitMaterial, 1793 " 1792 "InternalSlit"); 1794 << 1793 1795 physicInternalSlit = new G4PVPlacement(0, 1794 physicInternalSlit = new G4PVPlacement(0, 1796 G4 1795 G4ThreeVector(internalSlitXPosition, 1797 1796 internalSlitYPosition, 1798 1797 internalSlitZPosition), 1799 "I 1798 "InternalSlit", 1800 lo 1799 logicInternalSlit, 1801 ph 1800 physicExternalSlit, 1802 fa 1801 false, 1803 0) 1802 0); 1804 1803 1805 logicInternalSlit -> SetVisAttributes(sky 1804 logicInternalSlit -> SetVisAttributes(skyBlue); 1806 1805 1807 } 1806 } 1808 ////////////////////////////////////// Final 1807 ////////////////////////////////////// Final collimator //////////////////////////////////////////// 1809 void LaserDrivenBeamLine::FinalCollimator() 1808 void LaserDrivenBeamLine::FinalCollimator() 1810 { 1809 { 1811 // To rotate the collimator putting its a 1810 // To rotate the collimator putting its axis (along X direction) parallel to the beam axis 1812 G4double phi = 90. *deg; 1811 G4double phi = 90. *deg; 1813 G4RotationMatrix rm; 1812 G4RotationMatrix rm; 1814 rm.rotateY(phi); 1813 rm.rotateY(phi); 1815 << 1814 1816 solidFinalCollimator = new G4Box("collima 1815 solidFinalCollimator = new G4Box("collimatorFinal", 1817 collimat 1816 collimatorFinalBoxXSize/2.0, 1818 collimat 1817 collimatorFinalBoxYSize/2.0, 1819 collimat 1818 collimatorFinalBoxZSize/2.0); 1820 << 1819 1821 logicFinalCollimator = new G4LogicalVolum 1820 logicFinalCollimator = new G4LogicalVolume(solidFinalCollimator, 1822 1821 FinalcollimatorMaterial, 1823 1822 "collimatorFinal"); 1824 << 1823 1825 physicFinalCollimator = new G4PVPlacement 1824 physicFinalCollimator = new G4PVPlacement(0, 1826 1825 G4ThreeVector(collimatorFinalBox_XPosition, 1827 1826 collimatorFinalBox_YPosition, 1828 1827 collimatorFinalBox_ZPosition), 1829 1828 "collimatorFinal", 1830 1829 logicFinalCollimator, 1831 1830 physicInternalChamber, 1832 1831 false, 1833 1832 0); 1834 logicFinalCollimator -> SetVisAttributes( 1833 logicFinalCollimator -> SetVisAttributes(darkOrange3); 1835 1834 1836 solidFinalCollimatorHole= new G4Tubs("Fin 1835 solidFinalCollimatorHole= new G4Tubs("FinalCollimatorHole", 1837 inne 1836 innerRadiusFinalCollimator, 1838 oute 1837 outerRadiusFinalCollimator, 1839 Fina 1838 FinalCollimatorThickness/2., 1840 star 1839 startAngleFinalCollimator, 1841 span 1840 spanningAngleFinalCollimator); 1842 << 1841 1843 logicFinalCollimatorHole = new G4LogicalV 1842 logicFinalCollimatorHole = new G4LogicalVolume(solidFinalCollimatorHole, 1844 1843 FinalcollimatorHoleMaterial, 1845 1844 "FinalCollimatorHole", 1846 1845 0, 1847 1846 0, 1848 1847 0); 1849 << 1848 1850 physicFinalCollimatorHole = new G4PVPlace 1849 physicFinalCollimatorHole = new G4PVPlacement(G4Transform3D(rm, 1851 1850 G4ThreeVector(FinalcollimatorXPosition, 1852 1851 FinalcollimatorYPosition, 1853 1852 FinalcollimatorZPosition)), 1854 1853 "FinalCollimatorHole", 1855 1854 logicFinalCollimatorHole, 1856 1855 physicFinalCollimator, 1857 1856 false, 1858 1857 0); 1859 logicFinalCollimatorHole -> SetVisAttribu 1858 logicFinalCollimatorHole -> SetVisAttributes(skyBlue); 1860 } 1859 } 1861 //////////////////////////// Exit Window //// 1860 //////////////////////////// Exit Window //////////////////////////////////////////// 1862 void LaserDrivenBeamLine::ExitWindow() 1861 void LaserDrivenBeamLine::ExitWindow() 1863 { 1862 { 1864 // To rotate the ExitWindow putting its a 1863 // To rotate the ExitWindow putting its axis (along X direction) parallel to the beam axis 1865 G4double phi = 90. *deg; 1864 G4double phi = 90. *deg; 1866 G4RotationMatrix rm; 1865 G4RotationMatrix rm; 1867 rm.rotateY(phi); 1866 rm.rotateY(phi); 1868 << 1867 1869 solidExitWindow = new G4Tubs("ExitWindow" 1868 solidExitWindow = new G4Tubs("ExitWindow", 1870 InnerRadiusE 1869 InnerRadiusExitWindow, 1871 ExternalRadi 1870 ExternalRadiusExitWindow, 1872 ExitWindowTh 1871 ExitWindowThickness/2., 1873 startAngleEx 1872 startAngleExitWindow, 1874 spanningAngl 1873 spanningAngleExitWindow); 1875 << 1874 1876 logicExitWindow = new G4LogicalVolume(sol 1875 logicExitWindow = new G4LogicalVolume(solidExitWindow, 1877 Win 1876 WindowMaterial, 1878 "Ex 1877 "ExitWindow", 1879 0, 1878 0, 1880 0, 1879 0, 1881 0); 1880 0); 1882 << 1881 1883 physicExitWindow = new G4PVPlacement(G4Tr 1882 physicExitWindow = new G4PVPlacement(G4Transform3D(rm, 1884 1883 G4ThreeVector(ExitWindowXPosition, 1885 1884 ExitWindowYPosition, 1886 1885 ExitWindowZPosition)), 1887 "Exi 1886 "ExitWindow", 1888 logi 1887 logicExitWindow, 1889 phys 1888 physicTreatmentRoom, 1890 fals 1889 false, 1891 0); 1890 0); 1892 << 1891 1893 logicExitWindow -> SetVisAttributes(skyBl 1892 logicExitWindow -> SetVisAttributes(skyBlue); 1894 1893 1895 } 1894 } 1896 1895 1897 ///////////////////////////////////////////// 1896 //////////////////////////////////////////////////// Exit pipe /////////////////////// 1898 void LaserDrivenBeamLine::ExitPipe() 1897 void LaserDrivenBeamLine::ExitPipe() 1899 { 1898 { 1900 // To rotate the ExitPipe putting its axi 1899 // To rotate the ExitPipe putting its axis (along X direction) parallel to the beam axis 1901 G4double phi = 90. *deg; 1900 G4double phi = 90. *deg; 1902 G4RotationMatrix rm; 1901 G4RotationMatrix rm; 1903 rm.rotateY(phi); 1902 rm.rotateY(phi); 1904 << 1903 1905 solidExitPipe = new G4Tubs("ExitPipe", 1904 solidExitPipe = new G4Tubs("ExitPipe", 1906 InnerRadiusExi 1905 InnerRadiusExitPipe, 1907 ExternalRadius 1906 ExternalRadiusExitPipe, 1908 ExitPipeheight 1907 ExitPipeheight/2., 1909 startAngleExit 1908 startAngleExitPipe, 1910 spanningAngleE 1909 spanningAngleExitPipe); 1911 << 1910 1912 logicExitPipe = new G4LogicalVolume(solid 1911 logicExitPipe = new G4LogicalVolume(solidExitPipe, 1913 PipeM 1912 PipeMaterial, 1914 "Exit 1913 "ExitPipe", 1915 0, 1914 0, 1916 0, 1915 0, 1917 0); 1916 0); 1918 << 1917 1919 physicExitPipe = new G4PVPlacement(G4Tran 1918 physicExitPipe = new G4PVPlacement(G4Transform3D(rm, 1920 1919 G4ThreeVector(ExitPipeXPosition, 1921 1920 ExitPipeYPosition, 1922 1921 ExitPipeZPosition)), 1923 "ExitP 1922 "ExitPipe", 1924 logicE 1923 logicExitPipe, 1925 physic 1924 physicTreatmentRoom, 1926 false, 1925 false, 1927 0); 1926 0); 1928 << 1927 1929 logicExitPipe -> SetVisAttributes(red); 1928 logicExitPipe -> SetVisAttributes(red); 1930 1929 1931 } 1930 } 1932 1931 1933 ///////////////////////////////////// Exit ho 1932 ///////////////////////////////////// Exit hole /////////////////////// 1934 void LaserDrivenBeamLine::Exithole() 1933 void LaserDrivenBeamLine::Exithole() 1935 { 1934 { 1936 // To rotate the ExitPipe putting its axi 1935 // To rotate the ExitPipe putting its axis (along X direction) parallel to the beam axis 1937 G4double phi = 90. *deg; 1936 G4double phi = 90. *deg; 1938 G4RotationMatrix rm; 1937 G4RotationMatrix rm; 1939 rm.rotateY(phi); 1938 rm.rotateY(phi); 1940 << 1939 1941 solidExithole = new G4Tubs("Exithole", 1940 solidExithole = new G4Tubs("Exithole", 1942 InnerRadiusExi 1941 InnerRadiusExithole, 1943 ExternalRadius 1942 ExternalRadiusExithole, 1944 ExitholeThickn 1943 ExitholeThickness/2., 1945 startAngleExit 1944 startAngleExithole, 1946 spanningAngleE 1945 spanningAngleExithole); 1947 << 1946 1948 logicExithole = new G4LogicalVolume(solid 1947 logicExithole = new G4LogicalVolume(solidExithole, 1949 inter 1948 internalChamberMaterial, 1950 "Exit 1949 "Exithole", 1951 0, 1950 0, 1952 0, 1951 0, 1953 0); 1952 0); 1954 << 1953 1955 physicExithole = new G4PVPlacement(G4Tran 1954 physicExithole = new G4PVPlacement(G4Transform3D(rm, 1956 1955 G4ThreeVector(ExitholeXPosition, 1957 1956 ExitholeYPosition, 1958 1957 ExitholeZPosition)), 1959 "Exith 1958 "Exithole", 1960 logicE 1959 logicExithole, 1961 physic 1960 physicExternalChamber, 1962 false, 1961 false, 1963 0); 1962 0); 1964 << 1963 1965 logicExithole -> SetVisAttributes(skyBlue 1964 logicExithole -> SetVisAttributes(skyBlue); 1966 1965 1967 } 1966 } 1968 /////////////////////////// MESSENGER /////// 1967 /////////////////////////// MESSENGER /////////////////////////////////////// 1969 ///////////////////////////////////////////// 1968 ///////////////////////////////////////////////////////////////////////////// 1970 // Disable via external macro command the Ene 1969 // Disable via external macro command the Energy Selector System 1971 void LaserDrivenBeamLine::RemoveESS() 1970 void LaserDrivenBeamLine::RemoveESS() 1972 { 1971 { 1973 if(physicMagnet_1Left) {delete physicMagn 1972 if(physicMagnet_1Left) {delete physicMagnet_1Left; delete physicMagnet_1Right; delete logicMagnet_1; delete solidMagnet_1;} 1974 if(physicExternalMagnet_1Down){delete phy << 1973 if(physicExternalMagnet_1Down){delete physicExternalMagnet_1Down; delete physicExternalMagnet_1; delete logicExternalMagnet_1; delete solidExternalMagnet_1;} 1975 if(physicMagnet_2Left){delete physicMagne << 1974 if(physicMagnet_2Left){delete physicMagnet_2Left; delete physicMagnet_2Right; delete logicMagnet_2; delete solidMagnet_2;} 1976 if(physicExternalMagnet_2Down){ delete ph << 1975 if(physicExternalMagnet_2Down){ delete physicExternalMagnet_2Down; delete physicExternalMagnet_2; delete logicExternalMagnet_2; delete solidExternalMagnet_2; } 1977 if(physicMagnet_3Left){delete physicMagne << 1976 if(physicMagnet_3Left){delete physicMagnet_3Left; delete physicMagnet_3Right; delete logicMagnet_3; delete solidMagnet_3; } 1978 if(physicExternalMagnet_3Down){delete phy << 1977 if(physicExternalMagnet_3Down){delete physicExternalMagnet_3Down; delete physicExternalMagnet_3; delete logicExternalMagnet_3; delete solidExternalMagnet_3; } 1979 if(physicMagnet_4Left) {delete physicMagn << 1978 if(physicMagnet_4Left) {delete physicMagnet_4Left; delete physicMagnet_4Right; delete logicMagnet_4; delete solidMagnet_4; } 1980 if(physicExternalMagnet_4Down){delete phy << 1979 if(physicExternalMagnet_4Down){delete physicExternalMagnet_4Down; delete physicExternalMagnet_4; delete logicExternalMagnet_4; delete solidExternalMagnet_4; } 1981 if(physicCollimatorHole){delete physicCol << 1980 if(physicCollimatorHole){delete physicCollimatorHole; delete logicCollimatorHole; delete solidCollimatorHole; } 1982 if(physicCollimator) {delete physicCollim << 1981 if(physicCollimator) {delete physicCollimator; delete logicCollimator; delete solidCollimator; } 1983 if(physicFinalCollimatorHole) {delete phy << 1982 if(physicFinalCollimatorHole) {delete physicFinalCollimatorHole; delete logicFinalCollimatorHole; delete solidFinalCollimatorHole; } 1984 if(physicFinalCollimator){delete physicFi << 1983 if(physicFinalCollimator){delete physicFinalCollimator; delete logicFinalCollimator; delete solidFinalCollimator; } 1985 if(physicInternalSlit){ delete physicInte << 1984 if(physicInternalSlit){ delete physicInternalSlit; delete logicInternalSlit; delete solidInternalSlit; } 1986 if(physicExternalSlit){delete physicExter << 1985 if(physicExternalSlit){delete physicExternalSlit; delete logicExternalSlit; delete solidExternalSlit; } 1987 if(physicExithole){delete physicExithole; << 1986 if(physicExithole){delete physicExithole; delete logicExithole; delete solidExithole;} 1988 if(physicExitWindow){delete physicExitWin << 1987 if(physicExitWindow){delete physicExitWindow; delete logicExitWindow; delete solidExitWindow;} 1989 if(physicExitPipe){delete physicExitPipe; << 1988 if(physicExitPipe){delete physicExitPipe; delete logicExitPipe; delete solidExitPipe;} 1990 if(physicEntranceholeESSChamber){delete p << 1989 if(physicEntranceholeESSChamber){delete physicEntranceholeESSChamber;} 1991 if(physicInternalChamber){delete physicIn << 1990 if(physicInternalChamber){delete physicInternalChamber; delete logicInternalChamber; delete solidInternalChamber;} 1992 if(physicExternalChamber) {delete physicE << 1991 if(physicExternalChamber) {delete physicExternalChamber; delete logicExternalChamber; delete solidExternalChamber;} 1993 if(pFieldMgr) {delete pFieldMgr;} << 1992 if(pFieldMgr) {delete pFieldMgr;} 1994 << 1993 1995 << 1994 1996 1995 1997 G4cout << "****************************** 1996 G4cout << "****************************************************" << G4endl; 1998 G4cout << "************ The ESS has been 1997 G4cout << "************ The ESS has been disabled *************" << G4endl; 1999 G4cout << "****************************** 1998 G4cout << "****************************************************" << G4endl; 2000 G4RunManager::GetRunManager() -> Geometry 1999 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2001 << 2000 #ifdef G4VIS_USE 2002 G4UImanager::GetUIpointer() -> ApplyComma << 2001 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2003 << 2002 #endif 2004 } 2003 } 2005 // Change via external macro command the diam 2004 // Change via external macro command the diameter of the first collimator 2006 void LaserDrivenBeamLine::SetFirstCollimatorR 2005 void LaserDrivenBeamLine::SetFirstCollimatorRadius(G4double valueR) 2007 { 2006 { 2008 G4double radius = valueR; 2007 G4double radius = valueR; 2009 solidCollimatorHole -> SetOuterRadius(rad 2008 solidCollimatorHole -> SetOuterRadius(radius); 2010 G4RunManager::GetRunManager() -> Geometry 2009 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2011 << 2010 #ifdef G4VIS_USE 2012 G4UImanager::GetUIpointer() -> ApplyComma << 2011 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2013 << 2012 #endif 2014 G4cout << "The first collimator aperture 2013 G4cout << "The first collimator aperture has been modified to "<< valueR/mm <<"mm in diameter" << G4endl; 2015 } 2014 } 2016 ///////////////////////////////////////////// 2015 ///////////////////////////////////////////////////////////////////////////// 2017 // Change via external macro command the thic 2016 // Change via external macro command the thickness of the first collimator 2018 void LaserDrivenBeamLine::SetFirstCollimatorT 2017 void LaserDrivenBeamLine::SetFirstCollimatorThickness(G4double valueC) 2019 { 2018 { 2020 G4double thickness = valueC/2; 2019 G4double thickness = valueC/2; 2021 solidCollimator -> SetXHalfLength(thickne 2020 solidCollimator -> SetXHalfLength(thickness); 2022 solidCollimatorHole -> SetZHalfLength(thi 2021 solidCollimatorHole -> SetZHalfLength(thickness); 2023 G4RunManager::GetRunManager() -> Geometry 2022 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2024 << 2023 #ifdef G4VIS_USE 2025 G4UImanager::GetUIpointer() -> ApplyComma << 2024 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2026 << 2025 #endif 2027 G4cout << "The first collimator thickness 2026 G4cout << "The first collimator thickness has been modified to "<< valueC/mm <<" mm in thickness" << G4endl; 2028 } 2027 } 2029 2028 2030 // Change via external macro command the Z po 2029 // Change via external macro command the Z position of the first collimator hole 2031 void LaserDrivenBeamLine::SetFirstCollimatorP 2030 void LaserDrivenBeamLine::SetFirstCollimatorPositionZ(G4double valueQ) 2032 { 2031 { 2033 physicCollimatorHole -> SetTranslation(G4 2032 physicCollimatorHole -> SetTranslation(G4ThreeVector(0., 0., valueQ)); 2034 G4RunManager::GetRunManager() -> Geometry 2033 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2035 << 2034 #ifdef G4VIS_USE 2036 G4UImanager::GetUIpointer() -> ApplyComma << 2035 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2037 << 2036 #endif 2038 G4cout << "The first collimator has been 2037 G4cout << "The first collimator has been translated to "<< valueQ/mm <<"mm (along the z axis)" << G4endl; 2039 } 2038 } 2040 2039 2041 // Change via external macro command the diam 2040 // Change via external macro command the diameter of the second collimator 2042 void LaserDrivenBeamLine::SetSecondCollimator 2041 void LaserDrivenBeamLine::SetSecondCollimatorRadius(G4double value) 2043 { 2042 { 2044 G4double radius = value; 2043 G4double radius = value; 2045 solidFinalCollimatorHole -> SetOuterRadiu 2044 solidFinalCollimatorHole -> SetOuterRadius(radius); 2046 G4RunManager::GetRunManager() -> Geometry 2045 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2047 << 2046 #ifdef G4VIS_USE 2048 G4UImanager::GetUIpointer() -> ApplyComma << 2047 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2049 << 2048 #endif 2050 G4cout << "The second collimator aperture 2049 G4cout << "The second collimator aperture has been modified to "<< value/mm <<"mm in diameter" << G4endl; 2051 } 2050 } 2052 2051 2053 ///////////////////////////////////////////// 2052 ///////////////////////////////////////////////////////////////////////////// 2054 // Change via external macro command the thic 2053 // Change via external macro command the thickness of the second collimator 2055 void LaserDrivenBeamLine::SetSecondCollimator 2054 void LaserDrivenBeamLine::SetSecondCollimatorThickness(G4double value) 2056 { 2055 { 2057 G4double thickness = value/2; 2056 G4double thickness = value/2; 2058 solidFinalCollimator -> SetXHalfLength(th 2057 solidFinalCollimator -> SetXHalfLength(thickness); 2059 solidFinalCollimatorHole -> SetZHalfLengt 2058 solidFinalCollimatorHole -> SetZHalfLength(thickness); 2060 G4RunManager::GetRunManager() -> Geometry 2059 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2061 << 2060 #ifdef G4VIS_USE 2062 G4UImanager::GetUIpointer() -> ApplyComma << 2061 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2063 << 2062 #endif 2064 G4cout << "The second collimator thicknes 2063 G4cout << "The second collimator thickness has been modified to "<< value/mm <<" mm in thickness" << G4endl; 2065 } 2064 } 2066 2065 2067 // Change via external macro command the Z po 2066 // Change via external macro command the Z position of the second collimator hole 2068 void LaserDrivenBeamLine::SetSecondCollimator 2067 void LaserDrivenBeamLine::SetSecondCollimatorPositionZ(G4double value) 2069 { 2068 { 2070 physicFinalCollimatorHole -> SetTranslati 2069 physicFinalCollimatorHole -> SetTranslation(G4ThreeVector(0., 0., value)); 2071 G4RunManager::GetRunManager() -> Geometry 2070 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2072 << 2071 #ifdef G4VIS_USE 2073 G4UImanager::GetUIpointer() -> ApplyComma << 2072 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2074 << 2073 #endif 2075 G4cout << "The second collimator has been 2074 G4cout << "The second collimator has been translated to "<< value/mm <<"mm (along the z axis)" << G4endl; 2076 } 2075 } 2077 // THE SLIT MESSENGERS 2076 // THE SLIT MESSENGERS 2078 ///////////////////////////////////////////// 2077 ///////////////////////////////////////////////////////////////////////////// 2079 // Change the thickness of the Slit 2078 // Change the thickness of the Slit 2080 void LaserDrivenBeamLine::SetThicknessSlit(G4 2079 void LaserDrivenBeamLine::SetThicknessSlit(G4double value) 2081 { 2080 { 2082 if (value >(10.0*mm)) { 2081 if (value >(10.0*mm)) { 2083 G4cout <<"*************************** 2082 G4cout <<"***************************************"<< G4endl; 2084 G4cout <<"******This is a warning mes 2083 G4cout <<"******This is a warning messenger******"<< G4endl; 2085 G4cout <<"*************************** 2084 G4cout <<"***************************************"<< G4endl; 2086 G4cout <<"The maximum value of the th 2085 G4cout <<"The maximum value of the thickness of the slit is 10 mm, your value is >10 mm." << G4endl; 2087 G4cout <<"The default thickness value 2086 G4cout <<"The default thickness value is used, it is: " << ((solidExternalSlit -> GetXHalfLength())*2.)/mm 2088 << G4endl; 2087 << G4endl; 2089 G4cout <<"*************************** 2088 G4cout <<"***************************************"<< G4endl; 2090 2089 2091 } 2090 } 2092 else { 2091 else { 2093 G4double dimension = value/2; 2092 G4double dimension = value/2; 2094 solidExternalSlit -> SetXHalfLength(d 2093 solidExternalSlit -> SetXHalfLength(dimension); 2095 solidInternalSlit -> SetXHalfLength(d 2094 solidInternalSlit -> SetXHalfLength(dimension); 2096 G4RunManager::GetRunManager() -> Geom 2095 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2097 << 2096 #ifdef G4VIS_USE 2098 G4UImanager::GetUIpointer() -> ApplyC << 2097 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2099 << 2098 #endif 2100 G4cout <<"The thickness of the slit i 2099 G4cout <<"The thickness of the slit is:" << ((solidExternalSlit -> GetXHalfLength())*2.)/mm 2101 << G4endl; 2100 << G4endl; 2102 } 2101 } 2103 } 2102 } 2104 ///////////////////////////////////////////// 2103 ///////////////////////////////////////////////////////////////////////////// 2105 // Change the hole size (in Y direction) of t 2104 // Change the hole size (in Y direction) of the Slit 2106 void LaserDrivenBeamLine::SetSlitHoleDimensio 2105 void LaserDrivenBeamLine::SetSlitHoleDimensionY(G4double value) 2107 { 2106 { 2108 G4double hole = value/2; 2107 G4double hole = value/2; 2109 solidInternalSlit -> SetYHalfLength(hole) 2108 solidInternalSlit -> SetYHalfLength(hole); 2110 G4RunManager::GetRunManager() -> Geometry 2109 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2111 << 2110 #ifdef G4VIS_USE 2112 G4UImanager::GetUIpointer() -> ApplyComma << 2111 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2113 << 2112 #endif 2114 G4cout << "The hole of the Slit has been 2113 G4cout << "The hole of the Slit has been changed in the Y direction to "<< value/mm <<" mm" <<G4endl; 2115 } 2114 } 2116 2115 2117 ///////////////////////////////////////////// 2116 ///////////////////////////////////////////////////////////////////////////// 2118 // Change the hole size (in Z direction) of t 2117 // Change the hole size (in Z direction) of the Slit 2119 void LaserDrivenBeamLine::SetSlitHoleDimensio 2118 void LaserDrivenBeamLine::SetSlitHoleDimensionZ(G4double value) 2120 { 2119 { 2121 G4double hole = value/2; 2120 G4double hole = value/2; 2122 solidInternalSlit -> SetZHalfLength(hole) 2121 solidInternalSlit -> SetZHalfLength(hole); 2123 G4RunManager::GetRunManager() -> Geometry 2122 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2124 << 2123 #ifdef G4VIS_USE 2125 G4UImanager::GetUIpointer() -> ApplyComma << 2124 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2126 << 2125 #endif 2127 G4cout << "The hole of the Slit has been 2126 G4cout << "The hole of the Slit has been changed in the Z direction to "<< value/mm <<" mm" <<G4endl; 2128 } 2127 } 2129 ///////////////////////////////////////////// 2128 ///////////////////////////////////////////////////////////////////////////// 2130 // Change the Z position of the hole of the S 2129 // Change the Z position of the hole of the Slit 2131 void LaserDrivenBeamLine::SetSlitHolePosition 2130 void LaserDrivenBeamLine::SetSlitHolePositionZ(G4double value) 2132 { 2131 { 2133 physicInternalSlit -> SetTranslation(G4Th 2132 physicInternalSlit -> SetTranslation(G4ThreeVector(0., 0., value)); 2134 G4RunManager::GetRunManager() -> Geometry 2133 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2135 << 2134 #ifdef G4VIS_USE 2136 G4UImanager::GetUIpointer() -> ApplyComma << 2135 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2137 << 2136 #endif 2138 G4cout << "The hole of the slit has been 2137 G4cout << "The hole of the slit has been translated to "<< value/mm <<" mm (along the Z axis)" <<G4endl; 2139 } 2138 } 2140 2139 2141 // QUADRUPOLES 2140 // QUADRUPOLES 2142 2141 2143 // Disable via external macro command all qua 2142 // Disable via external macro command all quadrupoles 2144 void LaserDrivenBeamLine::RemoveQuads() 2143 void LaserDrivenBeamLine::RemoveQuads() 2145 { 2144 { 2146 if(physicFirstQuad) << 2145 if(physicFirstQuad) 2147 {delete solidFirstQuad; delete logicFirst << 2146 {delete solidFirstQuad; delete logicFirstQuad; delete physicFirstQuad;delete SFirstTriplet; delete LFirstTriplet; delete PFirstTriplet;} 2148 if(physicSecondQuad) << 2147 if(physicSecondQuad) 2149 {delete solidSecondQuad; delete logicSeco << 2148 {delete solidSecondQuad; delete logicSecondQuad; delete physicSecondQuad;delete SSecondTriplet; delete LSecondTriplet; delete PSecondTriplet;} 2150 if(physicThirdQuad) << 2149 if(physicThirdQuad) 2151 {delete solidThirdQuad; delete logicThird << 2150 {delete solidThirdQuad; delete logicThirdQuad; delete physicThirdQuad;delete SThirdTriplet; delete LThirdTriplet; delete PThirdTriplet;} 2152 if(physicFourthQuad) << 2151 if(physicFourthQuad) 2153 {delete solidFourthQuad; delete logicFour << 2152 {delete solidFourthQuad; delete logicFourthQuad; delete physicFourthQuad;delete SFourthTriplet; delete LFourthTriplet; delete PFourthTriplet;} 2154 if(pFieldMgrQuadFourth) {delete pFieldMgr << 2153 if(pFieldMgrQuadFourth) {delete pFieldMgrQuadFourth;} 2155 if(pFieldMgrQuadThird) {delete pFieldMgrQ << 2154 if(pFieldMgrQuadThird) {delete pFieldMgrQuadThird;} 2156 if(pFieldMgrQuadSecond) {delete pFieldMgr << 2155 if(pFieldMgrQuadSecond) {delete pFieldMgrQuadSecond;} 2157 if(pFieldMgrQuadFirst) {delete pFieldMgrQ << 2156 if(pFieldMgrQuadFirst) {delete pFieldMgrQuadFirst;} 2158 << 2157 2159 2158 2160 G4cout << "****************************** 2159 G4cout << "******************************************************************" << G4endl; 2161 G4cout << "************ The Quadrupoles s 2160 G4cout << "************ The Quadrupoles system has been disabled *************" << G4endl; 2162 G4cout << "****************************** 2161 G4cout << "******************************************************************" << G4endl; 2163 G4RunManager::GetRunManager() -> Geometry 2162 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 2164 << 2163 #ifdef G4VIS_USE 2165 G4UImanager::GetUIpointer() -> ApplyComma << 2164 G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush"); 2166 << 2165 #endif 2167 } 2166 } 2168 2167 2169 2168