Added a couple of routines to handle the link between regions and volumes
authoriglez2 <iglez2@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Nov 2002 18:42:27 +0000 (18:42 +0000)
committeriglez2 <iglez2@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Nov 2002 18:42:27 +0000 (18:42 +0000)
Flugg/FGeometryInit.cxx
Flugg/FGeometryInit.hh

index 45b0494..b20ffe7 100644 (file)
@@ -386,6 +386,23 @@ void FGeometryInit::PrintRegionsMap(G4std::ostream& os) {
 
 ////////////////////////////////////////////////////////////////////////
 // 
+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() {
 #ifdef G4GEOMETRY_DEBUG
   G4cout << "==> Flugg FGeometryInit::BuildMaterialTables()" << G4endl;
index d50eac6..bbd9759 100644 (file)
@@ -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<G4VPhysicalVolume*, int, G4std::less<G4VPhysicalVolume*> >::iterator RegionIterator;
+typedef  G4std::map<G4VPhysicalVolume*, int, G4std::less<G4VPhysicalVolume*> >::const_iterator RegionIterator;
 typedef  G4std::vector<G4Material*>::const_iterator MatTableIterator;