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