G4BuildGeom.cc File Reference

#include <iomanip>
#include <fstream>
#include "globals.hh"
#include "G3toG4.hh"
#include "G3MatTable.hh"
#include "G3MedTable.hh"
#include "G3RotTable.hh"
#include "G3VolTable.hh"
#include "G3PartTable.hh"
#include "G3DetTable.hh"
#include "G3toG4BuildTree.hh"
#include "G4GeometryManager.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"

Go to the source code of this file.

Functions

void G3CLRead (G4String &, char *)
void checkVol (G4LogicalVolume *, G4int)
void checkVol ()
G4LogicalVolumeG4BuildGeom (G4String &inFile)

Variables

std::ofstream ofile


Function Documentation

void checkVol (  ) 

Definition at line 110 of file G4BuildGeom.cc.

References checkVol(), and G4LogicalVolumeStore::GetInstance().

00111 {
00112   G4LogicalVolumeStore* theStore = G4LogicalVolumeStore::GetInstance();
00113   G4LogicalVolume* ll = (*theStore)[0];
00114   G4int level=0;
00115   checkVol(ll, level);
00116 }

void checkVol ( G4LogicalVolume ,
G4int   
)

Definition at line 118 of file G4BuildGeom.cc.

References G4cout, G4endl, and G4LogicalVolume::GetName().

Referenced by checkVol(), and G4BuildGeom().

00119 {
00120   G4LogicalVolume* _ldvol;
00121   G4VPhysicalVolume* _pdvol;
00122   level++;
00123   
00124   G4int ndau = _lvol -> GetNoDaughters();
00125   
00126   G4cout << "G44LogicalVolume " << _lvol->GetName() << " at level " << level
00127          << " contains " << ndau << " daughters." << G4endl;
00128   for (G4int idau=0; idau<ndau; idau++){
00129     _pdvol = _lvol-> GetDaughter(idau);
00130     _ldvol = _pdvol -> GetLogicalVolume();
00131     G4cout << "G4VPhysical volume " << std::setw(5) << _pdvol -> GetName() 
00132          << " (G4LogicalVolume " << std::setw(5) << _ldvol->GetName() << ")" 
00133          << G4endl;
00134     checkVol(_ldvol, level);
00135   }
00136   return;
00137 }

void G3CLRead ( G4String ,
char *   
)

Definition at line 99 of file clparse.cc.

References G3CLEval(), G3CLTokens(), G4endl, ofile, and G4String::readLine().

Referenced by G4BuildGeom().

00100 {
00101   //
00102   //  G3CLRead
00103   //  Read the call List file, parse the tokens, and pass the token
00104   //  List to the Geant4 interpreter
00105   //
00106   //  fname: call List filename
00107   
00108     G4String line;
00109     G4String tokens[1000];
00110 
00111     const char* ofname = "clparse.out";
00112     ofile.open(ofname);
00113     ofile << "Output file open\n";
00114 
00115     G4int count = 0;
00116     G4int ntokens = 0;
00117     std::ifstream istr(fname);
00118     
00119     while (line.readLine(istr) && ! istr.eof())
00120     {
00121         count++;
00122         ntokens = G3CLTokens(&line,tokens);  // tokenize the line
00123         for (G4int i=0; i < ntokens; i++)
00124         {
00125           ofile << tokens[i] << G4endl;
00126         }
00127 
00128         // interpret the line as a Geant call
00129         //
00130         G3CLEval(tokens, select);
00131     }
00132 }

G4LogicalVolume* G4BuildGeom ( G4String inFile  ) 

Definition at line 55 of file G4BuildGeom.cc.

References checkVol(), G3CLRead(), G3Det, G3Part, G3toG4BuildTree(), G3Vol, G4cout, G4endl, G4gsrotm(), G3VolTable::GetFirstVTE(), G3VolTableEntry::GetLV(), G4LogicalVolume::GetName(), G3VolTableEntry::GetName(), G4LogicalVolume::GetVisAttributes(), G4VisAttributes::Invisible, G3VolTable::PrintAll(), G3DetTable::PrintAll(), G3PartTable::PrintAll(), and G4LogicalVolume::SetVisAttributes().

00055                                               {
00056 
00057   G4int irot=0;
00058   G4gsrotm(0, 90, 0, 90, 90, 0, 0);
00059 
00060   G4cout << "Instantiated unit rotation matrix irot=" << irot << G4endl;
00061  
00062   // Read the call List and interpret to Generate Geant4 geometry
00063 
00064   G4cout << "Reading the call List file " << inFile << "..." << G4endl;
00065 
00066   G3CLRead(inFile, 0);
00067 
00068   G3Part.PrintAll();
00069 
00070   G3Det.PrintAll();
00071 
00072   G3Vol.PrintAll();
00073 
00074   G4cout << "Call List file read completed. Build geometry" << G4endl;
00075 
00076   // Build the geometry
00077 
00078   G3VolTableEntry* topVTE = G3Vol.GetFirstVTE();
00079   G4cout << "G3toG4 top level volume is " << topVTE->GetName() << G4endl;
00080 
00081   // modified
00082   G3toG4BuildTree(topVTE, 0);
00083 
00084   // Retrieve the top-level G3toG4 logical mother volume pointer
00085 
00086   G4LogicalVolume* topLV = topVTE->GetLV();
00087 
00088   // position the top logical volume
00089   // (in Geant3 the top volume is not positioned)
00090   // 
00091   new G4PVPlacement(0, G4ThreeVector(), topLV->GetName(), topLV, 0, false, 0);
00092 
00093   // mark as invisible
00094 
00095   topLV->SetVisAttributes(G4VisAttributes::Invisible);
00096     
00097   G4cout << "Top-level G3toG4 logical volume " << topLV->GetName() << " "
00098          << *(topLV->GetVisAttributes()) << G4endl;
00099         
00100         // check the geometry here
00101 
00102   #ifdef G3G4DEBUG
00103     G4cout << "scan through G4LogicalVolumeStore:" << G4endl;
00104     checkVol();
00105   #endif
00106 
00107   return topLV;
00108 }


Variable Documentation

std::ofstream ofile

Definition at line 45 of file clparse.cc.

Referenced by G4VScoreWriter::DumpAllQuantitiesToFile(), G4VScoreWriter::DumpQuantityToFile(), G3CLEval(), G3CLRead(), G3fillParams(), G4GMocrenIO::storeData2(), G4GMocrenIO::storeData3(), and G4GMocrenIO::storeData4().


Generated on Mon May 27 17:50:38 2013 for Geant4 by  doxygen 1.4.7