Import Geant4 0.1.0 source tree
This commit is contained in:
@@ -5,32 +5,15 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: clparse.cc,v 2.3 1998/09/18 08:57:07 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: clparse.cc,v 1.5 1999/05/26 03:50:35 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
//
|
||||
// G3CLParse
|
||||
//
|
||||
// Parse the call List of Geant3 geometry calls and execute them
|
||||
// in Geant4.
|
||||
//
|
||||
// Torre Wenaus, LLNL 6/95
|
||||
//
|
||||
// To do:
|
||||
// - Build a linked List container for tokens rather than fixed array.
|
||||
// Not going to be appreciably slower; time goes into I/O.
|
||||
//
|
||||
// Comments:
|
||||
// - RWCString doesn't have toInt, toFloat methods! Had to use C's
|
||||
// atol, atof
|
||||
//
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include <fstream.h>
|
||||
#include <rw/rstream.h>
|
||||
#include <rw/ctoken.h>
|
||||
#include <rw/rwfile.h>
|
||||
|
||||
#include "G3toG4.hh"
|
||||
#include "G3EleTable.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "G3MatTable.hh"
|
||||
#include "G3MedTable.hh"
|
||||
@@ -46,30 +29,13 @@ extern "C" {
|
||||
|
||||
extern ofstream ofile;
|
||||
|
||||
// The first volume defined on the call List file is assumed to be
|
||||
// the mother.
|
||||
// If GlobalMotherVolume is non-null, it is used as the mother rather
|
||||
// than the volume specified on the call List file.
|
||||
// If GlobalMotherVolume is null, the volume in the call List file is
|
||||
// used normally.
|
||||
//
|
||||
// This is used by BaBar's Bogus, which uses G3toG4 as one way to
|
||||
// Build subsystems. Bogus must have a way to override the global
|
||||
// mother. The G3toG4 defined geometry is installed immediately below
|
||||
// the global mother.
|
||||
|
||||
// G4LogicalVolume* GlobalMotherVolume = 0;
|
||||
|
||||
// Save the second volume pointer. In Bogus usage, it is the
|
||||
// containing mother for the subdetector.
|
||||
// G4LogicalVolume* SubsystemMotherVolume = 0;
|
||||
|
||||
G3VolTable G3Vol; // volume G3 name <-> G4 pointer tables
|
||||
G3MatTable G3Mat; // material G3 ID <-> G4 pointer table
|
||||
G3MedTable G3Med; // trk media G3 ID <-> G4 pointer table
|
||||
G3RotTable G3Rot; // rotation ID <-> G4 transform object table
|
||||
G3VolTable G3Vol;
|
||||
G3MatTable G3Mat; // material G3 ID <-> G4 pointer table
|
||||
G3MedTable G3Med; // trk media G3 ID <-> G4 pointer table
|
||||
G3RotTable G3Rot; // rotation ID <-> G4 transform object table
|
||||
G3PartTable G3Part; // particle ID <-> ParticleDefinition pointer
|
||||
G3DetTable G3Det; // sensitive detector name <-> pointer
|
||||
G3DetTable G3Det; // sensitive detector name <-> pointer
|
||||
G3EleTable G3Ele; // element names table
|
||||
|
||||
G4int narray;
|
||||
|
||||
@@ -105,18 +71,15 @@ void PG4gsdetd(RWCString *tokens);
|
||||
void PG4gsdetu(RWCString *tokens);
|
||||
void PG4ggclos();
|
||||
|
||||
void G3CLRead(G4String & fname, char *select = NULL)
|
||||
void G3CLRead(G4String & fname, char *select = NULL){
|
||||
//
|
||||
// G3CLRead
|
||||
// Read the call List file, parse the tokens, and pass the token
|
||||
// List to the Geant4 interpreter
|
||||
//
|
||||
// fname: call List filename
|
||||
// select: if non-NULL, the selected context. Only the subset of
|
||||
// the call List matching the selected context will be
|
||||
// executed. If NULL, the full call List will run.
|
||||
//
|
||||
{
|
||||
|
||||
RWCString line;
|
||||
RWCString tokens[1000];
|
||||
|
||||
@@ -129,19 +92,9 @@ void G3CLRead(G4String & fname, char *select = NULL)
|
||||
ifstream istr(fname);
|
||||
G4bool _debug=false;
|
||||
|
||||
while (line.readLine(istr) && ! istr.eof())
|
||||
{
|
||||
while (line.readLine(istr) && ! istr.eof()){
|
||||
count++;
|
||||
ntokens = G3CLTokens(&line,tokens); // tokenize the line
|
||||
|
||||
// check tokens
|
||||
if (_debug) {
|
||||
G4cout << "==== Line " << count << " Tokens " << ntokens
|
||||
<< " Nvol " << G3Vol.GetEntryCount() << endl;
|
||||
|
||||
G4cout << line << " // " << G3Vol.GetEntryCount() << endl;
|
||||
}
|
||||
|
||||
for (G4int i=0; i < ntokens; i++) ofile << tokens[i] << endl;
|
||||
|
||||
// interpret the line as a Geant call
|
||||
|
||||
Reference in New Issue
Block a user