#include <G4tgrVolumeMgr.hh>
Public Member Functions | |
G4tgrSolid * | CreateSolid (const std::vector< G4String > &wl, G4bool bVOLUtag) |
void | RegisterParentChild (const G4String &parentName, const G4tgrPlace *pl) |
G4tgrSolid * | FindSolid (const G4String &name, G4bool exists=false) |
G4tgrVolume * | FindVolume (const G4String &volname, G4bool exists=false) |
std::vector< G4tgrVolume * > | FindVolumes (const G4String &volname, G4bool exists) |
const G4tgrVolume * | GetTopVolume () |
std::pair< G4mmapspl::iterator, G4mmapspl::iterator > | GetChildren (const G4String &name) |
void | DumpSummary () |
void | DumpVolumeTree () |
void | DumpVolumeLeaf (const G4tgrVolume *vol, unsigned int copyNo, unsigned int leafDepth) |
void | RegisterMe (G4tgrSolid *vol) |
void | UnRegisterMe (G4tgrSolid *vol) |
void | RegisterMe (G4tgrVolume *vol) |
void | UnRegisterMe (G4tgrVolume *vol) |
void | RegisterMe (G4tgrPlace *pl) |
void | RegisterMe (G4tgrIsotope *iso) |
void | RegisterMe (G4tgrElement *ele) |
void | RegisterMe (G4tgrMaterial *mat) |
void | RegisterMe (G4tgrRotationMatrix *rm) |
const G4mapssol & | GetSolidMap () |
const G4mapsvol & | GetVolumeMap () |
const G4mmapspl & | GetVolumeTree () |
std::vector< G4tgrVolume * > | GetVolumeList () |
std::vector< G4tgrPlace * > | GetDetPlaceList () |
std::vector< G4tgrIsotope * > | GetIsotopeList () |
std::vector< G4tgrElement * > | GetElementList () |
std::vector< G4tgrMaterial * > | GetMaterialList () |
std::vector< G4tgrRotationMatrix * > | GetRotMList () |
Static Public Member Functions | |
static G4tgrVolumeMgr * | GetInstance () |
Definition at line 59 of file G4tgrVolumeMgr.hh.
G4tgrSolid * G4tgrVolumeMgr::CreateSolid | ( | const std::vector< G4String > & | wl, | |
G4bool | bVOLUtag | |||
) |
Definition at line 75 of file G4tgrVolumeMgr.cc.
References FatalException, FindSolid(), and G4Exception().
Referenced by G4tgrVolume::G4tgrVolume(), and G4tgrLineProcessor::ProcessLine().
00076 { 00077 G4tgrSolid* sol = FindSolid( wl[1] ); 00078 if( sol ) 00079 { 00080 G4String ErrMessage = "Solid already exists... " + wl[1]; 00081 G4Exception("G4tgrVolumeMgr::CreateSolid()", "InvalidSetup", 00082 FatalException, ErrMessage); 00083 } 00084 00085 std::vector<G4String> wlc = wl; 00086 if( bVOLUtag ) { wlc.pop_back(); } 00087 00088 G4String wl2 = wlc[2]; 00089 for( size_t ii = 0; ii < wl2.length(); ii++ ) 00090 { 00091 wl2[ii] = toupper( wl2[ii] ); 00092 } 00093 if( (wl2 == "UNION") || (wl2 == "SUBTRACTION") || (wl2 == "INTERSECTION") ) 00094 { 00095 //---------- Boolean solid 00096 //---------- Create G4tgrSolidBoolean and fill the solid params 00097 sol = new G4tgrSolidBoolean( wlc ); 00098 } 00099 else 00100 { 00101 //---------- Create G4tgrSolidSimple and fill the solid params 00102 sol = new G4tgrSolid( wlc ); 00103 } 00104 00105 return sol; 00106 }
void G4tgrVolumeMgr::DumpSummary | ( | ) |
Definition at line 392 of file G4tgrVolumeMgr.cc.
References G4tgrMaterialFactory::DumpElementList(), G4tgrMaterialFactory::DumpIsotopeList(), G4tgrMaterialFactory::DumpMaterialList(), G4tgrRotationMatrixFactory::DumpRotmList(), DumpVolumeTree(), G4cout, G4endl, G4tgrMaterialFactory::GetElementList(), G4tgrRotationMatrixFactory::GetInstance(), G4tgrMaterialFactory::GetInstance(), G4tgrMaterialFactory::GetIsotopeList(), G4tgrMaterialFactory::GetMaterialList(), G4tgrVolume::GetName(), G4tgrRotationMatrixFactory::GetRotMatList(), and GetTopVolume().
00393 { 00394 //---------- Dump number of objects of each class 00395 G4cout << " @@@@@@@@@@@@@@@@@@ Dumping Detector Summary " << G4endl; 00396 G4cout << " @@@ Geometry built inside world volume: " 00397 << GetTopVolume()->GetName() << G4endl; 00398 G4cout << " Number of G4tgrVolume's: " 00399 << theG4tgrVolumeMap.size() << G4endl; 00400 G4mapsvol::const_iterator cite; 00401 unsigned int nPlace = 0; 00402 for( cite = theG4tgrVolumeMap.begin(); 00403 cite != theG4tgrVolumeMap.end(); cite++ ) 00404 { 00405 nPlace += ((*cite).second)->GetPlacements().size(); 00406 } 00407 G4cout << " Number of G4tgrPlace's: " << nPlace << G4endl; 00408 00409 G4tgrMaterialFactory* matef = G4tgrMaterialFactory::GetInstance(); 00410 G4cout << " Number of G4tgrIsotope's: " 00411 << matef->GetIsotopeList().size() << G4endl; 00412 G4cout << " Number of G4tgrElement's: " 00413 << matef->GetElementList().size() << G4endl; 00414 G4cout << " Number of G4tgrMaterial's: " 00415 << matef->GetMaterialList().size() << G4endl; 00416 00417 G4tgrRotationMatrixFactory* rotmf = G4tgrRotationMatrixFactory::GetInstance(); 00418 G4cout << " Number of G4tgrRotationMatrix's: " 00419 << rotmf->GetRotMatList().size() << G4endl; 00420 00421 00422 //---------- Dump detail list of objects of each class 00423 DumpVolumeTree(); 00424 00425 matef->DumpIsotopeList(); 00426 matef->DumpElementList(); 00427 matef->DumpMaterialList(); 00428 rotmf->DumpRotmList(); 00429 }
void G4tgrVolumeMgr::DumpVolumeLeaf | ( | const G4tgrVolume * | vol, | |
unsigned int | copyNo, | |||
unsigned int | leafDepth | |||
) |
Definition at line 362 of file G4tgrVolumeMgr.cc.
References G4cout, G4endl, GetChildren(), G4tgrPlace::GetCopyNo(), G4tgrVolume::GetName(), and G4tgrPlace::GetVolume().
Referenced by DumpVolumeTree().
00365 { 00366 for( size_t ii=0; ii < leafDepth; ii++ ) 00367 { 00368 G4cout << " "; 00369 } 00370 G4cout << " VOL:(" << leafDepth << ")" << vol->GetName() 00371 << " copy No " << copyNo << G4endl; 00372 00373 //---------- construct the children of this VOL 00374 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> children 00375 = GetChildren( vol->GetName() ); 00376 G4mmapspl::const_iterator cite; 00377 00378 leafDepth++; 00379 for( cite = children.first; cite != children.second; cite++ ) 00380 { 00381 //---- find G4tgrVolume pointed by G4tgrPlace 00382 const G4tgrPlace* pla = (*cite).second; 00383 const G4tgrVolume* volchild = pla->GetVolume(); 00384 //--- find copyNo 00385 unsigned int cn = pla->GetCopyNo(); 00386 DumpVolumeLeaf( volchild, cn, leafDepth ); 00387 } 00388 }
void G4tgrVolumeMgr::DumpVolumeTree | ( | ) |
Definition at line 351 of file G4tgrVolumeMgr.cc.
References DumpVolumeLeaf(), G4cout, G4endl, and GetTopVolume().
Referenced by DumpSummary().
00352 { 00353 G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrVolume's Tree " << G4endl; 00354 00355 const G4tgrVolume* vol = GetTopVolume(); 00356 00357 DumpVolumeLeaf( vol, 0, 0); 00358 }
G4tgrSolid * G4tgrVolumeMgr::FindSolid | ( | const G4String & | name, | |
G4bool | exists = false | |||
) |
Definition at line 187 of file G4tgrVolumeMgr.cc.
References FatalException, G4cerr, G4endl, and G4Exception().
Referenced by CreateSolid(), G4tgrSolidBoolean::G4tgrSolidBoolean(), and G4tgrVolume::G4tgrVolume().
00188 { 00189 G4tgrSolid* vol = 0; 00190 00191 G4mapssol::iterator svite = theG4tgrSolidMap.find( volname ); 00192 if( svite == theG4tgrSolidMap.end() ) 00193 { 00194 if( exists ) 00195 { 00196 for( svite = theG4tgrSolidMap.begin(); 00197 svite != theG4tgrSolidMap.end(); svite++ ) 00198 { 00199 G4cerr << " VOL:" << (*svite).first << G4endl; 00200 } 00201 G4String ErrMessage = "Solid not found... " + volname; 00202 G4Exception("G4tgrVolumeMgr::FindSolid()", "InvalidSetup", 00203 FatalException, ErrMessage); 00204 } 00205 } 00206 else 00207 { 00208 vol = const_cast<G4tgrSolid*>((*svite).second); 00209 } 00210 00211 return vol; 00212 }
G4tgrVolume * G4tgrVolumeMgr::FindVolume | ( | const G4String & | volname, | |
G4bool | exists = false | |||
) |
Definition at line 217 of file G4tgrVolumeMgr.cc.
References FatalException, G4cerr, G4endl, G4Exception(), and JustWarning.
Referenced by G4tgrLineProcessor::FindVolume(), G4tgrSolidBoolean::G4tgrSolidBoolean(), G4tgrVolumeDivision::G4tgrVolumeDivision(), and GetTopVolume().
00218 { 00219 G4tgrVolume* vol = 0; 00220 00221 G4mapsvol::iterator svite = theG4tgrVolumeMap.find( volname ); 00222 if( svite == theG4tgrVolumeMap.end() ) 00223 { 00224 if( exists ) 00225 { 00226 for( svite = theG4tgrVolumeMap.begin(); 00227 svite != theG4tgrVolumeMap.end(); svite++ ) 00228 { 00229 G4cerr << " VOL:" << (*svite).first << G4endl; 00230 } 00231 G4String ErrMessage = "Volume not found... " + volname; 00232 G4Exception("G4tgrVolumeMgr::FindVolume()", "InvalidSetup", 00233 FatalException, ErrMessage); 00234 } 00235 else 00236 { 00237 G4String WarMessage = "Volume does not exists... " + volname; 00238 G4Exception("G4tgrVolumeMgr::FindVolume()", "SearchFailed", 00239 JustWarning, WarMessage); 00240 } 00241 } 00242 else 00243 { 00244 vol = const_cast<G4tgrVolume*>((*svite).second); 00245 } 00246 00247 return vol; 00248 }
std::vector< G4tgrVolume * > G4tgrVolumeMgr::FindVolumes | ( | const G4String & | volname, | |
G4bool | exists | |||
) |
Definition at line 252 of file G4tgrVolumeMgr.cc.
References G4tgrUtils::AreWordsEquivalent(), FatalException, G4cerr, G4endl, G4Exception(), and JustWarning.
Referenced by G4tgrLineProcessor::ProcessLine().
00253 { 00254 std::vector<G4tgrVolume*> vols; 00255 00256 G4mapsvol::iterator svite; 00257 for( svite = theG4tgrVolumeMap.begin(); 00258 svite != theG4tgrVolumeMap.end(); svite++ ) 00259 { 00260 if( G4tgrUtils::AreWordsEquivalent( volname, (*svite).second->GetName()) ) 00261 { 00262 vols.push_back(const_cast<G4tgrVolume*>((*svite).second) ); 00263 } 00264 } 00265 00266 if( vols.size() == 0 ) 00267 { 00268 if( exists ) 00269 { 00270 for( svite = theG4tgrVolumeMap.begin(); 00271 svite != theG4tgrVolumeMap.end(); svite++ ) 00272 { 00273 G4cerr << " VOL:" << (*svite).first << G4endl; 00274 } 00275 G4String ErrMessage = "Volume not found... " + volname; 00276 G4Exception("G4tgrVolumeMgr::FindVolumes()", "InvalidSetup", 00277 FatalException, ErrMessage); 00278 } 00279 else 00280 { 00281 G4String WarMessage = "Volume does not exists... " + volname; 00282 G4Exception("G4tgrVolumeMgr::FindVolumes()", "SearchFailed", 00283 JustWarning, WarMessage); 00284 } 00285 } 00286 00287 return vols; 00288 }
std::pair< G4mmapspl::iterator, G4mmapspl::iterator > G4tgrVolumeMgr::GetChildren | ( | const G4String & | name | ) |
Definition at line 342 of file G4tgrVolumeMgr.cc.
Referenced by G4tgbVolume::ConstructG4Volumes(), and DumpVolumeLeaf().
00343 { 00344 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> dite; 00345 dite = theG4tgrVolumeTree.equal_range( name ); 00346 return dite; 00347 }
std::vector<G4tgrPlace*> G4tgrVolumeMgr::GetDetPlaceList | ( | ) | [inline] |
std::vector<G4tgrElement*> G4tgrVolumeMgr::GetElementList | ( | ) | [inline] |
G4tgrVolumeMgr * G4tgrVolumeMgr::GetInstance | ( | ) | [static] |
Definition at line 63 of file G4tgrVolumeMgr.cc.
Referenced by G4tgrVolumeAssembly::AddPlace(), G4tgrVolume::AddPlace(), G4tgrVolume::AddPlaceParam(), G4tgrVolume::AddPlaceReplica(), G4tgbDetectorConstruction::Construct(), G4tgbVolume::ConstructG4Volumes(), G4tgbVolumeMgr::CopyVolumes(), G4tgrLineProcessor::G4tgrLineProcessor(), G4tgrSolid::G4tgrSolid(), G4tgrSolidBoolean::G4tgrSolidBoolean(), G4tgrVolume::G4tgrVolume(), G4tgrVolumeDivision::G4tgrVolumeDivision(), and G4tgbDetectorBuilder::ReadDetector().
00064 { 00065 if( !theInstance ) 00066 { 00067 theInstance = new G4tgrVolumeMgr; 00068 } 00069 return theInstance; 00070 }
std::vector<G4tgrIsotope*> G4tgrVolumeMgr::GetIsotopeList | ( | ) | [inline] |
std::vector<G4tgrMaterial*> G4tgrVolumeMgr::GetMaterialList | ( | ) | [inline] |
std::vector<G4tgrRotationMatrix*> G4tgrVolumeMgr::GetRotMList | ( | ) | [inline] |
const G4mapssol& G4tgrVolumeMgr::GetSolidMap | ( | ) | [inline] |
const G4tgrVolume * G4tgrVolumeMgr::GetTopVolume | ( | ) |
Definition at line 292 of file G4tgrVolumeMgr.cc.
References FindVolume(), G4cout, G4endl, G4Exception(), G4tgrVolume::GetName(), G4tgrVolume::GetType(), G4tgrMessenger::GetVerboseLevel(), and JustWarning.
Referenced by G4tgbDetectorConstruction::Construct(), DumpSummary(), DumpVolumeTree(), and G4tgbDetectorBuilder::ReadDetector().
00293 { 00294 //--- Start from any G4tgrVolume and go upwards until you get to the top. 00295 // Check that indeed all volumes drive to the same top volume 00296 00297 const G4tgrVolume* topVol = 0; 00298 G4mapsvol::const_iterator itetv; 00299 for( itetv = theG4tgrVolumeMap.begin(); 00300 itetv != theG4tgrVolumeMap.end(); itetv++ ) 00301 { 00302 const G4tgrVolume* vol = (*itetv).second; 00303 #ifdef G4VERBOSE 00304 if( G4tgrMessenger::GetVerboseLevel() >= 3 ) 00305 { 00306 G4cout << " G4tgrVolumeMgr::GetTopVolume() - Vol: " 00307 << vol->GetName() << " no place = " 00308 << vol->GetPlacements().size() << G4endl; 00309 } 00310 #endif 00311 00312 while( vol->GetPlacements().size() != 0 ) 00313 { 00314 vol = FindVolume((*(vol->GetPlacements()).begin())->GetParentName(), 1); 00315 #ifdef G4VERBOSE 00316 if( G4tgrMessenger::GetVerboseLevel() >= 3 ) 00317 { 00318 G4cout << " G4tgrVolumeMgr::GetTopVolume() - Vol: " 00319 << vol->GetName()<< " N place = " 00320 << vol->GetPlacements().size() << G4endl; 00321 } 00322 #endif 00323 } 00324 if ( (topVol != 0) && (topVol != vol) 00325 && (topVol->GetType() != "VOLDivision") 00326 && (vol->GetType() != "VOLDivision") ) 00327 { 00328 G4Exception("G4tgrVolumeMgr::GetTopVolume()", 00329 "Two world volumes found, second will be taken", JustWarning, 00330 (G4String("Both volumes are at the top of a hierarchy: ") 00331 + topVol->GetName() + " & " + vol->GetName() ).c_str()); 00332 } 00333 topVol = vol; 00334 } 00335 00336 return topVol; 00337 }
std::vector<G4tgrVolume*> G4tgrVolumeMgr::GetVolumeList | ( | ) | [inline] |
const G4mapsvol& G4tgrVolumeMgr::GetVolumeMap | ( | ) | [inline] |
const G4mmapspl& G4tgrVolumeMgr::GetVolumeTree | ( | ) | [inline] |
void G4tgrVolumeMgr::RegisterMe | ( | G4tgrRotationMatrix * | rm | ) | [inline] |
void G4tgrVolumeMgr::RegisterMe | ( | G4tgrMaterial * | mat | ) | [inline] |
void G4tgrVolumeMgr::RegisterMe | ( | G4tgrElement * | ele | ) | [inline] |
void G4tgrVolumeMgr::RegisterMe | ( | G4tgrIsotope * | iso | ) | [inline] |
void G4tgrVolumeMgr::RegisterMe | ( | G4tgrPlace * | pl | ) | [inline] |
void G4tgrVolumeMgr::RegisterMe | ( | G4tgrVolume * | vol | ) |
Definition at line 140 of file G4tgrVolumeMgr.cc.
References FatalException, G4Exception(), and G4tgrVolume::GetName().
00141 { 00142 theG4tgrVolumeList.push_back( vol ); 00143 if( theG4tgrVolumeMap.find( vol->GetName() ) != theG4tgrVolumeMap.end() ) 00144 { 00145 G4String ErrMessage = "Cannot be two volumes with the same name... " 00146 + vol->GetName(); 00147 G4Exception("G4tgrVolumeMgr::RegisterMe()", "InvalidSetup", 00148 FatalException, ErrMessage); 00149 } 00150 theG4tgrVolumeMap.insert(G4mapsvol::value_type(vol->GetName(), vol) ); 00151 }
void G4tgrVolumeMgr::RegisterMe | ( | G4tgrSolid * | vol | ) |
Definition at line 109 of file G4tgrVolumeMgr.cc.
References FatalException, G4Exception(), and G4tgrSolid::GetName().
Referenced by G4tgrSolid::G4tgrSolid(), G4tgrSolidBoolean::G4tgrSolidBoolean(), and G4tgrLineProcessor::ProcessLine().
00110 { 00111 if( theG4tgrSolidMap.find( sol->GetName() ) != theG4tgrSolidMap.end() ) 00112 { 00113 G4String ErrMessage = "Cannot be two solids with the same name... " 00114 + sol->GetName(); 00115 G4Exception("G4tgrVolumeMgr::RegisterMe()", "InvalidSetup", 00116 FatalException, ErrMessage); 00117 } 00118 theG4tgrSolidMap.insert(G4mapssol::value_type(sol->GetName(), sol) ); 00119 }
void G4tgrVolumeMgr::RegisterParentChild | ( | const G4String & | parentName, | |
const G4tgrPlace * | pl | |||
) |
Definition at line 179 of file G4tgrVolumeMgr.cc.
Referenced by G4tgrVolumeAssembly::AddPlace(), G4tgrVolume::AddPlace(), G4tgrVolume::AddPlaceParam(), G4tgrVolume::AddPlaceReplica(), and G4tgrVolumeDivision::G4tgrVolumeDivision().
void G4tgrVolumeMgr::UnRegisterMe | ( | G4tgrVolume * | vol | ) |
Definition at line 155 of file G4tgrVolumeMgr.cc.
References FatalException, G4Exception(), and G4tgrVolume::GetName().
00156 { 00157 std::vector<G4tgrVolume*>::iterator ite; 00158 for(ite = theG4tgrVolumeList.begin(); ite != theG4tgrVolumeList.end(); ite++) 00159 { 00160 if((*ite) == vol ) { break; } 00161 } 00162 if( ite == theG4tgrVolumeList.end() ) 00163 { 00164 G4String ErrMessage = "Cannot unregister a volume not registered... " 00165 + vol->GetName(); 00166 G4Exception("G4tgrVolumeMgr::unRegisterMe()", "InvalidSetup", 00167 FatalException, ErrMessage); 00168 } 00169 else 00170 { 00171 theG4tgrVolumeList.erase( ite ); 00172 } 00173 theG4tgrVolumeMap.erase( theG4tgrVolumeMap.find( vol->GetName() ) ); 00174 }
void G4tgrVolumeMgr::UnRegisterMe | ( | G4tgrSolid * | vol | ) |
Definition at line 123 of file G4tgrVolumeMgr.cc.
References FatalException, G4Exception(), and G4tgrSolid::GetName().
00124 { 00125 if( theG4tgrSolidMap.find( sol->GetName() ) != theG4tgrSolidMap.end() ) 00126 { 00127 G4String ErrMessage = "Cannot unregister a solid that is not registered... " 00128 + sol->GetName(); 00129 G4Exception("G4tgrSolidMgr::unRegisterMe()", "InvalidSetup", 00130 FatalException, ErrMessage); 00131 } 00132 else 00133 { 00134 theG4tgrSolidMap.erase( theG4tgrSolidMap.find( sol->GetName() ) ); 00135 } 00136 }