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