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