]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added PrintMaterials(), GenerateXMLGeometry(); correction in Construct()
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Nov 2000 21:20:20 +0000 (21:20 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Nov 2000 21:20:20 +0000 (21:20 +0000)
AliGeant4/AliModulesComposition.cxx

index b1bf94a9183602e4be401b8355b164daa9fa9fdc..98021b99409f71754c01c1aef459d93bccc76e87 100644 (file)
 #include "AliMagneticField.h"
 #include "AliGlobals.h"
 
+#include "TG4XMLGeometryGenerator.h"
+
 #include <G4UniformMagField.hh>
 #include <G4FieldManager.hh>
 #include <G4TransportationManager.hh>
+#include <G4Material.hh>
 
 AliModulesComposition::AliModulesComposition()
   : fAllLVSensitive(false),
@@ -103,6 +106,9 @@ void AliModulesComposition::ConstructModules()
   
   // one module constructions
   G4int nofDets = fModuleConstructionVector.entries();
+  for (G4int i=0; i<nofDets; i++) {
+    fModuleConstructionVector[i]->Configure();
+  }  
   for (G4int i=0; i<nofDets; i++) {
     G4cout << "Module " << fModuleConstructionVector[i]->GetDetName()
            << " will be constructed now." << G4endl;
@@ -112,6 +118,7 @@ void AliModulesComposition::ConstructModules()
   // more modules construction
   G4int nofModules = fMoreModulesConstruction->GetNofModules();
   if (nofModules>0) {
+    fMoreModulesConstruction->Configure();
     G4cout << "Dependent modules will be constructed now." << G4endl;
     fMoreModulesConstruction->Construct();
   }  
@@ -313,6 +320,63 @@ void AliModulesComposition::PrintAvailableDets() const
   G4cout << avList << G4endl;
 }
 
+void AliModulesComposition::PrintMaterials() const
+{
+// Prints all materials.
+// ---
+
+  const G4MaterialTable* matTable = G4Material::GetMaterialTable();
+  G4cout << *matTable;
+}
+
+void AliModulesComposition::GenerateXMLGeometry() const 
+{
+// Generates XML geometry file from the top volume.
+// The file name is set according the last switched detector
+// registered in the det switch vector.
+// ---
+
+  G4VPhysicalVolume* world = AliSingleModuleConstruction::GetWorld();
+
+  // set filename
+  G4String detName;
+  G4String version = "v";
+  G4String filePath= getenv("AG4_INSTALL");   
+  filePath = filePath + "/xml/";  
+  for (G4int i=fDetSwitchVector.entries()-1; i>=0; i--) {
+    G4int versionNumber = fDetSwitchVector[i]->GetSwitchedVersion();
+    if (versionNumber > -1) {
+      detName = fDetSwitchVector[i]->GetDetName();
+      AliGlobals::AppendNumberToString(version, versionNumber); 
+      filePath = filePath + detName + version + ".xml";
+      break;
+    }  
+  }  
+  
+  // set top volume name
+  G4String topName = world->GetName() + "_comp";
+  
+  // generate XML
+  
+  TG4XMLGeometryGenerator xml;
+  xml.OpenFile(filePath);
+
+  // generate materials 
+  // not yet implemented
+  // xml.GenerateMaterials(version, "today", "Generated from G4",
+  //                     "v4", world->GetLogicalVolume());
+
+  // generate volumes tree
+  xml.GenerateSection(detName, version, "today", "Generated from Geant4",
+                      topName, world->GetLogicalVolume());
+  xml.CloseFile();
+  
+  // set verbose
+  G4cout << "File " << detName << version << ".xml has been generated." 
+         << G4endl;
+}  
+
+
 G4String AliModulesComposition::GetSwitchedDetsList() const
 { 
 // Returns list of switched detectors.