[807] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
[1230] | 26 | // $Id: DetectorConstruction.cc,v 1.15 2009/01/22 17:41:43 vnivanch Exp $ |
---|
| 27 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
[807] | 28 | // |
---|
| 29 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 30 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 31 | |
---|
| 32 | #include "DetectorConstruction.hh" |
---|
| 33 | #include "DetectorMessenger.hh" |
---|
| 34 | |
---|
| 35 | #include "G4Material.hh" |
---|
| 36 | #include "G4Box.hh" |
---|
| 37 | #include "G4LogicalVolume.hh" |
---|
| 38 | #include "G4PVPlacement.hh" |
---|
| 39 | #include "G4UniformMagField.hh" |
---|
| 40 | |
---|
| 41 | #include "G4GeometryManager.hh" |
---|
| 42 | #include "G4PhysicalVolumeStore.hh" |
---|
| 43 | #include "G4LogicalVolumeStore.hh" |
---|
| 44 | #include "G4SolidStore.hh" |
---|
| 45 | |
---|
| 46 | #include "G4UnitsTable.hh" |
---|
| 47 | #include "G4NistManager.hh" |
---|
[1230] | 48 | #include "G4RunManager.hh" |
---|
[807] | 49 | |
---|
| 50 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 51 | |
---|
| 52 | DetectorConstruction::DetectorConstruction() |
---|
| 53 | :AbsorberMaterial(0),WorldMaterial(0),defaultWorld(true), |
---|
| 54 | solidWorld(0),logicWorld(0),physiWorld(0), |
---|
| 55 | solidAbsorber(0),logicAbsorber(0),physiAbsorber(0), |
---|
| 56 | magField(0) |
---|
| 57 | { |
---|
| 58 | // default parameter values of the calorimeter |
---|
| 59 | AbsorberThickness = 1.*cm; |
---|
| 60 | AbsorberSizeYZ = 2.*cm; |
---|
| 61 | XposAbs = 0.*cm; |
---|
| 62 | ComputeCalorParameters(); |
---|
| 63 | |
---|
| 64 | // materials |
---|
| 65 | DefineMaterials(); |
---|
| 66 | SetWorldMaterial ("Galactic"); |
---|
| 67 | SetAbsorberMaterial("Silicon"); |
---|
| 68 | |
---|
| 69 | // create commands for interactive definition of the calorimeter |
---|
| 70 | detectorMessenger = new DetectorMessenger(this); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 74 | |
---|
| 75 | DetectorConstruction::~DetectorConstruction() |
---|
| 76 | { |
---|
| 77 | delete detectorMessenger; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 81 | |
---|
| 82 | G4VPhysicalVolume* DetectorConstruction::Construct() |
---|
| 83 | { |
---|
| 84 | return ConstructCalorimeter(); |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 88 | |
---|
| 89 | void DetectorConstruction::DefineMaterials() |
---|
| 90 | { |
---|
[1230] | 91 | //This function illustrates the possible ways to define materials |
---|
[807] | 92 | |
---|
[1230] | 93 | G4String symbol; //a=mass of a mole; |
---|
| 94 | G4double a, z, density; //z=mean number of protons; |
---|
[807] | 95 | |
---|
[1230] | 96 | G4int ncomponents, natoms; |
---|
| 97 | G4double fractionmass; |
---|
| 98 | G4double temperature, pressure; |
---|
| 99 | |
---|
| 100 | // |
---|
| 101 | // define Elements |
---|
| 102 | // |
---|
[807] | 103 | |
---|
[1230] | 104 | G4Element* H = new G4Element("Hydrogen",symbol="H", z= 1, a= 1.01*g/mole); |
---|
| 105 | G4Element* C = new G4Element("Carbon", symbol="C", z= 6, a= 12.01*g/mole); |
---|
| 106 | G4Element* N = new G4Element("Nitrogen",symbol="N", z= 7, a= 14.01*g/mole); |
---|
| 107 | G4Element* O = new G4Element("Oxygen", symbol="O", z= 8, a= 16.00*g/mole); |
---|
| 108 | G4Element* Na = new G4Element("Sodium", symbol="Na", z=11, a= 22.99*g/mole); |
---|
| 109 | G4Element* Ar = new G4Element("Argon", symbol="Ar", z=18, a= 39.95*g/mole); |
---|
| 110 | G4Element* I = new G4Element("Iodine", symbol="I" , z=53, a= 126.90*g/mole); |
---|
| 111 | G4Element* Xe = new G4Element("Xenon", symbol="Xe", z=54, a= 131.29*g/mole); |
---|
[807] | 112 | |
---|
[1230] | 113 | // |
---|
| 114 | // define simple materials |
---|
| 115 | // |
---|
[807] | 116 | |
---|
[1230] | 117 | new G4Material("H2Liq" , z= 1, a= 1.01*g/mole, density= 70.8*mg/cm3); |
---|
| 118 | new G4Material("Beryllium", z= 4, a= 9.01*g/mole, density= 1.848*g/cm3); |
---|
| 119 | new G4Material("Aluminium", z=13, a=26.98*g/mole, density= 2.700*g/cm3); |
---|
| 120 | new G4Material("Silicon" , z=14, a=28.09*g/mole, density= 2.330*g/cm3); |
---|
[807] | 121 | |
---|
[1230] | 122 | G4Material* lAr = |
---|
| 123 | new G4Material("liquidArgon", density= 1.390*g/cm3, ncomponents=1); |
---|
| 124 | lAr->AddElement(Ar, natoms=1); |
---|
[807] | 125 | |
---|
[1230] | 126 | new G4Material("Iron", z=26, a= 55.85*g/mole, density= 7.870*g/cm3); |
---|
| 127 | new G4Material("Copper", z=29, a= 63.55*g/mole, density= 8.960*g/cm3); |
---|
| 128 | new G4Material("Germanium",z=32, a= 72.61*g/mole, density= 5.323*g/cm3); |
---|
| 129 | new G4Material("Silver", z=47, a=107.87*g/mole, density= 10.50*g/cm3); |
---|
| 130 | new G4Material("Tungsten", z=74, a=183.85*g/mole, density= 19.30*g/cm3); |
---|
| 131 | new G4Material("Gold", z=79, a=196.97*g/mole, density= 19.32*g/cm3); |
---|
| 132 | new G4Material("Lead", z=82, a=207.19*g/mole, density= 11.35*g/cm3); |
---|
[807] | 133 | |
---|
[1230] | 134 | // |
---|
| 135 | // define a material from elements. case 1: chemical molecule |
---|
| 136 | // |
---|
[807] | 137 | |
---|
[1230] | 138 | G4Material* H2O = new G4Material("Water", density= 1.000*g/cm3, ncomponents=2); |
---|
| 139 | H2O->AddElement(H, natoms=2); |
---|
| 140 | H2O->AddElement(O, natoms=1); |
---|
| 141 | H2O->GetIonisation()->SetMeanExcitationEnergy(75*eV); |
---|
[807] | 142 | |
---|
[1230] | 143 | G4Material* CH = new G4Material("Plastic", density= 1.04*g/cm3, ncomponents=2); |
---|
| 144 | CH->AddElement(C, natoms=1); |
---|
| 145 | CH->AddElement(H, natoms=1); |
---|
[807] | 146 | |
---|
[1230] | 147 | G4Material* NaI = new G4Material("NaI", density= 3.67*g/cm3, ncomponents=2); |
---|
| 148 | NaI->AddElement(Na, natoms=1); |
---|
| 149 | NaI->AddElement(I , natoms=1); |
---|
| 150 | NaI->GetIonisation()->SetMeanExcitationEnergy(452*eV); |
---|
[807] | 151 | |
---|
[1230] | 152 | // |
---|
| 153 | // define a material from elements. case 2: mixture by fractional mass |
---|
| 154 | // |
---|
[807] | 155 | |
---|
[1230] | 156 | G4Material* Air = new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2); |
---|
| 157 | Air->AddElement(N, fractionmass=0.7); |
---|
| 158 | Air->AddElement(O, fractionmass=0.3); |
---|
[807] | 159 | |
---|
[1230] | 160 | G4Material* Air20 = |
---|
| 161 | new G4Material("Air20", density= 1.205*mg/cm3, ncomponents=2, |
---|
| 162 | kStateGas, 293.*kelvin, 1.*atmosphere); |
---|
| 163 | Air20->AddElement(N, fractionmass=0.7); |
---|
| 164 | Air20->AddElement(O, fractionmass=0.3); |
---|
[807] | 165 | |
---|
[1230] | 166 | //Graphite |
---|
| 167 | // |
---|
| 168 | G4Material* Graphite = |
---|
| 169 | new G4Material("Graphite", density= 1.7*g/cm3, ncomponents=1); |
---|
| 170 | Graphite->AddElement(C, fractionmass=1.); |
---|
[807] | 171 | |
---|
[1230] | 172 | //Havar |
---|
| 173 | // |
---|
| 174 | G4Element* Cr = new G4Element("Chrome", "Cr", z=25, a= 51.996*g/mole); |
---|
| 175 | G4Element* Fe = new G4Element("Iron" , "Fe", z=26, a= 55.845*g/mole); |
---|
| 176 | G4Element* Co = new G4Element("Cobalt", "Co", z=27, a= 58.933*g/mole); |
---|
| 177 | G4Element* Ni = new G4Element("Nickel", "Ni", z=28, a= 58.693*g/mole); |
---|
| 178 | G4Element* W = new G4Element("Tungsten","W", z=74, a= 183.850*g/mole); |
---|
[807] | 179 | |
---|
[1230] | 180 | G4Material* Havar = |
---|
| 181 | new G4Material("Havar", density= 8.3*g/cm3, ncomponents=5); |
---|
| 182 | Havar->AddElement(Cr, fractionmass=0.1785); |
---|
| 183 | Havar->AddElement(Fe, fractionmass=0.1822); |
---|
| 184 | Havar->AddElement(Co, fractionmass=0.4452); |
---|
| 185 | Havar->AddElement(Ni, fractionmass=0.1310); |
---|
| 186 | Havar->AddElement(W , fractionmass=0.0631); |
---|
[807] | 187 | |
---|
[1230] | 188 | // |
---|
| 189 | // examples of gas |
---|
| 190 | // |
---|
| 191 | new G4Material("ArgonGas", z=18, a=39.948*g/mole, density= 1.782*mg/cm3, |
---|
| 192 | kStateGas, 273.15*kelvin, 1*atmosphere); |
---|
[807] | 193 | |
---|
[1230] | 194 | new G4Material("XenonGas", z=54, a=131.29*g/mole, density= 5.458*mg/cm3, |
---|
| 195 | kStateGas, 293.15*kelvin, 1*atmosphere); |
---|
[807] | 196 | |
---|
[1230] | 197 | G4Material* CO2 = |
---|
| 198 | new G4Material("CarbonicGas", density= 1.977*mg/cm3, ncomponents=2); |
---|
| 199 | CO2->AddElement(C, natoms=1); |
---|
| 200 | CO2->AddElement(O, natoms=2); |
---|
[807] | 201 | |
---|
[1230] | 202 | G4Material* ArCO2 = |
---|
| 203 | new G4Material("ArgonCO2", density= 1.8223*mg/cm3, ncomponents=2); |
---|
| 204 | ArCO2->AddElement (Ar, fractionmass=0.7844); |
---|
| 205 | ArCO2->AddMaterial(CO2, fractionmass=0.2156); |
---|
[807] | 206 | |
---|
[1230] | 207 | //another way to define mixture of gas per volume |
---|
| 208 | G4Material* NewArCO2 = |
---|
| 209 | new G4Material("NewArgonCO2", density= 1.8223*mg/cm3, ncomponents=3); |
---|
| 210 | NewArCO2->AddElement (Ar, natoms=8); |
---|
| 211 | NewArCO2->AddElement (C, natoms=2); |
---|
| 212 | NewArCO2->AddElement (O, natoms=4); |
---|
[807] | 213 | |
---|
[1230] | 214 | G4Material* ArCH4 = |
---|
| 215 | new G4Material("ArgonCH4", density= 1.709*mg/cm3, ncomponents=3); |
---|
| 216 | ArCH4->AddElement (Ar, natoms=93); |
---|
| 217 | ArCH4->AddElement (C, natoms=7); |
---|
| 218 | ArCH4->AddElement (H, natoms=28); |
---|
[807] | 219 | |
---|
[1230] | 220 | G4Material* XeCH = |
---|
| 221 | new G4Material("XenonMethanePropane", density= 4.9196*mg/cm3, ncomponents=3, |
---|
| 222 | kStateGas, 293.15*kelvin, 1*atmosphere); |
---|
| 223 | XeCH->AddElement (Xe, natoms=875); |
---|
| 224 | XeCH->AddElement (C, natoms=225); |
---|
| 225 | XeCH->AddElement (H, natoms=700); |
---|
[807] | 226 | |
---|
[1230] | 227 | G4Material* steam = |
---|
| 228 | new G4Material("WaterSteam", density= 1.0*mg/cm3, ncomponents=1); |
---|
| 229 | steam->AddMaterial(H2O, fractionmass=1.); |
---|
| 230 | steam->GetIonisation()->SetMeanExcitationEnergy(71.6*eV); |
---|
[807] | 231 | |
---|
[1230] | 232 | // |
---|
| 233 | // example of vacuum |
---|
| 234 | // |
---|
[807] | 235 | |
---|
[1230] | 236 | density = universe_mean_density; //from PhysicalConstants.h |
---|
| 237 | pressure = 3.e-18*pascal; |
---|
| 238 | temperature = 2.73*kelvin; |
---|
| 239 | new G4Material("Galactic", z=1, a=1.01*g/mole,density, |
---|
| 240 | kStateGas,temperature,pressure); |
---|
[807] | 241 | } |
---|
| 242 | |
---|
| 243 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 244 | |
---|
| 245 | void DetectorConstruction::ComputeCalorParameters() |
---|
| 246 | { |
---|
| 247 | // Compute derived parameters of the calorimeter |
---|
| 248 | xstartAbs = XposAbs-0.5*AbsorberThickness; |
---|
| 249 | xendAbs = XposAbs+0.5*AbsorberThickness; |
---|
| 250 | |
---|
| 251 | if (defaultWorld) { |
---|
| 252 | WorldSizeX = 1.5*AbsorberThickness; WorldSizeYZ= 1.2*AbsorberSizeYZ; |
---|
| 253 | } |
---|
| 254 | } |
---|
| 255 | |
---|
| 256 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 257 | |
---|
| 258 | G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter() |
---|
| 259 | { |
---|
| 260 | // Cleanup old geometry |
---|
| 261 | // |
---|
| 262 | G4GeometryManager::GetInstance()->OpenGeometry(); |
---|
| 263 | G4PhysicalVolumeStore::GetInstance()->Clean(); |
---|
| 264 | G4LogicalVolumeStore::GetInstance()->Clean(); |
---|
| 265 | G4SolidStore::GetInstance()->Clean(); |
---|
| 266 | |
---|
| 267 | // complete the Calor parameters definition |
---|
| 268 | ComputeCalorParameters(); |
---|
| 269 | |
---|
| 270 | // World |
---|
| 271 | // |
---|
| 272 | solidWorld = new G4Box("World", //its name |
---|
| 273 | WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2); //its size |
---|
| 274 | |
---|
| 275 | logicWorld = new G4LogicalVolume(solidWorld, //its solid |
---|
| 276 | WorldMaterial, //its material |
---|
| 277 | "World"); //its name |
---|
| 278 | |
---|
| 279 | physiWorld = new G4PVPlacement(0, //no rotation |
---|
| 280 | G4ThreeVector(), //at (0,0,0) |
---|
| 281 | logicWorld, //its logical volume |
---|
| 282 | "World", //its name |
---|
| 283 | 0, //its mother volume |
---|
| 284 | false, //no boolean operation |
---|
| 285 | 0); //copy number |
---|
| 286 | |
---|
| 287 | // Absorber |
---|
| 288 | // |
---|
| 289 | solidAbsorber = new G4Box("Absorber", |
---|
| 290 | AbsorberThickness/2,AbsorberSizeYZ/2,AbsorberSizeYZ/2); |
---|
| 291 | |
---|
| 292 | logicAbsorber = new G4LogicalVolume(solidAbsorber, //its solid |
---|
| 293 | AbsorberMaterial, //its material |
---|
| 294 | "Absorber"); //its name |
---|
| 295 | |
---|
| 296 | physiAbsorber = new G4PVPlacement(0, //no rotation |
---|
| 297 | G4ThreeVector(XposAbs,0.,0.), //its position |
---|
| 298 | logicAbsorber, //its logical volume |
---|
| 299 | "Absorber", //its name |
---|
| 300 | logicWorld, //its mother |
---|
| 301 | false, //no boulean operat |
---|
| 302 | 0); //copy number |
---|
| 303 | |
---|
[1230] | 304 | PrintCalorParameters(); |
---|
[807] | 305 | |
---|
| 306 | //always return the physical World |
---|
| 307 | // |
---|
| 308 | return physiWorld; |
---|
| 309 | } |
---|
| 310 | |
---|
| 311 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 312 | |
---|
| 313 | void DetectorConstruction::PrintCalorParameters() |
---|
| 314 | { |
---|
| 315 | G4cout << "\n" << WorldMaterial << G4endl; |
---|
| 316 | G4cout << "\n" << AbsorberMaterial << G4endl; |
---|
| 317 | |
---|
| 318 | G4cout << "\n The WORLD is made of " << G4BestUnit(WorldSizeX,"Length") |
---|
| 319 | << " of " << WorldMaterial->GetName(); |
---|
| 320 | G4cout << ". The transverse size (YZ) of the world is " |
---|
| 321 | << G4BestUnit(WorldSizeYZ,"Length") << G4endl; |
---|
| 322 | G4cout << " The ABSORBER is made of " |
---|
| 323 | <<G4BestUnit(AbsorberThickness,"Length") |
---|
| 324 | << " of " << AbsorberMaterial->GetName(); |
---|
| 325 | G4cout << ". The transverse size (YZ) is " |
---|
| 326 | << G4BestUnit(AbsorberSizeYZ,"Length") << G4endl; |
---|
| 327 | G4cout << " X position of the middle of the absorber " |
---|
| 328 | << G4BestUnit(XposAbs,"Length"); |
---|
| 329 | G4cout << G4endl; |
---|
| 330 | } |
---|
| 331 | |
---|
| 332 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 333 | |
---|
| 334 | void DetectorConstruction::SetAbsorberMaterial(G4String materialChoice) |
---|
| 335 | { |
---|
| 336 | // search the material by its name |
---|
| 337 | G4Material* pttoMaterial = |
---|
| 338 | G4NistManager::Instance()->FindOrBuildMaterial(materialChoice); |
---|
| 339 | |
---|
[1230] | 340 | if (pttoMaterial && AbsorberMaterial != pttoMaterial) { |
---|
| 341 | AbsorberMaterial = pttoMaterial; |
---|
| 342 | if(logicAbsorber) logicAbsorber->SetMaterial(AbsorberMaterial); |
---|
| 343 | G4RunManager::GetRunManager()->PhysicsHasBeenModified(); |
---|
| 344 | } |
---|
[807] | 345 | } |
---|
| 346 | |
---|
| 347 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 348 | |
---|
| 349 | void DetectorConstruction::SetWorldMaterial(G4String materialChoice) |
---|
| 350 | { |
---|
| 351 | // search the material by its name |
---|
| 352 | G4Material* pttoMaterial = |
---|
| 353 | G4NistManager::Instance()->FindOrBuildMaterial(materialChoice); |
---|
| 354 | |
---|
[1230] | 355 | if (pttoMaterial && WorldMaterial != pttoMaterial) { |
---|
| 356 | WorldMaterial = pttoMaterial; |
---|
| 357 | if(logicWorld) logicWorld->SetMaterial(WorldMaterial); |
---|
| 358 | G4RunManager::GetRunManager()->PhysicsHasBeenModified(); |
---|
| 359 | } |
---|
[807] | 360 | } |
---|
| 361 | |
---|
| 362 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 363 | |
---|
| 364 | void DetectorConstruction::SetAbsorberThickness(G4double val) |
---|
| 365 | { |
---|
| 366 | AbsorberThickness = val; |
---|
[1230] | 367 | G4RunManager::GetRunManager()->GeometryHasBeenModified(); |
---|
[807] | 368 | } |
---|
| 369 | |
---|
| 370 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 371 | |
---|
| 372 | void DetectorConstruction::SetAbsorberSizeYZ(G4double val) |
---|
| 373 | { |
---|
| 374 | AbsorberSizeYZ = val; |
---|
[1230] | 375 | G4RunManager::GetRunManager()->GeometryHasBeenModified(); |
---|
[807] | 376 | } |
---|
| 377 | |
---|
| 378 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 379 | |
---|
| 380 | void DetectorConstruction::SetWorldSizeX(G4double val) |
---|
| 381 | { |
---|
| 382 | WorldSizeX = val; |
---|
| 383 | defaultWorld = false; |
---|
[1230] | 384 | G4RunManager::GetRunManager()->GeometryHasBeenModified(); |
---|
[807] | 385 | } |
---|
| 386 | |
---|
| 387 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 388 | |
---|
| 389 | void DetectorConstruction::SetWorldSizeYZ(G4double val) |
---|
| 390 | { |
---|
| 391 | WorldSizeYZ = val; |
---|
| 392 | defaultWorld = false; |
---|
[1230] | 393 | G4RunManager::GetRunManager()->GeometryHasBeenModified(); |
---|
[807] | 394 | } |
---|
| 395 | |
---|
| 396 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 397 | |
---|
| 398 | void DetectorConstruction::SetAbsorberXpos(G4double val) |
---|
| 399 | { |
---|
| 400 | XposAbs = val; |
---|
[1230] | 401 | G4RunManager::GetRunManager()->GeometryHasBeenModified(); |
---|
[807] | 402 | } |
---|
| 403 | |
---|
| 404 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... |
---|
| 405 | |
---|
| 406 | #include "G4FieldManager.hh" |
---|
| 407 | #include "G4TransportationManager.hh" |
---|
| 408 | |
---|
| 409 | void DetectorConstruction::SetMagField(G4double fieldValue) |
---|
| 410 | { |
---|
| 411 | //apply a global uniform magnetic field along Z axis |
---|
| 412 | G4FieldManager* fieldMgr |
---|
| 413 | = G4TransportationManager::GetTransportationManager()->GetFieldManager(); |
---|
| 414 | |
---|
| 415 | if(magField) delete magField; //delete the existing magn field |
---|
| 416 | |
---|
| 417 | if(fieldValue!=0.) // create a new one if non nul |
---|
| 418 | { magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue)); |
---|
| 419 | fieldMgr->SetDetectorField(magField); |
---|
| 420 | fieldMgr->CreateChordFinder(magField); |
---|
| 421 | } else { |
---|
| 422 | magField = NULL; |
---|
| 423 | fieldMgr->SetDetectorField(magField); |
---|
| 424 | } |
---|
| 425 | } |
---|
| 426 | |
---|
| 427 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... |
---|
| 428 | |
---|
| 429 | void DetectorConstruction::UpdateGeometry() |
---|
| 430 | { |
---|
[1230] | 431 | G4RunManager::GetRunManager()->PhysicsHasBeenModified(); |
---|
[807] | 432 | G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter()); |
---|
| 433 | } |
---|
| 434 | |
---|
| 435 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 436 | |
---|