Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -2,6 +2,18 @@
|
||||
G3toG4 Modification History (reverse chronological order, please !)
|
||||
--------------------------------------------------------------------
|
||||
|
||||
g3tog4-V10-07-04 15-November-2021 I.Hrivnacova
|
||||
- Fixed Coverity: uninitialized variable in G3EleTable.cc
|
||||
|
||||
g3tog4-V10-07-03 25-October-2021 B.Morgan
|
||||
- Use G4StrUtil functions replacing deprecated G4String member functions
|
||||
|
||||
g3tog4-V10-07-02 18-October-2021 B.Morgan
|
||||
- Use std::string member functions from G4String in place of synonyms
|
||||
|
||||
g3tog4-V10-07-01 29-June-2021 G.Cosmo
|
||||
- Fixed compilation error in G3EleTable when c++20 is enabled.
|
||||
|
||||
g3tog4-V10-07-00 1-April-2021 B.Morgan
|
||||
- Migrate build to modular CMake API
|
||||
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
G3toG4
|
||||
------
|
||||
|
||||
G3toG4 is the Geant4 facility to convert Geant3 geometries into Geant4.
|
||||
This is done in two stages.
|
||||
|
||||
First, the user supplies a Geant3 .rz file containing the initialization
|
||||
data structures. An executable, rztog4, reads this file and produces an
|
||||
ascii ("call list") file containing instructions on how to build the
|
||||
geometry. The source code for this is fortran.
|
||||
|
||||
Second, a call list interpreter (G4BuildGeom.cc) reads these instructions
|
||||
and builds the geometry in the user's G4 client code.
|
||||
|
||||
Two examples of how to use the call list interpreter are supplied in
|
||||
examples/extended/g3tog4:
|
||||
- the first example, cltog4, is a simple example which simply invokes the
|
||||
call list interpreter method G4BuildGeom from G3toG4DetectorConstruction
|
||||
class, builds the geometry and exits.
|
||||
- the second example, clGeometry, is more complete and is patterned after
|
||||
the novice G4 examples. It also invokes the call list interpreter, but
|
||||
in addition, allows the geometry to be visualized and particles to be
|
||||
tracked. Currently, G3toG4 does not provide a method for scoring hits
|
||||
in G4.
|
||||
|
||||
To build these examples, especially the one involving visualization, the
|
||||
user must have one or more of the following environment variables set:
|
||||
|
||||
setenv G4VIS_BUILD_<driver>_DRIVER
|
||||
setenv G4VIS_USE_<driver>
|
||||
|
||||
where the G4-supported drivers are listed in source/visualization/README.
|
||||
|
||||
To use the freeware Mesa API, you must have the environment variable
|
||||
OGLHOME defined to point to the directory containing the Mesa lib/ directory
|
||||
specific to your platform.
|
||||
|
||||
To compile and build the G3toG4 libraries, simply type
|
||||
|
||||
gmake
|
||||
|
||||
from the top-level G3toG4 directory.
|
||||
|
||||
To build the converter executable "rztog4", simply type
|
||||
|
||||
gmake bin
|
||||
|
||||
To make everything, simply type:
|
||||
|
||||
gmake global
|
||||
|
||||
To remove all G3toG4 libraries, executables and .d files, simply type
|
||||
|
||||
gmake clean
|
||||
|
||||
the implementation (April 1999)
|
||||
----------------------------------------
|
||||
- PGON, PCON are built using the CSG classes G4Polycone and G4Polyhedra.
|
||||
- G3 MANY feature has not been tested.
|
||||
- GsROTM is fully implemented and supports rotations and mirror reflections
|
||||
- GSPOSP implemented via individual logical volumes for each instantiation
|
||||
(G4PVIndexed doesn't exist yet)
|
||||
- GSDV* routines for dividing volumes implemented, using
|
||||
G4PVReplicas, G4PVParametrised
|
||||
- GSROTM is implemented
|
||||
- hits are not implemented. Hit code is do-nothing. (It is
|
||||
coded up, but hit class references are commented out.)
|
||||
The digits+hits code has to be updated before G3toG4's
|
||||
hit code can be activated.
|
||||
- GSPART has to be updated.
|
||||
- Usage of magnetic field class has to be turned on.
|
||||
|
||||
the implementation (February 2001)
|
||||
----------------------------------------
|
||||
- Supported shapes: all G3 shapes except for
|
||||
"HYPE", "GTRA", "CTUB"
|
||||
- G3 MANY feature is not supported.
|
||||
- GSDV* routines for dividing volumes implemented, using
|
||||
G4PVReplicas, for shapes:
|
||||
"BOX", "TUBE", "TUBS", "PARA" - all axes;
|
||||
"CONE", "CONS" - axes 2, 3;
|
||||
"TRD1", "TRD2", "TRAP" - axis 3;
|
||||
"PGON", "PCON" - axis 2;
|
||||
"PARA" -axis 1; axis 2,3 for a special case
|
||||
Unsupported shapes:
|
||||
"SPHE", "ELTU", "HYPE", "GTRA", "CTUB"
|
||||
|
||||
the implementation (November 2001)
|
||||
----------------------------------------
|
||||
- Support for G3 MANY feature:
|
||||
|
||||
MANY positions are resolved in G3toG4MANY function,
|
||||
which has to be processed before G3toG4BuildTree
|
||||
(it is not called by default).
|
||||
In order to resolve MANY user code has to provide
|
||||
additional info using G4gsbool(G4String volName, G4String manyVolName)
|
||||
function) for all overlapping volumes. Daughters of
|
||||
overlapping volumes are then resolved automatically
|
||||
and should not be specified via Gsbool.
|
||||
|
||||
Limitation: a volume with a MANY position can have only this
|
||||
one position; if more than one position is needed a new volume
|
||||
has to be defined (gsvolu) for each position.
|
||||
|
||||
See History file for modification history.
|
||||
@@ -49,13 +49,18 @@ G3EleTable::~G3EleTable(){
|
||||
|
||||
G4Element*
|
||||
G3EleTable::GetEle(G4double Z){
|
||||
G4double A;
|
||||
G4double A = 0.;
|
||||
char name[20], sym[3];
|
||||
G4int index = (G4int) Z-1;
|
||||
if (!parse(Z, name, sym, A)) {
|
||||
G4String na(name);
|
||||
G4String sy(sym);
|
||||
if (_Ele[index] == 0) {
|
||||
if ( A == 0. ) {
|
||||
// Cannot create element with A = 0.
|
||||
G4String text = "Failed to get element Z = " + std::to_string(Z);
|
||||
G4Exception("G3EleTable::GetEle", "G3toG40016", FatalException, text);
|
||||
}
|
||||
// add an element to the element table here
|
||||
_Ele[index] = new G4Element(na, sy, Z, A*g/mole);
|
||||
}
|
||||
@@ -68,8 +73,17 @@ G3EleTable::parse(G4double& Z, char* name, char* sym, G4double& A){
|
||||
G4int rc = 0;
|
||||
if (Z>0 && Z <=_MaxEle){
|
||||
G4int z = (G4int) Z-1;
|
||||
std::istringstream in(_EleNames[z]);
|
||||
in >> name >> sym >> A;
|
||||
G4String str(_EleNames[z]);
|
||||
char* cstr = new char [str.length()+1];
|
||||
std::strcpy(cstr, str.c_str());
|
||||
char* p = std::strtok(cstr," ");
|
||||
std::strcpy(name, p);
|
||||
p = std::strtok(NULL," ");
|
||||
std::strcpy(sym, p);
|
||||
p = std::strtok(NULL," ");
|
||||
std::istringstream in(p);
|
||||
in >> A;
|
||||
delete [] cstr;
|
||||
} else {
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
@@ -339,8 +339,8 @@ G3VolTableEntry*
|
||||
G3VolTableEntry::GetMasterClone(){
|
||||
G3VolTableEntry* master;
|
||||
G4String name = fVname;
|
||||
if (name.contains(gSeparator)) {
|
||||
name = name(0, name.first(gSeparator));
|
||||
if (G4StrUtil::contains(name, gSeparator)) {
|
||||
name = name.substr(0, name.find(gSeparator));
|
||||
master = G3Vol.GetVTE(name);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -64,7 +64,8 @@ void G4CreateCloneVTEWithDivision(G4String vname, G3VolTableEntry* mvte,
|
||||
G4String newName = vname;
|
||||
if (i>0) {
|
||||
char index[12]; sprintf(index, "%d", i);
|
||||
newName.append(gSeparator); newName = newName + index;
|
||||
newName += gSeparator;
|
||||
newName = newName + index;
|
||||
}
|
||||
|
||||
// create new VTE with 0 solid
|
||||
|
||||
@@ -113,7 +113,7 @@ void G4gsmate(G4int imate, G4String name, G4double ain, G4double zin,
|
||||
|
||||
G4Material* material=0;
|
||||
|
||||
G4String sname = name.strip(G4String::both);
|
||||
G4String sname = G4StrUtil::strip_copy(name);
|
||||
if (sname == "AIR") {
|
||||
// handle the built in AIR mixture
|
||||
G4double aa[2], zz[2], wmat[2];
|
||||
|
||||
@@ -144,7 +144,8 @@ void G4CloneDaughters(G3VolTableEntry* vte, G3VolTableEntry* vteClone)
|
||||
G4int cloneNo = dvteMaster->GetNoClones();
|
||||
char index[5]; sprintf(index,"%d",cloneNo);
|
||||
G4String newName = dvteMaster->GetName();
|
||||
newName.append(gSeparator); newName = newName + index;
|
||||
newName += gSeparator;
|
||||
newName = newName + index;
|
||||
|
||||
// create dvteClone
|
||||
G4String dvteShape = dvte->GetShape();
|
||||
@@ -268,7 +269,8 @@ void G4CreateCloneVTE(G3VolTableEntry* vte, G3VolTableEntry* mvte,
|
||||
G4int cloneNo = vte->GetNoClones();
|
||||
char index[5]; sprintf(index,"%d",cloneNo);
|
||||
G4String newName = vte->GetName();
|
||||
newName.append(gSeparator); newName = newName + index;
|
||||
newName += gSeparator;
|
||||
newName = newName + index;
|
||||
|
||||
// update vteClone
|
||||
vteClone->SetName(newName);
|
||||
|
||||
@@ -115,7 +115,7 @@ void G3CLRead(G4String & fname, char *select = 0)
|
||||
G4int ntokens = 0;
|
||||
std::ifstream istr(fname);
|
||||
|
||||
while (line.readLine(istr) && ! istr.eof())
|
||||
while (G4StrUtil::readline(istr, line) && ! istr.eof())
|
||||
{
|
||||
count++;
|
||||
ntokens = G3CLTokens(&line,tokens); // tokenize the line
|
||||
@@ -146,7 +146,7 @@ G4int G3CLTokens(G4String *line, G4String tokens[])
|
||||
G4int itok = 0;
|
||||
G4int ntokens = 0;
|
||||
G4String token1, token2;
|
||||
while (!(token1=next("\"")).isNull())
|
||||
while (!(token1=next("\"")).empty())
|
||||
{
|
||||
itok++;
|
||||
if (itok%2 == 0 ) // even: inside a string
|
||||
@@ -156,7 +156,7 @@ G4int G3CLTokens(G4String *line, G4String tokens[])
|
||||
else // not in a quoted string: finish tokenization
|
||||
{
|
||||
G4Tokenizer lev2(token1);
|
||||
while (!(token2=lev2()).isNull())
|
||||
while (!(token2=lev2()).empty())
|
||||
{
|
||||
tokens[ntokens] = token2;
|
||||
ntokens++;
|
||||
|
||||
Reference in New Issue
Block a user