Import Geant4 0.1.0 source tree
This commit is contained in:
@@ -5,85 +5,107 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4BuildGeom.cc,v 2.4 1998/09/18 08:56:00 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// cltog4
|
||||
//
|
||||
// Convert Geant3 call List to Geant4 init file
|
||||
//
|
||||
// T. Wenaus LLNL 6/95
|
||||
//
|
||||
// 1-27-97 Akbar Mokhtarani
|
||||
// change the name to BuildGeom for use with visualization
|
||||
//code. This routine is called by test18.cc in prototype/visualization/test
|
||||
// directory. It reads the call List 'g3calls.dat' produced by rztog4
|
||||
// code from geant 3 geometry and builds the g4 geometry
|
||||
// It returns a pointer to the logical volume of the mother of all worlds.
|
||||
// $Id: G4BuildGeom.cc,v 1.7 1999/05/26 03:47:49 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include <iomanip.h>
|
||||
#include <fstream.h>
|
||||
#include "G4ios.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3MatTable.hh"
|
||||
#include "G3MedTable.hh"
|
||||
#include "G3RotTable.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "globals.hh"
|
||||
#include "VolTableEntry.hh"
|
||||
#include "G3toG4BuildTree.hh"
|
||||
|
||||
extern ofstream ofile;
|
||||
|
||||
void G3CLRead(G4String &, char *);
|
||||
void checkLogVol(G4LogicalVolume*, G4int);
|
||||
void checkVol(G4LogicalVolume*, G4int);
|
||||
void checkVol();
|
||||
|
||||
|
||||
G4LogicalVolume* G4BuildGeom(G4String& inFile)
|
||||
{
|
||||
// Read the call List and interpret to Generate Geant4 geometry
|
||||
G4LogicalVolume* G4BuildGeom(G4String& inFile){
|
||||
|
||||
G4cout << "Reading the call List file " << inFile << "..." << endl;
|
||||
G4int irot=0;
|
||||
G4gsrotm(0, 90, 0, 90, 90, 0, 0);
|
||||
|
||||
G3CLRead(inFile, NULL);
|
||||
G4cout << "Instantiated unit rotation matrix irot=" << irot << endl;
|
||||
|
||||
// Read the call List and interpret to Generate Geant4 geometry
|
||||
|
||||
G4cout << "Call List file read completed." << endl;
|
||||
G4cout << "Reading the call List file " << inFile << "..." << endl;
|
||||
|
||||
// Retrieve the top-level G3toG4 logical mother volume pointer
|
||||
G3CLRead(inFile, NULL);
|
||||
|
||||
G4LogicalVolume* lG3toG4 = G3Vol.GetLV();
|
||||
G3Vol.VTEStat();
|
||||
|
||||
// make the top-level volume invisible
|
||||
G4cout << "Call List file read completed. Build geometry" << endl;
|
||||
|
||||
// Build the geometry
|
||||
|
||||
G4cout << "G3toG4 top level volume is " << G3Vol.GetFirstVTE()->GetName()
|
||||
<< endl;
|
||||
|
||||
G3toG4BuildTree(G3Vol.GetFirstVTE());
|
||||
|
||||
// Retrieve the top-level G3toG4 logical mother volume pointer
|
||||
|
||||
G4LogicalVolume* lG3toG4 = G3Vol.GetFirstVTE()->GetLV();
|
||||
|
||||
// mark as invisible
|
||||
|
||||
lG3toG4->SetVisAttributes(G4VisAttributes::Invisible);
|
||||
|
||||
lG3toG4 -> SetVisAttributes(G4VisAttributes::Invisible);
|
||||
G4cout << "Top-level G3toG4 logical volume " << lG3toG4->GetName() << " "
|
||||
G4cout << "Top-level G3toG4 logical volume " << lG3toG4->GetName() << " "
|
||||
<< *(lG3toG4 -> GetVisAttributes()) << endl;
|
||||
|
||||
// check the geometry here
|
||||
|
||||
G4int debug=0;
|
||||
G4int debug=0;
|
||||
|
||||
if (debug){
|
||||
G4int level=0;
|
||||
checkLogVol(lG3toG4, level);
|
||||
}
|
||||
|
||||
return lG3toG4;
|
||||
if (debug){
|
||||
G4cout << "scan through G4LogicalVolumeStore:" << endl;
|
||||
checkVol();
|
||||
}
|
||||
return lG3toG4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void checkLogVol(G4LogicalVolume* _lvol, G4int level)
|
||||
void checkVol()
|
||||
{
|
||||
G4LogicalVolume* _ldvol;
|
||||
level++;
|
||||
|
||||
G4int ndau = _lvol -> GetNoDaughters();
|
||||
|
||||
for (int idau=0; idau<ndau; idau++){
|
||||
_ldvol = _lvol-> GetDaughter(idau) -> GetLogicalVolume();
|
||||
|
||||
G4cout << "logical volume " << _lvol->GetName() << " at level " << level
|
||||
<< " contains daughter " << idau+1 << " name: "
|
||||
<< _ldvol -> GetName() << endl;
|
||||
checkLogVol(_ldvol, level);
|
||||
}
|
||||
return;
|
||||
G4LogicalVolumeStore* theStore = G4LogicalVolumeStore::GetInstance();
|
||||
G4LogicalVolume* ll = (*theStore)[0];
|
||||
G4int level=0;
|
||||
checkVol(ll, level);
|
||||
}
|
||||
|
||||
void checkVol(G4LogicalVolume* _lvol, G4int level)
|
||||
{
|
||||
G4LogicalVolume* _ldvol;
|
||||
G4VPhysicalVolume* _pdvol;
|
||||
level++;
|
||||
|
||||
G4int ndau = _lvol -> GetNoDaughters();
|
||||
|
||||
G4cout << "G44LogicalVolume " << _lvol->GetName() << " at level " << level
|
||||
<< " contains " << ndau << " daughters." << endl;
|
||||
for (int idau=0; idau<ndau; idau++){
|
||||
_pdvol = _lvol-> GetDaughter(idau);
|
||||
_ldvol = _pdvol -> GetLogicalVolume();
|
||||
G4cout << "G4VPhysical volume " << setw(5) << _pdvol -> GetName()
|
||||
<< " (G4LogicalVolume " << setw(5) << _ldvol->GetName() << ")"
|
||||
<< endl;
|
||||
checkVol(_ldvol, level);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user