Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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

◆ checkVol() [1/2]

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}
void checkVol()
Definition: G4BuildGeom.cc:110
int G4int
Definition: G4Types.hh:66
static G4LogicalVolumeStore * GetInstance()

Referenced by checkVol(), and G4BuildGeom().

◆ checkVol() [2/2]

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}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4String GetName() const

◆ G3CLRead()

void G3CLRead ( G4String fname,
char *  select 
)

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)
void G3CLEval(G4String *tokens, char *select)
G4int G3CLTokens(G4String *line, G4String *tokens)
std::ofstream ofile
Definition: clparse.cc:45

Referenced by G4BuildGeom().

◆ G4BuildGeom()

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
69
71
73
74 G4cout << "Call List file read completed. Build geometry" << G4endl;
75
76 // Build the geometry
77
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 G3DetTable G3Det
Definition: clparse.cc:59
void G4gsrotm(G4int irot, G4double theta1, G4double phi1, G4double theta2, G4double phi2, G4double theta3, G4double phi3)
Definition: G4gsrotm.cc:54
G3G4DLL_API G3PartTable G3Part
Definition: clparse.cc:58
G3G4DLL_API G3VolTable G3Vol
Definition: clparse.cc:54
void G3toG4BuildTree(G3VolTableEntry *curVTE, G3VolTableEntry *motherVTE)
void G3CLRead(G4String &, char *)
Definition: clparse.cc:99
CLHEP::Hep3Vector G4ThreeVector
void PrintAll()
Definition: G3DetTable.cc:96
void PrintAll()
Definition: G3PartTable.cc:79
G4LogicalVolume * GetLV()
void PrintAll()
Definition: G3VolTable.cc:61
G3VolTableEntry * GetFirstVTE()
Definition: G3VolTable.cc:107
const G4VisAttributes * GetVisAttributes() const
void SetVisAttributes(const G4VisAttributes *pVA)
static const G4VisAttributes Invisible

Variable Documentation

◆ ofile