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 biasing/B01/src/B01DetectorConstruct << 27 /// \brief Implementation of the B01DetectorCo << 28 // << 29 // 26 // >> 27 // $Id: B01DetectorConstruction.cc,v 1.20 2007-06-22 13:15:29 ahoward Exp $ >> 28 // GEANT4 tag $Name: not supported by cvs2svn $ 30 // 29 // 31 30 >> 31 #include "G4Types.hh" >> 32 #include <sstream> >> 33 #include <set> >> 34 #include "globals.hh" >> 35 32 #include "B01DetectorConstruction.hh" 36 #include "B01DetectorConstruction.hh" 33 37 >> 38 #include "G4Material.hh" 34 #include "G4Box.hh" 39 #include "G4Box.hh" 35 #include "G4Colour.hh" << 40 #include "G4Tubs.hh" 36 #include "G4LogicalVolume.hh" 41 #include "G4LogicalVolume.hh" 37 #include "G4Material.hh" << 38 #include "G4PVPlacement.hh" << 39 #include "G4PhysicalConstants.hh" << 40 #include "G4SystemOfUnits.hh" << 41 #include "G4ThreeVector.hh" 42 #include "G4ThreeVector.hh" 42 #include "G4Tubs.hh" << 43 #include "G4PVPlacement.hh" 43 #include "G4Types.hh" << 44 #include "G4VisAttributes.hh" 44 #include "G4VisAttributes.hh" 45 #include "globals.hh" << 45 #include "G4Colour.hh" 46 << 47 #include <set> << 48 #include <sstream> << 49 46 50 // For Primitive Scorers 47 // For Primitive Scorers >> 48 #include "G4SDManager.hh" 51 #include "G4MultiFunctionalDetector.hh" 49 #include "G4MultiFunctionalDetector.hh" >> 50 #include "G4SDParticleFilter.hh" 52 #include "G4PSNofCollision.hh" 51 #include "G4PSNofCollision.hh" 53 #include "G4PSPopulation.hh" 52 #include "G4PSPopulation.hh" 54 #include "G4PSTrackCounter.hh" 53 #include "G4PSTrackCounter.hh" 55 #include "G4PSTrackLength.hh" 54 #include "G4PSTrackLength.hh" 56 #include "G4SDManager.hh" << 57 #include "G4SDParticleFilter.hh" << 58 55 59 // for importance biasing 56 // for importance biasing 60 #include "G4IStore.hh" 57 #include "G4IStore.hh" 61 58 62 // for weight window technique 59 // for weight window technique 63 #include "G4WeightWindowStore.hh" 60 #include "G4WeightWindowStore.hh" 64 61 65 //....oooOO0OOooo........oooOO0OOooo........oo << 62 B01DetectorConstruction::B01DetectorConstruction() : 66 << 63 fPhysicalVolumeVector(),fLogicalVolumeVector() 67 B01DetectorConstruction::B01DetectorConstructi << 64 {;} 68 : G4VUserDetectorConstruction(), fLogicalVol << 69 { << 70 ; << 71 } << 72 << 73 //....oooOO0OOooo........oooOO0OOooo........oo << 74 65 75 B01DetectorConstruction::~B01DetectorConstruct 66 B01DetectorConstruction::~B01DetectorConstruction() 76 { << 67 {;} 77 fLogicalVolumeVector.clear(); << 78 fPhysicalVolumeVector.clear(); << 79 } << 80 << 81 //....oooOO0OOooo........oooOO0OOooo........oo << 82 68 83 G4VPhysicalVolume* B01DetectorConstruction::Co 69 G4VPhysicalVolume* B01DetectorConstruction::Construct() 84 { 70 { 85 G4double pos_x; 71 G4double pos_x; 86 G4double pos_y; 72 G4double pos_y; 87 G4double pos_z; << 73 G4double pos_z; 88 74 89 G4double density, pressure, temperature; 75 G4double density, pressure, temperature; 90 G4double A; 76 G4double A; 91 G4int Z; 77 G4int Z; 92 78 93 G4String name, symbol; 79 G4String name, symbol; 94 G4double z; 80 G4double z; 95 G4double fractionmass; 81 G4double fractionmass; 96 82 97 A = 1.01 * g / mole; << 83 A = 1.01*g/mole; 98 G4Element* elH = new G4Element(name = "Hydro << 84 G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , Z= 1, A); 99 85 100 A = 12.01 * g / mole; << 86 A = 12.01*g/mole; 101 G4Element* elC = new G4Element(name = "Carbo << 87 G4Element* elC = new G4Element(name="Carbon" ,symbol="C" , Z = 6, A); 102 88 103 A = 16.00 * g / mole; << 89 A = 16.00*g/mole; 104 G4Element* elO = new G4Element(name = "Oxyge << 90 G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , Z= 8, A); 105 91 106 A = 22.99 * g / mole; << 92 A = 22.99*g/mole; 107 G4Element* elNa = new G4Element(name = "Natr << 93 G4Element* elNa = new G4Element(name="Natrium" ,symbol="Na" , Z=11 , A); 108 94 109 A = 200.59 * g / mole; << 95 A = 200.59*g/mole; 110 G4Element* elHg = new G4Element(name = "Hg", << 96 G4Element* elHg = new G4Element(name="Hg" ,symbol="Hg" , Z=80, A); 111 97 112 A = 26.98 * g / mole; << 98 A = 26.98*g/mole; 113 G4Element* elAl = new G4Element(name = "Alum << 99 G4Element* elAl = new G4Element(name="Aluminium" ,symbol="Al" , Z=13, A); 114 100 115 A = 28.09 * g / mole; << 101 A = 28.09*g/mole; 116 G4Element* elSi = new G4Element(name = "Sili << 102 G4Element* elSi = new G4Element(name="Silicon", symbol="Si", Z=14, A); 117 103 118 A = 39.1 * g / mole; << 104 A = 39.1*g/mole; 119 G4Element* elK = new G4Element(name = "K", s << 105 G4Element* elK = new G4Element(name="K" ,symbol="K" , Z=19 , A); 120 106 121 A = 69.72 * g / mole; << 107 A = 69.72*g/mole; 122 G4Element* elCa = new G4Element(name = "Calz << 108 G4Element* elCa = new G4Element(name="Calzium" ,symbol="Ca" , Z=31 , A); 123 109 124 A = 55.85 * g / mole; << 110 A = 55.85*g/mole; 125 G4Element* elFe = new G4Element(name = "Iron << 111 G4Element* elFe = new G4Element(name="Iron" ,symbol="Fe", Z=26, A); 126 112 127 density = universe_mean_density; // from Ph << 113 density = universe_mean_density; //from PhysicalConstants.h 128 pressure = 3.e-18 * pascal; << 114 pressure = 3.e-18*pascal; 129 temperature = 2.73 * kelvin; << 115 temperature = 2.73*kelvin; 130 G4Material* Galactic = new G4Material(name = << 116 G4Material *Galactic = 131 kState << 117 new G4Material(name="Galactic", z=1., A=1.01*g/mole, density, >> 118 kStateGas,temperature,pressure); 132 119 133 density = 2.03 * g / cm3; << 120 density = 2.03*g/cm3; 134 G4Material* Concrete = new G4Material("Concr 121 G4Material* Concrete = new G4Material("Concrete", density, 10); 135 Concrete->AddElement(elH, fractionmass = 0.0 << 122 Concrete->AddElement(elH , fractionmass= 0.01); 136 Concrete->AddElement(elO, fractionmass = 0.5 << 123 Concrete->AddElement(elO , fractionmass= 0.529); 137 Concrete->AddElement(elNa, fractionmass = 0. << 124 Concrete->AddElement(elNa , fractionmass= 0.016); 138 Concrete->AddElement(elHg, fractionmass = 0. << 125 Concrete->AddElement(elHg , fractionmass= 0.002); 139 Concrete->AddElement(elAl, fractionmass = 0. << 126 Concrete->AddElement(elAl , fractionmass= 0.034); 140 Concrete->AddElement(elSi, fractionmass = 0. << 127 Concrete->AddElement(elSi , fractionmass= 0.337); 141 Concrete->AddElement(elK, fractionmass = 0.0 << 128 Concrete->AddElement(elK , fractionmass= 0.013); 142 Concrete->AddElement(elCa, fractionmass = 0. << 129 Concrete->AddElement(elCa , fractionmass= 0.044); 143 Concrete->AddElement(elFe, fractionmass = 0. << 130 Concrete->AddElement(elFe , fractionmass= 0.014); 144 Concrete->AddElement(elC, fractionmass = 0.0 << 131 Concrete->AddElement(elC , fractionmass= 0.001); 145 132 146 ///////////////////////////// 133 ///////////////////////////// 147 // world cylinder volume 134 // world cylinder volume 148 //////////////////////////// 135 //////////////////////////// 149 136 150 // world solid 137 // world solid 151 138 152 G4double innerRadiusCylinder = 0 * cm; << 139 G4double innerRadiusCylinder = 0*cm; 153 G4double outerRadiusCylinder = 100 * cm; << 140 G4double outerRadiusCylinder = 100*cm; 154 G4double heightCylinder = 100 * cm; << 141 G4double hightCylinder = 100*cm; 155 G4double startAngleCylinder = 0 * deg; << 142 G4double startAngleCylinder = 0*deg; 156 G4double spanningAngleCylinder = 360 * deg; << 143 G4double spanningAngleCylinder = 360*deg; 157 << 144 158 G4Tubs* worldCylinder = new G4Tubs("worldCyl << 145 G4Tubs *worldCylinder = new G4Tubs("worldCylinder", 159 heightCyl << 146 innerRadiusCylinder, >> 147 outerRadiusCylinder, >> 148 hightCylinder, >> 149 startAngleCylinder, >> 150 spanningAngleCylinder); 160 151 161 // logical world 152 // logical world 162 153 163 G4LogicalVolume* worldCylinder_log = << 154 G4LogicalVolume *worldCylinder_log = 164 new G4LogicalVolume(worldCylinder, Galacti 155 new G4LogicalVolume(worldCylinder, Galactic, "worldCylinder_log"); 165 fLogicalVolumeVector.push_back(worldCylinder << 156 fLogicalVolumeVector.push_back(worldCylinder_log); 166 157 167 name = "shieldWorld"; 158 name = "shieldWorld"; 168 fWorldVolume = new G4PVPlacement(0, G4ThreeV << 159 pWorldVolume = new >> 160 G4PVPlacement(0, G4ThreeVector(0,0,0), worldCylinder_log, >> 161 name, 0, false, 0); 169 162 170 fPhysicalVolumeVector.push_back(fWorldVolume << 171 163 172 // creating 18 slabs of 10 cm thick concrete << 164 fPhysicalVolumeVector.push_back(pWorldVolume); 173 << 174 G4double innerRadiusShield = 0 * cm; << 175 G4double outerRadiusShield = 100 * cm; << 176 G4double heightShield = 5 * cm; << 177 G4double startAngleShield = 0 * deg; << 178 G4double spanningAngleShield = 360 * deg; << 179 165 180 G4Tubs* aShield = new G4Tubs("aShield", inne << 166 // creating 18 slabs of 10 cm thick concrete 181 startAngleShiel << 182 167 >> 168 G4double innerRadiusShield = 0*cm; >> 169 G4double outerRadiusShield = 100*cm; >> 170 G4double hightShield = 5*cm; >> 171 G4double startAngleShield = 0*deg; >> 172 G4double spanningAngleShield = 360*deg; >> 173 >> 174 G4Tubs *aShield = new G4Tubs("aShield", >> 175 innerRadiusShield, >> 176 outerRadiusShield, >> 177 hightShield, >> 178 startAngleShield, >> 179 spanningAngleShield); >> 180 183 // logical shield 181 // logical shield 184 182 185 G4LogicalVolume* aShield_log = new G4Logical << 183 G4LogicalVolume *aShield_log = >> 184 new G4LogicalVolume(aShield, Concrete, "aShield_log"); 186 fLogicalVolumeVector.push_back(aShield_log); 185 fLogicalVolumeVector.push_back(aShield_log); 187 186 188 G4VisAttributes* pShieldVis = new G4VisAttri << 187 G4VisAttributes* pShieldVis = new G4VisAttributes(G4Colour(0.0,0.0,1.0)); 189 pShieldVis->SetForceSolid(true); 188 pShieldVis->SetForceSolid(true); 190 aShield_log->SetVisAttributes(pShieldVis); 189 aShield_log->SetVisAttributes(pShieldVis); 191 190 192 // physical shields 191 // physical shields 193 192 194 G4int i; 193 G4int i; 195 G4double startz = -85 * cm; << 194 G4double startz = -85*cm; 196 for (i = 1; i <= 18; i++) { << 195 for (i=1; i<=18; i++) >> 196 { 197 name = GetCellName(i); 197 name = GetCellName(i); 198 pos_x = 0 * cm; << 198 G4double pos_x = 0*cm; 199 pos_y = 0 * cm; << 199 G4double pos_y = 0*cm; 200 pos_z = startz + (i - 1) * (2 * heightShie << 200 G4double pos_z = startz + (i-1) * (2*hightShield); 201 G4VPhysicalVolume* pvol = new G4PVPlacemen << 201 G4VPhysicalVolume *pvol = 202 << 202 new G4PVPlacement(0, >> 203 G4ThreeVector(pos_x, pos_y, pos_z), >> 204 aShield_log, >> 205 name, >> 206 worldCylinder_log, >> 207 false, >> 208 i); 203 fPhysicalVolumeVector.push_back(pvol); 209 fPhysicalVolumeVector.push_back(pvol); 204 } 210 } 205 211 206 // filling the rest of the world volume behi 212 // filling the rest of the world volume behind the concrete with 207 // another slab which should get the same im << 213 // another slab which should get the same importance value 208 // or lower weight bound as the last slab 214 // or lower weight bound as the last slab 209 // 215 // 210 innerRadiusShield = 0 * cm; << 216 innerRadiusShield = 0*cm; 211 outerRadiusShield = 100 * cm; << 217 outerRadiusShield = 100*cm; 212 heightShield = 5 * cm; << 218 hightShield = 5*cm; 213 startAngleShield = 0 * deg; << 219 startAngleShield = 0*deg; 214 spanningAngleShield = 360 * deg; << 220 spanningAngleShield = 360*deg; 215 << 221 216 G4Tubs* aRest = new G4Tubs("Rest", innerRadi << 222 G4Tubs *aRest = new G4Tubs("Rest", 217 startAngleShield, << 223 innerRadiusShield, 218 << 224 outerRadiusShield, 219 G4LogicalVolume* aRest_log = new G4LogicalVo << 225 hightShield, >> 226 startAngleShield, >> 227 spanningAngleShield); >> 228 >> 229 G4LogicalVolume *aRest_log = >> 230 new G4LogicalVolume(aRest, Galactic, "aRest_log"); 220 fLogicalVolumeVector.push_back(aRest_log); 231 fLogicalVolumeVector.push_back(aRest_log); 221 name = "rest"; 232 name = "rest"; 222 << 233 223 pos_x = 0 * cm; << 234 pos_x = 0*cm; 224 pos_y = 0 * cm; << 235 pos_y = 0*cm; 225 pos_z = 95 * cm; << 236 pos_z = 95*cm; 226 G4VPhysicalVolume* pvol_rest = new G4PVPlace << 237 G4VPhysicalVolume *pvol_rest = 227 << 238 new G4PVPlacement(0, 228 << 239 G4ThreeVector(pos_x, pos_y, pos_z), >> 240 aRest_log, >> 241 name, >> 242 worldCylinder_log, >> 243 false, >> 244 19); // i=19 229 245 230 fPhysicalVolumeVector.push_back(pvol_rest); 246 fPhysicalVolumeVector.push_back(pvol_rest); 231 247 232 SetSensitive(); 248 SetSensitive(); 233 return fWorldVolume; << 249 return pWorldVolume; 234 } 250 } 235 251 236 //....oooOO0OOooo........oooOO0OOooo........oo << 237 252 238 G4VIStore* B01DetectorConstruction::CreateImpo << 253 G4VIStore *B01DetectorConstruction::CreateImportanceStore() 239 { 254 { 240 G4cout << " B01DetectorConstruction:: Creati << 255 if (!fPhysicalVolumeVector.size()) 241 if (!fPhysicalVolumeVector.size()) { << 256 { 242 G4Exception("B01DetectorConstruction::Crea << 257 G4Exception("B01DetectorConstruction::CreateImportanceStore","exampleB01_0001",RunMustBeAborted,"no physical volumes created yet!"); 243 RunMustBeAborted, "no physical << 244 } 258 } 245 259 246 fWorldVolume = fPhysicalVolumeVector[0]; << 260 pWorldVolume = fPhysicalVolumeVector[0]; 247 261 248 // creating and filling the importance store 262 // creating and filling the importance store 249 << 263 250 G4IStore* istore = G4IStore::GetInstance(); << 264 G4IStore *istore = new G4IStore(*pWorldVolume); 251 265 252 G4int n = 0; 266 G4int n = 0; 253 G4double imp = 1; << 267 G4double imp =1; 254 istore->AddImportanceGeometryCell(1, *fWorld << 268 istore->AddImportanceGeometryCell(1, *pWorldVolume); 255 for (std::vector<G4VPhysicalVolume*>::iterat << 269 for (std::vector<G4VPhysicalVolume *>::iterator >> 270 it = fPhysicalVolumeVector.begin(); 256 it != fPhysicalVolumeVector.end() - 1; 271 it != fPhysicalVolumeVector.end() - 1; it++) 257 { 272 { 258 if (*it != fWorldVolume) { << 273 if (*it != pWorldVolume) >> 274 { 259 imp = std::pow(2., n++); 275 imp = std::pow(2., n++); 260 G4cout << "Going to assign importance: " << 276 G4cout << "Going to assign importance: " << imp << ", to volume: " 261 << G4endl; << 277 << (*it)->GetName() << G4endl; 262 istore->AddImportanceGeometryCell(imp, * << 278 istore->AddImportanceGeometryCell(imp, *(*it),n); 263 } 279 } 264 } 280 } 265 281 266 // the remaining part pf the geometry (rest) 282 // the remaining part pf the geometry (rest) gets the same 267 // importance as the last conrete cell 283 // importance as the last conrete cell 268 // 284 // 269 istore->AddImportanceGeometryCell(imp, *(fPh << 285 istore->AddImportanceGeometryCell(imp, 270 ++n); << 286 *(fPhysicalVolumeVector[fPhysicalVolumeVector.size()-1]),++n); 271 << 287 272 return istore; 288 return istore; 273 } 289 } 274 290 275 //....oooOO0OOooo........oooOO0OOooo........oo << 291 G4VWeightWindowStore *B01DetectorConstruction::CreateWeightWindowStore() 276 << 277 G4VWeightWindowStore* B01DetectorConstruction: << 278 { 292 { 279 if (!fPhysicalVolumeVector.size()) { << 293 if (!fPhysicalVolumeVector.size()) 280 G4Exception("B01DetectorConstruction::Crea << 294 { 281 RunMustBeAborted, "no physical << 295 G4Exception("B01DetectorConstruction::CreateWeightWindowStore","exampleB01_0002",RunMustBeAborted,"no physical volumes created yet!"); 282 } 296 } 283 297 284 fWorldVolume = fPhysicalVolumeVector[0]; << 298 pWorldVolume = fPhysicalVolumeVector[0]; 285 299 286 // creating and filling the weight window st 300 // creating and filling the weight window store 287 << 301 288 G4WeightWindowStore* wwstore = G4WeightWindo << 302 G4WeightWindowStore *wwstore = new G4WeightWindowStore(*pWorldVolume); 289 << 303 290 // create one energy region covering the ene 304 // create one energy region covering the energies of the problem 291 // 305 // 292 std::set<G4double, std::less<G4double>> enBo << 306 std::set<G4double, std::less<G4double> > enBounds; 293 enBounds.insert(1 * GeV); 307 enBounds.insert(1 * GeV); 294 wwstore->SetGeneralUpperEnergyBounds(enBound 308 wwstore->SetGeneralUpperEnergyBounds(enBounds); 295 309 296 G4int n = 0; 310 G4int n = 0; 297 G4double lowerWeight = 1; << 311 G4double lowerWeight =1; 298 std::vector<G4double> lowerWeights; 312 std::vector<G4double> lowerWeights; 299 313 300 lowerWeights.push_back(1); 314 lowerWeights.push_back(1); 301 G4GeometryCell gWorldCell(*fWorldVolume, 0); << 315 G4GeometryCell gWorldCell(*pWorldVolume,0); 302 wwstore->AddLowerWeights(gWorldCell, lowerWe 316 wwstore->AddLowerWeights(gWorldCell, lowerWeights); 303 317 304 for (std::vector<G4VPhysicalVolume*>::iterat << 318 for (std::vector<G4VPhysicalVolume *>::iterator >> 319 it = fPhysicalVolumeVector.begin(); 305 it != fPhysicalVolumeVector.end() - 1; 320 it != fPhysicalVolumeVector.end() - 1; it++) 306 { 321 { 307 if (*it != fWorldVolume) { << 322 if (*it != pWorldVolume) 308 lowerWeight = 1. / std::pow(2., n++); << 323 { 309 G4cout << "Going to assign lower weight: << 324 lowerWeight = 1./std::pow(2., n++); 310 << ", to volume: " << (*it)->GetN << 325 G4cout << "Going to assign lower weight: " << lowerWeight 311 G4GeometryCell gCell(*(*it), n); << 326 << ", to volume: " >> 327 << (*it)->GetName() << G4endl; >> 328 G4GeometryCell gCell(*(*it),n); 312 lowerWeights.clear(); 329 lowerWeights.clear(); 313 lowerWeights.push_back(lowerWeight); 330 lowerWeights.push_back(lowerWeight); 314 wwstore->AddLowerWeights(gCell, lowerWei 331 wwstore->AddLowerWeights(gCell, lowerWeights); 315 } 332 } 316 } 333 } 317 334 318 // the remaining part pf the geometry (rest) 335 // the remaining part pf the geometry (rest) gets the same 319 // lower weight bound as the last conrete c 336 // lower weight bound as the last conrete cell 320 // 337 // 321 G4GeometryCell gRestCell(*(fPhysicalVolumeVe << 338 G4GeometryCell 322 wwstore->AddLowerWeights(gRestCell, lowerWei << 339 gRestCell(*(fPhysicalVolumeVector[fPhysicalVolumeVector.size()-1]), ++n); >> 340 wwstore->AddLowerWeights(gRestCell, lowerWeights); 323 341 324 return wwstore; 342 return wwstore; 325 } 343 } 326 344 327 //....oooOO0OOooo........oooOO0OOooo........oo << 328 << 329 G4String B01DetectorConstruction::GetCellName( 345 G4String B01DetectorConstruction::GetCellName(G4int i) 330 { 346 { 331 std::ostringstream os; 347 std::ostringstream os; 332 os << "cell_"; 348 os << "cell_"; 333 if (i < 10) { << 349 if (i<10) >> 350 { 334 os << "0"; 351 os << "0"; 335 } 352 } 336 os << i; << 353 os << i ; 337 G4String name = os.str(); 354 G4String name = os.str(); 338 return name; 355 return name; 339 } 356 } 340 357 341 G4VPhysicalVolume* B01DetectorConstruction::Ge << 358 G4VPhysicalVolume *B01DetectorConstruction::GetWorldVolume() { 342 { << 359 return pWorldVolume; 343 return fWorldVolume; << 344 } 360 } 345 361 346 //....oooOO0OOooo........oooOO0OOooo........oo << 362 void B01DetectorConstruction::SetSensitive(){ 347 363 348 void B01DetectorConstruction::SetSensitive() << 349 { << 350 // ---------------------------------------- 364 // ------------------------------------------------- 351 // The collection names of defined Primiti 365 // The collection names of defined Primitives are 352 // 0 ConcreteSD/Collisions 366 // 0 ConcreteSD/Collisions 353 // 1 ConcreteSD/CollWeight 367 // 1 ConcreteSD/CollWeight 354 // 2 ConcreteSD/Population 368 // 2 ConcreteSD/Population 355 // 3 ConcreteSD/TrackEnter 369 // 3 ConcreteSD/TrackEnter 356 // 4 ConcreteSD/SL 370 // 4 ConcreteSD/SL 357 // 5 ConcreteSD/SLW 371 // 5 ConcreteSD/SLW 358 // 6 ConcreteSD/SLWE 372 // 6 ConcreteSD/SLWE 359 // 7 ConcreteSD/SLW_V 373 // 7 ConcreteSD/SLW_V 360 // 8 ConcreteSD/SLWE_V 374 // 8 ConcreteSD/SLWE_V 361 // ---------------------------------------- 375 // ------------------------------------------------- 362 376 363 // moved to ConstructSDandField() for MT com << 364 } << 365 << 366 //....oooOO0OOooo........oooOO0OOooo........oo << 367 377 368 void B01DetectorConstruction::ConstructSDandFi << 378 //================================================ 369 { << 379 // Sensitive detectors : MultiFunctionalDetector >> 380 //================================================ >> 381 // 370 // Sensitive Detector Manager. 382 // Sensitive Detector Manager. 371 G4SDManager* SDman = G4SDManager::GetSDMpoin 383 G4SDManager* SDman = G4SDManager::GetSDMpointer(); >> 384 // 372 // Sensitive Detector Name 385 // Sensitive Detector Name 373 G4String concreteSDname = "ConcreteSD"; 386 G4String concreteSDname = "ConcreteSD"; 374 387 375 //------------------------ 388 //------------------------ 376 // MultiFunctionalDetector 389 // MultiFunctionalDetector 377 //------------------------ 390 //------------------------ 378 // 391 // 379 // Define MultiFunctionalDetector with name. 392 // Define MultiFunctionalDetector with name. 380 G4MultiFunctionalDetector* MFDet = new G4Mul 393 G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(concreteSDname); 381 SDman->AddNewDetector(MFDet); // Register S << 394 SDman->AddNewDetector( MFDet ); // Register SD to SDManager 382 395 383 G4String fltName, particleName; << 396 384 G4SDParticleFilter* neutronFilter = << 397 G4String fltName,particleName; 385 new G4SDParticleFilter(fltName = "neutronF << 398 G4SDParticleFilter* neutronFilter = >> 399 new G4SDParticleFilter(fltName="neutronFilter", particleName="neutron"); 386 400 387 MFDet->SetFilter(neutronFilter); 401 MFDet->SetFilter(neutronFilter); 388 402 389 for (std::vector<G4LogicalVolume*>::iterator << 403 390 it != fLogicalVolumeVector.end(); it++) << 404 for (std::vector<G4LogicalVolume *>::iterator it = fLogicalVolumeVector.begin(); 391 { << 405 it != fLogicalVolumeVector.end(); it++){ 392 // (*it)->SetSensitiveDetector(MFDet) << 406 (*it)->SetSensitiveDetector(MFDet); 393 SetSensitiveDetector((*it)->GetName(), MFD << 394 } 407 } 395 408 396 G4String psName; 409 G4String psName; 397 G4PSNofCollision* scorer0 = new G4PSNofColli << 410 G4PSNofCollision* scorer0 = new G4PSNofCollision(psName="Collisions"); 398 MFDet->RegisterPrimitive(scorer0); 411 MFDet->RegisterPrimitive(scorer0); 399 412 400 G4PSNofCollision* scorer1 = new G4PSNofColli << 413 >> 414 G4PSNofCollision* scorer1 = new G4PSNofCollision(psName="CollWeight"); 401 scorer1->Weighted(true); 415 scorer1->Weighted(true); 402 MFDet->RegisterPrimitive(scorer1); 416 MFDet->RegisterPrimitive(scorer1); 403 417 404 G4PSPopulation* scorer2 = new G4PSPopulation << 418 >> 419 G4PSPopulation* scorer2 = new G4PSPopulation(psName="Population"); 405 MFDet->RegisterPrimitive(scorer2); 420 MFDet->RegisterPrimitive(scorer2); 406 421 407 G4PSTrackCounter* scorer3 = new G4PSTrackCou << 422 G4PSTrackCounter* scorer3 = new G4PSTrackCounter(psName="TrackEnter",fCurrent_In); 408 MFDet->RegisterPrimitive(scorer3); 423 MFDet->RegisterPrimitive(scorer3); 409 424 410 G4PSTrackLength* scorer4 = new G4PSTrackLeng << 425 G4PSTrackLength* scorer4 = new G4PSTrackLength(psName="SL"); 411 MFDet->RegisterPrimitive(scorer4); 426 MFDet->RegisterPrimitive(scorer4); 412 427 413 G4PSTrackLength* scorer5 = new G4PSTrackLeng << 428 G4PSTrackLength* scorer5 = new G4PSTrackLength(psName="SLW"); 414 scorer5->Weighted(true); 429 scorer5->Weighted(true); 415 MFDet->RegisterPrimitive(scorer5); 430 MFDet->RegisterPrimitive(scorer5); 416 431 417 G4PSTrackLength* scorer6 = new G4PSTrackLeng << 432 G4PSTrackLength* scorer6 = new G4PSTrackLength(psName="SLWE"); 418 scorer6->Weighted(true); 433 scorer6->Weighted(true); 419 scorer6->MultiplyKineticEnergy(true); 434 scorer6->MultiplyKineticEnergy(true); 420 MFDet->RegisterPrimitive(scorer6); 435 MFDet->RegisterPrimitive(scorer6); 421 436 422 G4PSTrackLength* scorer7 = new G4PSTrackLeng << 437 G4PSTrackLength* scorer7 = new G4PSTrackLength(psName="SLW_V"); 423 scorer7->Weighted(true); 438 scorer7->Weighted(true); 424 scorer7->DivideByVelocity(true); 439 scorer7->DivideByVelocity(true); 425 MFDet->RegisterPrimitive(scorer7); 440 MFDet->RegisterPrimitive(scorer7); 426 441 427 G4PSTrackLength* scorer8 = new G4PSTrackLeng << 442 G4PSTrackLength* scorer8 = new G4PSTrackLength(psName="SLWE_V"); 428 scorer8->Weighted(true); 443 scorer8->Weighted(true); 429 scorer8->MultiplyKineticEnergy(true); 444 scorer8->MultiplyKineticEnergy(true); 430 scorer8->DivideByVelocity(true); 445 scorer8->DivideByVelocity(true); 431 MFDet->RegisterPrimitive(scorer8); 446 MFDet->RegisterPrimitive(scorer8); 432 } << 433 447 434 //....oooOO0OOooo........oooOO0OOooo........oo << 448 } 435 449