43G4tgrVolumeMgr::G4tgrVolumeMgr()
48G4tgrVolumeMgr::~G4tgrVolumeMgr()
56 if(theInstance ==
nullptr)
70 G4String ErrMessage =
"Solid already exists... " + wl[1];
75 std::vector<G4String> wlc = wl;
82 for(std::size_t ii = 0; ii < wl2.length(); ++ii)
84 wl2[ii] = toupper(wl2[ii]);
86 if((wl2 ==
"UNION") || (wl2 ==
"SUBTRACTION") || (wl2 ==
"INTERSECTION"))
104 if(theG4tgrSolidMap.find(sol->
GetName()) != theG4tgrSolidMap.cend())
107 "Cannot be two solids with the same name... " + sol->
GetName();
111 theG4tgrSolidMap.insert(G4mapssol::value_type(sol->
GetName(), sol));
117 if(theG4tgrSolidMap.find(sol->
GetName()) != theG4tgrSolidMap.cend())
120 "Cannot unregister a solid that is not registered... " + sol->
GetName();
126 theG4tgrSolidMap.erase(theG4tgrSolidMap.find(sol->
GetName()));
133 theG4tgrVolumeList.push_back(vol);
134 if(theG4tgrVolumeMap.find(vol->
GetName()) != theG4tgrVolumeMap.cend())
137 "Cannot be two volumes with the same name... " + vol->
GetName();
141 theG4tgrVolumeMap.insert(G4mapsvol::value_type(vol->
GetName(), vol));
147 std::vector<G4tgrVolume*>::const_iterator ite;
148 for(ite = theG4tgrVolumeList.cbegin();
149 ite != theG4tgrVolumeList.cend(); ++ite)
156 if(ite == theG4tgrVolumeList.cend())
159 "Cannot unregister a volume not registered... " + vol->
GetName();
160 G4Exception(
"G4tgrVolumeMgr::unRegisterMe()",
"InvalidSetup",
165 theG4tgrVolumeList.erase(ite);
167 theG4tgrVolumeMap.erase(theG4tgrVolumeMap.find(vol->
GetName()));
174 theG4tgrVolumeTree.insert(G4mmapspl::value_type(parentName, pl));
182 G4mapssol::const_iterator svite = theG4tgrSolidMap.find(volname);
183 if(svite == theG4tgrSolidMap.cend())
187 for(svite = theG4tgrSolidMap.cbegin();
188 svite != theG4tgrSolidMap.cend(); ++svite)
192 G4String ErrMessage =
"Solid not found... " + volname;
199 vol =
const_cast<G4tgrSolid*
>((*svite).second);
210 G4mapsvol::const_iterator svite = theG4tgrVolumeMap.find(volname);
211 if(svite == theG4tgrVolumeMap.cend())
215 for(svite = theG4tgrVolumeMap.cbegin();
216 svite != theG4tgrVolumeMap.cend(); ++svite)
220 G4String ErrMessage =
"Volume not found... " + volname;
221 G4Exception(
"G4tgrVolumeMgr::FindVolume()",
"InvalidSetup",
226 G4String WarMessage =
"Volume does not exists... " + volname;
243 std::vector<G4tgrVolume*> vols;
245 G4mapsvol::const_iterator svite;
246 for(svite = theG4tgrVolumeMap.cbegin();
247 svite != theG4tgrVolumeMap.cend(); ++svite)
251 vols.push_back(
const_cast<G4tgrVolume*
>((*svite).second));
259 for(svite = theG4tgrVolumeMap.cbegin();
260 svite != theG4tgrVolumeMap.cend(); ++svite)
264 G4String ErrMessage =
"Volume not found... " + volname;
265 G4Exception(
"G4tgrVolumeMgr::FindVolumes()",
"InvalidSetup",
270 G4String WarMessage =
"Volume does not exists... " + volname;
286 for(
auto itetv = theG4tgrVolumeMap.cbegin();
287 itetv != theG4tgrVolumeMap.cend(); ++itetv)
293 G4cout <<
" G4tgrVolumeMgr::GetTopVolume() - Vol: " << vol->
GetName()
304 G4cout <<
" G4tgrVolumeMgr::GetTopVolume() - Vol: " << vol->
GetName()
309 if((topVol !=
nullptr) && (topVol != vol) &&
310 (topVol->
GetType() !=
"VOLDivision") &&
311 (vol->
GetType() !=
"VOLDivision"))
314 "Two world volumes found, second will be taken",
JustWarning,
315 (
G4String(
"Both volumes are at the top of a hierarchy: ") +
326std::pair<G4mmapspl::iterator, G4mmapspl::iterator>
329 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> dite;
330 dite = theG4tgrVolumeTree.equal_range(name);
337 G4cout <<
" @@@@@@@@@@@@@@@@ DUMPING G4tgrVolume's Tree " <<
G4endl;
346 unsigned int leafDepth)
348 for(std::size_t ii = 0; ii < leafDepth; ++ii)
352 G4cout <<
" VOL:(" << leafDepth <<
")" << vol->
GetName() <<
" copy No "
356 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> children =
358 G4mmapspl::const_iterator cite;
361 for(cite = children.first; cite != children.second; ++cite)
376 G4cout <<
" @@@@@@@@@@@@@@@@@@ Dumping Detector Summary " <<
G4endl;
377 G4cout <<
" @@@ Geometry built inside world volume: "
379 G4cout <<
" Number of G4tgrVolume's: " << theG4tgrVolumeMap.size() <<
G4endl;
380 unsigned int nPlace = 0;
381 for(
auto cite = theG4tgrVolumeMap.cbegin();
382 cite != theG4tgrVolumeMap.cend(); ++cite)
384 nPlace += ((*cite).second)->GetPlacements().size();
386 G4cout <<
" Number of G4tgrPlace's: " << nPlace <<
G4endl;
397 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