[1199] | 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: F02DetectorConstruction.cc,v 1.4 2006/06/29 18:27:49 gunter Exp $ |
---|
| 28 | // GEANT4 tag $Name: HEAD $ |
---|
| 29 | // |
---|
| 30 | // |
---|
| 31 | |
---|
| 32 | #include "F02DetectorConstruction.hh" |
---|
| 33 | #include "F02DetectorMessenger.hh" |
---|
| 34 | |
---|
| 35 | #include "F02CalorimeterSD.hh" |
---|
| 36 | #include "F02ElectroMagneticField.hh" |
---|
| 37 | |
---|
| 38 | #include "G4VClusterModel.hh" |
---|
| 39 | #include "G4PAIclusterModel.hh" |
---|
| 40 | |
---|
| 41 | #include "G4Material.hh" |
---|
| 42 | #include "G4Tubs.hh" |
---|
| 43 | #include "G4LogicalVolume.hh" |
---|
| 44 | #include "G4PVPlacement.hh" |
---|
| 45 | #include "G4UniformMagField.hh" |
---|
| 46 | #include "G4FieldManager.hh" |
---|
| 47 | #include "G4TransportationManager.hh" |
---|
| 48 | #include "G4SDManager.hh" |
---|
| 49 | #include "G4RunManager.hh" |
---|
| 50 | |
---|
| 51 | #include "G4ios.hh" |
---|
| 52 | |
---|
| 53 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 54 | // |
---|
| 55 | // |
---|
| 56 | |
---|
| 57 | F02DetectorConstruction::F02DetectorConstruction() |
---|
| 58 | :solidWorld(NULL),logicWorld(NULL),physiWorld(NULL), |
---|
| 59 | solidAbsorber(NULL),logicAbsorber(NULL),physiAbsorber(NULL), |
---|
| 60 | AbsorberMaterial(NULL),WorldMaterial(NULL),fRadiatorMat(NULL), |
---|
| 61 | magField(NULL),calorimeterSD(NULL),worldchanged(false),fEmField(NULL) |
---|
| 62 | { |
---|
| 63 | // default parameter values of the calorimeter |
---|
| 64 | |
---|
| 65 | G4double inch = 2.54*cm ; |
---|
| 66 | G4double mil = inch/1000.0 ; |
---|
| 67 | |
---|
| 68 | WorldSizeZ = 200.*cm; |
---|
| 69 | WorldSizeR = 1000.*cm; |
---|
| 70 | |
---|
| 71 | AbsorberThickness = 0.01*cm; |
---|
| 72 | |
---|
| 73 | AbsorberRadius = WorldSizeR - 0.1*cm; |
---|
| 74 | // zAbsorber = 0.5*WorldSizeZ - 50.5*cm ; // - 0.5*AbsorberThickness ; |
---|
| 75 | zAbsorber = 99*cm - 0.5*AbsorberThickness ; |
---|
| 76 | |
---|
| 77 | fWindowThick = 51.0*micrometer ; |
---|
| 78 | fElectrodeThick = 10.0*micrometer ; |
---|
| 79 | fGapThick = 1.0*mm ; |
---|
| 80 | |
---|
| 81 | fRadThickness = 25*micrometer ; // 0.5*mil ; |
---|
| 82 | fGasGap = 1500*micrometer ; // 30*mil ; |
---|
| 83 | fFoilNumber = 188 ; |
---|
| 84 | |
---|
| 85 | fDetThickness = 40.0*mm ; |
---|
| 86 | fDetLength = 200.0*cm ; |
---|
| 87 | fDetGap = 1.0*mm ; |
---|
| 88 | |
---|
| 89 | fStartR = 40*cm ; |
---|
| 90 | fStartZ = 10.0*mm ; |
---|
| 91 | |
---|
| 92 | fModuleNumber = 1 ; |
---|
| 93 | |
---|
| 94 | // create commands for interactive definition of the calorimeter |
---|
| 95 | |
---|
| 96 | detectorMessenger = new F02DetectorMessenger(this); |
---|
| 97 | |
---|
| 98 | // fEmField = new F02ElectroMagneticField() ; |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | ////////////////////////////////////////////////////////////////////////// |
---|
| 102 | // |
---|
| 103 | // |
---|
| 104 | |
---|
| 105 | F02DetectorConstruction::~F02DetectorConstruction() |
---|
| 106 | { |
---|
| 107 | delete detectorMessenger; |
---|
| 108 | if (fEmField) delete fEmField ; |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | ////////////////////////////////////////////////////////////////////////// |
---|
| 112 | // |
---|
| 113 | // |
---|
| 114 | |
---|
| 115 | G4VPhysicalVolume* F02DetectorConstruction::Construct() |
---|
| 116 | { |
---|
| 117 | DefineMaterials(); |
---|
| 118 | return ConstructCalorimeter(); |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 122 | // |
---|
| 123 | // |
---|
| 124 | |
---|
| 125 | void F02DetectorConstruction::DefineMaterials() |
---|
| 126 | { |
---|
| 127 | //This function illustrates the possible ways to define materials |
---|
| 128 | |
---|
| 129 | G4String name, symbol ; //a=mass of a mole; |
---|
| 130 | G4double a, z, density ; //z=mean number of protons; |
---|
| 131 | G4int iz, n, nel ; //iz=number of protons in an isotope; |
---|
| 132 | // n=number of nucleons in an isotope; |
---|
| 133 | |
---|
| 134 | G4int ncomponents, natoms; |
---|
| 135 | G4double abundance, fractionmass; |
---|
| 136 | G4double temperature, pressure; |
---|
| 137 | |
---|
| 138 | // |
---|
| 139 | // define Elements |
---|
| 140 | // |
---|
| 141 | |
---|
| 142 | a = 1.01*g/mole; |
---|
| 143 | G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); |
---|
| 144 | |
---|
| 145 | a = 6.01*g/mole; |
---|
| 146 | G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a); |
---|
| 147 | |
---|
| 148 | a = 14.01*g/mole; |
---|
| 149 | G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a); |
---|
| 150 | |
---|
| 151 | a = 16.00*g/mole; |
---|
| 152 | G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); |
---|
| 153 | |
---|
| 154 | a = 39.948*g/mole; |
---|
| 155 | G4Element* elAr = new G4Element(name="Argon", symbol="Ar", z=18., a); |
---|
| 156 | |
---|
| 157 | a = 131.29*g/mole; |
---|
| 158 | G4Element* elXe = new G4Element(name="Xenon", symbol="Xe", z=54., a); |
---|
| 159 | |
---|
| 160 | a = 19.00*g/mole; |
---|
| 161 | G4Element* elF = new G4Element(name="Fluorine", symbol="F", z=9., a); |
---|
| 162 | |
---|
| 163 | |
---|
| 164 | // |
---|
| 165 | // define simple materials |
---|
| 166 | // |
---|
| 167 | |
---|
| 168 | /* ****************************************************************** |
---|
| 169 | |
---|
| 170 | density = 1.848*g/cm3; |
---|
| 171 | a = 9.01*g/mole; |
---|
| 172 | G4Material* Be = new G4Material(name="Beryllium", z=4., a, density); |
---|
| 173 | |
---|
| 174 | |
---|
| 175 | density = 1.390*g/cm3; |
---|
| 176 | a = 39.95*g/mole; |
---|
| 177 | G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density); |
---|
| 178 | |
---|
| 179 | density = 7.870*g/cm3; |
---|
| 180 | a = 55.85*g/mole; |
---|
| 181 | G4Material* Fe = new G4Material(name="Iron" , z=26., a, density); |
---|
| 182 | |
---|
| 183 | density = 8.960*g/cm3; |
---|
| 184 | a = 63.55*g/mole; |
---|
| 185 | G4Material* Cu = new G4Material(name="Copper" , z=29., a, density); |
---|
| 186 | |
---|
| 187 | density = 19.32*g/cm3; |
---|
| 188 | a =196.97*g/mole; |
---|
| 189 | G4Material* Au = new G4Material(name="Gold" , z=79., a, density); |
---|
| 190 | |
---|
| 191 | density = 11.35*g/cm3; |
---|
| 192 | a = 207.19*g/mole; |
---|
| 193 | G4Material* Pb = new G4Material(name="Lead" , z=82., a, density); |
---|
| 194 | |
---|
| 195 | // |
---|
| 196 | // define a material from elements. case 1: chemical molecule |
---|
| 197 | // |
---|
| 198 | |
---|
| 199 | density = 1.000*g/cm3; |
---|
| 200 | G4Material* H2O = new G4Material(name="Water", density, ncomponents=2); |
---|
| 201 | H2O->AddElement(elH, natoms=2); |
---|
| 202 | H2O->AddElement(elO, natoms=1); |
---|
| 203 | |
---|
| 204 | // Kapton (polyimide) ??? since = Mylar C5H4O2 |
---|
| 205 | |
---|
| 206 | density = 1.39*g/cm3; |
---|
| 207 | G4Material* Kapton = new G4Material(name="Kapton", density, nel=3); |
---|
| 208 | Kapton->AddElement(elO,2); |
---|
| 209 | Kapton->AddElement(elC,5); |
---|
| 210 | Kapton->AddElement(elH,4); |
---|
| 211 | |
---|
| 212 | // Silicon as detector material |
---|
| 213 | |
---|
| 214 | density = 2.330*g/cm3; |
---|
| 215 | a = 28.09*g/mole; |
---|
| 216 | G4Material* Si = new G4Material(name="Silicon", z=14., a, density); |
---|
| 217 | |
---|
| 218 | // Carbon dioxide |
---|
| 219 | |
---|
| 220 | density = 1.977*mg/cm3; |
---|
| 221 | G4Material* CO2 = new G4Material(name="CO2", density, nel=2, |
---|
| 222 | kStateGas,273.15*kelvin,1.*atmosphere); |
---|
| 223 | CO2->AddElement(elC,1); |
---|
| 224 | CO2->AddElement(elO,2); |
---|
| 225 | |
---|
| 226 | |
---|
| 227 | // TRT_CH2 |
---|
| 228 | |
---|
| 229 | density = 0.935*g/cm3; |
---|
| 230 | G4Material* TRT_CH2 = new G4Material(name="TRT_CH2",density, nel=2); |
---|
| 231 | TRT_CH2->AddElement(elC,1); |
---|
| 232 | TRT_CH2->AddElement(elH,2); |
---|
| 233 | |
---|
| 234 | // Radiator |
---|
| 235 | |
---|
| 236 | density = 0.059*g/cm3; |
---|
| 237 | G4Material* Radiator = new G4Material(name="Radiator",density, nel=2); |
---|
| 238 | Radiator->AddElement(elC,1); |
---|
| 239 | Radiator->AddElement(elH,2); |
---|
| 240 | |
---|
| 241 | // Carbon Fiber |
---|
| 242 | |
---|
| 243 | density = 0.145*g/cm3; |
---|
| 244 | G4Material* CarbonFiber = new G4Material(name="CarbonFiber",density, nel=1); |
---|
| 245 | CarbonFiber->AddElement(elC,1); |
---|
| 246 | |
---|
| 247 | density = 1.290*mg/cm3; // old air from elements |
---|
| 248 | G4Material* air = new G4Material(name="air" , density, ncomponents=2); |
---|
| 249 | Air->AddElement(elN, fractionmass=0.7); |
---|
| 250 | Air->AddElement(elO, fractionmass=0.3); |
---|
| 251 | |
---|
| 252 | |
---|
| 253 | density = 1.25053*mg/cm3 ; // STP |
---|
| 254 | a = 14.01*g/mole ; // get atomic weight !!! |
---|
| 255 | // a = 28.016*g/mole; |
---|
| 256 | G4Material* N2 = new G4Material(name="Nitrogen", z= 7.,a,density) ; |
---|
| 257 | |
---|
| 258 | density = 1.25053*mg/cm3 ; // STP |
---|
| 259 | G4Material* anotherN2 = new G4Material(name="anotherN2", density,ncomponents=2); |
---|
| 260 | anotherN2->AddElement(elN, 1); |
---|
| 261 | anotherN2->AddElement(elN, 1); |
---|
| 262 | |
---|
| 263 | ************************ */ |
---|
| 264 | |
---|
| 265 | // Al for electrodes |
---|
| 266 | |
---|
| 267 | density = 2.700*g/cm3; |
---|
| 268 | a = 26.98*g/mole; |
---|
| 269 | G4Material* Al = new G4Material(name="Aluminium", z=13., a, density); |
---|
| 270 | |
---|
| 271 | // Mylar |
---|
| 272 | |
---|
| 273 | density = 1.39*g/cm3; |
---|
| 274 | G4Material* Mylar = new G4Material(name="Mylar", density, nel=3); |
---|
| 275 | Mylar->AddElement(elO,2); |
---|
| 276 | Mylar->AddElement(elC,5); |
---|
| 277 | Mylar->AddElement(elH,4); |
---|
| 278 | |
---|
| 279 | // Polypropelene |
---|
| 280 | |
---|
| 281 | G4Material* CH2 = new G4Material ("Polypropelene" , 0.91*g/cm3, 2); |
---|
| 282 | CH2->AddElement(elH,2); |
---|
| 283 | CH2->AddElement(elC,1); |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | |
---|
| 287 | // Krypton as detector gas, STP |
---|
| 288 | |
---|
| 289 | density = 3.700*mg/cm3 ; |
---|
| 290 | a = 83.80*g/mole ; |
---|
| 291 | G4Material* Kr = new G4Material(name="Kr",z=36., a, density ); |
---|
| 292 | |
---|
| 293 | // Metane, STP |
---|
| 294 | |
---|
| 295 | // density = 0.7174*mg/cm3 ; |
---|
| 296 | // G4Material* metane = new G4Material(name="CH4",density,nel=2) ; |
---|
| 297 | // metane->AddElement(elC,1) ; |
---|
| 298 | // metane->AddElement(elH,4) ; |
---|
| 299 | |
---|
| 300 | |
---|
| 301 | // Dry air (average composition) |
---|
| 302 | |
---|
| 303 | density = 1.7836*mg/cm3 ; // STP |
---|
| 304 | G4Material* Argon = new G4Material(name="Argon" , density, ncomponents=1); |
---|
| 305 | Argon->AddElement(elAr, 1); |
---|
| 306 | |
---|
| 307 | density = 1.25053*mg/cm3 ; // STP |
---|
| 308 | G4Material* Nitrogen = new G4Material(name="N2" , density, ncomponents=1); |
---|
| 309 | Nitrogen->AddElement(elN, 2); |
---|
| 310 | |
---|
| 311 | density = 1.4289*mg/cm3 ; // STP |
---|
| 312 | G4Material* Oxygen = new G4Material(name="O2" , density, ncomponents=1); |
---|
| 313 | Oxygen->AddElement(elO, 2); |
---|
| 314 | |
---|
| 315 | |
---|
| 316 | density = 1.2928*mg/cm3 ; // STP |
---|
| 317 | density *= 10e-8 ; |
---|
| 318 | G4Material* Air = new G4Material(name="Air" , density, ncomponents=3); |
---|
| 319 | Air->AddMaterial( Nitrogen, fractionmass = 0.7557 ) ; |
---|
| 320 | Air->AddMaterial( Oxygen, fractionmass = 0.2315 ) ; |
---|
| 321 | Air->AddMaterial( Argon, fractionmass = 0.0128 ) ; |
---|
| 322 | |
---|
| 323 | // 93% Ar + 7% CH4, STP |
---|
| 324 | |
---|
| 325 | // density = 1.709*mg/cm3 ; |
---|
| 326 | // G4Material* Ar7CH4 = new G4Material(name="Ar7CH4" , density, |
---|
| 327 | // ncomponents=2); |
---|
| 328 | // Ar7CH4->AddMaterial( Argon, fractionmass = 0.971 ) ; |
---|
| 329 | // Ar7CH4->AddMaterial( metane, fractionmass = 0.029 ) ; |
---|
| 330 | |
---|
| 331 | // 93% Kr + 7% CH4, STP |
---|
| 332 | |
---|
| 333 | // density = 3.491*mg/cm3 ; |
---|
| 334 | // G4Material* Kr7CH4 = new G4Material(name="Kr7CH4" , density, |
---|
| 335 | // ncomponents=2); |
---|
| 336 | // Kr7CH4->AddMaterial( Kr, fractionmass = 0.986 ) ; |
---|
| 337 | // Kr7CH4->AddMaterial( metane, fractionmass = 0.014 ) ; |
---|
| 338 | |
---|
| 339 | /* ************** |
---|
| 340 | |
---|
| 341 | G4double TRT_Xe_density = 5.485*mg/cm3; |
---|
| 342 | G4Material* TRT_Xe = new G4Material(name="TRT_Xe", TRT_Xe_density, nel=1, |
---|
| 343 | kStateGas,293.15*kelvin,1.*atmosphere); |
---|
| 344 | TRT_Xe->AddElement(elXe,1); |
---|
| 345 | |
---|
| 346 | G4double TRT_CO2_density = 1.842*mg/cm3; |
---|
| 347 | G4Material* TRT_CO2 = new G4Material(name="TRT_CO2", TRT_CO2_density, nel=2, |
---|
| 348 | kStateGas,293.15*kelvin,1.*atmosphere); |
---|
| 349 | TRT_CO2->AddElement(elC,1); |
---|
| 350 | TRT_CO2->AddElement(elO,2); |
---|
| 351 | |
---|
| 352 | G4double TRT_CF4_density = 3.9*mg/cm3; |
---|
| 353 | G4Material* TRT_CF4 = new G4Material(name="TRT_CF4", TRT_CF4_density, nel=2, |
---|
| 354 | kStateGas,293.15*kelvin,1.*atmosphere); |
---|
| 355 | TRT_CF4->AddElement(elC,1); |
---|
| 356 | TRT_CF4->AddElement(elF,4); |
---|
| 357 | |
---|
| 358 | // ATLAS TRT straw tube gas mixture (20 C, 1 atm) |
---|
| 359 | |
---|
| 360 | G4double XeCO2CF4_density = 4.76*mg/cm3; |
---|
| 361 | G4Material* XeCO2CF4 = new G4Material(name="XeCO2CF4", XeCO2CF4_density, |
---|
| 362 | ncomponents=3, |
---|
| 363 | kStateGas,293.15*kelvin,1.*atmosphere); |
---|
| 364 | XeCO2CF4->AddMaterial(TRT_Xe,0.807); |
---|
| 365 | XeCO2CF4->AddMaterial(TRT_CO2,0.039); |
---|
| 366 | XeCO2CF4->AddMaterial(TRT_CF4,0.154); |
---|
| 367 | |
---|
| 368 | *********** */ |
---|
| 369 | |
---|
| 370 | // Xenon as detector gas, STP |
---|
| 371 | |
---|
| 372 | density = 5.858*mg/cm3 ; |
---|
| 373 | a = 131.29*g/mole ; |
---|
| 374 | G4Material* Xe = new G4Material(name="Xenon",z=54., a, density ); |
---|
| 375 | |
---|
| 376 | // Carbon dioxide, STP |
---|
| 377 | |
---|
| 378 | density = 1.977*mg/cm3; |
---|
| 379 | G4Material* CarbonDioxide = new G4Material(name="CO2", density, nel=2); |
---|
| 380 | CarbonDioxide->AddElement(elC,1); |
---|
| 381 | CarbonDioxide->AddElement(elO,2); |
---|
| 382 | |
---|
| 383 | // 80% Ar + 20% CO2, STP |
---|
| 384 | |
---|
| 385 | // density = 1.8223*mg/cm3 ; |
---|
| 386 | // G4Material* Ar_80CO2_20 = new G4Material(name="ArCO2" , density, |
---|
| 387 | // ncomponents=2); |
---|
| 388 | // Ar_80CO2_20->AddMaterial( Argon, fractionmass = 0.783 ) ; |
---|
| 389 | // Ar_80CO2_20->AddMaterial( CarbonDioxide, fractionmass = 0.217 ) ; |
---|
| 390 | |
---|
| 391 | // 80% Xe + 20% CO2, STP |
---|
| 392 | |
---|
| 393 | density = 5.0818*mg/cm3 ; |
---|
| 394 | G4Material* Xe20CO2 = new G4Material(name="Xe20CO2" , density, ncomponents=2); |
---|
| 395 | Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 ) ; |
---|
| 396 | Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 ) ; |
---|
| 397 | |
---|
| 398 | // 80% Kr + 20% CO2, STP |
---|
| 399 | |
---|
| 400 | density = 3.601*mg/cm3 ; |
---|
| 401 | G4Material* Kr20CO2 = new G4Material(name="Kr20CO2" , density, |
---|
| 402 | ncomponents=2); |
---|
| 403 | Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 ) ; |
---|
| 404 | Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 ) ; |
---|
| 405 | |
---|
| 406 | |
---|
| 407 | G4cout << *(G4Material::GetMaterialTable()) << G4endl; |
---|
| 408 | |
---|
| 409 | //default materials of the calorimeter and TR radiator |
---|
| 410 | |
---|
| 411 | fRadiatorMat = Mylar ; // CH2 ; // Mylar ; |
---|
| 412 | |
---|
| 413 | fWindowMat = Mylar ; |
---|
| 414 | fElectrodeMat = Al ; |
---|
| 415 | |
---|
| 416 | AbsorberMaterial = Air ; // Kr20CO2 ; // XeCO2CF4 ; |
---|
| 417 | fGapMat = Air ; // Kr20CO2 ; |
---|
| 418 | |
---|
| 419 | WorldMaterial = Air ; |
---|
| 420 | } |
---|
| 421 | |
---|
| 422 | ///////////////////////////////////////////////////////////////////////// |
---|
| 423 | // |
---|
| 424 | // |
---|
| 425 | |
---|
| 426 | G4VPhysicalVolume* F02DetectorConstruction::ConstructCalorimeter() |
---|
| 427 | { |
---|
| 428 | G4int i, j ; |
---|
| 429 | G4double zModule, zRadiator, rModule, rRadiator ; |
---|
| 430 | |
---|
| 431 | // complete the Calor parameters definition and Print |
---|
| 432 | |
---|
| 433 | ComputeCalorParameters(); |
---|
| 434 | PrintCalorParameters(); |
---|
| 435 | |
---|
| 436 | // World |
---|
| 437 | |
---|
| 438 | if(solidWorld) delete solidWorld ; |
---|
| 439 | if(logicWorld) delete logicWorld ; |
---|
| 440 | if(physiWorld) delete physiWorld ; |
---|
| 441 | |
---|
| 442 | solidWorld = new G4Tubs("World", //its name |
---|
| 443 | 0.,WorldSizeR,WorldSizeZ/2.,0.,twopi) ;//its size |
---|
| 444 | |
---|
| 445 | logicWorld = new G4LogicalVolume(solidWorld, //its solid |
---|
| 446 | WorldMaterial, //its material |
---|
| 447 | "World"); //its name |
---|
| 448 | |
---|
| 449 | physiWorld = new G4PVPlacement(0, //no rotation |
---|
| 450 | G4ThreeVector(), //at (0,0,0) |
---|
| 451 | "World", //its name |
---|
| 452 | logicWorld, //its logical volume |
---|
| 453 | NULL, //its mother volume |
---|
| 454 | false, //no boolean operation |
---|
| 455 | 0); //copy number |
---|
| 456 | |
---|
| 457 | /************************** |
---|
| 458 | |
---|
| 459 | G4Tubs* solidElectrode = new G4Tubs("Electrode",0.,AbsorberRadius, |
---|
| 460 | fElectrodeThick/2.,0.,twopi); |
---|
| 461 | |
---|
| 462 | G4LogicalVolume* logicElectrode = new G4LogicalVolume(solidElectrode, |
---|
| 463 | fElectrodeMat, "Electrode"); |
---|
| 464 | |
---|
| 465 | G4double zElectrode = zAbsorber - AbsorberThickness/2. - |
---|
| 466 | fElectrodeThick/2. - 0.01*mm; |
---|
| 467 | |
---|
| 468 | G4VPhysicalVolume* physiElectrode = new G4PVPlacement(0, |
---|
| 469 | G4ThreeVector(0.,0.,zElectrode), |
---|
| 470 | "Electrode",logicElectrode, |
---|
| 471 | physiWorld,false,0); |
---|
| 472 | |
---|
| 473 | |
---|
| 474 | |
---|
| 475 | G4Tubs* solidGap = new G4Tubs("Gap",0.,AbsorberRadius,fGapThick/2.,0.,twopi); |
---|
| 476 | |
---|
| 477 | G4LogicalVolume* logicGap = new G4LogicalVolume(solidGap,fGapMat, "Gap"); |
---|
| 478 | |
---|
| 479 | G4double zGap = zElectrode - fElectrodeThick/2. - fGapThick/2. - 0.01*mm ; |
---|
| 480 | |
---|
| 481 | G4VPhysicalVolume* physiGap = new G4PVPlacement(0, |
---|
| 482 | G4ThreeVector(0.,0.,zGap), |
---|
| 483 | "Gap",logicGap,physiWorld,false,0); |
---|
| 484 | |
---|
| 485 | G4Tubs* solidWindow = new G4Tubs("Window",0.,AbsorberRadius, |
---|
| 486 | fWindowThick/2.,0.,twopi); |
---|
| 487 | |
---|
| 488 | G4LogicalVolume* logicWindow = new G4LogicalVolume(solidWindow, |
---|
| 489 | fWindowMat, "Window"); |
---|
| 490 | |
---|
| 491 | G4double zWindow = zGap - fGapThick/2. - fWindowThick/2. - 0.01*mm ; |
---|
| 492 | |
---|
| 493 | G4VPhysicalVolume* physiWindow = new G4PVPlacement(0, |
---|
| 494 | G4ThreeVector(0.,0.,zWindow), |
---|
| 495 | "Window",logicWindow,physiWorld,false,0); |
---|
| 496 | |
---|
| 497 | ************ */ |
---|
| 498 | |
---|
| 499 | // Absorber |
---|
| 500 | |
---|
| 501 | if (AbsorberThickness > 0.) |
---|
| 502 | { |
---|
| 503 | if(solidAbsorber) delete solidAbsorber ; |
---|
| 504 | if(logicAbsorber) delete logicAbsorber ; |
---|
| 505 | if(physiAbsorber) delete physiAbsorber ; |
---|
| 506 | |
---|
| 507 | solidAbsorber = new G4Tubs("Absorber", |
---|
| 508 | 0.,AbsorberRadius,AbsorberThickness/2.,0.,twopi); |
---|
| 509 | |
---|
| 510 | logicAbsorber = new G4LogicalVolume(solidAbsorber, |
---|
| 511 | AbsorberMaterial, |
---|
| 512 | "Absorber"); |
---|
| 513 | |
---|
| 514 | physiAbsorber = new G4PVPlacement(0, |
---|
| 515 | G4ThreeVector(0.,0.,zAbsorber), |
---|
| 516 | "Absorber", |
---|
| 517 | logicAbsorber, |
---|
| 518 | physiWorld, |
---|
| 519 | false, |
---|
| 520 | 0); |
---|
| 521 | |
---|
| 522 | } |
---|
| 523 | |
---|
| 524 | // Sensitive Detectors: Absorber |
---|
| 525 | |
---|
| 526 | G4SDManager* SDman = G4SDManager::GetSDMpointer(); |
---|
| 527 | |
---|
| 528 | if(!calorimeterSD) |
---|
| 529 | { |
---|
| 530 | calorimeterSD = new F02CalorimeterSD("CalorSD",this); |
---|
| 531 | SDman->AddNewDetector( calorimeterSD ); |
---|
| 532 | } |
---|
| 533 | if (logicAbsorber) logicAbsorber->SetSensitiveDetector(calorimeterSD); |
---|
| 534 | |
---|
| 535 | return physiWorld; |
---|
| 536 | } |
---|
| 537 | |
---|
| 538 | //////////////////////////////////////////////////////////////////////////// |
---|
| 539 | // |
---|
| 540 | // |
---|
| 541 | |
---|
| 542 | void F02DetectorConstruction::PrintCalorParameters() |
---|
| 543 | { |
---|
| 544 | G4cout << "\n The WORLD is made of " |
---|
| 545 | << WorldSizeZ/mm << "mm of " << WorldMaterial->GetName() ; |
---|
| 546 | G4cout << ", the transverse size (R) of the world is " << WorldSizeR/mm << " mm. " << G4endl; |
---|
| 547 | G4cout << " The ABSORBER is made of " |
---|
| 548 | << AbsorberThickness/mm << "mm of " << AbsorberMaterial->GetName() ; |
---|
| 549 | G4cout << ", the transverse size (R) is " << AbsorberRadius/mm << " mm. " << G4endl; |
---|
| 550 | G4cout << " Z position of the (middle of the) absorber " << zAbsorber/mm << " mm." << G4endl; |
---|
| 551 | G4cout << G4endl; |
---|
| 552 | } |
---|
| 553 | |
---|
| 554 | /////////////////////////////////////////////////////////////////////////// |
---|
| 555 | // |
---|
| 556 | // |
---|
| 557 | |
---|
| 558 | void F02DetectorConstruction::SetAbsorberMaterial(G4String materialChoice) |
---|
| 559 | { |
---|
| 560 | // search the material by its name |
---|
| 561 | G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice); |
---|
| 562 | if (pttoMaterial) |
---|
| 563 | { |
---|
| 564 | AbsorberMaterial = pttoMaterial; |
---|
| 565 | logicAbsorber->SetMaterial(pttoMaterial); |
---|
| 566 | PrintCalorParameters(); |
---|
| 567 | } |
---|
| 568 | } |
---|
| 569 | |
---|
| 570 | //////////////////////////////////////////////////////////////////////////// |
---|
| 571 | // |
---|
| 572 | // |
---|
| 573 | |
---|
| 574 | void F02DetectorConstruction::SetWorldMaterial(G4String materialChoice) |
---|
| 575 | { |
---|
| 576 | // search the material by its name |
---|
| 577 | G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice); |
---|
| 578 | if (pttoMaterial) |
---|
| 579 | { |
---|
| 580 | WorldMaterial = pttoMaterial; |
---|
| 581 | logicWorld->SetMaterial(pttoMaterial); |
---|
| 582 | PrintCalorParameters(); |
---|
| 583 | } |
---|
| 584 | } |
---|
| 585 | |
---|
| 586 | /////////////////////////////////////////////////////////////////////////// |
---|
| 587 | // |
---|
| 588 | // |
---|
| 589 | |
---|
| 590 | void F02DetectorConstruction::SetAbsorberThickness(G4double val) |
---|
| 591 | { |
---|
| 592 | // change Absorber thickness and recompute the calorimeter parameters |
---|
| 593 | AbsorberThickness = val; |
---|
| 594 | ComputeCalorParameters(); |
---|
| 595 | } |
---|
| 596 | |
---|
| 597 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 598 | // |
---|
| 599 | // |
---|
| 600 | |
---|
| 601 | void F02DetectorConstruction::SetAbsorberRadius(G4double val) |
---|
| 602 | { |
---|
| 603 | // change the transverse size and recompute the calorimeter parameters |
---|
| 604 | AbsorberRadius = val; |
---|
| 605 | ComputeCalorParameters(); |
---|
| 606 | } |
---|
| 607 | |
---|
| 608 | //////////////////////////////////////////////////////////////////////////// |
---|
| 609 | // |
---|
| 610 | // |
---|
| 611 | |
---|
| 612 | void F02DetectorConstruction::SetWorldSizeZ(G4double val) |
---|
| 613 | { |
---|
| 614 | worldchanged=true; |
---|
| 615 | WorldSizeZ = val; |
---|
| 616 | ComputeCalorParameters(); |
---|
| 617 | } |
---|
| 618 | |
---|
| 619 | /////////////////////////////////////////////////////////////////////////// |
---|
| 620 | // |
---|
| 621 | // |
---|
| 622 | |
---|
| 623 | void F02DetectorConstruction::SetWorldSizeR(G4double val) |
---|
| 624 | { |
---|
| 625 | worldchanged=true; |
---|
| 626 | WorldSizeR = val; |
---|
| 627 | ComputeCalorParameters(); |
---|
| 628 | } |
---|
| 629 | |
---|
| 630 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 631 | // |
---|
| 632 | // |
---|
| 633 | |
---|
| 634 | void F02DetectorConstruction::SetAbsorberZpos(G4double val) |
---|
| 635 | { |
---|
| 636 | zAbsorber = val; |
---|
| 637 | ComputeCalorParameters(); |
---|
| 638 | } |
---|
| 639 | |
---|
| 640 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 641 | // |
---|
| 642 | // |
---|
| 643 | |
---|
| 644 | void F02DetectorConstruction::SetMagField(G4double fieldValue) |
---|
| 645 | { |
---|
| 646 | //apply a global uniform magnetic field along X axis |
---|
| 647 | |
---|
| 648 | /* ********************************************************* |
---|
| 649 | |
---|
| 650 | G4FieldManager* fieldMgr |
---|
| 651 | = G4TransportationManager::GetTransportationManager()->GetFieldManager(); |
---|
| 652 | |
---|
| 653 | if(magField) delete magField; //delete the existing magn field |
---|
| 654 | |
---|
| 655 | if(fieldValue!=0.) // create a new one if non nul |
---|
| 656 | { |
---|
| 657 | magField = new G4UniformMagField(G4ThreeVector(fieldValue,0.,0.)); |
---|
| 658 | fieldMgr->SetDetectorField(magField); |
---|
| 659 | fieldMgr->CreateChordFinder(magField); |
---|
| 660 | } |
---|
| 661 | else |
---|
| 662 | { |
---|
| 663 | magField = NULL; |
---|
| 664 | fieldMgr->SetDetectorField(magField); |
---|
| 665 | } |
---|
| 666 | |
---|
| 667 | *************************************************************** */ |
---|
| 668 | |
---|
| 669 | } |
---|
| 670 | |
---|
| 671 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 672 | // |
---|
| 673 | // |
---|
| 674 | |
---|
| 675 | void F02DetectorConstruction::UpdateGeometry() |
---|
| 676 | { |
---|
| 677 | G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter()); |
---|
| 678 | } |
---|
| 679 | |
---|
| 680 | // |
---|
| 681 | // |
---|
| 682 | //////////////////////////////////////////////////////////////////////////// |
---|
| 683 | |
---|
| 684 | |
---|
| 685 | |
---|
| 686 | |
---|
| 687 | |
---|
| 688 | |
---|
| 689 | |
---|
| 690 | |
---|
| 691 | |
---|
| 692 | |
---|
| 693 | |
---|
| 694 | |
---|
| 695 | |
---|
| 696 | |
---|
| 697 | |
---|
| 698 | |
---|
| 699 | |
---|