45G4tgrVolumeMgr::G4tgrVolumeMgr()
50G4tgrVolumeMgr::~G4tgrVolumeMgr()
58 if(theInstance ==
nullptr)
72 G4String ErrMessage =
"Solid already exists... " + wl[1];
77 std::vector<G4String> wlc = wl;
84 for(
G4int ii = 0; ii < (
G4int)wl2.length(); ++ii)
86 wl2[ii] = (char)std::toupper(wl2[ii]);
88 if((wl2 ==
"UNION") || (wl2 ==
"SUBTRACTION") || (wl2 ==
"INTERSECTION"))
94 else if(wl2 ==
"SCALED")
99 else if(wl2 ==
"MULTIUNION")
116 if(theG4tgrSolidMap.find(sol->
GetName()) != theG4tgrSolidMap.cend())
119 "Cannot be two solids with the same name... " + sol->
GetName();
123 theG4tgrSolidMap.insert(G4mapssol::value_type(sol->
GetName(), sol));
129 if(theG4tgrSolidMap.find(sol->
GetName()) != theG4tgrSolidMap.cend())
132 "Cannot unregister a solid that is not registered... " + sol->
GetName();
138 theG4tgrSolidMap.erase(theG4tgrSolidMap.find(sol->
GetName()));
145 theG4tgrVolumeList.push_back(vol);
146 if(theG4tgrVolumeMap.find(vol->
GetName()) != theG4tgrVolumeMap.cend())
149 "Cannot be two volumes with the same name... " + vol->
GetName();
153 theG4tgrVolumeMap.insert(G4mapsvol::value_type(vol->
GetName(), vol));
159 std::vector<G4tgrVolume*>::const_iterator ite;
160 for(ite = theG4tgrVolumeList.cbegin();
161 ite != theG4tgrVolumeList.cend(); ++ite)
168 if(ite == theG4tgrVolumeList.cend())
171 "Cannot unregister a volume not registered... " + vol->
GetName();
172 G4Exception(
"G4tgrVolumeMgr::unRegisterMe()",
"InvalidSetup",
177 theG4tgrVolumeList.erase(ite);
179 theG4tgrVolumeMap.erase(theG4tgrVolumeMap.find(vol->
GetName()));
186 theG4tgrVolumeTree.insert(G4mmapspl::value_type(parentName, pl));
194 G4mapssol::const_iterator svite = theG4tgrSolidMap.find(volname);
195 if(svite == theG4tgrSolidMap.cend())
199 for(svite = theG4tgrSolidMap.cbegin();
200 svite != theG4tgrSolidMap.cend(); ++svite)
204 G4String ErrMessage =
"Solid not found... " + volname;
211 vol =
const_cast<G4tgrSolid*
>((*svite).second);
222 G4mapsvol::const_iterator svite = theG4tgrVolumeMap.find(volname);
223 if(svite == theG4tgrVolumeMap.cend())
227 for(svite = theG4tgrVolumeMap.cbegin();
228 svite != theG4tgrVolumeMap.cend(); ++svite)
232 G4String ErrMessage =
"Volume not found... " + volname;
233 G4Exception(
"G4tgrVolumeMgr::FindVolume()",
"InvalidSetup",
238 G4String WarMessage =
"Volume does not exists... " + volname;
255 std::vector<G4tgrVolume*> vols;
257 G4mapsvol::const_iterator svite;
258 for(svite = theG4tgrVolumeMap.cbegin();
259 svite != theG4tgrVolumeMap.cend(); ++svite)
263 vols.push_back(
const_cast<G4tgrVolume*
>((*svite).second));
271 for(svite = theG4tgrVolumeMap.cbegin();
272 svite != theG4tgrVolumeMap.cend(); ++svite)
276 G4String ErrMessage =
"Volume not found... " + volname;
277 G4Exception(
"G4tgrVolumeMgr::FindVolumes()",
"InvalidSetup",
282 G4String WarMessage =
"Volume does not exists... " + volname;
298 for(
auto itetv = theG4tgrVolumeMap.cbegin();
299 itetv != theG4tgrVolumeMap.cend(); ++itetv)
305 G4cout <<
" G4tgrVolumeMgr::GetTopVolume() - Vol: " << vol->
GetName()
316 G4cout <<
" G4tgrVolumeMgr::GetTopVolume() - Vol: " << vol->
GetName()
321 if((topVol !=
nullptr) && (topVol != vol) &&
322 (topVol->
GetType() !=
"VOLDivision") &&
323 (vol->
GetType() !=
"VOLDivision"))
326 "Two world volumes found, second will be taken",
JustWarning,
327 (
G4String(
"Both volumes are at the top of a hierarchy: ") +
338std::pair<G4mmapspl::iterator, G4mmapspl::iterator>
341 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> dite;
342 dite = theG4tgrVolumeTree.equal_range(name);
349 G4cout <<
" @@@@@@@@@@@@@@@@ DUMPING G4tgrVolume's Tree " <<
G4endl;
358 unsigned int leafDepth)
360 for(std::size_t ii = 0; ii < leafDepth; ++ii)
364 G4cout <<
" VOL:(" << leafDepth <<
")" << vol->
GetName() <<
" copy No "
368 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> children =
370 G4mmapspl::const_iterator cite;
373 for(cite = children.first; cite != children.second; ++cite)
388 G4cout <<
" @@@@@@@@@@@@@@@@@@ Dumping Detector Summary " <<
G4endl;
389 G4cout <<
" @@@ Geometry built inside world volume: "
391 G4cout <<
" Number of G4tgrVolume's: " << theG4tgrVolumeMap.size() <<
G4endl;
392 unsigned int nPlace = 0;
393 for(
auto cite = theG4tgrVolumeMap.cbegin();
394 cite != theG4tgrVolumeMap.cend(); ++cite)
396 nPlace += ((*cite).second)->GetPlacements().size();
398 G4cout <<
" Number of G4tgrPlace's: " << nPlace <<
G4endl;
409 G4cout <<
" Number of G4tgrRotationMatrix's: "
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL 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