From e4a64a3afeed939626d229da639558be66e34127 Mon Sep 17 00:00:00 2001 From: ivana Date: Tue, 23 Jan 2001 15:30:47 +0000 Subject: [PATCH] new method SetUserLimits() added --- TGeant4/TG4GeometryServices.cxx | 28 +++++++++++++++++++++++++++- TGeant4/TG4GeometryServices.h | 2 ++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/TGeant4/TG4GeometryServices.cxx b/TGeant4/TG4GeometryServices.cxx index ae59166ed31..2ba404710e7 100644 --- a/TGeant4/TG4GeometryServices.cxx +++ b/TGeant4/TG4GeometryServices.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include 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; ientries(); 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) diff --git a/TGeant4/TG4GeometryServices.h b/TGeant4/TG4GeometryServices.h index aa59859316d..55f074b0333 100644 --- a/TGeant4/TG4GeometryServices.h +++ b/TGeant4/TG4GeometryServices.h @@ -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); -- 2.43.0