]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TGeant4/TG4GeometryServices.cxx
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / TGeant4 / TG4GeometryServices.cxx
index 9d6513aaf530e23e2b405be5b7e9180024c4c5a0..0277cb8c8743bee18c32c197cc0b96ad8c2a61a4 100644 (file)
@@ -23,6 +23,7 @@
 #include <G3toG4.hh> 
 #include <G3EleTable.hh> 
 #include <g4std/vector>
+#include <g4std/iomanip>
 
 #include <math.h>
 
@@ -33,8 +34,10 @@ const G4double       TG4GeometryServices::fgkDensityTolerance = 0.005;
 //_____________________________________________________________________________
 TG4GeometryServices::TG4GeometryServices(TG4IntMap* mediumMap, 
                                          TG4NameMap* nameMap) 
-  : fMediumMap(mediumMap),
-    fNameMap(nameMap)                           
+  : TG4Verbose("geometryServices"),
+    fMediumMap(mediumMap),
+    fNameMap(nameMap),
+    fWorld(0)                           
 {
 //
   if (fgInstance) {
@@ -46,7 +49,8 @@ TG4GeometryServices::TG4GeometryServices(TG4IntMap* mediumMap,
 }
 
 //_____________________________________________________________________________
-TG4GeometryServices::TG4GeometryServices() {
+TG4GeometryServices::TG4GeometryServices()
+  : TG4Verbose("geometryServices") {
 // 
   TG4Globals::Exception(
     "TG4GeometryServices default constructor is protected.");
@@ -54,7 +58,8 @@ TG4GeometryServices::TG4GeometryServices() {
 
 
 //_____________________________________________________________________________
-TG4GeometryServices::TG4GeometryServices(const TG4GeometryServices& right) {
+TG4GeometryServices::TG4GeometryServices(const TG4GeometryServices& right)  
+  : TG4Verbose("geometryServices")  {
 // 
   TG4Globals::Exception(
     "Attempt to copy TG4GeometryServices singleton.");
@@ -279,9 +284,11 @@ G4Material* TG4GeometryServices::MixMaterials(G4String name, G4double density,
     G4String text = "TG4GeometryServices::MixMaterials: ";
     text = text +  "different number of material names and weigths.";
     TG4Globals::Exception(text);
-  }    
-  // add verbose
-  // G4cout << "Nof of materials to be mixed: " << nofMaterials << G4endl;
+  } 
+     
+  if (VerboseLevel() > 1) {
+    G4cout << "Nof of materials to be mixed: " << nofMaterials << G4endl;
+  }  
 
   // fill vector of materials
   G4std::vector<G4Material*> matVector;  
@@ -352,21 +359,58 @@ void TG4GeometryServices::PrintStatistics(G4bool open, G4bool close) const
   if (open)  TG4Globals::PrintStars(true);
      
   G4cout << "    GEANT4 Geometry statistics: " << G4endl
-         << "          " << NofG4LogicalVolumes()  
+         << "          " << G4std::setw(5) << NofG4LogicalVolumes()  
                         << " logical volumes" << G4endl
         << "          " 
-                        << NofG4PhysicalVolumes() 
+                        << G4std::setw(5) << NofG4PhysicalVolumes() 
                         << " physical volumes" << G4endl
         << "          " 
-                        << G4Material::GetNumberOfMaterials()
+                        << G4std::setw(5) << G4Material::GetNumberOfMaterials()
                         << " materials"        << G4endl
         << "          " 
-                        << TG4Limits::GetNofLimits()
+                        << G4std::setw(5) << TG4Limits::GetNofLimits()
                         << " user limits"      << G4endl;
 
   if (close) TG4Globals::PrintStars(false);
 }
 
+//_____________________________________________________________________________
+void 
+TG4GeometryServices::PrintLogicalVolumeStore() const
+{
+// Prints all logical volumes and their daughters.
+// ---
+
+  G4LogicalVolumeStore* lvStore = G4LogicalVolumeStore::GetInstance();
+  
+  G4cout << "Logical volume store: " << G4endl;
+
+  for (G4int i=0; i<lvStore->size(); i++) {
+  
+    G4LogicalVolume* lv = (*lvStore)[i];
+
+    G4cout << "Logical volume: " << G4endl;
+    G4cout << "  " << G4std::setw(5)  << i
+           << "  " << lv
+          << "  " << lv->GetName()
+          << "  " << G4std::setw(5)  << lv->GetNoDaughters() << " daughters"
+          << "  limits: " << lv->GetUserLimits()
+          << G4endl;
+          
+    for (G4int j=0; j<lv->GetNoDaughters(); j++) {
+      G4cout << "  Daughter: " 
+             << G4std::setw(5)  << j
+             << "  " << lv->GetDaughter(j)
+            << "  " << lv->GetDaughter(j)->GetName()
+            << "  of LV: " << lv->GetDaughter(j)->GetLogicalVolume()
+            << "  " << lv->GetDaughter(j)->GetLogicalVolume()->GetName()
+            << "  copy no: " << lv->GetDaughter(j)->GetCopyNo()
+             << G4endl;
+    
+    }              
+  }
+}  
+
 //_____________________________________________________________________________
 Int_t TG4GeometryServices::NofG3Volumes() const
 {
@@ -480,7 +524,6 @@ TG4GeometryServices::FindLogicalVolume(const G4String& name, G4bool silent) cons
   return 0;                     
 }  
 
-
 //_____________________________________________________________________________
 TG4Limits* 
 TG4GeometryServices::FindLimits(const G4String& name, G4bool silent) const