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 field/field03/src/F03DetectorConstru << 27 /// \brief Implementation of the F03DetectorCo << 28 // 26 // >> 27 // $Id: F03DetectorConstruction.cc,v 1.12 2006/06/29 17:19:23 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-03-patch-02 $ 29 // 29 // 30 // << 30 // 31 // << 32 //....oooOO0OOooo........oooOO0OOooo........oo << 33 //....oooOO0OOooo........oooOO0OOooo........oo << 34 31 35 #include "F03DetectorConstruction.hh" 32 #include "F03DetectorConstruction.hh" 36 << 37 #include "F03CalorimeterSD.hh" << 38 #include "F03DetectorMessenger.hh" 33 #include "F03DetectorMessenger.hh" >> 34 #include "F03CalorimeterSD.hh" >> 35 #include "F03FieldSetup.hh" 39 36 40 #include "G4AutoDelete.hh" << 41 #include "G4GeometryManager.hh" << 42 #include "G4FieldBuilder.hh" << 43 #include "G4LogicalVolume.hh" << 44 #include "G4LogicalVolumeStore.hh" << 45 #include "G4Material.hh" 37 #include "G4Material.hh" >> 38 #include "G4Tubs.hh" >> 39 #include "G4LogicalVolume.hh" 46 #include "G4PVPlacement.hh" 40 #include "G4PVPlacement.hh" 47 #include "G4PhysicalConstants.hh" << 41 #include "G4UniformMagField.hh" 48 #include "G4PhysicalVolumeStore.hh" << 42 #include "G4FieldManager.hh" 49 #include "G4RunManager.hh" << 43 #include "G4TransportationManager.hh" 50 #include "G4SDManager.hh" 44 #include "G4SDManager.hh" >> 45 #include "G4RunManager.hh" >> 46 >> 47 #include "G4GeometryManager.hh" >> 48 #include "G4PhysicalVolumeStore.hh" >> 49 #include "G4LogicalVolumeStore.hh" 51 #include "G4SolidStore.hh" 50 #include "G4SolidStore.hh" 52 #include "G4SystemOfUnits.hh" << 53 #include "G4Tubs.hh" << 54 #include "G4UniformMagField.hh" << 55 51 56 //....oooOO0OOooo........oooOO0OOooo........oo << 52 #include "G4ios.hh" >> 53 >> 54 ///////////////////////////////////////////////////////////////////////////// >> 55 // >> 56 // 57 57 58 F03DetectorConstruction::F03DetectorConstructi 58 F03DetectorConstruction::F03DetectorConstruction() >> 59 : solidWorld(0), logicWorld(0), physiWorld(0), >> 60 solidAbsorber(0),logicAbsorber(0), physiAbsorber(0), >> 61 magField(0), fEmFieldSetup(0), calorimeterSD(0), >> 62 AbsorberMaterial(0), fRadiatorMat(0), worldchanged(false), WorldMaterial(0) 59 { 63 { 60 fDetectorMessenger = new F03DetectorMessenge << 64 // default parameter values of the calorimeter >> 65 >> 66 WorldSizeZ = 44000.*mm; >> 67 WorldSizeR = 22000.*mm; >> 68 >> 69 AbsorberThickness = 1.0*mm; >> 70 >> 71 AbsorberRadius = 20000.*mm; >> 72 >> 73 zAbsorber = 21990.0*mm ; >> 74 >> 75 fRadThickness = 100*mm ; >> 76 fGasGap = 100*mm ; >> 77 fFoilNumber = 1 ; 61 78 62 // create field builder << 79 fDetGap = 1.0*mm ; 63 // this will create commands for field param << 64 G4FieldBuilder* fieldBuilder = G4FieldBuilde << 65 // fieldBuilder->SetVerboseLevel(2); << 66 80 67 auto globalFieldParameters = fieldBuilder->G << 81 fStartR = 40*cm ; 68 auto localFieldParameters = fieldBuilder->Cr << 82 fStartZ = 10.0*mm ; 69 83 70 // set default min step 0.25 mm << 84 // create commands for interactive definition of the calorimeter 71 globalFieldParameters->SetMinimumStep(0.25 * << 72 localFieldParameters->SetMinimumStep(0.25 * << 73 85 74 // create materials << 86 detectorMessenger = new F03DetectorMessenger(this); >> 87 75 DefineMaterials(); 88 DefineMaterials(); >> 89 >> 90 fEmFieldSetup = new F03FieldSetup() ; 76 } 91 } 77 92 78 //....oooOO0OOooo........oooOO0OOooo........oo << 93 ////////////////////////////////////////////////////////////////////////// >> 94 // >> 95 // 79 96 80 F03DetectorConstruction::~F03DetectorConstruct 97 F03DetectorConstruction::~F03DetectorConstruction() 81 { << 98 { 82 delete fDetectorMessenger; << 99 delete detectorMessenger; >> 100 if (fEmFieldSetup) delete fEmFieldSetup ; 83 } 101 } 84 102 85 //....oooOO0OOooo........oooOO0OOooo........oo << 103 ////////////////////////////////////////////////////////////////////////// >> 104 // >> 105 // 86 106 87 G4VPhysicalVolume* F03DetectorConstruction::Co 107 G4VPhysicalVolume* F03DetectorConstruction::Construct() 88 { 108 { 89 return ConstructCalorimeter(); 109 return ConstructCalorimeter(); 90 } 110 } 91 111 92 //....oooOO0OOooo........oooOO0OOooo........oo << 112 ////////////////////////////////////////////////////////////////////////////// >> 113 // >> 114 // 93 115 94 void F03DetectorConstruction::DefineMaterials( 116 void F03DetectorConstruction::DefineMaterials() 95 { << 117 { 96 // This function illustrates the possible wa 118 // This function illustrates the possible ways to define materials 97 << 119 98 G4String name, symbol; // a=mass of a mole; << 120 G4String name, symbol ; // a=mass of a mole; 99 G4double a, z, density; // z=mean number of << 121 G4double a, z, density ; // z=mean number of protons; 100 G4int nel; << 122 G4int nel ; 101 G4int ncomponents; 123 G4int ncomponents; 102 G4double fractionmass, pressure, temperature 124 G4double fractionmass, pressure, temperature; 103 125 104 // 126 // 105 // define Elements 127 // define Elements 106 // 128 // 107 129 108 a = 1.01 * g / mole; << 130 a = 1.01*g/mole; 109 auto elH = new G4Element(name = "Hydrogen", << 131 G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); 110 132 111 a = 12.01 * g / mole; << 133 a = 12.01*g/mole; 112 auto elC = new G4Element(name = "Carbon", sy << 134 G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a); 113 135 114 a = 14.01 * g / mole; << 136 a = 14.01*g/mole; 115 auto elN = new G4Element(name = "Nitrogen", << 137 G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a); 116 138 117 a = 16.00 * g / mole; << 139 a = 16.00*g/mole; 118 auto elO = new G4Element(name = "Oxygen", sy << 140 G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); 119 141 120 a = 39.948 * g / mole; << 142 a = 39.948*g/mole; 121 auto elAr = new G4Element(name = "Argon", sy << 143 G4Element* elAr = new G4Element(name="Argon", symbol="Ar", z=18., a); 122 144 123 // 145 // 124 // define simple materials 146 // define simple materials 125 // 147 // 126 148 127 // Mylar 149 // Mylar 128 150 129 density = 1.39 * g / cm3; << 151 density = 1.39*g/cm3; 130 auto mylar = new G4Material(name = "Mylar", << 152 G4Material* Mylar = new G4Material(name="Mylar", density, nel=3); 131 mylar->AddElement(elO, 2); << 153 Mylar->AddElement(elO,2); 132 mylar->AddElement(elC, 5); << 154 Mylar->AddElement(elC,5); 133 mylar->AddElement(elH, 4); << 155 Mylar->AddElement(elH,4); 134 156 135 // Polypropelene 157 // Polypropelene 136 158 137 auto CH2 = new G4Material("Polypropelene", 0 << 159 G4Material* CH2 = new G4Material ("Polypropelene" , 0.91*g/cm3, 2); 138 CH2->AddElement(elH, 2); << 160 CH2->AddElement(elH,2); 139 CH2->AddElement(elC, 1); << 161 CH2->AddElement(elC,1); 140 162 141 // Krypton as detector gas, STP 163 // Krypton as detector gas, STP 142 164 143 density = 3.700 * mg / cm3; << 165 density = 3.700*mg/cm3 ; 144 a = 83.80 * g / mole; << 166 a = 83.80*g/mole ; 145 auto Kr = new G4Material(name = "Kr", z = 36 << 167 G4Material* Kr = new G4Material(name="Kr",z=36., a, density ); 146 168 147 // Dry air (average composition) 169 // Dry air (average composition) 148 170 149 density = 1.7836 * mg / cm3; // STP << 171 density = 1.7836*mg/cm3 ; // STP 150 auto argon = new G4Material(name = "Argon", << 172 G4Material* Argon = new G4Material(name="Argon" , density, ncomponents=1); 151 argon->AddElement(elAr, 1); << 173 Argon->AddElement(elAr, 1); 152 << 174 153 density = 1.25053 * mg / cm3; // STP << 175 density = 1.25053*mg/cm3 ; // STP 154 auto nitrogen = new G4Material(name = "N2", << 176 G4Material* Nitrogen = new G4Material(name="N2" , density, ncomponents=1); 155 nitrogen->AddElement(elN, 2); << 177 Nitrogen->AddElement(elN, 2); 156 << 178 157 density = 1.4289 * mg / cm3; // STP << 179 density = 1.4289*mg/cm3 ; // STP 158 auto oxygen = new G4Material(name = "O2", de << 180 G4Material* Oxygen = new G4Material(name="O2" , density, ncomponents=1); 159 oxygen->AddElement(elO, 2); << 181 Oxygen->AddElement(elO, 2); 160 182 161 density = 1.2928 * mg / cm3; // STP << 183 density = 1.2928*mg/cm3 ; // STP 162 density *= 1.0e-8; // pumped vacuum << 184 density *= 1.0e-8 ; // pumped vacuum 163 temperature = STP_Temperature; 185 temperature = STP_Temperature; 164 pressure = 1.0e-8 * STP_Pressure; << 186 pressure = 1.0e-8*STP_Pressure; 165 187 166 auto air = << 188 G4Material* Air = new G4Material(name="Air" , density, ncomponents=3, 167 new G4Material(name = "Air", density, ncom << 189 kStateGas,temperature,pressure); 168 air->AddMaterial(nitrogen, fractionmass = 0. << 190 Air->AddMaterial( Nitrogen, fractionmass = 0.7557 ) ; 169 air->AddMaterial(oxygen, fractionmass = 0.23 << 191 Air->AddMaterial( Oxygen, fractionmass = 0.2315 ) ; 170 air->AddMaterial(argon, fractionmass = 0.012 << 192 Air->AddMaterial( Argon, fractionmass = 0.0128 ) ; 171 193 172 // Xenon as detector gas, STP 194 // Xenon as detector gas, STP 173 195 174 density = 5.858 * mg / cm3; << 196 density = 5.858*mg/cm3 ; 175 a = 131.29 * g / mole; << 197 a = 131.29*g/mole ; 176 auto Xe = new G4Material(name = "Xenon", z = << 198 G4Material* Xe = new G4Material(name="Xenon",z=54., a, density ); 177 199 178 // Carbon dioxide, STP 200 // Carbon dioxide, STP 179 201 180 density = 1.842 * mg / cm3; << 202 density = 1.977*mg/cm3; 181 auto CarbonDioxide = new G4Material(name = " << 203 G4Material* CarbonDioxide = new G4Material(name="CO2", density, nel=2); 182 CarbonDioxide->AddElement(elC, 1); << 204 CarbonDioxide->AddElement(elC,1); 183 CarbonDioxide->AddElement(elO, 2); << 205 CarbonDioxide->AddElement(elO,2); 184 206 185 // 80% Xe + 20% CO2, STP 207 // 80% Xe + 20% CO2, STP 186 208 187 density = 5.0818 * mg / cm3; << 209 density = 5.0818*mg/cm3 ; 188 auto Xe20CO2 = new G4Material(name = "Xe20CO << 210 G4Material* Xe20CO2 = new G4Material(name="Xe20CO2" , density, ncomponents=2); 189 Xe20CO2->AddMaterial(Xe, fractionmass = 0.92 << 211 Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 ) ; 190 Xe20CO2->AddMaterial(CarbonDioxide, fraction << 212 Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 ) ; 191 213 192 // 80% Kr + 20% CO2, STP 214 // 80% Kr + 20% CO2, STP 193 215 194 density = 3.601 * mg / cm3; << 216 density = 3.601*mg/cm3 ; 195 auto Kr20CO2 = new G4Material(name = "Kr20CO << 217 G4Material* Kr20CO2 = new G4Material(name="Kr20CO2" , density, 196 Kr20CO2->AddMaterial(Kr, fractionmass = 0.89 << 218 ncomponents=2); 197 Kr20CO2->AddMaterial(CarbonDioxide, fraction << 219 Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 ) ; >> 220 Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 ) ; 198 221 199 G4cout << *(G4Material::GetMaterialTable()) << 200 222 201 // default materials of the calorimeter and << 223 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 202 224 203 fRadiatorMat = air; // CH2 ; // mylar; << 225 //default materials of the calorimeter and TR radiator 204 226 205 fAbsorberMaterial = air; // Kr20CO2; // << 227 fRadiatorMat = Air ; // CH2 ; // Mylar ; >> 228 >> 229 AbsorberMaterial = Air ; // Kr20CO2 ; // XeCO2CF4 ; 206 230 207 fWorldMaterial = air; << 231 WorldMaterial = Air ; 208 } 232 } 209 233 210 //....oooOO0OOooo........oooOO0OOooo........oo << 234 ///////////////////////////////////////////////////////////////////////// 211 << 235 // >> 236 // >> 237 212 G4VPhysicalVolume* F03DetectorConstruction::Co 238 G4VPhysicalVolume* F03DetectorConstruction::ConstructCalorimeter() 213 { 239 { >> 240 G4int j ; >> 241 G4double zModule, zRadiator; >> 242 >> 243 // complete the Calor parameters definition and Print >> 244 >> 245 ComputeCalorParameters(); >> 246 PrintCalorParameters(); >> 247 214 // Cleanup old geometry 248 // Cleanup old geometry 215 249 216 if (fPhysiWorld) { << 250 if (physiWorld) >> 251 { 217 G4GeometryManager::GetInstance()->OpenGeom 252 G4GeometryManager::GetInstance()->OpenGeometry(); 218 G4PhysicalVolumeStore::GetInstance()->Clea 253 G4PhysicalVolumeStore::GetInstance()->Clean(); 219 G4LogicalVolumeStore::GetInstance()->Clean 254 G4LogicalVolumeStore::GetInstance()->Clean(); 220 G4SolidStore::GetInstance()->Clean(); 255 G4SolidStore::GetInstance()->Clean(); 221 } 256 } 222 257 223 // complete the Calor parameters definition << 258 solidWorld = new G4Tubs("World", // its name 224 << 259 0.,WorldSizeR,WorldSizeZ/2.,0.,twopi); // its size 225 ComputeCalorParameters(); << 260 226 PrintCalorParameters(); << 261 logicWorld = new G4LogicalVolume(solidWorld, // its solid 227 << 262 WorldMaterial, // its material 228 G4bool checkOverlaps = true; << 263 "World"); // its name 229 << 264 230 fSolidWorld = new G4Tubs("World", // its na << 265 physiWorld = new G4PVPlacement(0, // no rotation 231 0., fWorldSizeR, fW << 266 G4ThreeVector(), // at (0,0,0) 232 << 267 "World", // its name 233 fLogicWorld = new G4LogicalVolume(fSolidWorl << 268 logicWorld, // its logical volume 234 fWorldMate << 269 0, // its mother volume 235 "World"); << 270 false, // no boolean operation 236 << 271 0); // copy number 237 fPhysiWorld = new G4PVPlacement(nullptr, // << 238 G4ThreeVecto << 239 "World", // << 240 fLogicWorld, << 241 nullptr, // << 242 false, // n << 243 0, // copy << 244 checkOverlap << 245 272 246 // TR radiator envelope 273 // TR radiator envelope 247 G4double radThick = fFoilNumber * (fRadThick << 248 G4double zRad = fZAbsorber - 0.5 * (radThick << 249 << 250 G4cout << "zRad = " << zRad / mm << " mm" << << 251 G4cout << "radThick = " << radThick / mm << << 252 G4cout << "fFoilNumber = " << fFoilNumber << << 253 G4cout << "fRadiatorMat = " << fRadiatorMat- << 254 G4cout << "WorldMaterial = " << fWorldMateri << 255 << 256 fSolidRadiator = new G4Tubs("Radiator", 0.0, << 257 << 258 fLogicRadiator = new G4LogicalVolume(fSolidR << 259 274 260 fPhysiRadiator = new G4PVPlacement(nullptr, << 275 G4double radThick = fFoilNumber*(fRadThickness + fGasGap) + fDetGap ; 261 fPhysiWor << 262 276 263 fSolidRadSlice = new G4Tubs("RadSlice", 0.0, << 277 G4double zRad = zAbsorber - 20*cm - 0.5*radThick ; 264 << 278 G4cout<<"zRad = "<<zRad/mm<<" mm"<<G4endl ; 265 fLogicRadSlice = new G4LogicalVolume(fSolidR << 266 << 267 // Radiator slice << 268 G4double radSliceThick = fRadThickness + fGa << 269 G4double zStart = 0.5 * (-radThick + radSlic << 270 // start on the board of radiator enevelope << 271 << 272 for (G4int j = 0; j < fFoilNumber; j++) { << 273 G4double zSlice = zStart + j * radSliceThi << 274 G4cout << zSlice / mm << " mm" << 275 << "\t"; << 276 << 277 fPhysiRadSlice = new G4PVPlacement(nullptr << 278 fLogicR << 279 } << 280 G4cout << G4endl; << 281 279 >> 280 radThick *= 1.02 ; >> 281 G4cout<<"radThick = "<<radThick/mm<<" mm"<<G4endl ; >> 282 G4cout<<"fFoilNumber = "<<fFoilNumber<<G4endl ; >> 283 G4cout<<"fRadiatorMat = "<<fRadiatorMat->GetName()<<G4endl ; >> 284 G4cout<<"WorldMaterial = "<<WorldMaterial->GetName()<<G4endl ; >> 285 >> 286 solidRadiator = new G4Tubs("Radiator",0.0, >> 287 1.01*AbsorberRadius, >> 288 0.5*radThick,0.0,twopi ) ; >> 289 >> 290 logicRadiator = new G4LogicalVolume(solidRadiator, >> 291 WorldMaterial, >> 292 "Radiator"); >> 293 >> 294 // Set local field manager and local field in radiator and its daughters: >> 295 >> 296 G4bool allLocal = true ; >> 297 >> 298 logicRadiator->SetFieldManager( fEmFieldSetup->GetLocalFieldManager(), >> 299 allLocal ) ; >> 300 >> 301 >> 302 physiRadiator = new G4PVPlacement(0, >> 303 G4ThreeVector(0,0,zRad), >> 304 "Radiator", logicRadiator, >> 305 physiWorld, false, 0 ); >> 306 >> 307 fSolidRadSlice = new G4Tubs("RadSlice",0.0, >> 308 AbsorberRadius,0.5*fRadThickness,0.0,twopi ) ; >> 309 >> 310 fLogicRadSlice = new G4LogicalVolume(fSolidRadSlice,fRadiatorMat, >> 311 "RadSlice",0,0,0); >> 312 >> 313 zModule = zRad + 0.5*radThick/1.02 ; >> 314 G4cout<<"zModule = "<<zModule/mm<<" mm"<<G4endl ; >> 315 >> 316 for(j=0;j<fFoilNumber;j++) >> 317 { >> 318 >> 319 zRadiator = zModule - j*(fRadThickness + fGasGap) ; >> 320 G4cout<<zRadiator/mm<<" mm"<<"\t" ; >> 321 // G4cout<<"j = "<<j<<"\t" ; >> 322 >> 323 fPhysicRadSlice = new G4PVPlacement(0,G4ThreeVector(0.,0.,zRadiator-zRad), >> 324 "RadSlice",fLogicRadSlice, >> 325 physiRadiator,false,j); >> 326 } >> 327 G4cout<<G4endl ; >> 328 282 // Absorber 329 // Absorber 283 330 284 fSolidAbsorber = << 331 if (AbsorberThickness > 0.) 285 new G4Tubs("Absorber", 1.0 * mm, fAbsorber << 332 { 286 << 333 solidAbsorber = new G4Tubs("Absorber", 1.0*mm, 287 fLogicAbsorber = new G4LogicalVolume(fSolidA << 334 AbsorberRadius, 288 << 335 AbsorberThickness/2., 289 fPhysiAbsorber = new G4PVPlacement(nullptr, << 336 0.0,twopi); 290 fLogicAbs << 337 >> 338 logicAbsorber = new G4LogicalVolume(solidAbsorber, >> 339 AbsorberMaterial, >> 340 "Absorber"); >> 341 >> 342 physiAbsorber = new G4PVPlacement(0, >> 343 G4ThreeVector(0.,0.,zAbsorber), >> 344 "Absorber", >> 345 logicAbsorber, >> 346 physiWorld, >> 347 false, >> 348 0); >> 349 } >> 350 >> 351 // Sensitive Detectors: Absorber >> 352 >> 353 G4SDManager* SDman = G4SDManager::GetSDMpointer(); >> 354 >> 355 if(!calorimeterSD) >> 356 { >> 357 calorimeterSD = new F03CalorimeterSD("CalorSD",this); >> 358 SDman->AddNewDetector( calorimeterSD ); >> 359 } >> 360 if (logicAbsorber) logicAbsorber->SetSensitiveDetector(calorimeterSD); 291 361 292 return fPhysiWorld; << 362 return physiWorld; 293 } 363 } 294 364 295 //....oooOO0OOooo........oooOO0OOooo........oo << 365 //////////////////////////////////////////////////////////////////////////// >> 366 // >> 367 // 296 368 297 void F03DetectorConstruction::PrintCalorParame 369 void F03DetectorConstruction::PrintCalorParameters() 298 { 370 { 299 G4cout << "\n The WORLD is made of " << f << 371 G4cout << "\n The WORLD is made of " 300 << fWorldMaterial->GetName(); << 372 << WorldSizeZ/mm << "mm of " << WorldMaterial->GetName() ; 301 G4cout << ", the transverse size (R) of the << 373 G4cout << ", the transverse size (R) of the world is " << WorldSizeR/mm << " mm. " << G4endl; 302 G4cout << " The ABSORBER is made of " << fAb << 374 G4cout << " The ABSORBER is made of " 303 << fAbsorberMaterial->GetName(); << 375 << AbsorberThickness/mm << "mm of " << AbsorberMaterial->GetName() ; 304 G4cout << ", the transverse size (R) is " << << 376 G4cout << ", the transverse size (R) is " << AbsorberRadius/mm << " mm. " << G4endl; 305 G4cout << " Z position of the (middle of the << 377 G4cout << " Z position of the (middle of the) absorber " << zAbsorber/mm << " mm." << G4endl; 306 G4cout << G4endl; 378 G4cout << G4endl; 307 } 379 } 308 380 309 //....oooOO0OOooo........oooOO0OOooo........oo << 381 /////////////////////////////////////////////////////////////////////////// >> 382 // >> 383 // 310 384 311 void F03DetectorConstruction::SetAbsorberMater 385 void F03DetectorConstruction::SetAbsorberMaterial(G4String materialChoice) 312 { 386 { 313 // get the pointer to the material table 387 // get the pointer to the material table 314 const G4MaterialTable* theMaterialTable = G4 388 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 315 389 316 // search the material by its name << 390 // search the material by its name 317 G4Material* material; << 391 G4Material* pttoMaterial; 318 for (size_t j = 0; j < theMaterialTable->siz << 392 for (size_t J=0 ; J<theMaterialTable->size() ; J++) 319 material = (*theMaterialTable)[j]; << 393 { 320 if (material->GetName() == materialChoice) << 394 pttoMaterial = (*theMaterialTable)[J]; 321 fAbsorberMaterial = material; << 395 if(pttoMaterial->GetName() == materialChoice) 322 fLogicAbsorber->SetMaterial(material); << 396 { 323 G4RunManager::GetRunManager()->PhysicsHa << 397 AbsorberMaterial = pttoMaterial; 324 } << 398 logicAbsorber->SetMaterial(pttoMaterial); 325 } << 399 } >> 400 } 326 } 401 } 327 402 328 //....oooOO0OOooo........oooOO0OOooo........oo << 403 //////////////////////////////////////////////////////////////////////////// >> 404 // >> 405 // 329 406 330 void F03DetectorConstruction::SetWorldMaterial 407 void F03DetectorConstruction::SetWorldMaterial(G4String materialChoice) 331 { 408 { 332 // get the pointer to the material table 409 // get the pointer to the material table 333 const G4MaterialTable* theMaterialTable = G4 410 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 334 411 335 // search the material by its name << 412 // search the material by its name 336 G4Material* material; << 413 G4Material* pttoMaterial; 337 for (size_t j = 0; j < theMaterialTable->siz << 414 for (size_t J=0 ; J<theMaterialTable->size() ; J++) 338 material = (*theMaterialTable)[j]; << 415 { 339 if (material->GetName() == materialChoice) << 416 pttoMaterial = (*theMaterialTable)[J]; 340 fWorldMaterial = material; << 417 if(pttoMaterial->GetName() == materialChoice) 341 fLogicWorld->SetMaterial(material); << 418 { 342 G4RunManager::GetRunManager()->PhysicsHa << 419 WorldMaterial = pttoMaterial; 343 } << 420 logicWorld->SetMaterial(pttoMaterial); 344 } << 421 } >> 422 } 345 } 423 } 346 424 347 //....oooOO0OOooo........oooOO0OOooo........oo << 425 /////////////////////////////////////////////////////////////////////////// >> 426 // >> 427 // 348 428 349 void F03DetectorConstruction::SetAbsorberThick 429 void F03DetectorConstruction::SetAbsorberThickness(G4double val) 350 { 430 { 351 // change Absorber thickness and recompute t 431 // change Absorber thickness and recompute the calorimeter parameters 352 fAbsorberThickness = val; << 432 AbsorberThickness = val; 353 ComputeCalorParameters(); 433 ComputeCalorParameters(); 354 G4RunManager::GetRunManager()->GeometryHasBe << 434 } 355 } << 356 435 357 //....oooOO0OOooo........oooOO0OOooo........oo << 436 ///////////////////////////////////////////////////////////////////////////// >> 437 // >> 438 // 358 439 359 void F03DetectorConstruction::SetAbsorberRadiu 440 void F03DetectorConstruction::SetAbsorberRadius(G4double val) 360 { 441 { 361 // change the transverse size and recompute 442 // change the transverse size and recompute the calorimeter parameters 362 fAbsorberRadius = val; << 443 AbsorberRadius = val; 363 ComputeCalorParameters(); 444 ComputeCalorParameters(); 364 G4RunManager::GetRunManager()->GeometryHasBe << 445 } 365 } << 366 446 367 //....oooOO0OOooo........oooOO0OOooo........oo << 447 //////////////////////////////////////////////////////////////////////////// >> 448 // >> 449 // 368 450 369 void F03DetectorConstruction::SetWorldSizeZ(G4 451 void F03DetectorConstruction::SetWorldSizeZ(G4double val) 370 { 452 { 371 fWorldSizeZ = val; << 453 worldchanged=true; >> 454 WorldSizeZ = val; 372 ComputeCalorParameters(); 455 ComputeCalorParameters(); 373 G4RunManager::GetRunManager()->GeometryHasBe << 456 } 374 } << 375 457 376 //....oooOO0OOooo........oooOO0OOooo........oo << 458 /////////////////////////////////////////////////////////////////////////// >> 459 // >> 460 // 377 461 378 void F03DetectorConstruction::SetWorldSizeR(G4 462 void F03DetectorConstruction::SetWorldSizeR(G4double val) 379 { 463 { 380 fWorldSizeR = val; << 464 worldchanged=true; >> 465 WorldSizeR = val; 381 ComputeCalorParameters(); 466 ComputeCalorParameters(); 382 G4RunManager::GetRunManager()->GeometryHasBe << 467 } 383 } << 384 468 385 //....oooOO0OOooo........oooOO0OOooo........oo << 469 ////////////////////////////////////////////////////////////////////////////// >> 470 // >> 471 // 386 472 387 void F03DetectorConstruction::SetAbsorberZpos( 473 void F03DetectorConstruction::SetAbsorberZpos(G4double val) 388 { 474 { 389 fZAbsorber = val; << 475 zAbsorber = val; 390 ComputeCalorParameters(); 476 ComputeCalorParameters(); 391 G4RunManager::GetRunManager()->GeometryHasBe << 477 } 392 } << 393 << 394 //....oooOO0OOooo........oooOO0OOooo........oo << 395 << 396 void F03DetectorConstruction::SetFieldValue(G4 << 397 { << 398 fFieldVector = value; << 399 << 400 G4UniformMagField* magField = nullptr; << 401 if (fFieldVector != G4ThreeVector(0.,0.,0.)) << 402 magField = new G4UniformMagField(fFieldVec << 403 } << 404 478 405 // Set field to the field builder << 406 auto fieldBuilder = G4FieldBuilder::Instance << 407 fieldBuilder->SetGlobalField(magField); << 408 } << 409 479 410 //....oooOO0OOooo........oooOO0OOooo........oo << 480 /////////////////////////////////////////////////////////////////////////////// 411 << 481 // 412 << 482 // 413 void F03DetectorConstruction::SetLocalFieldVal << 483 414 { << 484 void F03DetectorConstruction::UpdateGeometry() 415 fLocalFieldVector = value; << 416 << 417 G4UniformMagField* magField = nullptr; << 418 if (fLocalFieldVector != G4ThreeVector(0.,0. << 419 magField = new G4UniformMagField(fLocalFie << 420 } << 421 << 422 // Set field to the field builder << 423 auto fieldBuilder = G4FieldBuilder::Instance << 424 fieldBuilder->SetLocalField(magField, fLogic << 425 } << 426 << 427 //....oooOO0OOooo........oooOO0OOooo........oo << 428 << 429 void F03DetectorConstruction::ConstructSDandFi << 430 { 485 { 431 // Sensitive Detectors: Absorber << 486 G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter()); 432 << 433 if (!fCalorimeterSD.Get()) { << 434 auto calorimeterSD = new F03CalorimeterSD( << 435 fCalorimeterSD.Put(calorimeterSD); << 436 } << 437 G4SDManager::GetSDMpointer()->AddNewDetector << 438 SetSensitiveDetector(fLogicAbsorber, fCalori << 439 << 440 // Create detector fields << 441 SetFieldValue(fFieldVector); << 442 SetLocalFieldValue(fLocalFieldVector); << 443 << 444 // Construct all Geant4 field objects << 445 auto fieldBuilder = G4FieldBuilder::Instance << 446 fieldBuilder->ConstructFieldSetup(); << 447 } 487 } 448 488 449 //....oooOO0OOooo........oooOO0OOooo........oo << 489 // >> 490 // >> 491 //////////////////////////////////////////////////////////////////////////// 450 492