#include <G4tgbVolumeMgr.hh>
Definition at line 66 of file G4tgbVolumeMgr.hh.
G4tgbVolumeMgr::G4tgbVolumeMgr | ( | ) |
Definition at line 56 of file G4tgbVolumeMgr.cc.
References G4ReflectionFactory::Instance(), and G4ReflectionFactory::SetScalePrecision().
Referenced by GetInstance().
00057 { 00058 G4ReflectionFactory::Instance()->SetScalePrecision(1.E-6*mm); 00059 // NOTE: problems building matrices with not enough figures, 00060 // like :ROTM RR30 0.866025 0.5 0. -0.5 0.866025 0. 0. 0 -1 00061 theDetectorBuilder = new G4tgbDetectorBuilder(); 00062 }
G4tgbVolumeMgr::~G4tgbVolumeMgr | ( | ) |
void G4tgbVolumeMgr::AddTextFile | ( | const G4String & | fname | ) |
Definition at line 85 of file G4tgbVolumeMgr.cc.
References G4tgrFileReader::AddTextFile(), and G4tgrFileReader::GetInstance().
00086 { 00087 G4tgrFileReader::GetInstance()->AddTextFile( fname ); 00088 }
void G4tgbVolumeMgr::BuildPhysVolTree | ( | ) |
Definition at line 343 of file G4tgbVolumeMgr.cc.
00344 { 00345 /* 00346 G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance(); 00347 std::vector<G4VPhysicalVolume*>::iterator cite; 00348 for( cite = pvs->begin(); cite != pvs->end(); cite++ ) 00349 { 00350 thePVTree[ *cite ] = (*cite)->GetMother(); 00351 thePVInvTree[ (*cite)->GetMother() ] = *cite; 00352 } 00353 */ 00354 }
void G4tgbVolumeMgr::CopyVolumes | ( | ) |
Definition at line 149 of file G4tgbVolumeMgr.cc.
References G4tgrVolumeMgr::GetInstance(), G4tgrVolumeMgr::GetVolumeMap(), and RegisterMe().
Referenced by G4tgbDetectorConstruction::Construct(), and G4tgbDetectorBuilder::ConstructDetector().
00150 { 00151 //--------- Loop G4tgbVolume's and create a G4tgbVolume for each DetUnit 00152 G4mapsvol::iterator cite; 00153 G4mapsvol vollist = G4tgrVolumeMgr::GetInstance()->GetVolumeMap(); 00154 for(cite = vollist.begin(); cite != vollist.end(); cite++) 00155 { 00156 G4tgrVolume* tgrvol = const_cast<G4tgrVolume*>( (*cite).second ); 00157 G4tgbVolume* svol = new G4tgbVolume( tgrvol ); 00158 RegisterMe( svol ); 00159 } 00160 }
void G4tgbVolumeMgr::DumpG4LogVolLeaf | ( | const G4LogicalVolume * | lv, | |
unsigned int | leafDepth | |||
) |
Definition at line 411 of file G4tgbVolumeMgr.cc.
References G4cout, G4endl, and G4LogicalVolume::GetName().
Referenced by DumpG4LogVolTree().
00413 { 00414 for( size_t ii=0; ii < leafDepth; ii++ ) 00415 { 00416 G4cout << " "; 00417 } 00418 G4cout << " LV:(" << leafDepth << ")" << lv->GetName() << G4endl; 00419 00420 //---------- construct the children of this volume 00421 // G4LogicalVolume* lvnc = const_cast<G4LogicalVolume*>(lv); 00422 // std::pair<G4mlvlv::iterator, G4mlvlv::iterator> children 00423 // = theLVTree.equal_range( lvnc ); 00424 // 00425 // G4mlvlv::iterator cite; 00426 00427 leafDepth++; 00428 // for( cite = children.first; cite != children.second; cite++ ) 00429 // { 00430 // DumpG4LVLeaf( (*cite)->second, leafDepth ); 00431 // } 00432 }
void G4tgbVolumeMgr::DumpG4LogVolTree | ( | ) |
Definition at line 400 of file G4tgbVolumeMgr.cc.
References DumpG4LogVolLeaf(), G4cout, G4endl, and GetTopLogVol().
Referenced by DumpSummary().
00401 { 00402 G4cout << " @@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << G4endl; 00403 00404 G4LogicalVolume* lv = GetTopLogVol(); 00405 00406 DumpG4LogVolLeaf(lv, 0); 00407 }
void G4tgbVolumeMgr::DumpG4PhysVolLeaf | ( | const G4VPhysicalVolume * | pv, | |
unsigned int | leafDepth | |||
) |
Definition at line 448 of file G4tgbVolumeMgr.cc.
References G4cout, G4endl, and G4VPhysicalVolume::GetName().
Referenced by DumpG4PhysVolTree().
00450 { 00451 for( size_t ii=0; ii < leafDepth; ii++ ) 00452 { 00453 G4cout << " "; 00454 } 00455 G4cout << " PV:(" << leafDepth << ")" << pv->GetName() << G4endl; 00456 00457 //---------- construct the children of this PV 00458 // G4VPhysicalVolume* pvnc = const_cast<G4VPhysicalVolume*>(pv); 00459 // std::pair<G4mpvpv::iterator, G4mpvpv::iterator> children 00460 // = thePVTree.equal_range( pvnc ); 00461 // 00462 // G4mpvpv::iterator cite; 00463 00464 leafDepth++; 00465 // for( cite = children.first; cite != children.second; cite++ ) 00466 // { 00467 // DumpG4PVLeaf( (*cite)->second, leafDepth ); 00468 // } 00469 }
void G4tgbVolumeMgr::DumpG4PhysVolTree | ( | ) |
Definition at line 437 of file G4tgbVolumeMgr.cc.
References DumpG4PhysVolLeaf(), G4cout, G4endl, and GetTopPhysVol().
Referenced by DumpSummary().
00438 { 00439 G4cout << " @@@@@@@@@@@@@ DUMPING G4PhysicalVolume's Tree " << G4endl; 00440 00441 G4VPhysicalVolume* pv = GetTopPhysVol(); 00442 00443 DumpG4PhysVolLeaf(pv, 0); 00444 }
void G4tgbVolumeMgr::DumpG4SolidList | ( | ) |
Definition at line 388 of file G4tgbVolumeMgr.cc.
References G4cout, and G4endl.
Referenced by DumpSummary().
00389 { 00390 G4mmssol::const_iterator cite; 00391 for( cite = theSolids.begin(); cite != theSolids.end(); cite++) 00392 { 00393 G4cout << "G4SOLID: " << (*cite).second->GetName() 00394 << " of type " << (*cite).second->GetEntityType() << G4endl; 00395 } 00396 }
void G4tgbVolumeMgr::DumpSummary | ( | ) |
Definition at line 358 of file G4tgbVolumeMgr.cc.
References DumpG4LogVolTree(), DumpG4PhysVolTree(), DumpG4SolidList(), G4cout, G4endl, G4tgbMaterialMgr::GetG4ElementList(), G4tgbMaterialMgr::GetG4IsotopeList(), G4tgbMaterialMgr::GetG4MaterialList(), G4tgbRotationMatrixMgr::GetG4RotMatList(), G4tgbRotationMatrixMgr::GetInstance(), G4tgbMaterialMgr::GetInstance(), G4VPhysicalVolume::GetName(), and GetTopPhysVol().
00359 { 00360 //---------- Dump number of objects of each class 00361 G4cout << " @@@@@@@@@@@@@ Dumping Geant4 geometry objects Summary " << G4endl; 00362 G4cout << " @@@ Geometry built inside world volume: " 00363 << GetTopPhysVol()->GetName() << G4endl; 00364 G4cout << " Number of G4VSolid's: " << theSolids.size() << G4endl; 00365 G4cout << " Number of G4LogicalVolume's: " << theLVs.size() << G4endl; 00366 G4cout << " Number of G4VPhysicalVolume's: " << thePVs.size() << G4endl; 00367 00368 G4tgbMaterialMgr* mateMgr = G4tgbMaterialMgr::GetInstance(); 00369 G4cout << " Number of G4Isotope's: " 00370 << mateMgr->GetG4IsotopeList().size() << G4endl; 00371 G4cout << " Number of G4Element's: " 00372 << mateMgr->GetG4ElementList().size() << G4endl; 00373 G4cout << " Number of G4Material's: " 00374 << mateMgr->GetG4MaterialList().size() << G4endl; 00375 00376 G4tgbRotationMatrixMgr* rotmMgr = G4tgbRotationMatrixMgr::GetInstance(); 00377 G4cout << " Number of G4RotationMatrix's: " 00378 << rotmMgr->GetG4RotMatList().size() << G4endl; 00379 00380 //---------- Dump list of objects of each class 00381 DumpG4SolidList(); 00382 DumpG4LogVolTree(); 00383 DumpG4PhysVolTree(); 00384 }
G4LogicalVolume * G4tgbVolumeMgr::FindG4LogVol | ( | const G4String & | theName, | |
const G4bool | bExists = 0 | |||
) |
Definition at line 239 of file G4tgbVolumeMgr.cc.
References FatalException, and G4Exception().
Referenced by G4tgbVolume::ConstructG4PhysVol(), and G4tgbVolume::ConstructG4Volumes().
00240 { 00241 G4mmslv::const_iterator mscite = theLVs.find( name ); 00242 if( mscite == theLVs.end() ) 00243 { 00244 if( exists ) 00245 { 00246 G4String ErrMessage = "Logical volume name " + name + " not found !"; 00247 G4Exception("G4tgbVolumeMgr::FindG4LogVol()", "InvalidSetup", 00248 FatalException, ErrMessage); 00249 } 00250 return 0; 00251 } 00252 else 00253 { 00254 return (*mscite).second; 00255 } 00256 }
G4VPhysicalVolume * G4tgbVolumeMgr::FindG4PhysVol | ( | const G4String & | theName, | |
const G4bool | bExists = 0 | |||
) |
Definition at line 260 of file G4tgbVolumeMgr.cc.
References FatalException, and G4Exception().
00261 { 00262 G4mmspv::const_iterator mscite = thePVs.find( name ); 00263 if( mscite == thePVs.end() ) 00264 { 00265 if( exists ) 00266 { 00267 G4String ErrMessage = "Physical volume name " + name + " not found !"; 00268 G4Exception("G4tgbVolumeMgr::FindG4PhysVol()", "InvalidSetup", 00269 FatalException, ErrMessage); 00270 } 00271 return 0; 00272 } 00273 else 00274 { 00275 return (*mscite).second; 00276 } 00277 }
Definition at line 178 of file G4tgbVolumeMgr.cc.
References G4cout, G4endl, and G4tgrMessenger::GetVerboseLevel().
Referenced by G4tgbVolume::FindOrConstructG4Solid().
00179 { 00180 #ifdef G4VERBOSE 00181 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00182 { 00183 G4cout << " G4tgbVolumeMgr::FindG4Solid() - " << name << G4endl; 00184 } 00185 #endif 00186 00187 G4VSolid* oldSolid = 0; 00188 std::pair<G4mmssol::iterator, G4mmssol::iterator> mmssdi; 00189 mmssdi = theSolids.equal_range( name ); 00190 00191 if( mmssdi.first != mmssdi.second ) { // check there is a solid found 00192 G4mmssol::const_iterator mmsscite = mmssdi.first; 00193 00194 #ifdef G4VERBOSE 00195 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00196 { 00197 G4cout << " G4tgbVolumeMgr::FindG4Solid() - Solid finding " 00198 << name << G4endl; 00199 } 00200 #endif 00201 /* 00202 G4VSolid overwrites the operator== comparing the addresses 00203 => this cannot be used !! 00204 Then just compare solids by name =>> POSP tag cannot be used 00205 for the moment ... 00206 if( solid == *( (*mmsscite).second ) ) 00207 { 00208 oldSolid = (*mmsscite).second; 00209 break; 00210 } 00211 until we write operator== for each solid type, we take a solid 00212 with the same name (therefore we will not allow two solids with 00213 equal name and different parameters (POSP) ) 00214 */ 00215 oldSolid = (*mmsscite).second; 00216 #ifdef G4VERBOSE 00217 if( G4tgrMessenger::GetVerboseLevel() >= 1 ) 00218 { 00219 G4cout << " G4tgbVolumeMgr::FindG4Solid() - Solid already found " 00220 << name << G4endl; 00221 } 00222 #endif 00223 } 00224 00225 #ifdef G4VERBOSE 00226 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00227 { 00228 G4cout << " G4tgbVolumeMgr::FindG4Solid() - Old solid: " 00229 << oldSolid << G4endl; 00230 } 00231 #endif 00232 00233 return oldSolid; 00234 }
G4tgbVolume * G4tgbVolumeMgr::FindVolume | ( | const G4String & | volname | ) |
Definition at line 164 of file G4tgbVolumeMgr.cc.
References FatalException, and G4Exception().
Referenced by G4tgbDetectorConstruction::Construct(), G4tgbDetectorBuilder::ConstructDetector(), G4tgbVolume::ConstructG4PhysVol(), and G4tgbVolume::ConstructG4Volumes().
00165 { 00166 G4mssvol::const_iterator cite = theVolumeList.find( volname ); 00167 if( cite == theVolumeList.end() ) 00168 { 00169 G4String ErrMessage = "G4tgbVolume not found: " + volname + " !"; 00170 G4Exception("G4tgbVolumeMgr::FindVolume()", "InvalidSetup", 00171 FatalException, ErrMessage); 00172 } 00173 return (*cite).second; 00174 }
G4tgbDetectorBuilder* G4tgbVolumeMgr::GetDetectorBuilder | ( | ) | const [inline] |
G4tgbVolumeMgr * G4tgbVolumeMgr::GetInstance | ( | ) | [static] |
Definition at line 74 of file G4tgbVolumeMgr.cc.
References G4tgbVolumeMgr().
Referenced by G4tgbDetectorConstruction::Construct(), G4tgbDetectorBuilder::ConstructDetector(), G4tgbVolume::ConstructG4PhysVol(), G4tgbVolume::ConstructG4Volumes(), and G4tgbVolume::FindOrConstructG4Solid().
00075 { 00076 if( !theInstance ) 00077 { 00078 theInstance = new G4tgbVolumeMgr(); 00079 } 00080 return theInstance; 00081 }
G4LogicalVolume * G4tgbVolumeMgr::GetTopLogVol | ( | ) |
Definition at line 299 of file G4tgbVolumeMgr.cc.
References FatalException, G4cout, G4endl, G4Exception(), G4LogicalVolume::GetName(), and G4tgrMessenger::GetVerboseLevel().
Referenced by DumpG4LogVolTree(), and GetTopPhysVol().
00300 { 00301 //----------- Start from any G4LogicalVolume, because if you go upwards 00302 // you will always end at the top 00303 #ifdef G4VERBOSE 00304 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00305 { 00306 G4cout << " G4tgbVolumeMgr::GetTopLogVol theLVInvTresize " 00307 << theLVInvTree.size() << G4endl; 00308 } 00309 #endif 00310 if( theLVInvTree.size() == 0 ) 00311 { 00312 G4Exception("G4tgbVolumeMgr::GetTopLogVol()", "InvalidSetup", 00313 FatalException, "theLVInvTree has no elements."); 00314 } 00315 G4LogicalVolume* lv = (*(theLVInvTree.begin())).second; 00316 00317 //------- if first element is the top LV, its parent is 0 00318 if( lv == 0 ) 00319 { 00320 lv = (*(theLVInvTree.begin())).first; 00321 } 00322 else 00323 { 00324 while( (*(theLVInvTree.find( lv ))).second != 0) 00325 { 00326 //---------- get parent of first position 00327 lv = (*(theLVInvTree.find( lv ))).second; 00328 #ifdef G4VERBOSE 00329 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00330 { 00331 G4cout << " G4tgbVolumeMgr::GetTopPhysVol: lv " 00332 << lv->GetName() << G4endl; 00333 } 00334 #endif 00335 } 00336 } 00337 00338 return lv; 00339 }
G4VPhysicalVolume * G4tgbVolumeMgr::GetTopPhysVol | ( | ) |
Definition at line 281 of file G4tgbVolumeMgr.cc.
References G4cout, G4endl, G4VPhysicalVolume::GetName(), G4LogicalVolume::GetName(), GetTopLogVol(), and G4tgrMessenger::GetVerboseLevel().
Referenced by G4tgbDetectorBuilder::ConstructDetector(), DumpG4PhysVolTree(), and DumpSummary().
00282 { 00283 G4LogicalVolume* lv = GetTopLogVol(); 00284 G4VPhysicalVolume* pv = ( *(thePVs.find( lv->GetName() )) ).second; 00285 00286 #ifdef G4VERBOSE 00287 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00288 { 00289 G4cout << " G4tgbVolumeMgr::GetTopPhysVol() - pv: " 00290 << pv->GetName() << G4endl; 00291 } 00292 #endif 00293 00294 return pv; 00295 }
G4VPhysicalVolume * G4tgbVolumeMgr::ReadAndConstructDetector | ( | ) |
Definition at line 92 of file G4tgbVolumeMgr.cc.
References G4tgbDetectorBuilder::ConstructDetector(), and G4tgbDetectorBuilder::ReadDetector().
00093 { 00094 const G4tgrVolume* tgrVoltop = theDetectorBuilder->ReadDetector(); 00095 return theDetectorBuilder->ConstructDetector(tgrVoltop); 00096 }
void G4tgbVolumeMgr::RegisterChildParentLVs | ( | const G4LogicalVolume * | logvol, | |
const G4LogicalVolume * | parentLV | |||
) |
Definition at line 139 of file G4tgbVolumeMgr.cc.
Referenced by G4tgbVolume::ConstructG4Volumes().
00141 { 00142 theLVInvTree[const_cast<G4LogicalVolume*>(logvol)] = 00143 const_cast<G4LogicalVolume*>(parentLV); 00144 theLVTree[const_cast<G4LogicalVolume*>(parentLV)] = 00145 const_cast<G4LogicalVolume*>(logvol); 00146 }
void G4tgbVolumeMgr::RegisterMe | ( | const G4VPhysicalVolume * | pv | ) |
Definition at line 131 of file G4tgbVolumeMgr.cc.
References G4VPhysicalVolume::GetName().
00132 { 00133 thePVs.insert( G4mmspv::value_type( pv->GetName(), 00134 const_cast<G4VPhysicalVolume*>(pv) ) ); 00135 }
void G4tgbVolumeMgr::RegisterMe | ( | const G4LogicalVolume * | lv | ) |
Definition at line 116 of file G4tgbVolumeMgr.cc.
References G4cout, G4endl, G4LogicalVolume::GetName(), and G4tgrMessenger::GetVerboseLevel().
00117 { 00118 theLVs.insert( G4mmslv::value_type( lv->GetName(), 00119 const_cast<G4LogicalVolume*>(lv) ) ); 00120 00121 #ifdef G4VERBOSE 00122 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00123 { 00124 G4cout << " G4tgbVolumeMgr::RegisterMe() - Logical volume registered: " 00125 << lv->GetName() << G4endl; 00126 } 00127 #endif 00128 }
void G4tgbVolumeMgr::RegisterMe | ( | const G4VSolid * | solid | ) |
Definition at line 108 of file G4tgbVolumeMgr.cc.
References G4VSolid::GetName().
00109 { 00110 theSolids.insert( G4mmssol::value_type( solid->GetName(), 00111 const_cast<G4VSolid*>(solid) ) ); 00112 }
void G4tgbVolumeMgr::RegisterMe | ( | const G4tgbVolume * | vol | ) |
Definition at line 100 of file G4tgbVolumeMgr.cc.
References G4tgbVolume::GetName().
Referenced by G4tgbVolume::ConstructG4Volumes(), and CopyVolumes().
00101 { 00102 theVolumeList.insert( G4mssvol::value_type( vol->GetName(), 00103 const_cast<G4tgbVolume*>(vol) ) ); 00104 }
void G4tgbVolumeMgr::SetDetectorBuilder | ( | G4tgbDetectorBuilder * | db | ) | [inline] |