]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
new method SetUserLimits() added
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Jan 2001 15:30:47 +0000 (15:30 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Jan 2001 15:30:47 +0000 (15:30 +0000)
TGeant4/TG4GeometryServices.cxx
TGeant4/TG4GeometryServices.h

index ae59166ed31537563bb1534f318a58c7ba6aa47f..2ba404710e7203635417003707daba166b5db3be 100644 (file)
@@ -12,6 +12,7 @@
 #include <G4LogicalVolumeStore.hh>
 #include <G4LogicalVolume.hh>
 #include <G4Material.hh>
+#include <G4UserLimits.hh>
 #include <G3toG4.hh> 
 
 TG4GeometryServices* TG4GeometryServices::fgInstance = 0;
@@ -106,7 +107,6 @@ G4String TG4GeometryServices::CutName(const char* name) const
   return cutName;
 }  
 
-
 void TG4GeometryServices::G4ToG3VolumeName(G4String& name) const
 {
 // Cuts _copyNo extension added to logical volume name in case 
@@ -117,6 +117,32 @@ void TG4GeometryServices::G4ToG3VolumeName(G4String& name) const
   name = name(0,name.first(gSeparator));
 }
 
+G4int TG4GeometryServices::SetUserLimits(G4UserLimits* userLimits, 
+                                         G4LogicalVolume* lv)
+{
+// Sets user limits to all logical volumes corresponding to 
+// the same G3 volume as the volume with specified name.
+// Returns the number of updated logical volumes.
+// ---  
+
+  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
+
+  G4String volName = lv->GetName();
+  G4ToG3VolumeName(volName);
+
+  G4int counter = 0;
+  for (G4int i=0; i<pLVStore->entries(); i++) {
+    G4LogicalVolume* lv = (*pLVStore)[i];
+    G4String name = lv->GetName();
+    G4ToG3VolumeName(name);
+    if (name == volName) {
+      lv->SetUserLimits(userLimits);
+      counter++;
+    }  
+  }
+  
+  return counter;
+}
 
 G4Material* TG4GeometryServices::MixMaterials(G4String name, G4double density, 
         TG4StringVector* matNames, TG4doubleVector* matWeights)
index aa59859316db692ffabb268184ca20b072d95c17..55f074b033344d211b22855acdf3b6ea291cd533 100644 (file)
@@ -22,6 +22,7 @@ class TG4GeometryOutputManager;
 class G4Material;
 class G4VPhysicalVolume;
 class G4LogicalVolume;
+class G4UserLimits;
 
 class TG4GeometryServices
 {
@@ -39,6 +40,7 @@ class TG4GeometryServices
     G4double* CreateG4doubleArray(Float_t* array, G4int size) const;
     G4String  CutName(const char* name) const;
     void G4ToG3VolumeName(G4String& name) const;
+    G4int SetUserLimits(G4UserLimits* userLimits, G4LogicalVolume* lv);                     
     G4Material* MixMaterials(G4String name, G4double density,
                      TG4StringVector* matNames, TG4doubleVector* matWeights);