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