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/field01/src/F01DetectorConstru 26 /// \file field/field01/src/F01DetectorConstruction.cc 27 /// \brief Implementation of the F01DetectorCo 27 /// \brief Implementation of the F01DetectorConstruction class 28 // 28 // 29 // 29 // >> 30 // $Id: F01DetectorConstruction.cc 77881 2013-11-29 08:37:53Z gcosmo $ 30 // 31 // 31 // 32 // 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 //....oooOO0OOooo........oooOO0OOooo........oo 34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 34 35 35 #include "F01DetectorConstruction.hh" 36 #include "F01DetectorConstruction.hh" >> 37 #include "F01DetectorMessenger.hh" 36 38 37 #include "F01CalorimeterSD.hh" 39 #include "F01CalorimeterSD.hh" 38 #include "F01DetectorMessenger.hh" << 40 #include "F01FieldSetup.hh" 39 41 40 #include "G4AutoDelete.hh" << 41 #include "G4GeometryManager.hh" 42 #include "G4GeometryManager.hh" 42 #include "G4FieldBuilder.hh" << 43 #include "G4PhysicalVolumeStore.hh" 43 #include "G4LogicalVolume.hh" << 44 #include "G4LogicalVolumeStore.hh" 44 #include "G4LogicalVolumeStore.hh" >> 45 #include "G4SolidStore.hh" >> 46 45 #include "G4Material.hh" 47 #include "G4Material.hh" >> 48 #include "G4Tubs.hh" >> 49 #include "G4LogicalVolume.hh" 46 #include "G4PVPlacement.hh" 50 #include "G4PVPlacement.hh" 47 #include "G4PhysicalConstants.hh" << 48 #include "G4PhysicalVolumeStore.hh" << 49 #include "G4RunManager.hh" 51 #include "G4RunManager.hh" 50 #include "G4SDManager.hh" << 52 #include "G4AutoDelete.hh" 51 #include "G4SolidStore.hh" << 53 >> 54 #include "G4PhysicalConstants.hh" 52 #include "G4SystemOfUnits.hh" 55 #include "G4SystemOfUnits.hh" 53 #include "G4Tubs.hh" << 54 #include "G4UniformMagField.hh" << 55 56 56 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 57 58 58 F01DetectorConstruction::F01DetectorConstructi 59 F01DetectorConstruction::F01DetectorConstruction() 59 { << 60 : G4VUserDetectorConstruction(), 60 // create commands for interactive definitio << 61 fDetectorMessenger(0), >> 62 fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0), >> 63 fSolidAbsorber(0), fLogicAbsorber(0), fPhysiAbsorber(0), >> 64 fAbsorberMaterial(0), fAbsorberThickness(0.), fAbsorberRadius(0.), >> 65 fZAbsorber(0.), fZStartAbs(0.), fZEndAbs(0.), >> 66 fWorldMaterial(0), fWorldSizeR(0.), fWorldSizeZ(0.) >> 67 { >> 68 // default parameter values of the calorimeter 61 69 62 G4cout << "F01DetectorConstruction::F01Detec << 70 fWorldSizeZ = 44000.*mm; >> 71 fWorldSizeR = 22000.*mm; 63 72 64 fDetectorMessenger = new F01DetectorMessenge << 73 fAbsorberThickness = 1.0*mm; >> 74 >> 75 fAbsorberRadius = 20000.*mm; >> 76 fZAbsorber = 21990.0*mm; >> 77 >> 78 // create commands for interactive definition of the calorimeter 65 79 66 // create field builder << 80 fDetectorMessenger = new F01DetectorMessenger(this); 67 // this will create commands for field confi << 68 G4FieldBuilder::Instance(); << 69 // G4FieldBuilder::Instance()->SetVerboseLev << 70 81 71 // create materials 82 // create materials 72 83 73 DefineMaterials(); 84 DefineMaterials(); >> 85 74 } 86 } 75 87 76 //....oooOO0OOooo........oooOO0OOooo........oo 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 89 78 F01DetectorConstruction::~F01DetectorConstruct 90 F01DetectorConstruction::~F01DetectorConstruction() 79 { 91 { 80 // delete fDetectorMessenger; << 92 delete fDetectorMessenger; 81 } 93 } 82 94 83 //....oooOO0OOooo........oooOO0OOooo........oo 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 96 85 G4VPhysicalVolume* F01DetectorConstruction::Co 97 G4VPhysicalVolume* F01DetectorConstruction::Construct() 86 { 98 { 87 return ConstructCalorimeter(); 99 return ConstructCalorimeter(); 88 } 100 } 89 101 90 //....oooOO0OOooo........oooOO0OOooo........oo 102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 91 103 92 void F01DetectorConstruction::DefineMaterials( 104 void F01DetectorConstruction::DefineMaterials() 93 { 105 { 94 // This function illustrates the possible wa << 106 //This function illustrates the possible ways to define materials 95 << 107 96 G4String name, symbol; // a=mass of a mole; << 108 G4String name, symbol; // a=mass of a mole; 97 G4double a, z, density; // z=mean number of << 109 G4double a, z, density; // z=mean number of protons; 98 G4int nel; 110 G4int nel; 99 G4int ncomponents; 111 G4int ncomponents; 100 G4double fractionmass, pressure, temperature 112 G4double fractionmass, pressure, temperature; 101 113 102 // 114 // 103 // define Elements 115 // define Elements 104 // 116 // 105 117 106 a = 1.01 * g / mole; << 118 a = 1.01*g/mole; 107 auto elH = new G4Element(name = "Hydrogen", << 119 G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); 108 120 109 a = 12.01 * g / mole; << 121 a = 12.01*g/mole; 110 auto elC = new G4Element(name = "Carbon", sy << 122 G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a); 111 123 112 a = 14.01 * g / mole; << 124 a = 14.01*g/mole; 113 auto elN = new G4Element(name = "Nitrogen", << 125 G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a); 114 126 115 a = 16.00 * g / mole; << 127 a = 16.00*g/mole; 116 auto elO = new G4Element(name = "Oxygen", sy << 128 G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); 117 129 118 a = 39.948 * g / mole; << 130 a = 39.948*g/mole; 119 auto elAr = new G4Element(name = "Argon", sy << 131 G4Element* elAr = new G4Element(name="Argon", symbol="Ar", z=18., a); 120 132 121 // 133 // 122 // define simple materials 134 // define simple materials 123 // 135 // 124 136 125 // Mylar 137 // Mylar 126 138 127 density = 1.39 * g / cm3; << 139 density = 1.39*g/cm3; 128 auto mylar = new G4Material(name = "Mylar", << 140 G4Material* mylar = new G4Material(name="Mylar", density, nel=3); 129 mylar->AddElement(elO, 2); << 141 mylar->AddElement(elO,2); 130 mylar->AddElement(elC, 5); << 142 mylar->AddElement(elC,5); 131 mylar->AddElement(elH, 4); << 143 mylar->AddElement(elH,4); 132 144 133 // Polypropelene 145 // Polypropelene 134 146 135 auto CH2 = new G4Material("Polypropelene", 0 << 147 G4Material* CH2 = new G4Material ("Polypropelene" , 0.91*g/cm3, 2); 136 CH2->AddElement(elH, 2); << 148 CH2->AddElement(elH,2); 137 CH2->AddElement(elC, 1); << 149 CH2->AddElement(elC,1); 138 150 139 // Krypton as detector gas, STP 151 // Krypton as detector gas, STP 140 152 141 density = 3.700 * mg / cm3; << 153 density = 3.700*mg/cm3; 142 a = 83.80 * g / mole; << 154 a = 83.80*g/mole; 143 auto Kr = new G4Material(name = "Kr", z = 36 << 155 G4Material* Kr = new G4Material(name="Kr",z=36., a, density ); 144 156 145 // Dry air (average composition) 157 // Dry air (average composition) 146 158 147 density = 1.7836 * mg / cm3; // STP << 159 density = 1.7836*mg/cm3; // STP 148 auto argon = new G4Material(name = "Argon", << 160 G4Material* argon = new G4Material(name="Argon" , density, ncomponents=1); 149 argon->AddElement(elAr, 1); 161 argon->AddElement(elAr, 1); 150 162 151 density = 1.25053 * mg / cm3; // STP << 163 density = 1.25053*mg/cm3; // STP 152 auto nitrogen = new G4Material(name = "N2", << 164 G4Material* nitrogen = new G4Material(name="N2" , density, ncomponents=1); 153 nitrogen->AddElement(elN, 2); 165 nitrogen->AddElement(elN, 2); 154 166 155 density = 1.4289 * mg / cm3; // STP << 167 density = 1.4289*mg/cm3; // STP 156 auto oxygen = new G4Material(name = "O2", de << 168 G4Material* oxygen = new G4Material(name="O2" , density, ncomponents=1); 157 oxygen->AddElement(elO, 2); 169 oxygen->AddElement(elO, 2); 158 170 159 density = 1.2928 * mg / cm3; // STP << 171 density = 1.2928*mg/cm3; // STP 160 density *= 1.0e-8; // pumped vacuum << 172 density *= 1.0e-8; // pumped vacuum 161 173 162 temperature = STP_Temperature; 174 temperature = STP_Temperature; 163 pressure = 1.0e-8 * STP_Pressure; << 175 pressure = 1.0e-8*STP_Pressure; 164 176 165 auto air = << 177 G4Material* air = new G4Material(name="Air" , density, ncomponents=3, 166 new G4Material(name = "Air", density, ncom << 178 kStateGas,temperature,pressure); 167 air->AddMaterial(nitrogen, fractionmass = 0. << 179 air->AddMaterial( nitrogen, fractionmass = 0.7557 ); 168 air->AddMaterial(oxygen, fractionmass = 0.23 << 180 air->AddMaterial( oxygen, fractionmass = 0.2315 ); 169 181 170 air->AddMaterial(argon, fractionmass = 0.012 << 182 air->AddMaterial( argon, fractionmass = 0.0128 ); 171 183 172 // Xenon as detector gas, STP 184 // Xenon as detector gas, STP 173 185 174 density = 5.858 * mg / cm3; << 186 density = 5.858*mg/cm3; 175 a = 131.29 * g / mole; << 187 a = 131.29*g/mole; 176 auto Xe = new G4Material(name = "Xenon", z = << 188 G4Material* Xe = new G4Material(name="Xenon",z=54., a, density ); 177 189 178 // Carbon dioxide, STP 190 // Carbon dioxide, STP 179 191 180 density = 1.842 * mg / cm3; << 192 density = 1.842*mg/cm3; 181 auto CarbonDioxide = new G4Material(name = " << 193 G4Material* CarbonDioxide = new G4Material(name="CO2", density, nel=2); 182 CarbonDioxide->AddElement(elC, 1); << 194 CarbonDioxide->AddElement(elC,1); 183 CarbonDioxide->AddElement(elO, 2); << 195 CarbonDioxide->AddElement(elO,2); 184 196 185 // 80% Xe + 20% CO2, STP 197 // 80% Xe + 20% CO2, STP 186 198 187 density = 5.0818 * mg / cm3; << 199 density = 5.0818*mg/cm3; 188 auto Xe20CO2 = new G4Material(name = "Xe20CO << 200 G4Material* Xe20CO2 = new G4Material(name="Xe20CO2", density, ncomponents=2); 189 Xe20CO2->AddMaterial(Xe, fractionmass = 0.92 << 201 Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 ); 190 Xe20CO2->AddMaterial(CarbonDioxide, fraction << 202 Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 ); 191 203 192 // 80% Kr + 20% CO2, STP 204 // 80% Kr + 20% CO2, STP 193 205 194 density = 3.601 * mg / cm3; << 206 density = 3.601*mg/cm3; 195 auto Kr20CO2 = new G4Material(name = "Kr20CO << 207 G4Material* Kr20CO2 = new G4Material(name="Kr20CO2", density, ncomponents=2); 196 Kr20CO2->AddMaterial(Kr, fractionmass = 0.89 << 208 Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 ); 197 Kr20CO2->AddMaterial(CarbonDioxide, fraction << 209 Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 ); 198 << 199 // Print material table -- silence it for no << 200 // G4cout << *(G4Material::GetMaterialTable( << 201 G4cout << "F01DetectorConstruction: not prin << 202 << G4endl; << 203 210 204 // default materials of the calorimeter << 211 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 205 212 206 fAbsorberMaterial = air; // Kr20CO2; // << 213 // default materials of the calorimeter >> 214 >> 215 fAbsorberMaterial = air; // Kr20CO2; // XeCO2CF4; 207 216 208 fWorldMaterial = air; << 217 fWorldMaterial = air; 209 } 218 } 210 219 211 //....oooOO0OOooo........oooOO0OOooo........oo 220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 212 221 213 G4VPhysicalVolume* F01DetectorConstruction::Co 222 G4VPhysicalVolume* F01DetectorConstruction::ConstructCalorimeter() 214 { 223 { 215 // In case an old geometry is present... cle << 224 // Cleanup old geometry 216 225 217 if (fPhysiWorld) { << 226 if (fPhysiWorld) >> 227 { 218 G4GeometryManager::GetInstance()->OpenGeom 228 G4GeometryManager::GetInstance()->OpenGeometry(); 219 G4PhysicalVolumeStore::GetInstance()->Clea 229 G4PhysicalVolumeStore::GetInstance()->Clean(); 220 G4LogicalVolumeStore::GetInstance()->Clean 230 G4LogicalVolumeStore::GetInstance()->Clean(); 221 G4SolidStore::GetInstance()->Clean(); 231 G4SolidStore::GetInstance()->Clean(); 222 } 232 } 223 233 224 // Compute the Calor parameters definition a << 234 // complete the Calor parameters definition and Print 225 235 226 ComputeCalorParameters(); 236 ComputeCalorParameters(); 227 PrintCalorParameters(); 237 PrintCalorParameters(); 228 << 238 229 // World 239 // World 230 240 231 fSolidWorld = new G4Tubs("World", // its na << 241 fSolidWorld = new G4Tubs("World", // its name 232 0., fWorldSizeR, fW << 242 0.,fWorldSizeR,fWorldSizeZ/2.,0.,twopi);// its size 233 243 234 fLogicWorld = new G4LogicalVolume(fSolidWorl << 244 fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid 235 fWorldMate << 245 fWorldMaterial, // its material 236 "World"); << 246 "World"); // its name 237 << 247 238 fPhysiWorld = new G4PVPlacement(nullptr, // << 248 fPhysiWorld = new G4PVPlacement(0, // no rotation 239 G4ThreeVecto << 249 G4ThreeVector(), // at (0,0,0) 240 "World", // << 250 "World", // its name 241 fLogicWorld, << 251 fLogicWorld, // its logical volume 242 nullptr, // << 252 0, // its mother volume 243 false, // n << 253 false, // no boolean op. 244 0); // copy << 254 0); // copy number 245 // Absorber 255 // Absorber 246 256 247 fSolidAbsorber = << 257 fSolidAbsorber = new G4Tubs("Absorber", 1.0*mm, 248 new G4Tubs("Absorber", 1.0 * mm, fAbsorber << 258 fAbsorberRadius, 249 << 259 fAbsorberThickness/2., 250 fLogicAbsorber = new G4LogicalVolume(fSolidA << 260 0.0,twopi); 251 << 261 252 fPhysiAbsorber = new G4PVPlacement(nullptr, << 262 fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, 253 fLogicAbs << 263 fAbsorberMaterial, >> 264 "Absorber"); >> 265 >> 266 fPhysiAbsorber = new G4PVPlacement(0, >> 267 G4ThreeVector(0.,0.,fZAbsorber), >> 268 "Absorber", >> 269 fLogicAbsorber, >> 270 fPhysiWorld, >> 271 false, >> 272 0); 254 273 255 return fPhysiWorld; 274 return fPhysiWorld; 256 } 275 } 257 276 258 //....oooOO0OOooo........oooOO0OOooo........oo 277 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 259 278 260 void F01DetectorConstruction::PrintCalorParame 279 void F01DetectorConstruction::PrintCalorParameters() 261 { 280 { 262 G4cout << "\n The WORLD is made of " << f << 281 G4cout << "\n The WORLD is made of " 263 << fWorldMaterial->GetName(); << 282 << fWorldSizeZ/mm << "mm of " << fWorldMaterial->GetName(); 264 G4cout << ", the transverse size (R) of the << 283 G4cout << ", the transverse size (R) of the world is " 265 G4cout << " The ABSORBER is made of " << fAb << 284 << fWorldSizeR/mm << " mm. " << G4endl; 266 << fAbsorberMaterial->GetName(); << 285 G4cout << " The ABSORBER is made of " 267 G4cout << ", the transverse size (R) is " << << 286 << fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName(); 268 G4cout << " Z position of the (middle of the << 287 G4cout << ", the transverse size (R) is " << fAbsorberRadius/mm >> 288 << " mm. " << G4endl; >> 289 G4cout << " Z position of the (middle of the) absorber " >> 290 << fZAbsorber/mm << " mm." << G4endl; 269 G4cout << G4endl; 291 G4cout << G4endl; 270 } 292 } 271 293 272 //....oooOO0OOooo........oooOO0OOooo........oo 294 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 273 295 274 void F01DetectorConstruction::SetAbsorberMater 296 void F01DetectorConstruction::SetAbsorberMaterial(G4String materialChoice) 275 { 297 { 276 // get the pointer to the material table 298 // get the pointer to the material table 277 const G4MaterialTable* theMaterialTable = G4 299 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 278 300 279 // search the material by its name 301 // search the material by its name 280 G4Material* material; 302 G4Material* material; 281 for (size_t j = 0; j < theMaterialTable->siz << 303 for (size_t j=0 ; j<theMaterialTable->size() ; j++) 282 material = (*theMaterialTable)[j]; << 304 { material = (*theMaterialTable)[j]; 283 if (material->GetName() == materialChoice) << 305 if (material->GetName() == materialChoice) 284 fAbsorberMaterial = material; << 306 { 285 fLogicAbsorber->SetMaterial(material); << 307 fAbsorberMaterial = material; 286 G4RunManager::GetRunManager()->PhysicsHa << 308 fLogicAbsorber->SetMaterial(material); 287 } << 309 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 288 } << 310 } >> 311 } 289 } 312 } 290 313 291 //....oooOO0OOooo........oooOO0OOooo........oo 314 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 292 315 293 void F01DetectorConstruction::SetWorldMaterial 316 void F01DetectorConstruction::SetWorldMaterial(G4String materialChoice) 294 { 317 { 295 // get the pointer to the material table 318 // get the pointer to the material table 296 const G4MaterialTable* theMaterialTable = G4 319 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 297 320 298 // search the material by its name 321 // search the material by its name 299 G4Material* material; 322 G4Material* material; 300 for (size_t j = 0; j < theMaterialTable->siz << 323 for (size_t j=0 ; j<theMaterialTable->size() ; j++) 301 material = (*theMaterialTable)[j]; << 324 { material = (*theMaterialTable)[j]; 302 if (material->GetName() == materialChoice) << 325 if(material->GetName() == materialChoice) 303 fWorldMaterial = material; << 326 { 304 fLogicWorld->SetMaterial(material); << 327 fWorldMaterial = material; 305 G4RunManager::GetRunManager()->PhysicsHa << 328 fLogicWorld->SetMaterial(material); 306 } << 329 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 307 } << 330 } >> 331 } 308 } 332 } 309 333 310 //....oooOO0OOooo........oooOO0OOooo........oo 334 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 311 335 312 void F01DetectorConstruction::SetAbsorberThick 336 void F01DetectorConstruction::SetAbsorberThickness(G4double val) 313 { 337 { 314 // change Absorber thickness and recompute t 338 // change Absorber thickness and recompute the calorimeter parameters 315 fAbsorberThickness = val; 339 fAbsorberThickness = val; 316 ComputeCalorParameters(); 340 ComputeCalorParameters(); 317 G4RunManager::GetRunManager()->GeometryHasBe << 341 G4RunManager::GetRunManager()->ReinitializeGeometry(); 318 } 342 } 319 343 320 //....oooOO0OOooo........oooOO0OOooo........oo 344 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 321 345 322 void F01DetectorConstruction::SetAbsorberRadiu 346 void F01DetectorConstruction::SetAbsorberRadius(G4double val) 323 { 347 { 324 // change the transverse size and recompute 348 // change the transverse size and recompute the calorimeter parameters 325 fAbsorberRadius = val; 349 fAbsorberRadius = val; 326 ComputeCalorParameters(); 350 ComputeCalorParameters(); 327 G4RunManager::GetRunManager()->GeometryHasBe << 351 G4RunManager::GetRunManager()->ReinitializeGeometry(); 328 } 352 } 329 353 330 //....oooOO0OOooo........oooOO0OOooo........oo 354 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 331 355 332 void F01DetectorConstruction::SetWorldSizeZ(G4 356 void F01DetectorConstruction::SetWorldSizeZ(G4double val) 333 { 357 { 334 fWorldSizeZ = val; 358 fWorldSizeZ = val; 335 ComputeCalorParameters(); 359 ComputeCalorParameters(); 336 G4RunManager::GetRunManager()->GeometryHasBe << 360 G4RunManager::GetRunManager()->ReinitializeGeometry(); 337 } 361 } 338 362 339 //....oooOO0OOooo........oooOO0OOooo........oo 363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 340 364 341 void F01DetectorConstruction::SetWorldSizeR(G4 365 void F01DetectorConstruction::SetWorldSizeR(G4double val) 342 { 366 { 343 fWorldSizeR = val; 367 fWorldSizeR = val; 344 ComputeCalorParameters(); 368 ComputeCalorParameters(); 345 G4RunManager::GetRunManager()->GeometryHasBe << 369 G4RunManager::GetRunManager()->ReinitializeGeometry(); 346 } 370 } 347 371 348 //....oooOO0OOooo........oooOO0OOooo........oo 372 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 349 373 350 void F01DetectorConstruction::SetAbsorberZpos( 374 void F01DetectorConstruction::SetAbsorberZpos(G4double val) 351 { 375 { 352 fZAbsorber = val; 376 fZAbsorber = val; 353 ComputeCalorParameters(); 377 ComputeCalorParameters(); 354 G4RunManager::GetRunManager()->GeometryHasBe << 378 G4RunManager::GetRunManager()->ReinitializeGeometry(); 355 } 379 } 356 380 357 //....oooOO0OOooo........oooOO0OOooo........oo 381 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 358 382 359 void F01DetectorConstruction::SetFieldValue(G4 << 360 { << 361 fFieldVector = value; << 362 << 363 G4UniformMagField* magField = nullptr; << 364 if (fFieldVector != G4ThreeVector(0.,0.,0.)) << 365 magField = new G4UniformMagField(fFieldVec << 366 } << 367 << 368 // Set field to the field builder << 369 auto fieldBuilder = G4FieldBuilder::Instance << 370 fieldBuilder->SetGlobalField(magField); << 371 } << 372 << 373 //....oooOO0OOooo........oooOO0OOooo........oo << 374 #include "G4FieldManager.hh" << 375 << 376 void F01DetectorConstruction::ConstructSDandFi 383 void F01DetectorConstruction::ConstructSDandField() 377 { 384 { 378 // Sensitive Detectors: Absorber 385 // Sensitive Detectors: Absorber 379 386 380 if (!fCalorimeterSD.Get()) { 387 if (!fCalorimeterSD.Get()) { 381 auto calorimeterSD = new F01CalorimeterSD( << 388 F01CalorimeterSD* calorimeterSD = new F01CalorimeterSD("CalorSD",this); 382 fCalorimeterSD.Put(calorimeterSD); 389 fCalorimeterSD.Put(calorimeterSD); 383 } 390 } 384 G4SDManager::GetSDMpointer()->AddNewDetector << 385 SetSensitiveDetector(fLogicAbsorber, fCalori 391 SetSensitiveDetector(fLogicAbsorber, fCalorimeterSD.Get()); 386 392 387 // Create detector field << 393 // Construct the field creator - this will register the field it creates 388 SetFieldValue(fFieldVector); << 394 if (!fEmFieldSetup.Get()) { 389 << 395 F01FieldSetup* fieldSetup 390 // Construct all Geant4 field objects << 396 = new F01FieldSetup(G4ThreeVector( 3.3*tesla, 0.0, 0.0 ) ); 391 auto fieldBuilder = G4FieldBuilder::Instance << 397 G4AutoDelete::Register(fieldSetup); // Kernel will delete the F01FieldSetup 392 fieldBuilder->ConstructFieldSetup(); << 398 fEmFieldSetup.Put(fieldSetup); >> 399 } 393 } 400 } 394 401 395 //....oooOO0OOooo........oooOO0OOooo........oo 402 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 396 403