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