50G4tgrVolumeMgr::G4tgrVolumeMgr()
56G4tgrVolumeMgr::~G4tgrVolumeMgr()
80 G4String ErrMessage =
"Solid already exists... " + wl[1];
81 G4Exception(
"G4tgrVolumeMgr::CreateSolid()",
"InvalidSetup",
85 std::vector<G4String> wlc = wl;
86 if( bVOLUtag ) { wlc.pop_back(); }
89 for(
size_t ii = 0; ii < wl2.length(); ii++ )
91 wl2[ii] = toupper( wl2[ii] );
93 if( (wl2 ==
"UNION") || (wl2 ==
"SUBTRACTION") || (wl2 ==
"INTERSECTION") )
111 if( theG4tgrSolidMap.find( sol->
GetName() ) != theG4tgrSolidMap.end() )
113 G4String ErrMessage =
"Cannot be two solids with the same name... "
115 G4Exception(
"G4tgrVolumeMgr::RegisterMe()",
"InvalidSetup",
118 theG4tgrSolidMap.insert(G4mapssol::value_type(sol->
GetName(), sol) );
125 if( theG4tgrSolidMap.find( sol->
GetName() ) != theG4tgrSolidMap.end() )
127 G4String ErrMessage =
"Cannot unregister a solid that is not registered... "
129 G4Exception(
"G4tgrSolidMgr::unRegisterMe()",
"InvalidSetup",
134 theG4tgrSolidMap.erase( theG4tgrSolidMap.find( sol->
GetName() ) );
142 theG4tgrVolumeList.push_back( vol );
143 if( theG4tgrVolumeMap.find( vol->
GetName() ) != theG4tgrVolumeMap.end() )
145 G4String ErrMessage =
"Cannot be two volumes with the same name... "
147 G4Exception(
"G4tgrVolumeMgr::RegisterMe()",
"InvalidSetup",
150 theG4tgrVolumeMap.insert(G4mapsvol::value_type(vol->
GetName(), vol) );
157 std::vector<G4tgrVolume*>::iterator ite;
158 for(ite = theG4tgrVolumeList.begin(); ite != theG4tgrVolumeList.end(); ite++)
160 if((*ite) == vol ) {
break; }
162 if( ite == theG4tgrVolumeList.end() )
164 G4String ErrMessage =
"Cannot unregister a volume not registered... "
166 G4Exception(
"G4tgrVolumeMgr::unRegisterMe()",
"InvalidSetup",
171 theG4tgrVolumeList.erase( ite );
173 theG4tgrVolumeMap.erase( theG4tgrVolumeMap.find( vol->
GetName() ) );
182 theG4tgrVolumeTree.insert(G4mmapspl::value_type(parentName, pl) );
191 G4mapssol::iterator svite = theG4tgrSolidMap.find( volname );
192 if( svite == theG4tgrSolidMap.end() )
196 for( svite = theG4tgrSolidMap.begin();
197 svite != theG4tgrSolidMap.end(); svite++ )
201 G4String ErrMessage =
"Solid not found... " + volname;
202 G4Exception(
"G4tgrVolumeMgr::FindSolid()",
"InvalidSetup",
208 vol =
const_cast<G4tgrSolid*
>((*svite).second);
221 G4mapsvol::iterator svite = theG4tgrVolumeMap.find( volname );
222 if( svite == theG4tgrVolumeMap.end() )
226 for( svite = theG4tgrVolumeMap.begin();
227 svite != theG4tgrVolumeMap.end(); svite++ )
231 G4String ErrMessage =
"Volume not found... " + volname;
232 G4Exception(
"G4tgrVolumeMgr::FindVolume()",
"InvalidSetup",
237 G4String WarMessage =
"Volume does not exists... " + volname;
238 G4Exception(
"G4tgrVolumeMgr::FindVolume()",
"SearchFailed",
251std::vector<G4tgrVolume*>
254 std::vector<G4tgrVolume*> vols;
256 G4mapsvol::iterator svite;
257 for( svite = theG4tgrVolumeMap.begin();
258 svite != theG4tgrVolumeMap.end(); svite++ )
262 vols.push_back(
const_cast<G4tgrVolume*
>((*svite).second) );
266 if( vols.size() == 0 )
270 for( svite = theG4tgrVolumeMap.begin();
271 svite != theG4tgrVolumeMap.end(); svite++ )
275 G4String ErrMessage =
"Volume not found... " + volname;
276 G4Exception(
"G4tgrVolumeMgr::FindVolumes()",
"InvalidSetup",
281 G4String WarMessage =
"Volume does not exists... " + volname;
282 G4Exception(
"G4tgrVolumeMgr::FindVolumes()",
"SearchFailed",
298 G4mapsvol::const_iterator itetv;
299 for( itetv = theG4tgrVolumeMap.begin();
300 itetv != theG4tgrVolumeMap.end(); itetv++ )
306 G4cout <<
" G4tgrVolumeMgr::GetTopVolume() - Vol: "
307 << vol->
GetName() <<
" no place = "
318 G4cout <<
" G4tgrVolumeMgr::GetTopVolume() - Vol: "
319 << vol->
GetName()<<
" N place = "
324 if ( (topVol != 0) && (topVol != vol)
325 && (topVol->
GetType() !=
"VOLDivision")
326 && (vol->
GetType() !=
"VOLDivision") )
329 "Two world volumes found, second will be taken",
JustWarning,
330 (
G4String(
"Both volumes are at the top of a hierarchy: ")
341std::pair<G4mmapspl::iterator, G4mmapspl::iterator>
344 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> dite;
345 dite = theG4tgrVolumeTree.equal_range( name );
353 G4cout <<
" @@@@@@@@@@@@@@@@ DUMPING G4tgrVolume's Tree " <<
G4endl;
364 unsigned int leafDepth)
366 for(
size_t ii=0; ii < leafDepth; ii++ )
371 <<
" copy No " << copyNo <<
G4endl;
374 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> children
376 G4mmapspl::const_iterator cite;
379 for( cite = children.first; cite != children.second; cite++ )
395 G4cout <<
" @@@@@@@@@@@@@@@@@@ Dumping Detector Summary " <<
G4endl;
396 G4cout <<
" @@@ Geometry built inside world volume: "
398 G4cout <<
" Number of G4tgrVolume's: "
399 << theG4tgrVolumeMap.size() <<
G4endl;
400 G4mapsvol::const_iterator cite;
401 unsigned int nPlace = 0;
402 for( cite = theG4tgrVolumeMap.begin();
403 cite != theG4tgrVolumeMap.end(); cite++ )
405 nPlace += ((*cite).second)->GetPlacements().size();
407 G4cout <<
" Number of G4tgrPlace's: " << nPlace <<
G4endl;
410 G4cout <<
" Number of G4tgrIsotope's: "
412 G4cout <<
" Number of G4tgrElement's: "
414 G4cout <<
" Number of G4tgrMaterial's: "
418 G4cout <<
" Number of G4tgrRotationMatrix's: "
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
const G4mstgrelem & GetElementList() const
const G4mstgrmate & GetMaterialList() const
static G4tgrMaterialFactory * GetInstance()
void DumpElementList() const
void DumpMaterialList() const
const G4mstgrisot & GetIsotopeList() const
void DumpIsotopeList() const
static G4int GetVerboseLevel()
unsigned int GetCopyNo() const
G4tgrVolume * GetVolume() const
std::vector< G4tgrRotationMatrix * > GetRotMatList() const
static G4tgrRotationMatrixFactory * GetInstance()
const G4String & GetName() const
static G4bool AreWordsEquivalent(const G4String &word1, const G4String &word2)
std::vector< G4tgrVolume * > FindVolumes(const G4String &volname, G4bool exists)
G4tgrVolume * FindVolume(const G4String &volname, G4bool exists=false)
G4tgrSolid * FindSolid(const G4String &name, G4bool exists=false)
void RegisterParentChild(const G4String &parentName, const G4tgrPlace *pl)
void DumpVolumeLeaf(const G4tgrVolume *vol, unsigned int copyNo, unsigned int leafDepth)
void RegisterMe(G4tgrSolid *vol)
const G4tgrVolume * GetTopVolume()
void UnRegisterMe(G4tgrSolid *vol)
G4tgrSolid * CreateSolid(const std::vector< G4String > &wl, G4bool bVOLUtag)
static G4tgrVolumeMgr * GetInstance()
std::pair< G4mmapspl::iterator, G4mmapspl::iterator > GetChildren(const G4String &name)
const G4String & GetName() const
const G4String & GetType() const
const std::vector< G4tgrPlace * > GetPlacements() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)