From bf547b2f6ebfee62abe271bd2c8659db40b20a2d Mon Sep 17 00:00:00 2001 From: iglez2 Date: Thu, 21 Nov 2002 18:42:27 +0000 Subject: [PATCH] Added a couple of routines to handle the link between regions and volumes --- Flugg/FGeometryInit.cxx | 17 +++++++++++++++++ Flugg/FGeometryInit.hh | 8 ++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Flugg/FGeometryInit.cxx b/Flugg/FGeometryInit.cxx index 45b04944aa7..b20ffe77572 100644 --- a/Flugg/FGeometryInit.cxx +++ b/Flugg/FGeometryInit.cxx @@ -384,6 +384,23 @@ void FGeometryInit::PrintRegionsMap(G4std::ostream& os) { #endif } +//////////////////////////////////////////////////////////////////////// +// +G4int FGeometryInit::GetRegionFromName(const char* volName) const { + for (RegionIterator i = fRegionVolumeMap.begin(); + i != fRegionVolumeMap.end(); + i++) { + + //Get info in the map + G4VPhysicalVolume* ptrVol = (*i).first; + if (ptrVol->GetName() == volName) + return ((*i).second); + } + return -1; +} + + + //////////////////////////////////////////////////////////////////////// // void FGeometryInit::BuildMaterialTables() { diff --git a/Flugg/FGeometryInit.hh b/Flugg/FGeometryInit.hh index d50eac634dd..bbd97591fcd 100644 --- a/Flugg/FGeometryInit.hh +++ b/Flugg/FGeometryInit.hh @@ -65,7 +65,11 @@ public: inline G4int * GetJrLtGeantArray(); inline G4int GetLttcFlagGeant(); void SetLttcFlagGeant(G4int); - void PrintJrLtGeant(); + void PrintJrLtGeant(); + + //Map access methods + G4int GetRegionFromName(const char* volName) const; + protected: void BuildRegionsMap(); @@ -105,7 +109,7 @@ private: //G4int NOfMaterials; }; -typedef G4std::map >::iterator RegionIterator; +typedef G4std::map >::const_iterator RegionIterator; typedef G4std::vector::const_iterator MatTableIterator; -- 2.39.3