#include <G4Region.hh>
Definition at line 61 of file G4Region.hh.
G4Region::G4Region | ( | const G4String & | name | ) |
Definition at line 48 of file G4Region.cc.
References G4endl, G4Exception(), G4RegionStore::GetInstance(), G4RegionStore::GetRegion(), JustWarning, and G4RegionStore::Register().
00049 : fName(pName), fRegionMod(true), fCut(0), fUserInfo(0), fUserLimits(0), 00050 fFieldManager(0), fFastSimulationManager(0), fWorldPhys(0), 00051 fRegionalSteppingAction(0), 00052 fInMassGeometry(false), fInParallelGeometry(false) 00053 { 00054 G4RegionStore* rStore = G4RegionStore::GetInstance(); 00055 if (rStore->GetRegion(pName,false)) 00056 { 00057 std::ostringstream message; 00058 message << "The region has NOT been registered !" << G4endl 00059 << " Region " << pName << " already existing in store !" 00060 << G4endl; 00061 G4Exception("G4Region::G4Region()", "GeomMgt1001", 00062 JustWarning, message); 00063 } 00064 else 00065 { 00066 rStore->Register(this); 00067 } 00068 }
G4Region::~G4Region | ( | ) | [virtual] |
Definition at line 91 of file G4Region.cc.
References G4RegionStore::DeRegister(), and G4RegionStore::GetInstance().
00092 { 00093 G4RegionStore::GetInstance()->DeRegister(this); 00094 if(fUserInfo) delete fUserInfo; 00095 }
G4Region::G4Region | ( | __void__ & | ) |
Definition at line 75 of file G4Region.cc.
References G4RegionStore::GetInstance(), and G4RegionStore::Register().
00076 : fName(""), fRegionMod(true), fCut(0), fUserInfo(0), fUserLimits(0), 00077 fFieldManager(0), fFastSimulationManager(0), fWorldPhys(0), 00078 fRegionalSteppingAction(0), 00079 fInMassGeometry(false), fInParallelGeometry(false) 00080 { 00081 // Register to store 00082 // 00083 G4RegionStore::GetInstance()->Register(this); 00084 }
void G4Region::AddRootLogicalVolume | ( | G4LogicalVolume * | lv | ) |
Definition at line 227 of file G4Region.cc.
References ScanVolumeTree(), and G4LogicalVolume::SetRegionRootFlag().
Referenced by G4RunManagerKernel::DefineWorldVolume().
00228 { 00229 // Check the logical volume is not already in the list 00230 // 00231 G4RootLVList::iterator pos; 00232 pos = std::find(fRootVolumes.begin(),fRootVolumes.end(),lv); 00233 if (pos == fRootVolumes.end()) 00234 { 00235 // Insert the root volume in the list and set it as root region 00236 // 00237 fRootVolumes.push_back(lv); 00238 lv->SetRegionRootFlag(true); 00239 } 00240 00241 // Scan recursively the tree of daugther volumes and set regions 00242 // 00243 ScanVolumeTree(lv, true); 00244 00245 // Set region as modified 00246 // 00247 fRegionMod = true; 00248 }
G4bool G4Region::BelongsTo | ( | G4VPhysicalVolume * | thePhys | ) | const |
Definition at line 335 of file G4Region.cc.
References G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetNoDaughters(), and G4LogicalVolume::GetRegion().
Referenced by SetWorld().
00336 { 00337 G4LogicalVolume* currLog = thePhys->GetLogicalVolume(); 00338 if (currLog->GetRegion()==this) {return true;} 00339 00340 G4int nDaughters = currLog->GetNoDaughters(); 00341 while (nDaughters--) 00342 { 00343 if (BelongsTo(currLog->GetDaughter(nDaughters))) {return true;} 00344 } 00345 00346 return false; 00347 }
void G4Region::ClearFastSimulationManager | ( | ) |
Definition at line 355 of file G4Region.cc.
References G4endl, G4Exception(), GetFastSimulationManager(), GetParentRegion(), and JustWarning.
Referenced by G4FastSimulationManager::~G4FastSimulationManager().
00356 { 00357 G4bool isUnique; 00358 G4Region* parent = GetParentRegion(isUnique); 00359 if(parent) 00360 { 00361 if (isUnique) 00362 { 00363 fFastSimulationManager = parent->GetFastSimulationManager(); 00364 } 00365 else 00366 { 00367 std::ostringstream message; 00368 message << "Region <" << fName << "> belongs to more than" 00369 << " one parent region !" << G4endl 00370 << "A region cannot belong to more than one direct parent region," 00371 << G4endl 00372 << "to have fast-simulation assigned."; 00373 G4Exception("G4Region::ClearFastSimulationManager()", 00374 "GeomMgt1002", JustWarning, message); 00375 fFastSimulationManager = 0; 00376 } 00377 } 00378 else 00379 { 00380 fFastSimulationManager = 0; 00381 } 00382 }
void G4Region::ClearMap | ( | ) | [inline] |
Definition at line 196 of file G4Region.icc.
00197 { 00198 if(!(fMaterialCoupleMap.empty())) 00199 { 00200 G4MaterialCoupleMap::iterator b = fMaterialCoupleMap.begin(); 00201 G4MaterialCoupleMap::iterator e = fMaterialCoupleMap.end(); 00202 fMaterialCoupleMap.erase(b,e); 00203 } 00204 }
void G4Region::ClearMaterialList | ( | ) |
G4MaterialCutsCouple * G4Region::FindCouple | ( | G4Material * | mat | ) | [inline] |
Definition at line 222 of file G4Region.icc.
Referenced by G4LogicalVolume::UpdateMaterial().
00223 { 00224 G4MaterialCoupleMap::iterator c = fMaterialCoupleMap.find(mat); 00225 G4MaterialCutsCouple* couple = 0; 00226 if(c!=fMaterialCoupleMap.end()) couple = (*c).second; 00227 return couple; 00228 }
G4FastSimulationManager * G4Region::GetFastSimulationManager | ( | ) | const [inline] |
Definition at line 245 of file G4Region.icc.
Referenced by ClearFastSimulationManager(), G4RunManagerKernel::DumpRegion(), G4VFastSimulationModel::G4VFastSimulationModel(), G4LogicalVolume::GetFastSimulationManager(), and G4FastSimulationManager::~G4FastSimulationManager().
G4FieldManager * G4Region::GetFieldManager | ( | ) | const [inline] |
Definition at line 255 of file G4Region.icc.
Referenced by G4PropagatorInField::FindAndSetFieldManager().
std::vector< G4Material * >::const_iterator G4Region::GetMaterialIterator | ( | ) | const [inline] |
Definition at line 125 of file G4Region.icc.
Referenced by G4RunManagerKernel::DumpRegion().
00126 { 00127 G4MaterialList::const_iterator iterator = fMaterials.begin(); 00128 return iterator; 00129 }
const G4String & G4Region::GetName | ( | ) | const [inline] |
Definition at line 50 of file G4Region.icc.
Referenced by G4PhysicalVolumeModel::CreateCurrentAttValues(), G4RunManagerKernel::DefineWorldVolume(), G4EmModelManager::DumpModelList(), G4RunManagerKernel::DumpRegion(), G4FastSimulationManager::ListTitle(), and G4GlobalFastSimulationManager::ShowSetup().
size_t G4Region::GetNumberOfMaterials | ( | ) | const [inline] |
size_t G4Region::GetNumberOfRootVolumes | ( | ) | const [inline] |
Definition at line 146 of file G4Region.icc.
Referenced by G4RunManagerKernel::DefineWorldVolume(), and G4RunManagerKernel::DumpRegion().
Definition at line 390 of file G4Region.cc.
References G4LogicalVolumeStore::GetInstance().
Referenced by ClearFastSimulationManager().
00391 { 00392 G4Region* parent = 0; unique = true; 00393 G4LogicalVolumeStore* lvStore = G4LogicalVolumeStore::GetInstance(); 00394 G4LogicalVolumeStore::iterator lvItr; 00395 00396 // Loop over all logical volumes in the store 00397 // 00398 for(lvItr=lvStore->begin(); lvItr!=lvStore->end(); lvItr++) 00399 { 00400 G4int nD = (*lvItr)->GetNoDaughters(); 00401 G4Region* aR = (*lvItr)->GetRegion(); 00402 00403 // Loop over all daughters of each logical volume 00404 // 00405 for(G4int iD=0; iD<nD; iD++) 00406 { 00407 if((*lvItr)->GetDaughter(iD)->GetLogicalVolume()->GetRegion()==this) 00408 { 00409 if(parent) 00410 { 00411 if(parent!=aR) { unique = false; } 00412 } 00413 else // Cache LV parent region which includes a daughter volume 00414 // with the same associated region as the current one 00415 { 00416 parent = aR; 00417 } 00418 } 00419 } 00420 } 00421 return parent; 00422 }
G4ProductionCuts * G4Region::GetProductionCuts | ( | ) | const [inline] |
Definition at line 101 of file G4Region.icc.
Referenced by G4RunManagerKernel::DumpRegion(), G4EmCalculator::FindCouple(), G4VUserPhysicsList::GetCutValue(), G4VAtomDeexcitation::InitialiseAtomicDeexcitation(), and G4VUserPhysicsList::SetParticleCuts().
G4UserSteppingAction * G4Region::GetRegionalSteppingAction | ( | ) | const [inline] |
Definition at line 311 of file G4Region.icc.
Referenced by G4RunManagerKernel::DumpRegion(), and G4SteppingManager::Stepping().
std::vector< G4LogicalVolume * >::iterator G4Region::GetRootLogicalVolumeIterator | ( | ) | [inline] |
Definition at line 112 of file G4Region.icc.
Referenced by G4RunManagerKernel::DefineWorldVolume(), and G4RunManagerKernel::DumpRegion().
00113 { 00114 G4RootLVList::iterator iterator = 00115 G4RootLVList::iterator(fRootVolumes.begin()); 00116 return iterator; 00117 }
G4VUserRegionInformation * G4Region::GetUserInformation | ( | ) | const [inline] |
G4UserLimits * G4Region::GetUserLimits | ( | ) | const [inline] |
Definition at line 186 of file G4Region.icc.
Referenced by G4RunManagerKernel::DumpRegion(), and G4LogicalVolume::GetUserLimits().
G4VPhysicalVolume * G4Region::GetWorldPhysical | ( | ) | const [inline] |
Definition at line 275 of file G4Region.icc.
Referenced by G4RunManagerKernel::DumpRegion(), and G4FastSimulationManager::ListTitle().
G4bool G4Region::IsInMassGeometry | ( | ) | const [inline] |
G4bool G4Region::IsInParallelGeometry | ( | ) | const [inline] |
G4bool G4Region::IsModified | ( | ) | const [inline] |
void G4Region::RegionModified | ( | G4bool | flag | ) | [inline] |
Definition at line 70 of file G4Region.icc.
Referenced by G4LogicalVolume::AddDaughter(), G4LogicalVolume::ClearDaughters(), and G4LogicalVolume::RemoveDaughter().
void G4Region::RegisterMaterialCouplePair | ( | G4Material * | mat, | |
G4MaterialCutsCouple * | couple | |||
) | [inline] |
void G4Region::RemoveRootLogicalVolume | ( | G4LogicalVolume * | lv, | |
G4bool | scan = true | |||
) |
Definition at line 256 of file G4Region.cc.
References G4LogicalVolume::SetRegionRootFlag(), and UpdateMaterialList().
Referenced by G4RunManagerKernel::DefineWorldVolume(), and G4LogicalVolume::~G4LogicalVolume().
00257 { 00258 // Find and remove logical volume from the list 00259 // 00260 G4RootLVList::iterator pos; 00261 pos = std::find(fRootVolumes.begin(),fRootVolumes.end(),lv); 00262 if (pos != fRootVolumes.end()) 00263 { 00264 if (fRootVolumes.size() != 1) // Avoid resetting flag for world since 00265 { // volume may be already deleted ! 00266 lv->SetRegionRootFlag(false); 00267 } 00268 fRootVolumes.erase(pos); 00269 } 00270 00271 if (scan) // Update the materials list 00272 { 00273 UpdateMaterialList(); 00274 } 00275 00276 // Set region as modified 00277 // 00278 fRegionMod = true; 00279 }
void G4Region::ScanVolumeTree | ( | G4LogicalVolume * | lv, | |
G4bool | region | |||
) |
Definition at line 106 of file G4Region.cc.
References FatalException, G4endl, G4Exception(), G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4Material::GetMaterial(), G4LogicalVolume::GetMaterial(), G4VPVParameterisation::GetMaterialScanner(), G4VPhysicalVolume::GetMultiplicity(), G4VPhysicalVolume::GetName(), G4LogicalVolume::GetName(), G4LogicalVolume::GetNoDaughters(), G4VVolumeMaterialScanner::GetNumberOfMaterials(), G4VPhysicalVolume::GetParameterisation(), G4VPhysicalVolume::IsParameterised(), and G4LogicalVolume::SetRegion().
Referenced by AddRootLogicalVolume(), G4LogicalVolume::PropagateRegion(), and UpdateMaterialList().
00107 { 00108 // If logical volume is going to become a region, add 00109 // its material to the list if not already present 00110 // 00111 G4Region* currentRegion = 0; 00112 size_t noDaughters = lv->GetNoDaughters(); 00113 G4Material* volMat = lv->GetMaterial(); 00114 if(!volMat && fInMassGeometry) 00115 { 00116 std::ostringstream message; 00117 message << "Logical volume <" << lv->GetName() << ">" << G4endl 00118 << "does not have a valid material pointer." << G4endl 00119 << "A logical volume belonging to the (tracking) world volume " 00120 << "must have a valid material."; 00121 G4Exception("G4Region::ScanVolumeTree()", "GeomMgt0002", 00122 FatalException, message, "Check your geometry construction."); 00123 } 00124 if (region) 00125 { 00126 currentRegion = this; 00127 if (volMat) 00128 { 00129 AddMaterial(volMat); 00130 G4Material* baseMat = const_cast<G4Material*>(volMat->GetBaseMaterial()); 00131 if (baseMat) { AddMaterial(baseMat); } 00132 } 00133 } 00134 00135 // Set the LV region to be either the current region or NULL, 00136 // according to the boolean selector 00137 // 00138 lv->SetRegion(currentRegion); 00139 00140 // Stop recursion here if no further daughters are involved 00141 // 00142 if(noDaughters==0) return; 00143 00144 G4VPhysicalVolume* daughterPVol = lv->GetDaughter(0); 00145 if (daughterPVol->IsParameterised()) 00146 { 00147 // Adopt special treatment in case of parameterised volumes, 00148 // where parameterisation involves a new material scan 00149 // 00150 G4VPVParameterisation* pParam = daughterPVol->GetParameterisation(); 00151 00152 if (pParam->GetMaterialScanner()) 00153 { 00154 size_t matNo = pParam->GetMaterialScanner()->GetNumberOfMaterials(); 00155 for (register size_t mat=0; mat<matNo; mat++) 00156 { 00157 volMat = pParam->GetMaterialScanner()->GetMaterial(mat); 00158 if(!volMat && fInMassGeometry) 00159 { 00160 std::ostringstream message; 00161 message << "The parameterisation for the physical volume <" 00162 << daughterPVol->GetName() << ">" << G4endl 00163 << "does not return a valid material pointer." << G4endl 00164 << "A volume belonging to the (tracking) world volume must " 00165 << "have a valid material."; 00166 G4Exception("G4Region::ScanVolumeTree()", "GeomMgt0002", 00167 FatalException, message, "Check your parameterisation."); 00168 } 00169 if (volMat) 00170 { 00171 AddMaterial(volMat); 00172 G4Material* baseMat = const_cast<G4Material*>(volMat->GetBaseMaterial()); 00173 if (baseMat) { AddMaterial(baseMat); } 00174 } 00175 } 00176 } 00177 else 00178 { 00179 size_t repNo = daughterPVol->GetMultiplicity(); 00180 for (register size_t rep=0; rep<repNo; rep++) 00181 { 00182 volMat = pParam->ComputeMaterial(rep, daughterPVol); 00183 if(!volMat && fInMassGeometry) 00184 { 00185 std::ostringstream message; 00186 message << "The parameterisation for the physical volume <" 00187 << daughterPVol->GetName() << ">" << G4endl 00188 << "does not return a valid material pointer." << G4endl 00189 << "A volume belonging to the (tracking) world volume must " 00190 << "have a valid material."; 00191 G4Exception("G4Region::ScanVolumeTree()", "GeomMgt0002", 00192 FatalException, message, "Check your parameterisation."); 00193 } 00194 if(volMat) 00195 { 00196 AddMaterial(volMat); 00197 G4Material* baseMat = const_cast<G4Material*>(volMat->GetBaseMaterial()); 00198 if (baseMat) { AddMaterial(baseMat); } 00199 } 00200 } 00201 } 00202 G4LogicalVolume* daughterLVol = daughterPVol->GetLogicalVolume(); 00203 ScanVolumeTree(daughterLVol, region); 00204 } 00205 else 00206 { 00207 for (register size_t i=0; i<noDaughters; i++) 00208 { 00209 G4LogicalVolume* daughterLVol = lv->GetDaughter(i)->GetLogicalVolume(); 00210 if (!daughterLVol->IsRootRegion()) 00211 { 00212 // Set daughter's LV to be a region and store materials in 00213 // the materials list, if the LV is not already a root region 00214 // 00215 ScanVolumeTree(daughterLVol, region); 00216 } 00217 } 00218 } 00219 }
void G4Region::SetFastSimulationManager | ( | G4FastSimulationManager * | fsm | ) | [inline] |
Definition at line 235 of file G4Region.icc.
Referenced by G4FastSimulationManager::G4FastSimulationManager().
void G4Region::SetFieldManager | ( | G4FieldManager * | fm | ) | [inline] |
void G4Region::SetName | ( | const G4String & | name | ) | [inline] |
void G4Region::SetProductionCuts | ( | G4ProductionCuts * | cut | ) | [inline] |
Definition at line 90 of file G4Region.icc.
Referenced by G4RunManagerKernel::DumpRegion(), and G4RunManagerKernel::G4RunManagerKernel().
void G4Region::SetRegionalSteppingAction | ( | G4UserSteppingAction * | rusa | ) | [inline] |
void G4Region::SetUserInformation | ( | G4VUserRegionInformation * | ui | ) | [inline] |
void G4Region::SetUserLimits | ( | G4UserLimits * | ul | ) | [inline] |
void G4Region::SetWorld | ( | G4VPhysicalVolume * | wp | ) |
Definition at line 319 of file G4Region.cc.
References BelongsTo().
00320 { 00321 if(!wp) 00322 { fWorldPhys = 0; } 00323 else 00324 { if(BelongsTo(wp)) fWorldPhys = wp; } 00325 00326 return; 00327 }
void G4Region::UpdateMaterialList | ( | ) |
Definition at line 297 of file G4Region.cc.
References ClearMaterialList(), and ScanVolumeTree().
Referenced by RemoveRootLogicalVolume().
00298 { 00299 // Reset the materials list 00300 // 00301 ClearMaterialList(); 00302 00303 // Loop over the root logical volumes and rebuild the list 00304 // of materials from scratch 00305 // 00306 G4RootLVList::iterator pLV; 00307 for (pLV=fRootVolumes.begin(); pLV!=fRootVolumes.end(); pLV++) 00308 { 00309 ScanVolumeTree(*pLV, true); 00310 } 00311 }
void G4Region::UsedInMassGeometry | ( | G4bool | val = true |
) | [inline] |
void G4Region::UsedInParallelGeometry | ( | G4bool | val = true |
) | [inline] |