Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
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 ( G4LogicalVolume _lvol,
G4int  level 
)

Definition at line 118 of file G4BuildGeom.cc.

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

Referenced by checkVol(), and G4BuildGeom().

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 }
G4String GetName() const
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
void checkVol ( )

Definition at line 110 of file G4BuildGeom.cc.

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

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()
void G3CLRead ( G4String ,
char *   
)

Definition at line 99 of file clparse.cc.

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

Referenced by G4BuildGeom().

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
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(), G3VolTableEntry::GetName(), G4LogicalVolume::GetName(), G4LogicalVolume::GetVisAttributes(), G4VisAttributes::Invisible, G3DetTable::PrintAll(), G3PartTable::PrintAll(), G3VolTable::PrintAll(), and G4LogicalVolume::SetVisAttributes().

Referenced by G3toG4DetectorConstruction::Construct().

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
G4String GetName() const
CLHEP::Hep3Vector G4ThreeVector
G3VolTableEntry * GetFirstVTE()
Definition: G3VolTable.cc:107
void G3CLRead(G4String &, char *)
Definition: clparse.cc:99
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 G3toG4BuildTree(G3VolTableEntry *curVTE, G3VolTableEntry *motherVTE)
G4String GetName()
static const G4VisAttributes Invisible
#define G4endl
Definition: G4ios.hh:61
void SetVisAttributes(const G4VisAttributes *pVA)
G3G4DLL_API G3VolTable G3Vol
Definition: clparse.cc:54

Variable Documentation

std::ofstream ofile