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 /// \file medical/electronScattering/src/Detec << 26 // $Id: DetectorConstruction.cc,v 1.1 2009/09/19 16:09:44 maire Exp $ 27 /// \brief Implementation of the DetectorConst << 27 // GEANT4 tag $Name: geant4-09-03 $ 28 // << 29 // 28 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 31 33 #include "DetectorConstruction.hh" 32 #include "DetectorConstruction.hh" 34 << 35 #include "DetectorMessenger.hh" 33 #include "DetectorMessenger.hh" 36 34 37 #include "G4GeometryManager.hh" << 38 #include "G4LogicalVolume.hh" << 39 #include "G4LogicalVolumeStore.hh" << 40 #include "G4Material.hh" 35 #include "G4Material.hh" >> 36 #include "G4Tubs.hh" >> 37 #include "G4LogicalVolume.hh" 41 #include "G4PVPlacement.hh" 38 #include "G4PVPlacement.hh" 42 #include "G4PhysicalConstants.hh" << 39 >> 40 #include "G4GeometryManager.hh" 43 #include "G4PhysicalVolumeStore.hh" 41 #include "G4PhysicalVolumeStore.hh" >> 42 #include "G4LogicalVolumeStore.hh" 44 #include "G4SolidStore.hh" 43 #include "G4SolidStore.hh" 45 #include "G4SystemOfUnits.hh" << 44 46 #include "G4Tubs.hh" << 47 #include "G4UnitsTable.hh" 45 #include "G4UnitsTable.hh" 48 46 49 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 50 48 51 DetectorConstruction::DetectorConstruction() 49 DetectorConstruction::DetectorConstruction() 52 : fMaterial_World(0), << 50 :material_World(0), material_Frame(0), 53 fMaterial_Frame(0), << 51 material_ExitWindow(0), material_ScatterFoil(0), material_MonitorChbr(0), 54 fMaterial_ExitWindow(0), << 52 material_Bag(0), material_Gas(0), material_Ring(0) 55 fMaterial_ScatterFoil(0), << 53 { 56 fMaterial_MonitorChbr(0), << 54 // materials 57 fMaterial_Bag(0), << 58 fMaterial_Gas(0), << 59 fMaterial_Ring(0), << 60 fPvol_World(0), << 61 fPvol_Frame(0), << 62 fDetectorMessenger(0) << 63 { << 64 // materials << 65 DefineMaterials(); 55 DefineMaterials(); 66 << 56 67 // geometry 57 // geometry 68 GeometryParameters(); 58 GeometryParameters(); 69 << 59 70 // create commands for interactive definitio << 60 // create commands for interactive definition of the calorimeter 71 fDetectorMessenger = new DetectorMessenger(t << 61 detectorMessenger = new DetectorMessenger(this); 72 } 62 } 73 63 74 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 65 76 DetectorConstruction::~DetectorConstruction() 66 DetectorConstruction::~DetectorConstruction() 77 { << 67 { 78 delete fDetectorMessenger; << 68 delete detectorMessenger; 79 } 69 } 80 70 81 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 72 83 G4VPhysicalVolume* DetectorConstruction::Const 73 G4VPhysicalVolume* DetectorConstruction::Construct() 84 { 74 { 85 return ConstructVolumes(); 75 return ConstructVolumes(); 86 } 76 } 87 77 88 //....oooOO0OOooo........oooOO0OOooo........oo 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 89 79 90 void DetectorConstruction::DefineMaterials() 80 void DetectorConstruction::DefineMaterials() 91 { << 81 { 92 G4double a, z, density; << 82 G4double a, z, density; 93 G4int ncomponents, natoms; << 83 G4int ncomponents, natoms; 94 G4double fractionmass; << 84 G4double fractionmass; 95 G4double temperature, pressure; << 85 G4double temperature, pressure; 96 << 97 // define Elements << 98 // << 99 G4Element* H = new G4Element("Hydrogen", "H" << 100 G4Element* He = new G4Element("Helium", "He" << 101 G4Element* Be = new G4Element("Beryllium", " << 102 G4Element* C = new G4Element("Carbon", "C", << 103 G4Element* N = new G4Element("Nitrogen", "N" << 104 G4Element* O = new G4Element("Oxygen", "O", << 105 G4Element* Al = new G4Element("Aluminium", " << 106 G4Element* Ar = new G4Element("Argon", "Ar", << 107 G4Element* Ti = new G4Element("Titanium", "T << 108 G4Element* Va = new G4Element("Vanadium", "V << 109 G4Element* Cu = new G4Element("Copper", "Cu" << 110 G4Element* Ta = new G4Element("Tantalum", "T << 111 G4Element* Au = new G4Element("Gold", "Au", << 112 << 113 // Air << 114 // << 115 G4Material* Air = new G4Material("Air", dens << 116 293. * kelv << 117 Air->AddElement(C, fractionmass = 0.000124); << 118 Air->AddElement(N, fractionmass = 0.755267); << 119 Air->AddElement(O, fractionmass = 0.231782); << 120 Air->AddElement(Ar, fractionmass = 0.012827) << 121 86 122 // Titanium << 87 // define Elements 123 // << 88 // 124 G4Material* Titanium = new G4Material("Titan << 89 G4Element* H = new G4Element("Hydrogen", "H", z= 1, a= 1.0079*g/mole); 125 Titanium->AddElement(Ti, fractionmass = 0.90 << 90 G4Element* He = new G4Element("Helium", "He", z= 2, a= 4.0026*g/mole); 126 Titanium->AddElement(Al, fractionmass = 0.06 << 91 G4Element* Be = new G4Element("Beryllium","Be", z= 4, a= 9.1218*g/mole); 127 Titanium->AddElement(Va, fractionmass = 0.04 << 92 G4Element* C = new G4Element("Carbon", "C", z= 6, a= 12.0107*g/mole); >> 93 G4Element* N = new G4Element("Nitrogen", "N", z= 7, a= 14.0067*g/mole); >> 94 G4Element* O = new G4Element("Oxygen", "O", z= 8, a= 15.9994*g/mole); >> 95 G4Element* Al = new G4Element("Aluminium","Al", z=13, a= 26.9815*g/mole); >> 96 G4Element* Ar = new G4Element("Argon", "Ar", z=18, a= 39.9480*g/mole); >> 97 G4Element* Ti = new G4Element("Titanium", "Ti", z=22, a= 47.8670*g/mole); >> 98 G4Element* Va = new G4Element("Vanadium", "Va", z=23, a= 50.9415*g/mole); >> 99 G4Element* Cu = new G4Element("Copper", "Cu", z=29, a= 63.5460*g/mole); >> 100 G4Element* Ta = new G4Element("Tantalum", "Ta", z=73, a= 180.9479*g/mole); >> 101 G4Element* Au = new G4Element("Gold", "Au", z=79, a= 196.9666*g/mole); 128 102 129 // Mylar << 103 // Air 130 // << 104 // 131 G4Material* Mylar = new G4Material("Mylar", << 105 G4Material* Air = 132 Mylar->AddElement(H, natoms = 4); << 106 new G4Material("Air", density= 1.205*mg/cm3, ncomponents=4, 133 Mylar->AddElement(C, natoms = 5); << 107 kStateGas, 293.*kelvin, 1.*atmosphere); 134 Mylar->AddElement(O, natoms = 2); << 108 Air->AddElement(C, fractionmass=0.000124); >> 109 Air->AddElement(N, fractionmass=0.755267); >> 110 Air->AddElement(O, fractionmass=0.231782); >> 111 Air->AddElement(Ar,fractionmass=0.012827); 135 112 136 // Helium << 113 // Titanium 137 // << 114 // 138 G4Material* Helium = new G4Material("Helium" << 115 G4Material* Titanium = 139 kStateGa << 116 new G4Material("Titanium", density= 4.42*g/cm3, ncomponents=3); 140 Helium->AddElement(He, fractionmass = 1.0); << 117 Titanium->AddElement(Ti, fractionmass=0.90); >> 118 Titanium->AddElement(Al, fractionmass=0.06); >> 119 Titanium->AddElement(Va, fractionmass=0.04); 141 120 142 // Aluminium << 121 // Mylar 143 // << 122 // 144 G4Material* Aluminium = new G4Material("Alum << 123 G4Material* Mylar = 145 Aluminium->AddElement(Al, fractionmass = 1.0 << 124 new G4Material("Mylar", density= 1.40*g/cm3, ncomponents=3); >> 125 Mylar->AddElement(H, natoms=4); >> 126 Mylar->AddElement(C, natoms=5); >> 127 Mylar->AddElement(O, natoms=2); 146 128 147 // Beryllium << 129 // Helium 148 // << 130 // 149 G4Material* Beryllium = new G4Material("Bery << 131 G4Material* Helium = 150 Beryllium->AddElement(Be, fractionmass = 1.0 << 132 new G4Material("Helium", density= 0.166*mg/cm3, ncomponents=1, >> 133 kStateGas, 293.*kelvin, 1.*atmosphere); >> 134 Helium->AddElement(He, fractionmass=1.0); 151 135 152 // Graphite << 136 // Aluminium 153 // << 137 // 154 G4Material* Graphite = new G4Material("Graph << 138 G4Material* Aluminium = 155 Graphite->AddElement(C, fractionmass = 1.0); << 139 new G4Material("Aluminium", density= 2.7*g/cm3, ncomponents=1); >> 140 Aluminium->AddElement(Al, fractionmass=1.0); 156 141 157 // Copper << 142 // Beryllium 158 // << 143 // 159 G4Material* Copper = new G4Material("Copper" << 144 G4Material* Beryllium = 160 Copper->AddElement(Cu, fractionmass = 1.0); << 145 new G4Material("Beryllium", density= 1.85*g/cm3, ncomponents=1); >> 146 Beryllium->AddElement(Be, fractionmass=1.0); 161 147 162 // Tantalum << 148 //Graphite 163 // << 149 // 164 G4Material* Tantalum = new G4Material("Tanta << 150 G4Material* Graphite = 165 Tantalum->AddElement(Ta, fractionmass = 1.0) << 151 new G4Material("Graphite", density= 2.18*g/cm3, ncomponents=1); >> 152 Graphite->AddElement(C, fractionmass=1.0); 166 153 167 // Gold << 154 // Copper 168 // << 155 // 169 G4Material* Gold = new G4Material("Gold", de << 156 G4Material* Copper = 170 Gold->AddElement(Au, fractionmass = 1.0); << 157 new G4Material("Copper", density= 8.92*g/cm3, ncomponents=1); >> 158 Copper->AddElement(Cu, fractionmass=1.0); 171 159 172 // example of vacuum << 160 // Tantalum 173 // << 161 // 174 density = universe_mean_density; // from Ph << 162 G4Material* Tantalum = 175 pressure = 3.e-18 * pascal; << 163 new G4Material("Tantalum", density= 16.65*g/cm3, ncomponents=1); 176 temperature = 2.73 * kelvin; << 164 Tantalum->AddElement(Ta, fractionmass=1.0); 177 G4Material* Vacuum = new G4Material("Galacti << 178 temperat << 179 165 180 // print << 166 // Gold 181 // << 167 // 182 G4cout << *(G4Material::GetMaterialTable()) << 168 G4Material* Gold = >> 169 new G4Material("Gold", density= 19.30*g/cm3, ncomponents=1); >> 170 Gold->AddElement(Au, fractionmass=1.0); 183 171 184 // assign materials << 172 // example of vacuum 185 // << 173 // 186 fMaterial_World = Vacuum; << 174 density = universe_mean_density; //from PhysicalConstants.h 187 fMaterial_Frame = Air; << 175 pressure = 3.e-18*pascal; 188 fMaterial_ExitWindow = Titanium; << 176 temperature = 2.73*kelvin; 189 fMaterial_ScatterFoil = fMaterial_Frame; << 177 G4Material* Vacuum = 190 fMaterial_MonitorChbr = Mylar; << 178 new G4Material("Galactic", z=1, a=1.01*g/mole,density, 191 fMaterial_Bag = Mylar; << 179 kStateGas,temperature,pressure); 192 fMaterial_Gas = Helium; << 180 193 fMaterial_Ring = Aluminium; << 181 //print >> 182 // >> 183 G4cout << *(G4Material::GetMaterialTable()) << G4endl; >> 184 >> 185 >> 186 // assign materials >> 187 // >> 188 material_World = Vacuum; >> 189 material_Frame = Air; >> 190 material_ExitWindow = Titanium; >> 191 material_ScatterFoil = material_Frame; >> 192 material_MonitorChbr = Mylar; >> 193 material_Bag = Mylar; >> 194 material_Gas = Helium; >> 195 material_Ring = Aluminium; 194 } 196 } 195 197 196 //....oooOO0OOooo........oooOO0OOooo........oo 198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 197 199 198 void DetectorConstruction::GeometryParameters( 200 void DetectorConstruction::GeometryParameters() 199 { 201 { 200 fZfront_ExitWindow = 0.0 * um; << 202 zfront_ExitWindow = 0.0*um; 201 fThickness_ExitWindow = 41.2 * um; << 203 thickness_ExitWindow = 41.2*um; 202 << 204 203 fZfront_ScatterFoil = 2.65 * cm; << 205 zfront_ScatterFoil = 2.65*cm; 204 fThickness_ScatterFoil = 0.0 * um; << 206 thickness_ScatterFoil = 0.0*um; 205 << 207 206 fZfront_MonitorChbr = 50. * mm; << 208 zfront_MonitorChbr = 50.*mm; 207 fThickness_MonitorChbr = 112.7 * um; << 209 thickness_MonitorChbr = 112.7*um; 208 << 210 209 fZfront_Bag = 64.975 * mm; << 211 zfront_Bag = 64.975*mm; 210 fThickness_Bag = 110.0050 * cm; << 212 thickness_Bag = 110.0050*cm; 211 << 213 212 fThickness_Gas = 110. * cm; << 214 thickness_Gas = 110.*cm; 213 << 215 214 fThickness_Ring = 14. * mm; << 216 thickness_Ring = 14.*mm; 215 fInnerRadius_Ring = 20. * cm; << 217 inneradius_Ring = 20.*cm; 216 << 218 217 fZfront_Frame = 2.0 * um; << 219 zfront_Frame = 2.0*um; 218 fThickness_Frame = 118.2 * cm; << 220 thickness_Frame = 118.2*cm; 219 << 221 220 fThickness_World = fZfront_Frame + fThicknes << 222 thickness_World = zfront_Frame + thickness_Frame; 221 fRadius_World = 23.3 * cm; << 223 radius_World = 23.3*cm; 222 } 224 } 223 225 224 //....oooOO0OOooo........oooOO0OOooo........oo 226 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 225 << 227 226 G4VPhysicalVolume* DetectorConstruction::Const 228 G4VPhysicalVolume* DetectorConstruction::ConstructVolumes() 227 { << 229 { 228 // Cleanup old geometry 230 // Cleanup old geometry 229 // 231 // 230 G4GeometryManager::GetInstance()->OpenGeomet 232 G4GeometryManager::GetInstance()->OpenGeometry(); 231 G4PhysicalVolumeStore::GetInstance()->Clean( 233 G4PhysicalVolumeStore::GetInstance()->Clean(); 232 G4LogicalVolumeStore::GetInstance()->Clean() 234 G4LogicalVolumeStore::GetInstance()->Clean(); 233 G4SolidStore::GetInstance()->Clean(); 235 G4SolidStore::GetInstance()->Clean(); 234 << 236 235 // World 237 // World 236 // 238 // 237 G4Tubs* svol_World = new G4Tubs("World", // << 239 G4Tubs* 238 0 * cm, fRad << 240 svol_World = new G4Tubs("World", //name 239 0.5 * fThick << 241 0*cm, radius_World, //r1, r2 240 0., twopi); << 242 0.5*thickness_World, //half-length 241 << 243 0., twopi); //theta1, theta2 242 G4LogicalVolume* lvol_World = new G4LogicalV << 244 243 << 245 G4LogicalVolume* 244 << 246 lvol_World = new G4LogicalVolume(svol_World, //its solid 245 << 247 material_World, //its material 246 fPvol_World = new G4PVPlacement(0, // no ro << 248 "World"); //its name 247 G4ThreeVecto << 249 248 lvol_World, << 250 pvol_World = new G4PVPlacement(0, //no rotation 249 "World", // << 251 G4ThreeVector(), //no translation 250 0, // its m << 252 lvol_World, //its logical volume 251 false, // n << 253 "World", //its name 252 0); // copy << 254 0, //its mother volume 253 << 255 false, //no boolean operation >> 256 0); //copy number >> 257 254 // Frame 258 // Frame 255 // 259 // 256 G4Tubs* svol_Frame = new G4Tubs("Frame", // << 260 G4Tubs* 257 0 * cm, fRad << 261 svol_Frame = new G4Tubs("Frame", //name 258 0.5 * fThick << 262 0*cm, radius_World, //r1, r2 259 0., twopi); << 263 0.5*thickness_Frame, //half-length 260 << 264 0., twopi); //theta1, theta2 261 G4LogicalVolume* lvol_Frame = new G4LogicalV << 265 262 << 266 G4LogicalVolume* 263 << 267 lvol_Frame = new G4LogicalVolume(svol_Frame, //its solid 264 << 268 material_Frame, //its material 265 G4double zpos = fZfront_Frame; << 269 "Frame"); //its name 266 << 270 267 fPvol_Frame = new G4PVPlacement(0, // no ro << 271 G4double 268 G4ThreeVecto << 272 zpos = zfront_Frame; 269 lvol_Frame, << 273 270 "Frame", // << 274 pvol_Frame = new G4PVPlacement(0, //no rotation 271 lvol_World, << 275 G4ThreeVector(0,0,zpos), //translation 272 false, // n << 276 lvol_Frame, //its logical volume 273 0); // copy << 277 "Frame", //its name >> 278 lvol_World, //its mother volume >> 279 false, //no boolean operation >> 280 0); //copy number 274 281 >> 282 275 // ExitWindow 283 // ExitWindow 276 // 284 // 277 G4Tubs* svol_ExitWindow = new G4Tubs("ExitWi << 285 G4Tubs* 278 0 * cm, << 286 svol_ExitWindow = new G4Tubs("ExitWindow", //name 279 0.5 * f << 287 0*cm, radius_World, //r1, r2 280 0., two << 288 0.5*thickness_ExitWindow, //half-length 281 << 289 0., twopi); //theta1, theta2 282 G4LogicalVolume* lvol_ExitWindow = new G4Log << 290 283 << 291 G4LogicalVolume* 284 << 292 lvol_ExitWindow = new G4LogicalVolume(svol_ExitWindow, //solid 285 << 293 material_ExitWindow, //material 286 zpos = fZfront_ExitWindow + 0.5 * fThickness << 294 "ExitWindow"); //name 287 << 295 288 new G4PVPlacement(0, // no rotation << 296 zpos = zfront_ExitWindow + 0.5*thickness_ExitWindow - 0.5*thickness_Frame; 289 G4ThreeVector(0, 0, zpos), << 297 290 lvol_ExitWindow, // logic << 298 new G4PVPlacement(0, //no rotation 291 "ExitWindow", // name << 299 G4ThreeVector(0,0,zpos), //translation 292 lvol_Frame, // mother vol << 300 lvol_ExitWindow, //logical volume 293 false, // no boolean oper << 301 "ExitWindow", //name 294 0); // copy number << 302 lvol_Frame, //mother volume 295 << 303 false, //no boolean operation >> 304 0); //copy number >> 305 296 // Monitor Chamber 306 // Monitor Chamber 297 // 307 // 298 G4Tubs* svol_MonitorChbr = new G4Tubs("Monit << 308 G4Tubs* 299 0 * cm << 309 svol_MonitorChbr = new G4Tubs("MonitorChbr", //name 300 0.5 * << 310 0*cm, radius_World, //r1, r2 301 0., tw << 311 0.5*thickness_MonitorChbr, //half-length 302 << 312 0., twopi); //theta1, theta2 303 G4LogicalVolume* lvol_MonitorChbr = new G4Lo << 313 304 << 314 G4LogicalVolume* 305 << 315 lvol_MonitorChbr = new G4LogicalVolume(svol_MonitorChbr, //solid 306 << 316 material_MonitorChbr, //material 307 zpos = fZfront_MonitorChbr + 0.5 * fThicknes << 317 "MonitorChbr"); //name 308 << 318 309 new G4PVPlacement(0, // no rotation << 319 zpos = zfront_MonitorChbr + 0.5*thickness_MonitorChbr - 0.5*thickness_Frame; 310 G4ThreeVector(0, 0, zpos), << 320 311 lvol_MonitorChbr, // logi << 321 new G4PVPlacement(0, //no rotation 312 "MonitorChbr", // name << 322 G4ThreeVector(0,0,zpos), //translation 313 lvol_Frame, // mother vol << 323 lvol_MonitorChbr, //logical volume 314 false, // no boolean oper << 324 "MonitorChbr", //name 315 0); // copy number << 325 lvol_Frame, //mother volume 316 << 326 false, //no boolean operation >> 327 0); //copy number >> 328 >> 329 317 // Bag 330 // Bag 318 // 331 // 319 G4Tubs* svol_Bag = new G4Tubs("Bag", // nam << 332 G4Tubs* 320 0 * cm, fRadiu << 333 svol_Bag = new G4Tubs("Bag", //name 321 0.5 * fThickne << 334 0*cm, radius_World, //r1, r2 322 0., twopi); / << 335 0.5*thickness_Bag, //half-length 323 << 336 0., twopi); //theta1, theta2 324 G4LogicalVolume* lvol_Bag = new G4LogicalVol << 337 325 << 338 G4LogicalVolume* 326 << 339 lvol_Bag = new G4LogicalVolume(svol_Bag, //solid 327 << 340 material_Bag, //material 328 zpos = fZfront_Bag + 0.5 * fThickness_Bag - << 341 "Bag"); //name 329 << 342 330 new G4PVPlacement(0, // no rotation << 343 zpos = zfront_Bag + 0.5*thickness_Bag - 0.5*thickness_Frame; 331 G4ThreeVector(0, 0, zpos), << 344 332 lvol_Bag, // logical volu << 345 new G4PVPlacement(0, //no rotation 333 "Bag", // name << 346 G4ThreeVector(0,0,zpos), //translation 334 lvol_Frame, // mother vol << 347 lvol_Bag, //logical volume 335 false, // no boolean oper << 348 "Bag", //name 336 0); // copy number << 349 lvol_Frame, //mother volume 337 << 350 false, //no boolean operation >> 351 0); //copy number >> 352 >> 353 338 // Gas 354 // Gas 339 // 355 // 340 G4Tubs* svol_Gas = new G4Tubs("Gas", // nam << 356 G4Tubs* 341 0 * cm, fRadiu << 357 svol_Gas = new G4Tubs("Gas", //name 342 0.5 * fThickne << 358 0*cm, radius_World, //r1, r2 343 0., twopi); / << 359 0.5*thickness_Gas, //half-length 344 << 360 0., twopi); //theta1, theta2 345 G4LogicalVolume* lvol_Gas = new G4LogicalVol << 361 346 << 362 G4LogicalVolume* 347 << 363 lvol_Gas = new G4LogicalVolume(svol_Gas, //solid 348 << 364 material_Gas, //material 349 new G4PVPlacement(0, // no rotation << 365 "Gas"); //name 350 G4ThreeVector(), // no tr << 366 351 lvol_Gas, // logical volu << 367 352 "Gas", // name << 368 new G4PVPlacement(0, //no rotation 353 lvol_Bag, // mother volum << 369 G4ThreeVector(), //no translation 354 false, // no boolean oper << 370 lvol_Gas, //logical volume 355 0); // copy number << 371 "Gas", //name >> 372 lvol_Bag, //mother volume >> 373 false, //no boolean operation >> 374 0); //copy number >> 375 356 376 357 // Rings 377 // Rings 358 // 378 // 359 G4Tubs* svol_Ring = new G4Tubs("Ring", // n << 379 G4Tubs* 360 fInnerRadius_ << 380 svol_Ring = new G4Tubs("Ring", //name 361 0.5 * fThickn << 381 inneradius_Ring, radius_World, //r1, r2 362 0., twopi); << 382 0.5*thickness_Ring, //half-length 363 << 383 0., twopi); //theta1, theta2 364 G4LogicalVolume* lvol_Ring = new G4LogicalVo << 384 365 << 385 G4LogicalVolume* 366 << 386 lvol_Ring = new G4LogicalVolume(svol_Ring, //solid 367 << 387 material_Ring, //material 368 zpos = 0.5 * (fThickness_Gas - fThickness_Ri << 388 "Ring"); //name 369 << 389 370 new G4PVPlacement(0, // no rotation << 390 zpos = 0.5*(thickness_Gas - thickness_Ring); 371 G4ThreeVector(0, 0, zpos), << 391 372 lvol_Ring, // logical vol << 392 new G4PVPlacement(0, //no rotation 373 "Ring", // name << 393 G4ThreeVector(0,0,zpos), //translation 374 lvol_Gas, // mother volum << 394 lvol_Ring, //logical volume 375 false, // no boolean oper << 395 "Ring", //name 376 1); // copy number << 396 lvol_Gas, //mother volume 377 << 397 false, //no boolean operation 378 new G4PVPlacement(0, // no rotation << 398 1); //copy number 379 G4ThreeVector(0, 0, -zpos) << 399 380 lvol_Ring, // logical vol << 400 new G4PVPlacement(0, //no rotation 381 "Ring", // name << 401 G4ThreeVector(0,0,-zpos), //translation 382 lvol_Gas, // mother volum << 402 lvol_Ring, //logical volume 383 false, // no boolean oper << 403 "Ring", //name 384 2); // copy number << 404 lvol_Gas, //mother volume >> 405 false, //no boolean operation >> 406 2); //copy number 385 407 >> 408 386 // ScatterFoil (only if it is not Air) 409 // ScatterFoil (only if it is not Air) 387 // 410 // 388 if ((fMaterial_ScatterFoil != fMaterial_Fram << 411 if ((material_ScatterFoil != material_Frame) && (thickness_ScatterFoil > 0.)) 389 G4Tubs* svol_ScatterFoil = new G4Tubs("Sca << 412 { 390 0 * << 413 G4Tubs* 391 0.5 << 414 svol_ScatterFoil = new G4Tubs("ScatterFoil", //name 392 0., << 415 0*cm, radius_World, //r1, r2 393 << 416 0.5*thickness_ScatterFoil, //half-length 394 G4LogicalVolume* lvol_ScatterFoil = new G4 << 417 0., twopi); //theta1, theta2 395 << 418 396 << 419 G4LogicalVolume* 397 << 420 lvol_ScatterFoil = new G4LogicalVolume(svol_ScatterFoil, //solid 398 zpos = fZfront_ScatterFoil + 0.5 * fThickn << 421 material_ScatterFoil, //material 399 << 422 "ScatterFoil"); //name 400 new G4PVPlacement(0, // no rotation << 423 401 G4ThreeVector(0, 0, zpos << 424 zpos = zfront_ScatterFoil + 0.5*thickness_ScatterFoil - 0.5*thickness_Frame; 402 lvol_ScatterFoil, // lo << 425 403 "ScatterFoil", // name << 426 new G4PVPlacement(0, //no rotation 404 lvol_Frame, // mother v << 427 G4ThreeVector(0,0,zpos), //translation 405 false, // no boolean op << 428 lvol_ScatterFoil, //logical volume 406 0); // copy number << 429 "ScatterFoil", //name 407 } << 430 lvol_Frame, //mother volume 408 << 431 false, //no boolean operation 409 PrintGeometry(); << 432 0); //copy number 410 << 433 } 411 // always return the physical World << 434 >> 435 PrintGeometry(); >> 436 >> 437 //always return the physical World 412 // 438 // 413 return fPvol_World; << 439 return pvol_World; 414 } 440 } 415 441 416 //....oooOO0OOooo........oooOO0OOooo........oo 442 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 417 443 418 void DetectorConstruction::PrintGeometry() 444 void DetectorConstruction::PrintGeometry() 419 { 445 { >> 446 420 // choose printing format 447 // choose printing format 421 std::ios::fmtflags mode = G4cout.flags(); 448 std::ios::fmtflags mode = G4cout.flags(); 422 G4cout.setf(std::ios::fixed, std::ios::float << 449 G4cout.setf(std::ios::fixed,std::ios::floatfield); 423 G4int prec = G4cout.precision(6); 450 G4int prec = G4cout.precision(6); 424 << 451 425 G4cout << "\n \t \t" << 452 G4cout << "\n \t \t" << "Material \t" << "Z_front \t" << "Thickness \n"; 426 << "Material \t" << 453 427 << "Z_front \t" << 454 G4cout << "\n ExitWindow \t" << material_ExitWindow->GetName() 428 << "Thickness \n"; << 455 << "\t" << G4BestUnit(zfront_ExitWindow,"Length") 429 << 456 << "\t" << G4BestUnit(thickness_ExitWindow,"Length"); 430 G4cout << "\n ExitWindow \t" << fMaterial_E << 457 431 << G4BestUnit(fZfront_ExitWindow, "Le << 458 if (material_ScatterFoil != material_Frame) { 432 << G4BestUnit(fThickness_ExitWindow, << 459 G4cout << "\n ScatterFoil \t" << material_ScatterFoil->GetName() << "\t" 433 << 460 << "\t" << G4BestUnit(zfront_ScatterFoil,"Length") 434 if (fMaterial_ScatterFoil != fMaterial_Frame << 461 << "\t" << G4BestUnit(thickness_ScatterFoil,"Length"); 435 G4cout << "\n ScatterFoil \t" << fMateria << 436 << "\t" << G4BestUnit(fZfront_Scatt << 437 << G4BestUnit(fThickness_ScatterFoi << 438 } 462 } 439 << 463 440 G4cout << "\n MonitorChbr \t" << fMaterial_ << 464 G4cout << "\n MonitorChbr \t" << material_MonitorChbr->GetName() << "\t" 441 << "\t" << G4BestUnit(fZfront_Monitor << 465 << "\t" << G4BestUnit(zfront_MonitorChbr,"Length") 442 << G4BestUnit(fThickness_MonitorChbr, << 466 << "\t" << G4BestUnit(thickness_MonitorChbr,"Length"); 443 << 467 444 G4double thickBagWindow = 0.5 * (fThickness_ << 468 G4double thickBagWindow = 0.5*(thickness_Bag - thickness_Gas); 445 G4double zfrontGas = fZfront_Bag + thickBagW << 469 G4double zfrontGas = zfront_Bag + thickBagWindow; 446 G4double zfrontBagWindow2 = zfrontGas + fThi << 470 G4double zfrontBagWindow2 = zfrontGas + thickness_Gas; 447 << 471 448 G4cout << "\n BagWindow1 \t" << fMaterial_B << 472 G4cout << "\n BagWindow1 \t" << material_Bag->GetName() << "\t" 449 << "\t" << G4BestUnit(fZfront_Bag, "L << 473 << "\t" << G4BestUnit(zfront_Bag,"Length") 450 << G4BestUnit(thickBagWindow, "Length << 474 << "\t" << G4BestUnit(thickBagWindow,"Length"); 451 << 475 452 G4cout << "\n Gas \t" << fMaterial_Ga << 476 G4cout << "\n Gas \t" << material_Gas->GetName() << "\t" 453 << "\t" << G4BestUnit(zfrontGas, "Len << 477 << "\t" << G4BestUnit(zfrontGas,"Length") 454 << 478 << "\t" << G4BestUnit(thickness_Gas,"Length"); 455 G4cout << "\n BagWindow2 \t" << fMaterial_B << 479 456 << "\t" << G4BestUnit(zfrontBagWindow << 480 G4cout << "\n BagWindow2 \t" << material_Bag->GetName() << "\t" 457 << G4BestUnit(thickBagWindow, "Length << 481 << "\t" << G4BestUnit(zfrontBagWindow2,"Length") 458 << 482 << "\t" << G4BestUnit(thickBagWindow,"Length"); 459 G4cout << "\n ScoringPlane \t" << fMaterial << 483 460 << "\t" << G4BestUnit(fThickness_Fram << 484 G4cout << "\n ScoringPlane \t" << material_Frame->GetName() << "\t" 461 << G4endl; << 485 << "\t" << G4BestUnit(thickness_Frame,"Length") << "\n" << G4endl; 462 << 486 463 // restaure default formats 487 // restaure default formats 464 G4cout.setf(mode, std::ios::floatfield); << 488 G4cout.setf(mode,std::ios::floatfield); 465 G4cout.precision(prec); << 489 G4cout.precision(prec); 466 } 490 } 467 491 468 //....oooOO0OOooo........oooOO0OOooo........oo 492 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 469 493 470 void DetectorConstruction::SetMaterialScatter( 494 void DetectorConstruction::SetMaterialScatter(G4String material) 471 { 495 { 472 // search the material by its name 496 // search the material by its name 473 G4Material* pMaterial = G4Material::GetMater 497 G4Material* pMaterial = G4Material::GetMaterial(material); 474 498 475 if (pMaterial) fMaterial_ScatterFoil = pMate << 499 if (pMaterial) material_ScatterFoil = pMaterial; 476 } 500 } 477 << 501 478 //....oooOO0OOooo........oooOO0OOooo........oo 502 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 479 503 480 void DetectorConstruction::SetThicknessScatter 504 void DetectorConstruction::SetThicknessScatter(G4double val) 481 { 505 { 482 fThickness_ScatterFoil = val; << 506 thickness_ScatterFoil = val; 483 } << 507 } 484 508 485 //....oooOO0OOooo........oooOO0OOooo........oo 509 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 486 510 487 #include "G4RunManager.hh" << 511 #include "G4RunManager.hh" 488 << 512 489 void DetectorConstruction::UpdateGeometry() 513 void DetectorConstruction::UpdateGeometry() 490 { 514 { 491 G4RunManager::GetRunManager()->DefineWorldVo 515 G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes()); 492 } 516 } 493 517 494 //....oooOO0OOooo........oooOO0OOooo........oo 518 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 519 495 520