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 electromagnetic/TestEm7/src/Detector 26 /// \file electromagnetic/TestEm7/src/DetectorConstruction.cc 27 /// \brief Implementation of the DetectorConst 27 /// \brief Implementation of the DetectorConstruction class 28 // 28 // >> 29 // $Id: DetectorConstruction.cc 68263 2013-03-20 10:16:46Z maire $ 29 // 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "DetectorConstruction.hh" 34 #include "DetectorConstruction.hh" 34 << 35 #include "DetectorMessenger.hh" 35 #include "DetectorMessenger.hh" 36 36 >> 37 #include "G4Material.hh" 37 #include "G4Box.hh" 38 #include "G4Box.hh" 38 #include "G4FieldManager.hh" << 39 #include "G4GeometryManager.hh" << 40 #include "G4LogicalVolume.hh" 39 #include "G4LogicalVolume.hh" 41 #include "G4LogicalVolumeStore.hh" << 42 #include "G4Material.hh" << 43 #include "G4NistManager.hh" << 44 #include "G4PVPlacement.hh" 40 #include "G4PVPlacement.hh" 45 #include "G4PhysicalConstants.hh" << 41 #include "G4UniformMagField.hh" >> 42 >> 43 #include "G4GeometryManager.hh" 46 #include "G4PhysicalVolumeStore.hh" 44 #include "G4PhysicalVolumeStore.hh" 47 #include "G4RunManager.hh" << 45 #include "G4LogicalVolumeStore.hh" 48 #include "G4SolidStore.hh" 46 #include "G4SolidStore.hh" 49 #include "G4SystemOfUnits.hh" << 47 50 #include "G4TransportationManager.hh" << 48 #include "G4NistManager.hh" 51 #include "G4UniformMagField.hh" << 52 #include "G4UnitsTable.hh" 49 #include "G4UnitsTable.hh" 53 50 >> 51 #include "G4FieldManager.hh" >> 52 #include "G4TransportationManager.hh" >> 53 #include "G4RunManager.hh" >> 54 >> 55 #include "G4PhysicalConstants.hh" >> 56 #include "G4SystemOfUnits.hh" >> 57 54 //....oooOO0OOooo........oooOO0OOooo........oo 58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 55 59 56 DetectorConstruction::DetectorConstruction() 60 DetectorConstruction::DetectorConstruction() 57 : G4VUserDetectorConstruction(), fMagField(n << 61 : G4VUserDetectorConstruction(), >> 62 fWorldMaterial(0),fAbsorMaterial(0),fMagField(0),fLAbsor(0), >> 63 fDetectorMessenger(0) 58 { 64 { 59 // default parameter values 65 // default parameter values 60 fAbsorSizeX = fAbsorSizeYZ = 20 * cm; << 66 fAbsorSizeX = fAbsorSizeYZ = 20*cm; 61 fWorldSizeX = fWorldSizeYZ = 1.2 * fAbsorSiz << 67 fWorldSizeX = fWorldSizeYZ = 1.2*fAbsorSizeX; 62 << 68 63 fTallyNumber = 0; << 69 fWorldMaterial = fAbsorMaterial = 0; 64 for (G4int j = 0; j < kMaxTally; j++) { << 70 fMagField = 0; 65 fTallySize[j] = fTallyPosition[j] = G4Thre << 71 fLAbsor = 0; 66 fTallyMass[j] = 0.; << 72 67 fLTally[j] = nullptr; << 73 fTallyNumber = 0; >> 74 for (G4int j=0; j<MaxTally; j++) { >> 75 fTallySize[j] = fTallyPosition[j] = G4ThreeVector(); >> 76 fTallyMaterial[j] = 0; >> 77 fTallyMass[j] = 0.; >> 78 fLTally[j] = 0; 68 } 79 } 69 << 80 70 DefineMaterials(); 81 DefineMaterials(); >> 82 SetMaterial("Water"); >> 83 for (G4int j=0; j<MaxTally; j++) { SetTallyMaterial(j,"Water");}; 71 84 72 // create commands for interactive definitio << 85 // create commands for interactive definition of the detector 73 fDetectorMessenger = new DetectorMessenger(t 86 fDetectorMessenger = new DetectorMessenger(this); 74 } 87 } 75 88 76 //....oooOO0OOooo........oooOO0OOooo........oo 89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 90 78 DetectorConstruction::~DetectorConstruction() 91 DetectorConstruction::~DetectorConstruction() >> 92 { delete fDetectorMessenger;} >> 93 >> 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 95 >> 96 G4VPhysicalVolume* DetectorConstruction::Construct() 79 { 97 { 80 delete fDetectorMessenger; << 98 return ConstructVolumes(); 81 } 99 } 82 100 83 //....oooOO0OOooo........oooOO0OOooo........oo 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 102 85 void DetectorConstruction::DefineMaterials() 103 void DetectorConstruction::DefineMaterials() 86 { << 104 { 87 // 105 // 88 // define Elements 106 // define Elements 89 // 107 // 90 G4double z, a; 108 G4double z, a; 91 109 92 G4Element* H = new G4Element("Hydrogen", "H" << 110 G4Element* H = new G4Element("Hydrogen", "H", z= 1, a= 1.008*g/mole); 93 G4Element* N = new G4Element("Nitrogen", "N" << 111 G4Element* N = new G4Element("Nitrogen", "N", z= 7, a= 14.01*g/mole); 94 G4Element* O = new G4Element("Oxygen", "O", << 112 G4Element* O = new G4Element("Oxygen" , "O", z= 8, a= 16.00*g/mole); 95 113 96 // 114 // 97 // define Materials. 115 // define Materials. 98 // 116 // 99 G4double density, temperature, pressure; 117 G4double density, temperature, pressure; 100 G4int ncomponents, natoms; << 118 G4int ncomponents, natoms; 101 G4double fractionmass; 119 G4double fractionmass; 102 << 120 103 G4Material* H2O = new G4Material("Water", de << 121 G4Material* H2O = 104 H2O->AddElement(H, natoms = 2); << 122 new G4Material("Water", density= 1.0*g/cm3, ncomponents=2); 105 H2O->AddElement(O, natoms = 1); << 123 H2O->AddElement(H, natoms=2); 106 H2O->GetIonisation()->SetMeanExcitationEnerg << 124 H2O->AddElement(O, natoms=1); >> 125 H2O->GetIonisation()->SetMeanExcitationEnergy(78.0*eV); 107 126 108 // In this line both G4_WATER and Water_1.05 127 // In this line both G4_WATER and Water_1.05 will be constructed 109 G4NistManager::Instance()->BuildMaterialWith << 128 G4NistManager::Instance()-> >> 129 BuildMaterialWithNewDensity("Water_1.05","G4_WATER",1.05*g/cm3); 110 130 111 G4Material* Air = new G4Material("Air", dens << 131 G4Material* Air = 112 Air->AddElement(N, fractionmass = 0.7); << 132 new G4Material("Air" , density= 1.290*mg/cm3, ncomponents=2); 113 Air->AddElement(O, fractionmass = 0.3); << 133 Air->AddElement(N, fractionmass=0.7); >> 134 Air->AddElement(O, fractionmass=0.3); 114 135 115 density = 1.e-5 * g / cm3; << 136 density = 1.e-5*g/cm3; 116 pressure = 2.e-2 * bar; << 137 pressure = 2.e-2*bar; 117 temperature = STP_Temperature; // From Phys 138 temperature = STP_Temperature; // From PhysicalConstants.h . 118 G4Material* vac = new G4Material("TechVacuum << 139 G4Material* vac = new G4Material( "TechVacuum", density, 1, 119 vac->AddMaterial(Air, 1.); << 140 kStateGas, temperature, pressure ); 120 << 141 vac->AddMaterial( Air, 1. ); 121 density = universe_mean_density; // from Ph << 142 122 pressure = 3.e-18 * pascal; << 143 density = universe_mean_density; //from PhysicalConstants.h 123 temperature = 2.73 * kelvin; << 144 pressure = 3.e-18*pascal; 124 G4Material* vacuum = new G4Material("Galacti << 145 temperature = 2.73*kelvin; 125 temperat << 146 G4Material* vacuum = >> 147 new G4Material("Galactic",z= 1,a= 1.008*g/mole,density, >> 148 kStateGas,temperature,pressure); 126 149 127 // default materials << 150 //default materials 128 fAbsorMaterial = H2O; << 129 fWorldMaterial = vacuum; 151 fWorldMaterial = vacuum; 130 } 152 } 131 153 132 //....oooOO0OOooo........oooOO0OOooo........oo 154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 133 << 155 134 G4VPhysicalVolume* DetectorConstruction::Const << 156 G4VPhysicalVolume* DetectorConstruction::ConstructVolumes() 135 { 157 { 136 // World << 158 G4GeometryManager::GetInstance()->OpenGeometry(); 137 // << 159 G4PhysicalVolumeStore::GetInstance()->Clean(); 138 G4Box* sWorld = new G4Box("World", // name << 160 G4LogicalVolumeStore::GetInstance()->Clean(); 139 fWorldSizeX / 2, f << 161 G4SolidStore::GetInstance()->Clean(); 140 162 141 fLWorld = new G4LogicalVolume(sWorld, // sh << 163 // World 142 fWorldMaterial << 143 "World"); // << 144 << 145 G4VPhysicalVolume* pWorld = new G4PVPlacemen << 146 << 147 << 148 << 149 << 150 << 151 << 152 // 164 // >> 165 G4Box* >> 166 sWorld = new G4Box("World", //name >> 167 fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2); //dimensions >> 168 >> 169 G4LogicalVolume* >> 170 lWorld = new G4LogicalVolume(sWorld, //shape >> 171 fWorldMaterial, //material >> 172 "World"); //name >> 173 >> 174 G4VPhysicalVolume* >> 175 pWorld = new G4PVPlacement(0, //no rotation >> 176 G4ThreeVector(), //at (0,0,0) >> 177 lWorld, //logical volume >> 178 "World", //name >> 179 0, //mother volume >> 180 false, //no boolean operation >> 181 0); //copy number >> 182 // 153 // Absorber 183 // Absorber 154 // << 184 // 155 G4Box* sAbsor = new G4Box("Absorber", // na << 185 G4Box* 156 fAbsorSizeX / 2, f << 186 sAbsor = new G4Box("Absorber", //name 157 << 187 fAbsorSizeX/2,fAbsorSizeYZ/2,fAbsorSizeYZ/2); //dimensions 158 fLAbsor = new G4LogicalVolume(sAbsor, // sh << 188 159 fAbsorMaterial << 189 fLAbsor = new G4LogicalVolume(sAbsor, //shape 160 "Absorber"); << 190 fAbsorMaterial, //material 161 << 191 "Absorber"); //name 162 new G4PVPlacement(0, // no rotation << 192 163 G4ThreeVector(0., 0., 0.), << 193 164 fLAbsor, // logical volum << 194 new G4PVPlacement(0, //no rotation 165 "Absorber", // name << 195 G4ThreeVector(), //at (0,0,0) 166 fLWorld, // mother volum << 196 fLAbsor, //logical volume 167 false, // no boolean oper << 197 "Absorber", //name 168 0); // copy number << 198 lWorld, //mother volume >> 199 false, //no boolean operation >> 200 0); //copy number 169 // 201 // 170 // Tallies (optional) 202 // Tallies (optional) 171 // 203 // 172 if (fTallyNumber > 0) { 204 if (fTallyNumber > 0) { 173 for (G4int j = 0; j < fTallyNumber; ++j) { << 205 for (G4int j=1; j<=fTallyNumber; j++) { 174 G4Box* sTally = << 206 175 new G4Box("Tally", fTallySize[j].x() / << 207 G4Box* sTally = new G4Box("Tally", 176 << 208 fTallySize[j].x()/2,fTallySize[j].y()/2,fTallySize[j].z()/2); 177 fLTally[j] = new G4LogicalVolume(sTally, << 209 178 << 210 fLTally[j] = new G4LogicalVolume(sTally,fTallyMaterial[j],"Tally"); 179 new G4PVPlacement(0, // no rotation << 211 180 fTallyPosition[j], // << 212 new G4PVPlacement(0, //no rotation 181 fLTally[j], // logica << 213 fTallyPosition[j], //position 182 "Tally", // name << 214 fLTally[j], //logical volume 183 fLAbsor, // mother v << 215 "Tally", //name 184 false, // no boolean << 216 fLAbsor, //mother volume 185 j + 1); // copy numbe << 217 false, //no boolean operation 186 << 218 j); //copy number 187 fTallyMass[j] = << 219 188 fTallySize[j].x() * fTallySize[j].y() << 220 fTallyMass[j] = fTallySize[j].x()*fTallySize[j].y()*fTallySize[j].z() 189 } << 221 *(fTallyMaterial[j]->GetDensity()); 190 } << 222 } >> 223 } 191 224 192 PrintParameters(); 225 PrintParameters(); 193 << 226 194 // << 195 // always return the World volume << 196 // 227 // >> 228 //always return the World volume >> 229 // 197 return pWorld; 230 return pWorld; 198 } 231 } 199 232 200 //....oooOO0OOooo........oooOO0OOooo........oo 233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 201 234 202 void DetectorConstruction::PrintParameters() c << 235 void DetectorConstruction::PrintParameters() 203 { 236 { 204 G4cout << *(G4Material::GetMaterialTable()) 237 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 205 G4cout << "\n------------------------------- 238 G4cout << "\n---------------------------------------------------------\n"; 206 G4cout << "---> The Absorber is " << G4BestU << 239 G4cout << "---> The Absorber is " << G4BestUnit(fAbsorSizeX,"Length") 207 << fAbsorMaterial->GetName() << G4end << 240 << " of " << fAbsorMaterial->GetName() << G4endl; 208 G4cout << "\n------------------------------- 241 G4cout << "\n---------------------------------------------------------\n"; 209 << 242 210 if (fTallyNumber > 0) { 243 if (fTallyNumber > 0) { 211 G4cout << "---> There are " << fTallyNumbe << 244 G4cout << "---> There are " << fTallyNumber << " tallies : " << G4endl; 212 for (G4int j = 0; j < fTallyNumber; ++j) { << 245 for (G4int j=1; j<=fTallyNumber; j++) { 213 G4cout << "fTally " << j << ": " << fAbs << 246 G4cout << "fTally " << j << ": " 214 << ", mass = " << G4BestUnit(fTa << 247 << fTallyMaterial[j]->GetName() 215 << " size = " << G4BestUnit(fTall << 248 << ", mass = " << G4BestUnit(fTallyMass[j],"Mass") 216 << " position = " << G4BestUnit(f << 249 << " size = " << G4BestUnit(fTallySize[j],"Length") 217 } << 250 << " position = " << G4BestUnit(fTallyPosition[j],"Length") >> 251 << G4endl; >> 252 } 218 G4cout << "\n----------------------------- 253 G4cout << "\n---------------------------------------------------------\n"; 219 } << 254 } 220 } 255 } 221 256 222 //....oooOO0OOooo........oooOO0OOooo........oo 257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 223 258 224 void DetectorConstruction::SetSizeX(G4double v 259 void DetectorConstruction::SetSizeX(G4double value) 225 { 260 { 226 fAbsorSizeX = value; << 261 fAbsorSizeX = value; fWorldSizeX = 1.2*fAbsorSizeX; 227 fWorldSizeX = 1.2 * fAbsorSizeX; << 262 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 228 } 263 } 229 << 264 230 //....oooOO0OOooo........oooOO0OOooo........oo 265 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 231 266 232 void DetectorConstruction::SetSizeYZ(G4double 267 void DetectorConstruction::SetSizeYZ(G4double value) 233 { 268 { 234 fAbsorSizeYZ = value; << 269 fAbsorSizeYZ = value; 235 fWorldSizeYZ = 1.2 * fAbsorSizeYZ; << 270 fWorldSizeYZ = 1.2*fAbsorSizeYZ; 236 } << 271 G4RunManager::GetRunManager()->GeometryHasBeenModified(); >> 272 } 237 273 238 //....oooOO0OOooo........oooOO0OOooo........oo 274 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 239 275 240 void DetectorConstruction::SetMaterial(const G << 276 void DetectorConstruction::SetMaterial(G4String materialChoice) 241 { 277 { 242 // search the material by its name << 278 // search the material by its name 243 G4Material* pttoMaterial = G4NistManager::In << 279 G4Material* pttoMaterial = 244 if (pttoMaterial && pttoMaterial != fAbsorMa << 280 G4NistManager::Instance()->FindOrBuildMaterial(materialChoice); 245 // change target material everywhere << 281 if (pttoMaterial) { 246 fAbsorMaterial = pttoMaterial; 282 fAbsorMaterial = pttoMaterial; 247 for (G4int j = 0; j < fTallyNumber; ++j) { << 283 if(fLAbsor) { 248 if (fLTally[j]) { << 249 fLTally[j]->SetMaterial(pttoMaterial); << 250 fTallyMass[j] = << 251 fTallySize[j].x() * fTallySize[j].y( << 252 } << 253 } << 254 if (fLAbsor) { << 255 fLAbsor->SetMaterial(fAbsorMaterial); 284 fLAbsor->SetMaterial(fAbsorMaterial); 256 G4RunManager::GetRunManager()->PhysicsHa 285 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 257 } 286 } 258 } 287 } 259 } 288 } 260 289 261 //....oooOO0OOooo........oooOO0OOooo........oo 290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 262 291 263 void DetectorConstruction::SetWorldMaterial(co << 292 void DetectorConstruction::SetMagField(G4double fieldValue) 264 { 293 { 265 // search the material by its name << 294 //apply a global uniform magnetic field along Z axis 266 G4Material* pttoMaterial = G4NistManager::In << 295 G4FieldManager* fieldMgr 267 if (pttoMaterial && pttoMaterial != fWorldMa << 296 = G4TransportationManager::GetTransportationManager()->GetFieldManager(); 268 fWorldMaterial = pttoMaterial; << 297 269 if (fLWorld) { << 298 if (fMagField) delete fMagField; //delete the existing magn field 270 fLWorld->SetMaterial(fAbsorMaterial); << 299 271 G4RunManager::GetRunManager()->PhysicsHa << 300 if (fieldValue!=0.) // create a new one if non nul >> 301 { >> 302 fMagField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue)); >> 303 fieldMgr->SetDetectorField(fMagField); >> 304 fieldMgr->CreateChordFinder(fMagField); >> 305 } >> 306 else >> 307 { >> 308 fMagField = 0; >> 309 fieldMgr->SetDetectorField(fMagField); 272 } 310 } 273 } << 274 } 311 } 275 << 276 //....oooOO0OOooo........oooOO0OOooo........oo 312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 277 313 278 void DetectorConstruction::SetMagField(G4doubl << 314 void DetectorConstruction::SetTallyNumber(G4int value) 279 { 315 { 280 // apply a global uniform magnetic field alo << 316 fTallyNumber = value; 281 G4FieldManager* fieldMgr = G4TransportationM << 282 << 283 if (fMagField) delete fMagField; // delete << 284 << 285 if (fieldValue != 0.) // create a new one i << 286 { << 287 fMagField = new G4UniformMagField(G4ThreeV << 288 fieldMgr->SetDetectorField(fMagField); << 289 fieldMgr->CreateChordFinder(fMagField); << 290 } << 291 else { << 292 fMagField = nullptr; << 293 fieldMgr->SetDetectorField(fMagField); << 294 } << 295 } 317 } >> 318 296 //....oooOO0OOooo........oooOO0OOooo........oo 319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 297 320 298 void DetectorConstruction::SetTallyNumber(G4in << 321 void DetectorConstruction::SetTallySize(G4int j, G4ThreeVector value) 299 { 322 { 300 if (value >= 0 && value < kMaxTally) { << 323 fTallySize[j] = value; 301 fTallyNumber = value; << 324 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 302 } << 325 } 303 else { << 304 G4cout << "### DetectorConstruction::SetTa << 305 << "number " << value << " is ignor << 306 } << 307 } << 308 326 309 //....oooOO0OOooo........oooOO0OOooo........oo 327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 310 328 311 void DetectorConstruction::SetTallySize(G4int << 329 void DetectorConstruction::SetTallyMaterial(G4int j, G4String materialChoice) 312 { 330 { 313 if (j >= 0 && j < kMaxTally) { << 331 // search the material by its name 314 fTallySize[j] = value; << 332 G4Material* pttoMaterial = 315 } << 333 G4NistManager::Instance()->FindOrBuildMaterial(materialChoice); 316 else { << 334 if (pttoMaterial) { 317 G4cout << "### DetectorConstruction::SetTa << 335 fTallyMaterial[j] = pttoMaterial; 318 << "number " << j << " is ignored" << 336 if(fLTally[j]) { >> 337 fLTally[j]->SetMaterial(fTallyMaterial[j]); >> 338 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); >> 339 } 319 } 340 } 320 } 341 } 321 342 322 //....oooOO0OOooo........oooOO0OOooo........oo 343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 323 344 324 void DetectorConstruction::SetTallyPosition(G4 << 345 void DetectorConstruction::SetTallyPosition(G4int j, G4ThreeVector value) 325 { 346 { 326 if (j >= 0 && j < kMaxTally) { << 327 fTallyPosition[j] = value; << 328 } << 329 else { << 330 G4cout << "### DetectorConstruction::SetTa << 331 << "number " << j << " is ignored" << 332 } << 333 } << 334 347 335 G4double DetectorConstruction::GetTallyMass(G4 << 348 fTallyPosition[j] = value; 336 { << 349 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 337 if (j >= 0 && j < kMaxTally) { << 350 } 338 return fTallyMass[j]; << 339 } << 340 else { << 341 G4cout << "### DetectorConstruction::GetTa << 342 << "number " << j << " is ignored" << 343 return 0.0; << 344 } << 345 } << 346 351 347 const G4LogicalVolume* DetectorConstruction::G << 352 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 353 >> 354 void DetectorConstruction::UpdateGeometry() 348 { 355 { 349 if (j >= 0 && j < kMaxTally) { << 356 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 350 return fLTally[j]; << 357 G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes()); 351 } << 352 else { << 353 G4cout << "### DetectorConstruction::GetLO << 354 << "number " << j << " is ignored" << 355 return nullptr; << 356 } << 357 } 358 } 358 359 359 //....oooOO0OOooo........oooOO0OOooo........oo 360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 360 361