Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
Include dependency graph for G4BuildGeom.cc:

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 ( G4LogicalVolume _lvol,
G4int  level 
)

Definition at line 118 of file G4BuildGeom.cc.

119 {
120  G4LogicalVolume* _ldvol;
121  G4VPhysicalVolume* _pdvol;
122  level++;
123 
124  G4int ndau = _lvol -> GetNoDaughters();
125 
126  G4cout << "G44LogicalVolume " << _lvol->GetName() << " at level " << level
127  << " contains " << ndau << " daughters." << G4endl;
128  for (G4int idau=0; idau<ndau; idau++){
129  _pdvol = _lvol-> GetDaughter(idau);
130  _ldvol = _pdvol -> GetLogicalVolume();
131  G4cout << "G4VPhysical volume " << std::setw(5) << _pdvol -> GetName()
132  << " (G4LogicalVolume " << std::setw(5) << _ldvol->GetName() << ")"
133  << G4endl;
134  checkVol(_ldvol, level);
135  }
136  return;
137 }
int G4int
Definition: G4Types.hh:78
void checkVol(G4LogicalVolume *, G4int)
Definition: G4BuildGeom.cc:118
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const

Here is the call graph for this function:

Here is the caller graph for this function:

void checkVol ( )

Definition at line 110 of file G4BuildGeom.cc.

111 {
113  G4LogicalVolume* ll = (*theStore)[0];
114  G4int level=0;
115  checkVol(ll, level);
116 }
int G4int
Definition: G4Types.hh:78
void checkVol(G4LogicalVolume *, G4int)
Definition: G4BuildGeom.cc:118
static G4LogicalVolumeStore * GetInstance()

Here is the call graph for this function:

void G3CLRead ( G4String ,
char *   
)

Definition at line 99 of file clparse.cc.

100 {
101  //
102  // G3CLRead
103  // Read the call List file, parse the tokens, and pass the token
104  // List to the Geant4 interpreter
105  //
106  // fname: call List filename
107 
108  G4String line;
109  G4String tokens[1000];
110 
111  const char* ofname = "clparse.out";
112  ofile.open(ofname);
113  ofile << "Output file open\n";
114 
115  G4int count = 0;
116  G4int ntokens = 0;
117  std::ifstream istr(fname);
118 
119  while (line.readLine(istr) && ! istr.eof())
120  {
121  count++;
122  ntokens = G3CLTokens(&line,tokens); // tokenize the line
123  for (G4int i=0; i < ntokens; i++)
124  {
125  ofile << tokens[i] << G4endl;
126  }
127 
128  // interpret the line as a Geant call
129  //
130  G3CLEval(tokens, select);
131  }
132 }
std::istream & readLine(std::istream &, G4bool skipWhite=true)
int G4int
Definition: G4Types.hh:78
G4int G3CLTokens(G4String *line, G4String *tokens)
std::ofstream ofile
Definition: clparse.cc:45
void G3CLEval(G4String *tokens, char *select)
#define G4endl
Definition: G4ios.hh:61
string fname
Definition: test.py:308

Here is the call graph for this function:

Here is the caller graph for this function:

G4LogicalVolume* G4BuildGeom ( G4String inFile)

Definition at line 55 of file G4BuildGeom.cc.

55  {
56 
57  G4int irot=0;
58  G4gsrotm(0, 90, 0, 90, 90, 0, 0);
59 
60  G4cout << "Instantiated unit rotation matrix irot=" << irot << G4endl;
61 
62  // Read the call List and interpret to Generate Geant4 geometry
63 
64  G4cout << "Reading the call List file " << inFile << "..." << G4endl;
65 
66  G3CLRead(inFile, 0);
67 
68  G3Part.PrintAll();
69 
70  G3Det.PrintAll();
71 
72  G3Vol.PrintAll();
73 
74  G4cout << "Call List file read completed. Build geometry" << G4endl;
75 
76  // Build the geometry
77 
78  G3VolTableEntry* topVTE = G3Vol.GetFirstVTE();
79  G4cout << "G3toG4 top level volume is " << topVTE->GetName() << G4endl;
80 
81  // modified
82  G3toG4BuildTree(topVTE, 0);
83 
84  // Retrieve the top-level G3toG4 logical mother volume pointer
85 
86  G4LogicalVolume* topLV = topVTE->GetLV();
87 
88  // position the top logical volume
89  // (in Geant3 the top volume is not positioned)
90  //
91  new G4PVPlacement(0, G4ThreeVector(), topLV->GetName(), topLV, 0, false, 0);
92 
93  // mark as invisible
94 
96 
97  G4cout << "Top-level G3toG4 logical volume " << topLV->GetName() << " "
98  << *(topLV->GetVisAttributes()) << G4endl;
99 
100  // check the geometry here
101 
102  #ifdef G3G4DEBUG
103  G4cout << "scan through G4LogicalVolumeStore:" << G4endl;
104  checkVol();
105  #endif
106 
107  return topLV;
108 }
G3G4DLL_API G3PartTable G3Part
Definition: clparse.cc:58
void PrintAll()
Definition: G3DetTable.cc:96
void G4gsrotm(G4int irot, G4double theta1, G4double phi1, G4double theta2, G4double phi2, G4double theta3, G4double phi3)
Definition: G4gsrotm.cc:54
CLHEP::Hep3Vector G4ThreeVector
G3VolTableEntry * GetFirstVTE()
Definition: G3VolTable.cc:107
G4LogicalVolume * GetLV()
void PrintAll()
Definition: G3PartTable.cc:79
G3G4DLL_API G3DetTable G3Det
Definition: clparse.cc:59
int G4int
Definition: G4Types.hh:78
void PrintAll()
Definition: G3VolTable.cc:61
void checkVol(G4LogicalVolume *, G4int)
Definition: G4BuildGeom.cc:118
G4GLOB_DLL std::ostream G4cout
const G4VisAttributes * GetVisAttributes() const
void G3CLRead(G4String &fname, char *select=0)
Definition: clparse.cc:99
void G3toG4BuildTree(G3VolTableEntry *curVTE, G3VolTableEntry *motherVTE)
G4String GetName()
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
static const G4VisAttributes & GetInvisible()
void SetVisAttributes(const G4VisAttributes *pVA)
G3G4DLL_API G3VolTable G3Vol
Definition: clparse.cc:54

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

std::ofstream ofile

Definition at line 45 of file clparse.cc.