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/B02/src/B02ImportanceDetecto 26 /// \file biasing/B02/src/B02ImportanceDetectorConstruction.cc 27 /// \brief Implementation of the B02Importance 27 /// \brief Implementation of the B02ImportanceDetectorConstruction class 28 // 28 // 29 // 29 // >> 30 // $Id: B02ImportanceDetectorConstruction.cc 77336 2013-11-22 15:04:18Z ahoward$ 30 // 31 // 31 32 >> 33 #include "globals.hh" >> 34 #include <sstream> >> 35 32 #include "B02ImportanceDetectorConstruction.hh 36 #include "B02ImportanceDetectorConstruction.hh" 33 37 34 #include "G4LogicalVolume.hh" << 35 #include "G4Material.hh" 38 #include "G4Material.hh" >> 39 #include "G4Tubs.hh" >> 40 #include "G4LogicalVolume.hh" >> 41 #include "G4ThreeVector.hh" 36 #include "G4PVPlacement.hh" 42 #include "G4PVPlacement.hh" 37 #include "G4PhysicalConstants.hh" 43 #include "G4PhysicalConstants.hh" 38 #include "G4SystemOfUnits.hh" 44 #include "G4SystemOfUnits.hh" 39 #include "G4ThreeVector.hh" << 40 #include "G4Tubs.hh" << 41 #include "globals.hh" << 42 << 43 #include <sstream> << 44 45 45 // For Primitive Scorers 46 // For Primitive Scorers >> 47 #include "G4SDManager.hh" 46 #include "G4MultiFunctionalDetector.hh" 48 #include "G4MultiFunctionalDetector.hh" >> 49 #include "G4SDParticleFilter.hh" 47 #include "G4PSNofCollision.hh" 50 #include "G4PSNofCollision.hh" 48 #include "G4PSPopulation.hh" 51 #include "G4PSPopulation.hh" 49 #include "G4PSTrackCounter.hh" 52 #include "G4PSTrackCounter.hh" 50 #include "G4PSTrackLength.hh" 53 #include "G4PSTrackLength.hh" 51 #include "G4SDManager.hh" << 52 #include "G4SDParticleFilter.hh" << 53 54 54 // for importance biasing 55 // for importance biasing 55 #include "G4IStore.hh" 56 #include "G4IStore.hh" 56 57 57 // for weight window technique 58 // for weight window technique 58 #include "G4WeightWindowStore.hh" 59 #include "G4WeightWindowStore.hh" 59 60 60 //....oooOO0OOooo........oooOO0OOooo........oo 61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 62 62 B02ImportanceDetectorConstruction::B02Importan << 63 B02ImportanceDetectorConstruction:: 63 : G4VUserParallelWorld(worldName), fLogicalV << 64 B02ImportanceDetectorConstruction(G4String worldName) >> 65 :G4VUserParallelWorld(worldName),fLogicalVolumeVector() 64 { 66 { 65 // Construct(); 67 // Construct(); 66 } 68 } 67 69 68 //....oooOO0OOooo........oooOO0OOooo........oo 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 69 71 70 B02ImportanceDetectorConstruction::~B02Importa 72 B02ImportanceDetectorConstruction::~B02ImportanceDetectorConstruction() 71 { 73 { 72 fLogicalVolumeVector.clear(); 74 fLogicalVolumeVector.clear(); 73 } 75 } 74 76 75 //....oooOO0OOooo........oooOO0OOooo........oo 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 76 78 77 void B02ImportanceDetectorConstruction::Constr 79 void B02ImportanceDetectorConstruction::Construct() 78 { << 80 { 79 G4cout << " constructing parallel world " << 81 G4cout << " constructing parallel world " << G4endl; 80 82 81 G4Material* dummyMat = 0; << 83 G4Material* dummyMat = 0; 82 84 83 // GetWorld methods create a clone of the ma << 85 //GetWorld methods create a clone of the mass world to the parallel world (!) 84 // via the transportation manager << 86 // via the transportation manager 85 fGhostWorld = GetWorld(); 87 fGhostWorld = GetWorld(); 86 G4cout << " B02ImportanceDetectorConstructio << 88 G4cout << " B02ImportanceDetectorConstruction:: ghostWorldName = " 87 << G4endl; << 89 << fGhostWorld->GetName() << G4endl; 88 G4LogicalVolume* worldLogical = fGhostWorld- 90 G4LogicalVolume* worldLogical = fGhostWorld->GetLogicalVolume(); 89 fLogicalVolumeVector.push_back(worldLogical) 91 fLogicalVolumeVector.push_back(worldLogical); 90 92 >> 93 >> 94 91 // fPVolumeStore.AddPVolume(G4GeometryCell( 95 // fPVolumeStore.AddPVolume(G4GeometryCell(*pWorldVolume, 0)); 92 fPVolumeStore.AddPVolume(G4GeometryCell(*fGh 96 fPVolumeStore.AddPVolume(G4GeometryCell(*fGhostWorld, 0)); 93 97 94 // creating 18 slobs of 10 cm thicknes << 95 98 96 G4double innerRadiusShield = 0 * cm; << 97 G4double outerRadiusShield = 100 * cm; << 98 G4double heightShield = 5 * cm; << 99 G4double startAngleShield = 0 * deg; << 100 G4double spanningAngleShield = 360 * deg; << 101 99 102 G4Tubs* aShield = new G4Tubs("aShield", inne << 103 startAngleShiel << 104 100 >> 101 // creating 18 slobs of 10 cm thicknes >> 102 >> 103 G4double innerRadiusShield = 0*cm; >> 104 G4double outerRadiusShield = 100*cm; >> 105 G4double heightShield = 5*cm; >> 106 G4double startAngleShield = 0*deg; >> 107 G4double spanningAngleShield = 360*deg; >> 108 >> 109 G4Tubs *aShield = new G4Tubs("aShield", >> 110 innerRadiusShield, >> 111 outerRadiusShield, >> 112 heightShield, >> 113 startAngleShield, >> 114 spanningAngleShield); >> 115 105 // logical parallel cells 116 // logical parallel cells 106 117 107 G4LogicalVolume* aShield_log_imp = new G4Log << 118 G4LogicalVolume *aShield_log_imp = >> 119 new G4LogicalVolume(aShield, dummyMat, "aShield_log_imp"); 108 fLogicalVolumeVector.push_back(aShield_log_i 120 fLogicalVolumeVector.push_back(aShield_log_imp); 109 121 110 // physical parallel cells 122 // physical parallel cells 111 G4String name = "none"; 123 G4String name = "none"; 112 G4int i = 1; 124 G4int i = 1; 113 G4double startz = -85 * cm; << 125 G4double startz = -85*cm; 114 // for (i=1; i<=18; ++i) { 126 // for (i=1; i<=18; ++i) { 115 for (i = 1; i <= 18; i++) { << 127 for (i=1; i<=18; i++) { >> 128 116 name = GetCellName(i); 129 name = GetCellName(i); 117 << 130 118 G4double pos_x = 0 * cm; << 131 G4double pos_x = 0*cm; 119 G4double pos_y = 0 * cm; << 132 G4double pos_y = 0*cm; 120 G4double pos_z = startz + (i - 1) * (2 * h << 133 G4double pos_z = startz + (i-1) * (2*heightShield); 121 G4VPhysicalVolume* pvol = new G4PVPlacemen << 134 G4VPhysicalVolume *pvol = 122 << 135 new G4PVPlacement(0, >> 136 G4ThreeVector(pos_x, pos_y, pos_z), >> 137 aShield_log_imp, >> 138 name, >> 139 worldLogical, >> 140 false, >> 141 i); 123 // 0); 142 // 0); 124 G4GeometryCell cell(*pvol, i); 143 G4GeometryCell cell(*pvol, i); 125 // G4GeometryCell cell(*pvol, 0); 144 // G4GeometryCell cell(*pvol, 0); 126 fPVolumeStore.AddPVolume(cell); 145 fPVolumeStore.AddPVolume(cell); 127 } 146 } 128 147 129 // filling the rest of the world volumr behi 148 // filling the rest of the world volumr behind the concrete with 130 // another slob which should get the same im << 149 // another slob which should get the same importance value as the 131 // last slob 150 // last slob 132 innerRadiusShield = 0 * cm; << 151 innerRadiusShield = 0*cm; 133 // outerRadiusShield = 110*cm; exceeds worl 152 // outerRadiusShield = 110*cm; exceeds world volume!!!! 134 outerRadiusShield = 100 * cm; << 153 outerRadiusShield = 100*cm; 135 // heightShield = 10*cm; 154 // heightShield = 10*cm; 136 heightShield = 5 * cm; << 155 heightShield = 5*cm; 137 startAngleShield = 0 * deg; << 156 startAngleShield = 0*deg; 138 spanningAngleShield = 360 * deg; << 157 spanningAngleShield = 360*deg; 139 << 158 140 G4Tubs* aRest = new G4Tubs("Rest", innerRadi << 159 G4Tubs *aRest = new G4Tubs("Rest", 141 startAngleShield, << 160 innerRadiusShield, 142 << 161 outerRadiusShield, 143 G4LogicalVolume* aRest_log = new G4LogicalVo << 162 heightShield, >> 163 startAngleShield, >> 164 spanningAngleShield); >> 165 >> 166 G4LogicalVolume *aRest_log = >> 167 new G4LogicalVolume(aRest, dummyMat, "aRest_log"); 144 168 145 fLogicalVolumeVector.push_back(aRest_log); 169 fLogicalVolumeVector.push_back(aRest_log); 146 170 147 name = GetCellName(19); 171 name = GetCellName(19); 148 << 172 149 G4double pos_x = 0 * cm; << 173 G4double pos_x = 0*cm; 150 G4double pos_y = 0 * cm; << 174 G4double pos_y = 0*cm; 151 // G4double pos_z = 100*cm; 175 // G4double pos_z = 100*cm; 152 G4double pos_z = 95 * cm; << 176 G4double pos_z = 95*cm; 153 G4VPhysicalVolume* pvol = new G4PVPlacement( << 177 G4VPhysicalVolume *pvol = 154 << 178 new G4PVPlacement(0, >> 179 G4ThreeVector(pos_x, pos_y, pos_z), >> 180 aRest_log, >> 181 name, >> 182 worldLogical, >> 183 false, >> 184 19); 155 // 0); 185 // 0); 156 G4GeometryCell cell(*pvol, 19); 186 G4GeometryCell cell(*pvol, 19); 157 // G4GeometryCell cell(*pvol, 0); 187 // G4GeometryCell cell(*pvol, 0); 158 fPVolumeStore.AddPVolume(cell); 188 fPVolumeStore.AddPVolume(cell); 159 189 160 SetSensitive(); 190 SetSensitive(); >> 191 161 } 192 } 162 193 163 //....oooOO0OOooo........oooOO0OOooo........oo 194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 164 195 165 const G4VPhysicalVolume& << 196 const G4VPhysicalVolume &B02ImportanceDetectorConstruction:: 166 B02ImportanceDetectorConstruction::GetPhysical << 197 GetPhysicalVolumeByName(const G4String& name) const { 167 { << 168 return *fPVolumeStore.GetPVolume(name); 198 return *fPVolumeStore.GetPVolume(name); 169 } 199 } 170 200 171 //....oooOO0OOooo........oooOO0OOooo........oo 201 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 172 202 173 G4String B02ImportanceDetectorConstruction::Li << 203 G4String B02ImportanceDetectorConstruction::ListPhysNamesAsG4String(){ 174 { << 175 G4String names(fPVolumeStore.GetPNames()); 204 G4String names(fPVolumeStore.GetPNames()); 176 return names; 205 return names; 177 } 206 } 178 207 179 //....oooOO0OOooo........oooOO0OOooo........oo 208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 180 209 181 G4String B02ImportanceDetectorConstruction::Ge << 210 G4String B02ImportanceDetectorConstruction::GetCellName(G4int i) { 182 { << 183 std::ostringstream os; 211 std::ostringstream os; 184 os << "cell_"; 212 os << "cell_"; 185 if (i < 10) { << 213 if (i<10) { 186 os << "0"; 214 os << "0"; 187 } 215 } 188 os << i; 216 os << i; 189 G4String name = os.str(); 217 G4String name = os.str(); 190 return name; 218 return name; 191 } 219 } 192 220 193 //....oooOO0OOooo........oooOO0OOooo........oo 221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 194 222 195 G4GeometryCell B02ImportanceDetectorConstructi << 223 G4GeometryCell B02ImportanceDetectorConstruction::GetGeometryCell(G4int i){ 196 { << 197 G4String name(GetCellName(i)); 224 G4String name(GetCellName(i)); 198 const G4VPhysicalVolume* p = 0; << 225 const G4VPhysicalVolume *p=0; 199 p = fPVolumeStore.GetPVolume(name); 226 p = fPVolumeStore.GetPVolume(name); 200 if (p) { 227 if (p) { 201 return G4GeometryCell(*p, 0); << 228 return G4GeometryCell(*p,0); 202 } 229 } 203 else { 230 else { 204 G4cout << "B02ImportanceDetectorConstructi 231 G4cout << "B02ImportanceDetectorConstruction::GetGeometryCell: " << G4endl 205 << " couldn't get G4GeometryCell" < 232 << " couldn't get G4GeometryCell" << G4endl; 206 return G4GeometryCell(*fGhostWorld, -2); << 233 return G4GeometryCell(*fGhostWorld,-2); 207 } 234 } 208 } 235 } 209 236 210 //....oooOO0OOooo........oooOO0OOooo........oo 237 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 211 238 212 G4VPhysicalVolume& B02ImportanceDetectorConstr << 239 G4VPhysicalVolume &B02ImportanceDetectorConstruction:: 213 { << 240 GetWorldVolumeAddress() const{ 214 return *fGhostWorld; << 241 return *fGhostWorld; 215 } 242 } 216 243 217 //....oooOO0OOooo........oooOO0OOooo........oo 244 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 218 245 219 G4VPhysicalVolume* B02ImportanceDetectorConstr << 246 G4VPhysicalVolume *B02ImportanceDetectorConstruction::GetWorldVolume() { 220 { << 221 return fGhostWorld; 247 return fGhostWorld; 222 } 248 } 223 249 224 //....oooOO0OOooo........oooOO0OOooo........oo 250 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 225 251 226 void B02ImportanceDetectorConstruction::SetSen << 252 void B02ImportanceDetectorConstruction::SetSensitive(){ 227 { << 253 228 // ---------------------------------------- 254 // ------------------------------------------------- 229 // The collection names of defined Primiti 255 // The collection names of defined Primitives are 230 // 0 ConcreteSD/Collisions 256 // 0 ConcreteSD/Collisions 231 // 1 ConcreteSD/CollWeight 257 // 1 ConcreteSD/CollWeight 232 // 2 ConcreteSD/Population 258 // 2 ConcreteSD/Population 233 // 3 ConcreteSD/TrackEnter 259 // 3 ConcreteSD/TrackEnter 234 // 4 ConcreteSD/SL 260 // 4 ConcreteSD/SL 235 // 5 ConcreteSD/SLW 261 // 5 ConcreteSD/SLW 236 // 6 ConcreteSD/SLWE 262 // 6 ConcreteSD/SLWE 237 // 7 ConcreteSD/SLW_V 263 // 7 ConcreteSD/SLW_V 238 // 8 ConcreteSD/SLWE_V 264 // 8 ConcreteSD/SLWE_V 239 // ---------------------------------------- 265 // ------------------------------------------------- 240 266 241 // moved to ConstructSD() for MT compliance 267 // moved to ConstructSD() for MT compliance >> 268 242 } 269 } 243 270 244 //....oooOO0OOooo........oooOO0OOooo........oo 271 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 245 void B02ImportanceDetectorConstruction::Constr 272 void B02ImportanceDetectorConstruction::ConstructSD() 246 { 273 { >> 274 247 G4SDManager* SDman = G4SDManager::GetSDMpoin 275 G4SDManager* SDman = G4SDManager::GetSDMpointer(); 248 // 276 // 249 // Sensitive Detector Name 277 // Sensitive Detector Name 250 G4String concreteSDname = "ConcreteSD"; 278 G4String concreteSDname = "ConcreteSD"; 251 279 252 //------------------------ 280 //------------------------ 253 // MultiFunctionalDetector 281 // MultiFunctionalDetector 254 //------------------------ 282 //------------------------ 255 // 283 // 256 // Define MultiFunctionalDetector with name. 284 // Define MultiFunctionalDetector with name. 257 G4MultiFunctionalDetector* MFDet = new G4Mul << 285 G4MultiFunctionalDetector* MFDet = 258 SDman->AddNewDetector(MFDet); // Register S << 286 new G4MultiFunctionalDetector(concreteSDname); >> 287 SDman->AddNewDetector( MFDet ); // Register SD to SDManager >> 288 259 289 260 G4String fltName, particleName; << 290 G4String fltName,particleName; 261 G4SDParticleFilter* neutronFilter = << 291 G4SDParticleFilter* neutronFilter = 262 new G4SDParticleFilter(fltName = "neutronF << 292 new G4SDParticleFilter(fltName="neutronFilter", particleName="neutron"); 263 293 264 MFDet->SetFilter(neutronFilter); 294 MFDet->SetFilter(neutronFilter); 265 295 266 for (std::vector<G4LogicalVolume*>::iterator << 296 267 it != fLogicalVolumeVector.end(); it++) << 297 for (std::vector<G4LogicalVolume *>::iterator it = 268 { << 298 fLogicalVolumeVector.begin(); >> 299 it != fLogicalVolumeVector.end(); it++){ 269 // (*it)->SetSensitiveDetector(MFDet) 300 // (*it)->SetSensitiveDetector(MFDet); 270 SetSensitiveDetector((*it)->GetName(), MFD 301 SetSensitiveDetector((*it)->GetName(), MFDet); 271 } 302 } 272 303 273 G4String psName; 304 G4String psName; 274 G4PSNofCollision* scorer0 = new G4PSNofColli << 305 G4PSNofCollision* scorer0 = new G4PSNofCollision(psName="Collisions"); 275 MFDet->RegisterPrimitive(scorer0); 306 MFDet->RegisterPrimitive(scorer0); 276 307 277 G4PSNofCollision* scorer1 = new G4PSNofColli << 308 >> 309 G4PSNofCollision* scorer1 = new G4PSNofCollision(psName="CollWeight"); 278 scorer1->Weighted(true); 310 scorer1->Weighted(true); 279 MFDet->RegisterPrimitive(scorer1); 311 MFDet->RegisterPrimitive(scorer1); 280 312 281 G4PSPopulation* scorer2 = new G4PSPopulation << 313 >> 314 G4PSPopulation* scorer2 = new G4PSPopulation(psName="Population"); 282 MFDet->RegisterPrimitive(scorer2); 315 MFDet->RegisterPrimitive(scorer2); 283 316 284 G4PSTrackCounter* scorer3 = new G4PSTrackCou << 317 G4PSTrackCounter* scorer3 = >> 318 new G4PSTrackCounter(psName="TrackEnter",fCurrent_In); 285 MFDet->RegisterPrimitive(scorer3); 319 MFDet->RegisterPrimitive(scorer3); 286 320 287 G4PSTrackLength* scorer4 = new G4PSTrackLeng << 321 G4PSTrackLength* scorer4 = new G4PSTrackLength(psName="SL"); 288 MFDet->RegisterPrimitive(scorer4); 322 MFDet->RegisterPrimitive(scorer4); 289 323 290 G4PSTrackLength* scorer5 = new G4PSTrackLeng << 324 G4PSTrackLength* scorer5 = new G4PSTrackLength(psName="SLW"); 291 scorer5->Weighted(true); 325 scorer5->Weighted(true); 292 MFDet->RegisterPrimitive(scorer5); 326 MFDet->RegisterPrimitive(scorer5); 293 327 294 G4PSTrackLength* scorer6 = new G4PSTrackLeng << 328 G4PSTrackLength* scorer6 = new G4PSTrackLength(psName="SLWE"); 295 scorer6->Weighted(true); 329 scorer6->Weighted(true); 296 scorer6->MultiplyKineticEnergy(true); 330 scorer6->MultiplyKineticEnergy(true); 297 MFDet->RegisterPrimitive(scorer6); 331 MFDet->RegisterPrimitive(scorer6); 298 332 299 G4PSTrackLength* scorer7 = new G4PSTrackLeng << 333 G4PSTrackLength* scorer7 = new G4PSTrackLength(psName="SLW_V"); 300 scorer7->Weighted(true); 334 scorer7->Weighted(true); 301 scorer7->DivideByVelocity(true); 335 scorer7->DivideByVelocity(true); 302 MFDet->RegisterPrimitive(scorer7); 336 MFDet->RegisterPrimitive(scorer7); 303 337 304 G4PSTrackLength* scorer8 = new G4PSTrackLeng << 338 G4PSTrackLength* scorer8 = new G4PSTrackLength(psName="SLWE_V"); 305 scorer8->Weighted(true); 339 scorer8->Weighted(true); 306 scorer8->MultiplyKineticEnergy(true); 340 scorer8->MultiplyKineticEnergy(true); 307 scorer8->DivideByVelocity(true); 341 scorer8->DivideByVelocity(true); 308 MFDet->RegisterPrimitive(scorer8); 342 MFDet->RegisterPrimitive(scorer8); 309 } 343 } 310 344 311 //....oooOO0OOooo........oooOO0OOooo........oo 345 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 312 G4VIStore* B02ImportanceDetectorConstruction:: 346 G4VIStore* B02ImportanceDetectorConstruction::CreateImportanceStore() 313 { 347 { 314 G4cout << " B02ImportanceDetectorConstructio << 348 315 if (!fPVolumeStore.Size()) { << 349 316 G4Exception("B02ImportanceDetectorConstruc << 350 G4cout << " B02ImportanceDetectorConstruction:: Creating Importance Store " 317 RunMustBeAborted, "no physical << 351 << G4endl; >> 352 if (!fPVolumeStore.Size()) >> 353 { >> 354 G4Exception("B02ImportanceDetectorConstruction::CreateImportanceStore" >> 355 ,"exampleB02_0001",RunMustBeAborted >> 356 ,"no physical volumes created yet!"); 318 } 357 } 319 358 320 // creating and filling the importance store 359 // creating and filling the importance store 321 << 360 322 // G4IStore *istore = new G4IStore(*fWorldV 361 // G4IStore *istore = new G4IStore(*fWorldVolume); 323 << 362 324 G4IStore* istore = G4IStore::GetInstance(Get << 363 G4IStore *istore = G4IStore::GetInstance(GetName()); 325 364 326 G4GeometryCell gWorldVolumeCell(GetWorldVolu 365 G4GeometryCell gWorldVolumeCell(GetWorldVolumeAddress(), 0); 327 366 328 G4double imp = 1; << 367 G4double imp =1; 329 368 330 istore->AddImportanceGeometryCell(1, gWorldV 369 istore->AddImportanceGeometryCell(1, gWorldVolumeCell); 331 370 332 // set importance values and create scorers << 371 // set importance values and create scorers 333 G4int cell(1); 372 G4int cell(1); 334 for (cell = 1; cell <= 18; cell++) { << 373 for (cell=1; cell<=18; cell++) { 335 G4GeometryCell gCell = GetGeometryCell(cel 374 G4GeometryCell gCell = GetGeometryCell(cell); 336 G4cout << " adding cell: " << cell << " re << 375 G4cout << " adding cell: " << cell >> 376 << " replica: " << gCell.GetReplicaNumber() 337 << " name: " << gCell.GetPhysicalVo 377 << " name: " << gCell.GetPhysicalVolume().GetName() << G4endl; 338 imp = std::pow(2.0, cell - 1); << 378 imp = std::pow(2.0,cell-1); 339 379 340 G4cout << "Going to assign importance: " < << 380 G4cout << "Going to assign importance: " << imp << ", to volume: " 341 << ", to volume: " << gCell.GetPhys << 381 << gCell.GetPhysicalVolume().GetName() << G4endl; 342 // x aIstore.AddImportanceGeometryCell( << 382 //x aIstore.AddImportanceGeometryCell(imp, gCell); 343 istore->AddImportanceGeometryCell(imp, gCe 383 istore->AddImportanceGeometryCell(imp, gCell.GetPhysicalVolume(), cell); 344 } 384 } 345 385 346 // creating the geometry cell and add both t 386 // creating the geometry cell and add both to the store 347 // G4GeometryCell gCell = GetGeometryCell(1 387 // G4GeometryCell gCell = GetGeometryCell(18); 348 388 349 // create importance geometry cell pair for 389 // create importance geometry cell pair for the "rest"cell 350 // with the same importance as the last conc << 390 // with the same importance as the last concrete cell 351 G4GeometryCell gCell = GetGeometryCell(19); 391 G4GeometryCell gCell = GetGeometryCell(19); 352 // G4double imp = std::pow(2.0,18); << 392 // G4double imp = std::pow(2.0,18); 353 imp = std::pow(2.0, 17); << 393 imp = std::pow(2.0,17); 354 istore->AddImportanceGeometryCell(imp, gCell 394 istore->AddImportanceGeometryCell(imp, gCell.GetPhysicalVolume(), 19); 355 395 356 return istore; 396 return istore; >> 397 357 } 398 } 358 399 359 //....oooOO0OOooo........oooOO0OOooo........oo 400 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 360 401 361 G4VWeightWindowStore* B02ImportanceDetectorCon << 402 G4VWeightWindowStore *B02ImportanceDetectorConstruction:: >> 403 CreateWeightWindowStore() 362 { 404 { 363 G4cout << " B02ImportanceDetectorConstructio << 405 G4cout << " B02ImportanceDetectorConstruction:: Creating Importance Store " 364 if (!fPVolumeStore.Size()) { << 406 << G4endl; 365 G4Exception("B02ImportanceDetectorConstruc << 407 if (!fPVolumeStore.Size()) 366 RunMustBeAborted, "no physical << 408 { >> 409 G4Exception("B02ImportanceDetectorConstruction::CreateWeightWindowStore" >> 410 ,"exampleB02_0002",RunMustBeAborted >> 411 ,"no physical volumes created yet!"); 367 } 412 } 368 413 369 // creating and filling the importance store 414 // creating and filling the importance store 370 << 415 371 // G4IStore *istore = new G4IStore(*fWorldV 416 // G4IStore *istore = new G4IStore(*fWorldVolume); >> 417 >> 418 G4WeightWindowStore *wwstore = G4WeightWindowStore::GetInstance(GetName()); 372 419 373 G4WeightWindowStore* wwstore = G4WeightWindo << 374 420 375 // create one energy region covering the ene 421 // create one energy region covering the energies of the problem 376 // 422 // 377 std::set<G4double, std::less<G4double>> enBo << 423 std::set<G4double, std::less<G4double> > enBounds; 378 enBounds.insert(1 * GeV); 424 enBounds.insert(1 * GeV); 379 wwstore->SetGeneralUpperEnergyBounds(enBound 425 wwstore->SetGeneralUpperEnergyBounds(enBounds); 380 << 426 381 G4int n = 0; 427 G4int n = 0; 382 G4double lowerWeight = 1; << 428 G4double lowerWeight =1; 383 std::vector<G4double> lowerWeights; 429 std::vector<G4double> lowerWeights; 384 430 385 lowerWeights.push_back(1); 431 lowerWeights.push_back(1); 386 G4GeometryCell gWorldCell(GetWorldVolumeAddr << 432 G4GeometryCell gWorldCell(GetWorldVolumeAddress(),0); 387 wwstore->AddLowerWeights(gWorldCell, lowerWe 433 wwstore->AddLowerWeights(gWorldCell, lowerWeights); 388 434 389 G4int cell(1); 435 G4int cell(1); 390 for (cell = 1; cell <= 18; cell++) { << 436 for (cell=1; cell<=18; cell++) { 391 G4GeometryCell gCell = GetGeometryCell(cel 437 G4GeometryCell gCell = GetGeometryCell(cell); 392 G4cout << " adding cell: " << cell << " re << 438 G4cout << " adding cell: " << cell >> 439 << " replica: " << gCell.GetReplicaNumber() 393 << " name: " << gCell.GetPhysicalVo 440 << " name: " << gCell.GetPhysicalVolume().GetName() << G4endl; 394 441 395 lowerWeight = 1. / std::pow(2., n++); << 442 lowerWeight = 1./std::pow(2., n++); 396 G4cout << "Going to assign lower weight: " << 443 G4cout << "Going to assign lower weight: " << lowerWeight 397 << ", to volume: " << gCell.GetPhys << 444 << ", to volume: " 398 lowerWeights.clear(); << 445 << gCell.GetPhysicalVolume().GetName() << G4endl; 399 lowerWeights.push_back(lowerWeight); << 446 lowerWeights.clear(); 400 wwstore->AddLowerWeights(gCell, lowerWeigh << 447 lowerWeights.push_back(lowerWeight); >> 448 wwstore->AddLowerWeights(gCell, lowerWeights); 401 } 449 } 402 450 403 // the remaining part pf the geometry (rest) 451 // the remaining part pf the geometry (rest) gets the same 404 // lower weight bound as the last conrete c 452 // lower weight bound as the last conrete cell 405 // 453 // 406 454 407 // create importance geometry cell pair for 455 // create importance geometry cell pair for the "rest"cell 408 // with the same importance as the last conc << 456 // with the same importance as the last concrete cell 409 G4GeometryCell gCell = GetGeometryCell(19); 457 G4GeometryCell gCell = GetGeometryCell(19); 410 wwstore->AddLowerWeights(gCell, lowerWeights << 458 wwstore->AddLowerWeights(gCell, lowerWeights); >> 459 411 460 412 return wwstore; 461 return wwstore; >> 462 413 } 463 } 414 464