[474] | 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 | // |
---|
| 26 | // |
---|
| 27 | // $Id: ExN03DetectorConstruction.cc,v 1.23 2006/06/29 17:48:54 gunter Exp $ |
---|
[609] | 28 | // GEANT4 tag $Name: $ |
---|
[474] | 29 | // |
---|
| 30 | // |
---|
| 31 | |
---|
| 32 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 33 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 34 | |
---|
| 35 | #include "ExN03DetectorConstruction.hh" |
---|
| 36 | #include "ExN03DetectorMessenger.hh" |
---|
| 37 | |
---|
| 38 | #include "G4Material.hh" |
---|
| 39 | #include "G4Box.hh" |
---|
| 40 | #include "G4LogicalVolume.hh" |
---|
| 41 | #include "G4PVPlacement.hh" |
---|
| 42 | #include "G4PVReplica.hh" |
---|
| 43 | #include "G4UniformMagField.hh" |
---|
| 44 | |
---|
| 45 | #include "G4GeometryManager.hh" |
---|
| 46 | #include "G4PhysicalVolumeStore.hh" |
---|
| 47 | #include "G4LogicalVolumeStore.hh" |
---|
| 48 | #include "G4SolidStore.hh" |
---|
| 49 | |
---|
| 50 | #include "G4VisAttributes.hh" |
---|
| 51 | #include "G4Colour.hh" |
---|
| 52 | |
---|
| 53 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 54 | |
---|
| 55 | ExN03DetectorConstruction::ExN03DetectorConstruction() |
---|
| 56 | :AbsorberMaterial(0),GapMaterial(0),defaultMaterial(0), |
---|
| 57 | solidWorld(0),logicWorld(0),physiWorld(0), |
---|
| 58 | solidCalor(0),logicCalor(0),physiCalor(0), |
---|
| 59 | solidLayer(0),logicLayer(0),physiLayer(0), |
---|
| 60 | solidAbsorber(0),logicAbsorber(0),physiAbsorber(0), |
---|
| 61 | solidGap (0),logicGap (0),physiGap (0), |
---|
| 62 | magField(0) |
---|
| 63 | { |
---|
| 64 | // default parameter values of the calorimeter |
---|
| 65 | AbsorberThickness = 10.*mm; |
---|
| 66 | GapThickness = 5.*mm; |
---|
| 67 | NbOfLayers = 10; |
---|
| 68 | CalorSizeYZ = 10.*cm; |
---|
| 69 | ComputeCalorParameters(); |
---|
| 70 | |
---|
| 71 | // materials |
---|
| 72 | DefineMaterials(); |
---|
| 73 | SetAbsorberMaterial("Lead"); |
---|
| 74 | SetGapMaterial("liquidArgon"); |
---|
| 75 | |
---|
| 76 | // create commands for interactive definition of the calorimeter |
---|
| 77 | detectorMessenger = new ExN03DetectorMessenger(this); |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 81 | |
---|
| 82 | ExN03DetectorConstruction::~ExN03DetectorConstruction() |
---|
| 83 | { delete detectorMessenger;} |
---|
| 84 | |
---|
| 85 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 86 | |
---|
| 87 | G4VPhysicalVolume* ExN03DetectorConstruction::Construct() |
---|
| 88 | { |
---|
| 89 | return ConstructCalorimeter(); |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 93 | |
---|
| 94 | void ExN03DetectorConstruction::DefineMaterials() |
---|
| 95 | { |
---|
| 96 | //This function illustrates the possible ways to define materials |
---|
| 97 | |
---|
| 98 | G4String symbol; //a=mass of a mole; |
---|
| 99 | G4double a, z, density; //z=mean number of protons; |
---|
| 100 | G4int iz, n; //iz=number of protons in an isotope; |
---|
| 101 | // n=number of nucleons in an isotope; |
---|
| 102 | |
---|
| 103 | G4int ncomponents, natoms; |
---|
| 104 | G4double abundance, fractionmass; |
---|
| 105 | |
---|
| 106 | // |
---|
| 107 | // define Elements |
---|
| 108 | // |
---|
| 109 | |
---|
| 110 | G4Element* H = new G4Element("Hydrogen",symbol="H" , z= 1., a= 1.01*g/mole); |
---|
| 111 | G4Element* C = new G4Element("Carbon" ,symbol="C" , z= 6., a= 12.01*g/mole); |
---|
| 112 | G4Element* N = new G4Element("Nitrogen",symbol="N" , z= 7., a= 14.01*g/mole); |
---|
| 113 | G4Element* O = new G4Element("Oxygen" ,symbol="O" , z= 8., a= 16.00*g/mole); |
---|
| 114 | G4Element* Si = new G4Element("Silicon",symbol="Si" , z= 14., a= 28.09*g/mole); |
---|
| 115 | |
---|
| 116 | // |
---|
| 117 | // define an Element from isotopes, by relative abundance |
---|
| 118 | // |
---|
| 119 | |
---|
| 120 | G4Isotope* U5 = new G4Isotope("U235", iz=92, n=235, a=235.01*g/mole); |
---|
| 121 | G4Isotope* U8 = new G4Isotope("U238", iz=92, n=238, a=238.03*g/mole); |
---|
| 122 | |
---|
| 123 | G4Element* U = new G4Element("enriched Uranium",symbol="U",ncomponents=2); |
---|
| 124 | U->AddIsotope(U5, abundance= 90.*perCent); |
---|
| 125 | U->AddIsotope(U8, abundance= 10.*perCent); |
---|
| 126 | |
---|
| 127 | // |
---|
| 128 | // define simple materials |
---|
| 129 | // |
---|
| 130 | |
---|
| 131 | new G4Material("Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3); |
---|
| 132 | new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3); |
---|
| 133 | new G4Material("Lead" , z=82., a= 207.19*g/mole, density= 11.35*g/cm3); |
---|
| 134 | |
---|
| 135 | // |
---|
| 136 | // define a material from elements. case 1: chemical molecule |
---|
| 137 | // |
---|
| 138 | |
---|
| 139 | G4Material* H2O = |
---|
| 140 | new G4Material("Water", density= 1.000*g/cm3, ncomponents=2); |
---|
| 141 | H2O->AddElement(H, natoms=2); |
---|
| 142 | H2O->AddElement(O, natoms=1); |
---|
| 143 | // overwrite computed meanExcitationEnergy with ICRU recommended value |
---|
| 144 | H2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV); |
---|
| 145 | |
---|
| 146 | G4Material* Sci = |
---|
| 147 | new G4Material("Scintillator", density= 1.032*g/cm3, ncomponents=2); |
---|
| 148 | Sci->AddElement(C, natoms=9); |
---|
| 149 | Sci->AddElement(H, natoms=10); |
---|
| 150 | |
---|
| 151 | G4Material* Myl = |
---|
| 152 | new G4Material("Mylar", density= 1.397*g/cm3, ncomponents=3); |
---|
| 153 | Myl->AddElement(C, natoms=10); |
---|
| 154 | Myl->AddElement(H, natoms= 8); |
---|
| 155 | Myl->AddElement(O, natoms= 4); |
---|
| 156 | |
---|
| 157 | G4Material* SiO2 = |
---|
| 158 | new G4Material("quartz",density= 2.200*g/cm3, ncomponents=2); |
---|
| 159 | SiO2->AddElement(Si, natoms=1); |
---|
| 160 | SiO2->AddElement(O , natoms=2); |
---|
| 161 | |
---|
| 162 | // |
---|
| 163 | // define a material from elements. case 2: mixture by fractional mass |
---|
| 164 | // |
---|
| 165 | |
---|
| 166 | G4Material* Air = |
---|
| 167 | new G4Material("Air" , density= 1.290*mg/cm3, ncomponents=2); |
---|
| 168 | Air->AddElement(N, fractionmass=0.7); |
---|
| 169 | Air->AddElement(O, fractionmass=0.3); |
---|
| 170 | |
---|
| 171 | // |
---|
| 172 | // define a material from elements and/or others materials (mixture of mixtures) |
---|
| 173 | // |
---|
| 174 | |
---|
| 175 | G4Material* Aerog = |
---|
| 176 | new G4Material("Aerogel", density= 0.200*g/cm3, ncomponents=3); |
---|
| 177 | Aerog->AddMaterial(SiO2, fractionmass=62.5*perCent); |
---|
| 178 | Aerog->AddMaterial(H2O , fractionmass=37.4*perCent); |
---|
| 179 | Aerog->AddElement (C , fractionmass= 0.1*perCent); |
---|
| 180 | |
---|
| 181 | // |
---|
| 182 | // examples of gas in non STP conditions |
---|
| 183 | // |
---|
| 184 | |
---|
| 185 | G4Material* CO2 = |
---|
| 186 | new G4Material("CarbonicGas", density= 27.*mg/cm3, ncomponents=2, |
---|
| 187 | kStateGas, 325.*kelvin, 50.*atmosphere); |
---|
| 188 | CO2->AddElement(C, natoms=1); |
---|
| 189 | CO2->AddElement(O, natoms=2); |
---|
| 190 | |
---|
| 191 | G4Material* steam = |
---|
| 192 | new G4Material("WaterSteam", density= 0.3*mg/cm3, ncomponents=1, |
---|
| 193 | kStateGas, 500.*kelvin, 2.*atmosphere); |
---|
| 194 | steam->AddMaterial(H2O, fractionmass=1.); |
---|
| 195 | |
---|
| 196 | // |
---|
| 197 | // examples of vacuum |
---|
| 198 | // |
---|
| 199 | |
---|
| 200 | G4Material* Vacuum = |
---|
| 201 | new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density, |
---|
| 202 | kStateGas, 2.73*kelvin, 3.e-18*pascal); |
---|
| 203 | |
---|
| 204 | G4Material* beam = |
---|
| 205 | new G4Material("Beam", density= 1.e-5*g/cm3, ncomponents=1, |
---|
| 206 | kStateGas, STP_Temperature, 2.e-2*bar); |
---|
| 207 | beam->AddMaterial(Air, fractionmass=1.); |
---|
| 208 | |
---|
| 209 | G4cout << *(G4Material::GetMaterialTable()) << G4endl; |
---|
| 210 | |
---|
| 211 | //default materials of the World |
---|
| 212 | defaultMaterial = Vacuum; |
---|
| 213 | } |
---|
| 214 | |
---|
| 215 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 216 | |
---|
| 217 | G4VPhysicalVolume* ExN03DetectorConstruction::ConstructCalorimeter() |
---|
| 218 | { |
---|
| 219 | |
---|
| 220 | // Clean old geometry, if any |
---|
| 221 | // |
---|
| 222 | G4GeometryManager::GetInstance()->OpenGeometry(); |
---|
| 223 | G4PhysicalVolumeStore::GetInstance()->Clean(); |
---|
| 224 | G4LogicalVolumeStore::GetInstance()->Clean(); |
---|
| 225 | G4SolidStore::GetInstance()->Clean(); |
---|
| 226 | |
---|
| 227 | // complete the Calor parameters definition |
---|
| 228 | ComputeCalorParameters(); |
---|
| 229 | |
---|
| 230 | // |
---|
| 231 | // World |
---|
| 232 | // |
---|
| 233 | solidWorld = new G4Box("World", //its name |
---|
| 234 | WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2); //its size |
---|
| 235 | |
---|
| 236 | logicWorld = new G4LogicalVolume(solidWorld, //its solid |
---|
| 237 | defaultMaterial, //its material |
---|
| 238 | "World"); //its name |
---|
| 239 | |
---|
| 240 | physiWorld = new G4PVPlacement(0, //no rotation |
---|
| 241 | G4ThreeVector(), //at (0,0,0) |
---|
| 242 | logicWorld, //its logical volume |
---|
| 243 | "World", //its name |
---|
| 244 | 0, //its mother volume |
---|
| 245 | false, //no boolean operation |
---|
| 246 | 0); //copy number |
---|
| 247 | |
---|
| 248 | // |
---|
| 249 | // Calorimeter |
---|
| 250 | // |
---|
| 251 | solidCalor=0; logicCalor=0; physiCalor=0; |
---|
| 252 | solidLayer=0; logicLayer=0; physiLayer=0; |
---|
| 253 | |
---|
| 254 | if (CalorThickness > 0.) |
---|
| 255 | { solidCalor = new G4Box("Calorimeter", //its name |
---|
| 256 | CalorThickness/2,CalorSizeYZ/2,CalorSizeYZ/2);//size |
---|
| 257 | |
---|
| 258 | logicCalor = new G4LogicalVolume(solidCalor, //its solid |
---|
| 259 | defaultMaterial, //its material |
---|
| 260 | "Calorimeter"); //its name |
---|
| 261 | |
---|
| 262 | physiCalor = new G4PVPlacement(0, //no rotation |
---|
| 263 | G4ThreeVector(), //at (0,0,0) |
---|
| 264 | logicCalor, //its logical volume |
---|
| 265 | "Calorimeter", //its name |
---|
| 266 | logicWorld, //its mother volume |
---|
| 267 | false, //no boolean operation |
---|
| 268 | 0); //copy number |
---|
| 269 | |
---|
| 270 | // |
---|
| 271 | // Layer |
---|
| 272 | // |
---|
| 273 | solidLayer = new G4Box("Layer", //its name |
---|
| 274 | LayerThickness/2,CalorSizeYZ/2,CalorSizeYZ/2); //size |
---|
| 275 | |
---|
| 276 | logicLayer = new G4LogicalVolume(solidLayer, //its solid |
---|
| 277 | defaultMaterial, //its material |
---|
| 278 | "Layer"); //its name |
---|
| 279 | if (NbOfLayers > 1) |
---|
| 280 | physiLayer = new G4PVReplica("Layer", //its name |
---|
| 281 | logicLayer, //its logical volume |
---|
| 282 | logicCalor, //its mother |
---|
| 283 | kXAxis, //axis of replication |
---|
| 284 | NbOfLayers, //number of replica |
---|
| 285 | LayerThickness); //witdth of replica |
---|
| 286 | else |
---|
| 287 | physiLayer = new G4PVPlacement(0, //no rotation |
---|
| 288 | G4ThreeVector(), //at (0,0,0) |
---|
| 289 | logicLayer, //its logical volume |
---|
| 290 | "Layer", //its name |
---|
| 291 | logicCalor, //its mother volume |
---|
| 292 | false, //no boolean operation |
---|
| 293 | 0); //copy number |
---|
| 294 | } |
---|
| 295 | |
---|
| 296 | // |
---|
| 297 | // Absorber |
---|
| 298 | // |
---|
| 299 | solidAbsorber=0; logicAbsorber=0; physiAbsorber=0; |
---|
| 300 | |
---|
| 301 | if (AbsorberThickness > 0.) |
---|
| 302 | { solidAbsorber = new G4Box("Absorber", //its name |
---|
| 303 | AbsorberThickness/2,CalorSizeYZ/2,CalorSizeYZ/2); |
---|
| 304 | |
---|
| 305 | logicAbsorber = new G4LogicalVolume(solidAbsorber, //its solid |
---|
| 306 | AbsorberMaterial, //its material |
---|
| 307 | AbsorberMaterial->GetName()); //name |
---|
| 308 | |
---|
| 309 | physiAbsorber = new G4PVPlacement(0, //no rotation |
---|
| 310 | G4ThreeVector(-GapThickness/2,0.,0.), //its position |
---|
| 311 | logicAbsorber, //its logical volume |
---|
| 312 | AbsorberMaterial->GetName(), //its name |
---|
| 313 | logicLayer, //its mother |
---|
| 314 | false, //no boulean operat |
---|
| 315 | 0); //copy number |
---|
| 316 | |
---|
| 317 | } |
---|
| 318 | |
---|
| 319 | // |
---|
| 320 | // Gap |
---|
| 321 | // |
---|
| 322 | solidGap=0; logicGap=0; physiGap=0; |
---|
| 323 | |
---|
| 324 | if (GapThickness > 0.) |
---|
| 325 | { solidGap = new G4Box("Gap", |
---|
| 326 | GapThickness/2,CalorSizeYZ/2,CalorSizeYZ/2); |
---|
| 327 | |
---|
| 328 | logicGap = new G4LogicalVolume(solidGap, |
---|
| 329 | GapMaterial, |
---|
| 330 | GapMaterial->GetName()); |
---|
| 331 | |
---|
| 332 | physiGap = new G4PVPlacement(0, //no rotation |
---|
| 333 | G4ThreeVector(AbsorberThickness/2,0.,0.), //its position |
---|
| 334 | logicGap, //its logical volume |
---|
| 335 | GapMaterial->GetName(), //its name |
---|
| 336 | logicLayer, //its mother |
---|
| 337 | false, //no boulean operat |
---|
| 338 | 0); //copy number |
---|
| 339 | } |
---|
| 340 | |
---|
| 341 | PrintCalorParameters(); |
---|
| 342 | |
---|
| 343 | // |
---|
| 344 | // Visualization attributes |
---|
| 345 | // |
---|
| 346 | logicWorld->SetVisAttributes (G4VisAttributes::Invisible); |
---|
| 347 | |
---|
| 348 | G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); |
---|
| 349 | simpleBoxVisAtt->SetVisibility(true); |
---|
| 350 | logicCalor->SetVisAttributes(simpleBoxVisAtt); |
---|
| 351 | |
---|
| 352 | /* |
---|
| 353 | // Below are vis attributes that permits someone to test / play |
---|
| 354 | // with the interactive expansion / contraction geometry system of the |
---|
| 355 | // vis/OpenInventor driver : |
---|
| 356 | {G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,0.0)); |
---|
| 357 | simpleBoxVisAtt->SetVisibility(true); |
---|
| 358 | delete logicCalor->GetVisAttributes(); |
---|
| 359 | logicCalor->SetVisAttributes(simpleBoxVisAtt);} |
---|
| 360 | |
---|
| 361 | {G4VisAttributes* atb= new G4VisAttributes(G4Colour(1.0,0.0,0.0)); |
---|
| 362 | logicLayer->SetVisAttributes(atb);} |
---|
| 363 | |
---|
| 364 | {G4VisAttributes* atb= new G4VisAttributes(G4Colour(0.0,1.0,0.0)); |
---|
| 365 | atb->SetForceSolid(true); |
---|
| 366 | logicAbsorber->SetVisAttributes(atb);} |
---|
| 367 | |
---|
| 368 | {//Set opacity = 0.2 then transparency = 1 - 0.2 = 0.8 |
---|
| 369 | G4VisAttributes* atb= new G4VisAttributes(G4Colour(0.0,0.0,1.0,0.2)); |
---|
| 370 | atb->SetForceSolid(true); |
---|
| 371 | logicGap->SetVisAttributes(atb);} |
---|
| 372 | */ |
---|
| 373 | |
---|
| 374 | // |
---|
| 375 | //always return the physical World |
---|
| 376 | // |
---|
| 377 | return physiWorld; |
---|
| 378 | } |
---|
| 379 | |
---|
| 380 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 381 | |
---|
| 382 | void ExN03DetectorConstruction::PrintCalorParameters() |
---|
| 383 | { |
---|
| 384 | G4cout << "\n------------------------------------------------------------" |
---|
| 385 | << "\n---> The calorimeter is " << NbOfLayers << " layers of: [ " |
---|
| 386 | << AbsorberThickness/mm << "mm of " << AbsorberMaterial->GetName() |
---|
| 387 | << " + " |
---|
| 388 | << GapThickness/mm << "mm of " << GapMaterial->GetName() << " ] " |
---|
| 389 | << "\n------------------------------------------------------------\n"; |
---|
| 390 | } |
---|
| 391 | |
---|
| 392 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 393 | |
---|
| 394 | void ExN03DetectorConstruction::SetAbsorberMaterial(G4String materialChoice) |
---|
| 395 | { |
---|
| 396 | // search the material by its name |
---|
| 397 | G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice); |
---|
| 398 | if (pttoMaterial) AbsorberMaterial = pttoMaterial; |
---|
| 399 | } |
---|
| 400 | |
---|
| 401 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 402 | |
---|
| 403 | void ExN03DetectorConstruction::SetGapMaterial(G4String materialChoice) |
---|
| 404 | { |
---|
| 405 | // search the material by its name |
---|
| 406 | G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice); |
---|
| 407 | if (pttoMaterial) GapMaterial = pttoMaterial; |
---|
| 408 | } |
---|
| 409 | |
---|
| 410 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 411 | |
---|
| 412 | void ExN03DetectorConstruction::SetAbsorberThickness(G4double val) |
---|
| 413 | { |
---|
| 414 | // change Absorber thickness and recompute the calorimeter parameters |
---|
| 415 | AbsorberThickness = val; |
---|
| 416 | } |
---|
| 417 | |
---|
| 418 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 419 | |
---|
| 420 | void ExN03DetectorConstruction::SetGapThickness(G4double val) |
---|
| 421 | { |
---|
| 422 | // change Gap thickness and recompute the calorimeter parameters |
---|
| 423 | GapThickness = val; |
---|
| 424 | } |
---|
| 425 | |
---|
| 426 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 427 | |
---|
| 428 | void ExN03DetectorConstruction::SetCalorSizeYZ(G4double val) |
---|
| 429 | { |
---|
| 430 | // change the transverse size and recompute the calorimeter parameters |
---|
| 431 | CalorSizeYZ = val; |
---|
| 432 | } |
---|
| 433 | |
---|
| 434 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 435 | |
---|
| 436 | void ExN03DetectorConstruction::SetNbOfLayers(G4int val) |
---|
| 437 | { |
---|
| 438 | NbOfLayers = val; |
---|
| 439 | } |
---|
| 440 | |
---|
| 441 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 442 | |
---|
| 443 | #include "G4FieldManager.hh" |
---|
| 444 | #include "G4TransportationManager.hh" |
---|
| 445 | |
---|
| 446 | void ExN03DetectorConstruction::SetMagField(G4double fieldValue) |
---|
| 447 | { |
---|
| 448 | //apply a global uniform magnetic field along Z axis |
---|
| 449 | G4FieldManager* fieldMgr |
---|
| 450 | = G4TransportationManager::GetTransportationManager()->GetFieldManager(); |
---|
| 451 | |
---|
| 452 | if(magField) delete magField; //delete the existing magn field |
---|
| 453 | |
---|
| 454 | if(fieldValue!=0.) // create a new one if non nul |
---|
| 455 | { magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue)); |
---|
| 456 | fieldMgr->SetDetectorField(magField); |
---|
| 457 | fieldMgr->CreateChordFinder(magField); |
---|
| 458 | } else { |
---|
| 459 | magField = 0; |
---|
| 460 | fieldMgr->SetDetectorField(magField); |
---|
| 461 | } |
---|
| 462 | } |
---|
| 463 | |
---|
| 464 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 465 | |
---|
| 466 | #include "G4RunManager.hh" |
---|
| 467 | |
---|
| 468 | void ExN03DetectorConstruction::UpdateGeometry() |
---|
| 469 | { |
---|
| 470 | G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter()); |
---|
| 471 | } |
---|
| 472 | |
---|
| 473 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|