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