Import Geant4 0.1.0 source tree
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3CalcParams.cc,v 2.2 1998/10/05 15:26:08 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G3CalcParams.cc,v 1.1 1999/01/07 16:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
@@ -5,70 +5,94 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3DetTable.cc,v 2.1 1998/07/12 02:54:17 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G3DetTable.cc,v 1.4 1999/05/18 02:40:32 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G3DetTable.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
class G4VSensitiveDetector;
|
||||
DetTableEntry::DetTableEntry(G4String& set, G4String& det, G4int id,
|
||||
G4VSensitiveDetector* D){
|
||||
_set = set;
|
||||
_det = det;
|
||||
_id = id;
|
||||
_detpt = D;
|
||||
};
|
||||
|
||||
RWBoolean DetTableMatch(const DetTableEntry *DetTentry, const void *pt)
|
||||
{
|
||||
G4String *name;
|
||||
name = (G4String*) pt;
|
||||
if (DetTentry->name == *name)
|
||||
{
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
DetTableEntry::~DetTableEntry(){;}
|
||||
|
||||
G4VSensitiveDetector*
|
||||
DetTableEntry::getSD(){
|
||||
return _detpt;
|
||||
}
|
||||
|
||||
G3DetTable::G3DetTable()
|
||||
{
|
||||
DetTable = &DetT;
|
||||
G4String
|
||||
DetTableEntry::getset(){
|
||||
return _set;
|
||||
}
|
||||
|
||||
G3DetTable::~G3DetTable()
|
||||
{
|
||||
while (! DetTable->isEmpty()) {
|
||||
DetTableEntry *DetTentry = DetTable->last();
|
||||
DetTable->removeReference(DetTentry);
|
||||
delete DetTentry;
|
||||
}
|
||||
delete DetTable;
|
||||
G4String
|
||||
DetTableEntry::getdet(){
|
||||
return _det;
|
||||
}
|
||||
|
||||
G4VSensitiveDetector *G3DetTable::get(G4String detname)
|
||||
{
|
||||
const void *pt;
|
||||
pt = &detname;
|
||||
DetTableEntry *DetTentry = DetTable->find(DetTableMatch, pt);
|
||||
if (DetTentry == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return DetTentry->detpt;
|
||||
}
|
||||
}
|
||||
G4int
|
||||
DetTableEntry::getid(){
|
||||
return _id;
|
||||
};
|
||||
|
||||
G4int G3DetTable::GetID(G4String detname)
|
||||
{
|
||||
const void *pt;
|
||||
pt = &detname;
|
||||
DetTableEntry *DetTentry = DetTable->find(DetTableMatch, pt);
|
||||
if (DetTentry == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
return DetTentry->detid;
|
||||
}
|
||||
}
|
||||
G4String
|
||||
G3DetTable::MakeHash(G4String& set, G4String& det){;
|
||||
return set+" "+det;
|
||||
};
|
||||
|
||||
G3DetTable::G3DetTable(){
|
||||
_Det = new RWTPtrHashDictionary<G4String,DetTableEntry>(RWCString::hash);
|
||||
};
|
||||
|
||||
G3DetTable::~G3DetTable(){
|
||||
_Det->clearAndDestroy();
|
||||
delete _Det;
|
||||
};
|
||||
|
||||
G4VSensitiveDetector*
|
||||
G3DetTable::getSD(G4String& set, G4String& det){
|
||||
|
||||
// make hash ID
|
||||
G4String HashID = MakeHash(set, det);
|
||||
|
||||
// search the Hash Dictionary
|
||||
_DTE = _Det->findValue(&HashID);
|
||||
if (_DTE != 0) {
|
||||
return _DTE->getSD();
|
||||
} else {
|
||||
// G4cerr << "No G3DetTable entry with key '" << HashID << "'" << endl;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
G4int
|
||||
G3DetTable::GetID(G4String& set, G4String& det){
|
||||
|
||||
// make hash ID
|
||||
G4String HashID = MakeHash(set, det);
|
||||
|
||||
// search the Hash Dictionary
|
||||
_DTE = _Det->findValue(&HashID);
|
||||
if (_DTE != 0) {
|
||||
return _DTE->getid();
|
||||
} else {
|
||||
// G4cerr << "No G3DetTable entry with key '" << HashID << "'" << endl;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
G3DetTable::put(G4String& set, G4String& det, G4int id,
|
||||
G4VSensitiveDetector* D){
|
||||
G4String* _HashID = new G4String(MakeHash(set, det));
|
||||
_DTE = new DetTableEntry(set, det, id, D);
|
||||
_Det->insertKeyAndValue(_HashID, _DTE);
|
||||
};
|
||||
|
||||
void G3DetTable::put(G4String name, G4int detid, G4VSensitiveDetector *detpt)
|
||||
{
|
||||
DetTableEntry *DetTentry = new DetTableEntry;
|
||||
DetTentry->name = name;
|
||||
DetTentry->detid = detid;
|
||||
DetTentry->detpt = detpt;
|
||||
DetTable->append(DetTentry);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3EleTable.cc,v 1.4 1999/05/28 21:08:50 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
|
||||
#include "G4strstreambuf.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G3EleTable.hh"
|
||||
|
||||
G3EleTable::G3EleTable() :_MaxEle(109){
|
||||
_EleNames = new char*[_MaxEle];
|
||||
// create an array of pointers to elements
|
||||
_Ele = new G4Element*[_MaxEle];
|
||||
LoadUp();
|
||||
}
|
||||
|
||||
G3EleTable::~G3EleTable(){
|
||||
delete [] _EleNames;
|
||||
delete [] _Ele;
|
||||
G4cout << "Deleted G3EleTable..." << endl;
|
||||
};
|
||||
|
||||
G4Element*
|
||||
G3EleTable::GetEle(G4double Z){
|
||||
G4double A;
|
||||
char name[20], sym[3];
|
||||
G4int index = Z-1;
|
||||
if (!parse(Z, name, sym, A)) {
|
||||
G4String nm(name);
|
||||
G4String sy(sym);
|
||||
if (_Ele[index] == 0) {
|
||||
// add an element to the element table here
|
||||
_Ele[index] = new G4Element(nm, sy, Z, A*g/mole);
|
||||
}
|
||||
}
|
||||
return _Ele[index];
|
||||
}
|
||||
|
||||
int
|
||||
G3EleTable::parse(G4double& Z, char* name, char* sym, G4double& A){
|
||||
int rc = 0;
|
||||
if (Z>0 && Z <=_MaxEle){
|
||||
G4int z = Z-1;
|
||||
istrstream in(_EleNames[z]);
|
||||
in >> name >> sym >> A;
|
||||
} else {
|
||||
rc = -1;
|
||||
}
|
||||
return rc;
|
||||
};
|
||||
|
||||
void
|
||||
G3EleTable::LoadUp(){
|
||||
int i=0;
|
||||
_EleNames[i]=(char *)"Hydrogen H 1.00794"; i++;
|
||||
_EleNames[i]=(char *)"Helium He 4.0026"; i++;
|
||||
_EleNames[i]=(char *)"Lithium Li 6.941"; i++;
|
||||
_EleNames[i]=(char *)"Beryllium Be 9.012182"; i++;
|
||||
_EleNames[i]=(char *)"Boron B 10.811"; i++;
|
||||
_EleNames[i]=(char *)"Carbon C 12.011"; i++;
|
||||
_EleNames[i]=(char *)"Nitrogen N 14.00674"; i++;
|
||||
_EleNames[i]=(char *)"Oxygen O 15.9994"; i++;
|
||||
_EleNames[i]=(char *)"Fluorine F 18.9984032"; i++;
|
||||
_EleNames[i]=(char *)"Neon Ne 20.1797"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Sodium Na 22.989768"; i++;
|
||||
_EleNames[i]=(char *)"Magnesium Mg 24.3050"; i++;
|
||||
_EleNames[i]=(char *)"Aluminum Al 26.981539"; i++;
|
||||
_EleNames[i]=(char *)"Silicon Si 28.0855"; i++;
|
||||
_EleNames[i]=(char *)"Phosphorus P 30.973762"; i++;
|
||||
_EleNames[i]=(char *)"Sulfur S 32.066"; i++;
|
||||
_EleNames[i]=(char *)"Chlorine Cl 35.4527"; i++;
|
||||
_EleNames[i]=(char *)"Argon Ar 39.948"; i++;
|
||||
_EleNames[i]=(char *)"Potassium K 39.0983"; i++;
|
||||
_EleNames[i]=(char *)"Calcium Ca 40.078"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Scandium Sc 44.955910"; i++;
|
||||
_EleNames[i]=(char *)"Titanium Ti 47.867"; i++;
|
||||
_EleNames[i]=(char *)"Vanadium V 50.9415"; i++;
|
||||
_EleNames[i]=(char *)"Chromium Cr 51.9961"; i++;
|
||||
_EleNames[i]=(char *)"Manganese Mn 54.93805"; i++;
|
||||
_EleNames[i]=(char *)"Iron Fe 55.845"; i++;
|
||||
_EleNames[i]=(char *)"Cobalt Co 58.93320"; i++;
|
||||
_EleNames[i]=(char *)"Nickel Ni 58.6934"; i++;
|
||||
_EleNames[i]=(char *)"Copper Cu 63.546"; i++;
|
||||
_EleNames[i]=(char *)"Zinc Zn 65.39"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Gallium Ga 69.723"; i++;
|
||||
_EleNames[i]=(char *)"Germanium Ge 72.61"; i++;
|
||||
_EleNames[i]=(char *)"Arsenic As 74.92159"; i++;
|
||||
_EleNames[i]=(char *)"Selenium Se 78.96"; i++;
|
||||
_EleNames[i]=(char *)"Bromine Br 79.904"; i++;
|
||||
_EleNames[i]=(char *)"Krypton Kr 83.80"; i++;
|
||||
_EleNames[i]=(char *)"Rubidium Rb 85.4678"; i++;
|
||||
_EleNames[i]=(char *)"Strontium Sr 87.62"; i++;
|
||||
_EleNames[i]=(char *)"Yttrium Y 88.90585"; i++;
|
||||
_EleNames[i]=(char *)"Zirconium Zr 91.224"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Niobium Nb 92.90638"; i++;
|
||||
_EleNames[i]=(char *)"Molybdenum Mo 95.94"; i++;
|
||||
_EleNames[i]=(char *)"Technetium Tc 97.907215"; i++;
|
||||
_EleNames[i]=(char *)"Ruthenium Ru 101.07"; i++;
|
||||
_EleNames[i]=(char *)"Rhodium Rh 102.90550"; i++;
|
||||
_EleNames[i]=(char *)"Palladium Pd 106.42"; i++;
|
||||
_EleNames[i]=(char *)"Silver Ag 107.8682"; i++;
|
||||
_EleNames[i]=(char *)"Cadmium Cd 112.41"; i++;
|
||||
_EleNames[i]=(char *)"Indium In 114.818"; i++;
|
||||
_EleNames[i]=(char *)"Tin Sn 118.710"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Antimony Sb 121.760"; i++;
|
||||
_EleNames[i]=(char *)"Tellurium Te 127.60"; i++;
|
||||
_EleNames[i]=(char *)"Iodine I 126.90447"; i++;
|
||||
_EleNames[i]=(char *)"Xenon Xe 131.29"; i++;
|
||||
_EleNames[i]=(char *)"Cesium Cs 132.90543"; i++;
|
||||
_EleNames[i]=(char *)"Barium Ba 137.27"; i++;
|
||||
_EleNames[i]=(char *)"Lanthanum La 138.9055"; i++;
|
||||
_EleNames[i]=(char *)"Cerium Ce 140.115"; i++;
|
||||
_EleNames[i]=(char *)"Praeseodymium Pr 140.90765"; i++;
|
||||
_EleNames[i]=(char *)"NeoDymium Nd 144.24"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Promethium Pm 144.912745"; i++;
|
||||
_EleNames[i]=(char *)"Samarium Sm 150.36"; i++;
|
||||
_EleNames[i]=(char *)"Europium Eu 151.965"; i++;
|
||||
_EleNames[i]=(char *)"Gadolinium Gd 157.25"; i++;
|
||||
_EleNames[i]=(char *)"Terbium Tb 158.92534"; i++;
|
||||
_EleNames[i]=(char *)"Dysprosium Dy 162.50"; i++;
|
||||
_EleNames[i]=(char *)"Holmium Ho 164.93032"; i++;
|
||||
_EleNames[i]=(char *)"Erbium Er 167.26"; i++;
|
||||
_EleNames[i]=(char *)"Thulium Tm 168.93421"; i++;
|
||||
_EleNames[i]=(char *)"Ytterbium Yb 173.04"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Lutetium Lu 174.967"; i++;
|
||||
_EleNames[i]=(char *)"Hafnium Hf 178.49"; i++;
|
||||
_EleNames[i]=(char *)"Tantalum Ta 180.9479"; i++;
|
||||
_EleNames[i]=(char *)"Tungsten W 183.84"; i++;
|
||||
_EleNames[i]=(char *)"Rhenium Re 186.207"; i++;
|
||||
_EleNames[i]=(char *)"Osmium Os 190.23"; i++;
|
||||
_EleNames[i]=(char *)"Iridium Ir 192.217"; i++;
|
||||
_EleNames[i]=(char *)"Platinum Pt 195.08"; i++;
|
||||
_EleNames[i]=(char *)"Gold Au 196.96654"; i++;
|
||||
_EleNames[i]=(char *)"Mercury Hg 200.59"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Thallium Tl 204.3833"; i++;
|
||||
_EleNames[i]=(char *)"Lead Pb 207.2"; i++;
|
||||
_EleNames[i]=(char *)"Bismuth Bi 208.98037"; i++;
|
||||
_EleNames[i]=(char *)"Polonium Po 208.982415"; i++;
|
||||
_EleNames[i]=(char *)"Astatine At 209.987131"; i++;
|
||||
_EleNames[i]=(char *)"Radon Rn 222.017570"; i++;
|
||||
_EleNames[i]=(char *)"Francium Fr 223.019731"; i++;
|
||||
_EleNames[i]=(char *)"Radium Ra 226.025402"; i++;
|
||||
_EleNames[i]=(char *)"Actinium Ac 227.027747"; i++;
|
||||
_EleNames[i]=(char *)"Thorium Th 232.0381"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Protactinium Pa 231.03588"; i++;
|
||||
_EleNames[i]=(char *)"Uranium U 238.0289"; i++;
|
||||
_EleNames[i]=(char *)"Neptunium Np 237.048166"; i++;
|
||||
_EleNames[i]=(char *)"Plutonium Pu 244.064197"; i++;
|
||||
_EleNames[i]=(char *)"Americium Am 243.061372"; i++;
|
||||
_EleNames[i]=(char *)"Curium Cm 247.070346"; i++;
|
||||
_EleNames[i]=(char *)"Berkelium Bk 247.070298"; i++;
|
||||
_EleNames[i]=(char *)"Californium Cf 251.079579"; i++;
|
||||
_EleNames[i]=(char *)"Einsteinium Es 252.08297"; i++;
|
||||
_EleNames[i]=(char *)"Fermium Fm 257.095096"; i++;
|
||||
|
||||
_EleNames[i]=(char *)"Mendelevium Md 258.098427"; i++;
|
||||
_EleNames[i]=(char *)"Nobelium No 259.1011"; i++;
|
||||
_EleNames[i]=(char *)"Lawrencium Lr 262.1098"; i++;
|
||||
_EleNames[i]=(char *)"Rutherfordium Rf 261.1089"; i++;
|
||||
_EleNames[i]=(char *)"Hahnium Ha 262.1144"; i++;
|
||||
_EleNames[i]=(char *)"Seaborgium Sg 263.1186"; i++;
|
||||
_EleNames[i]=(char *)"Nielsborium Ns 262.1231"; i++;
|
||||
_EleNames[i]=(char *)"Hassium Hs 265.1306"; i++;
|
||||
_EleNames[i]=(char *)"Meitnerium Mt 266.1378"; i++;
|
||||
|
||||
// initialize element pointers to 0
|
||||
for (int j=0; j<i; j++) {
|
||||
_Ele[j]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3IsMany.cc,v 2.1 1998/07/13 16:50:26 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G3toG4.hh"
|
||||
|
||||
G4bool G3IsMany(G4String vonly)
|
||||
{
|
||||
if (vonly == "ONLY" )
|
||||
{
|
||||
return FALSE;
|
||||
} else if (vonly == "MANY") {
|
||||
return TRUE;
|
||||
} else {
|
||||
G4cerr << "Unidentified ONLY/MANY tag: " << vonly << endl;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -5,54 +5,30 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3MatTable.cc,v 2.0 1998/07/02 16:16:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G3MatTable.cc,v 1.6 1999/05/28 21:08:55 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G3MatTable.hh"
|
||||
#include "G4Material.hh"
|
||||
|
||||
RWBoolean MatTableMatch(const MatTableEntry* MatTentry, const void* pt)
|
||||
{
|
||||
G4int matid;
|
||||
matid = *((G4int*) pt);
|
||||
if (MatTentry->matid == matid)
|
||||
{
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
G3MatTable::G3MatTable(){
|
||||
_Mat = new
|
||||
RWTPtrOrderedVector<G4Material>;
|
||||
};
|
||||
|
||||
G3MatTable::G3MatTable()
|
||||
{
|
||||
MatTable = &MatT;
|
||||
}
|
||||
G3MatTable::~G3MatTable(){
|
||||
_Mat->clear();
|
||||
G4cout << "Deleted G3MatTable..." << endl;
|
||||
delete _Mat;
|
||||
};
|
||||
|
||||
G3MatTable::~G3MatTable()
|
||||
{
|
||||
while (! MatTable->isEmpty()) {
|
||||
MatTableEntry* MatTentry = MatTable->last();
|
||||
MatTable->removeReference(MatTentry);
|
||||
delete MatTentry;
|
||||
}
|
||||
delete MatTable;
|
||||
}
|
||||
G4Material*
|
||||
G3MatTable::get(G4int MatID){
|
||||
return (*_Mat)[MatID-1];
|
||||
};
|
||||
|
||||
G4Material* G3MatTable::get(G4int matid)
|
||||
{
|
||||
const void* pt;
|
||||
pt = &matid;
|
||||
MatTableEntry* MatTentry = MatTable->find(MatTableMatch, pt);
|
||||
if (MatTentry == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return MatTentry->matpt;
|
||||
}
|
||||
}
|
||||
|
||||
void G3MatTable::put(G4int* matid, G4Material* matpt)
|
||||
{
|
||||
MatTableEntry* MatTentry = new MatTableEntry;
|
||||
MatTentry->matid = *matid;
|
||||
MatTentry->matpt = matpt;
|
||||
MatTable->append(MatTentry);
|
||||
}
|
||||
void G3MatTable::put(G4int MatID, G4Material* MatPT){
|
||||
_Mat->insertAt(MatID-1, MatPT);
|
||||
};
|
||||
|
||||
@@ -5,85 +5,31 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3MedTable.cc,v 2.1 1998/07/12 02:54:18 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G3MedTable.cc,v 1.6 1999/05/28 21:08:58 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G3MedTable.hh"
|
||||
#include "G4Material.hh"
|
||||
|
||||
RWBoolean MedTableMatch(const MedTableEntry *MedTentry, const void *pt)
|
||||
{
|
||||
G4int medid;
|
||||
medid = *((G4int*) pt);
|
||||
if (MedTentry->medid == medid)
|
||||
{
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
G3MedTable::G3MedTable(){
|
||||
_Med = new
|
||||
RWTPtrOrderedVector<G4Material>;
|
||||
};
|
||||
|
||||
G3MedTable::G3MedTable()
|
||||
{
|
||||
MedTable = &MedT;
|
||||
}
|
||||
G3MedTable::~G3MedTable(){
|
||||
_Med->clear();
|
||||
delete _Med;
|
||||
G4cout << "Deleted G3MedTable..." << endl;
|
||||
};
|
||||
|
||||
G3MedTable::~G3MedTable()
|
||||
{
|
||||
while (! MedTable->isEmpty()) {
|
||||
MedTableEntry *MedTentry = MedTable->last();
|
||||
MedTable->removeReference(MedTentry);
|
||||
delete MedTentry;
|
||||
}
|
||||
delete MedTable;
|
||||
}
|
||||
G4Material*
|
||||
G3MedTable::get(G4int MedID){
|
||||
return (*_Med)[MedID-1];
|
||||
};
|
||||
|
||||
G4Material *G3MedTable::GetMat(G4int medid)
|
||||
{
|
||||
const void *pt;
|
||||
pt = &medid;
|
||||
MedTableEntry *MedTentry = MedTable->find(MedTableMatch, pt);
|
||||
if (MedTentry == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return MedTentry->matpt;
|
||||
}
|
||||
}
|
||||
|
||||
G4MagneticField *G3MedTable::GetMag(G4int medid)
|
||||
{
|
||||
const void *pt;
|
||||
pt = &medid;
|
||||
MedTableEntry *MedTentry = MedTable->find(MedTableMatch, pt);
|
||||
if (MedTentry == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return MedTentry->magpt;
|
||||
}
|
||||
}
|
||||
|
||||
G4UserLimits *G3MedTable::GetLim(G4int medid)
|
||||
{
|
||||
const void *pt;
|
||||
pt = &medid;
|
||||
MedTableEntry *MedTentry = MedTable->find(MedTableMatch, pt);
|
||||
if (MedTentry == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return MedTentry->limpt;
|
||||
}
|
||||
}
|
||||
|
||||
void G3MedTable::put( G4int medid, G4Material *matpt, G4MagneticField *magpt,
|
||||
G4UserLimits *limpt, G4int isvol,
|
||||
G4double deemax, G4double epsil)
|
||||
{
|
||||
MedTableEntry *MedTentry = new MedTableEntry;
|
||||
MedTentry->medid = medid;
|
||||
MedTentry->matpt = matpt;
|
||||
MedTentry->magpt = magpt;
|
||||
MedTentry->limpt = limpt;
|
||||
MedTentry->isvol = isvol;
|
||||
MedTentry->deemax = deemax;
|
||||
MedTentry->epsil = epsil;
|
||||
MedTable->insert(MedTentry);
|
||||
}
|
||||
void
|
||||
G3MedTable::put(G4int MedID, G4Material* MatPT){
|
||||
_Med->insertAt(MedID-1, MatPT);
|
||||
};
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3NegVolPars.cc,v 2.1 1998/07/12 02:54:19 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include <math.h>
|
||||
|
||||
G4bool G3CalcParamsFn(G4double* Rpar, G4int npar, G4double* Rparm,
|
||||
G4String shape, G4String shapem);
|
||||
|
||||
// pars in case of gsposp are those passed to gsposp; for other cases,
|
||||
// they come from the logical volume
|
||||
G4bool G3NegVolPars(G4double pars[], G4int *nparpt,
|
||||
G4String name, G4String moth,
|
||||
char routine[])
|
||||
{
|
||||
G4bool NegPresent = FALSE;
|
||||
// Retrieve the parameters of the volume
|
||||
G4double rangehi, rangelo;
|
||||
EAxis axiscode;
|
||||
G4String shape;
|
||||
G4int nmed, npar;
|
||||
G4double *Rpar;
|
||||
G4VSolid *solid = NULL;
|
||||
G4int iaxis = 1;
|
||||
G3Vol.GetLVPars(&name, iaxis, &rangehi, &rangelo, &axiscode, &shape,
|
||||
&nmed, &Rpar, &npar, solid);
|
||||
if (pars == NULL) {
|
||||
pars = Rpar;
|
||||
*nparpt = npar;
|
||||
} else {
|
||||
Rpar = pars;
|
||||
}
|
||||
// and of the mother
|
||||
G4String shapem;
|
||||
G4int nparm;
|
||||
G4double *Rparm;
|
||||
G4VSolid *solidm = NULL;
|
||||
G3Vol.GetLVPars(&moth, 1, &rangehi, &rangelo, &axiscode, &shapem,
|
||||
&nmed, &Rparm, &nparm, solidm);
|
||||
|
||||
if (strcmp(routine,"GSPOS") == 0 || strcmp(routine,"GSVOLU") == 0) {
|
||||
NegPresent = G3CalcParamsFn(Rpar,npar,Rparm,shape,shapem);
|
||||
}
|
||||
if (strcmp(routine,"GSDVN") == 0) {
|
||||
// just set the flag. The parametrization function figures out
|
||||
// what to do.
|
||||
for (G4int i=0;i<npar;i++) {
|
||||
if (Rpar[i] < 0) {
|
||||
NegPresent = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NegPresent;
|
||||
}
|
||||
@@ -5,54 +5,48 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3PartTable.cc,v 2.0 1998/07/02 16:16:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G3PartTable.cc,v 1.4 1999/05/28 21:09:02 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
|
||||
#include <strstream.h>
|
||||
#include "globals.hh"
|
||||
#include "G3PartTable.hh"
|
||||
|
||||
RWBoolean PartTableMatch(const PartTableEntry *PartTentry, const void *pt)
|
||||
{
|
||||
G4int partid;
|
||||
partid = *((G4int*) pt);
|
||||
if (PartTentry->partid == partid)
|
||||
{
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
G3PartTable::G3PartTable(){
|
||||
_PTD = new RWTPtrHashDictionary<G4String,G4ParticleDefinition>(G4String::hash);
|
||||
}
|
||||
|
||||
G3PartTable::G3PartTable()
|
||||
{
|
||||
PartTable = &PartT;
|
||||
}
|
||||
G3PartTable::~G3PartTable(){
|
||||
_PTD->clearAndDestroy();
|
||||
delete _PTD;
|
||||
G4cout << "Deleted G3PartTable..." << endl;
|
||||
};
|
||||
|
||||
G3PartTable::~G3PartTable()
|
||||
{
|
||||
while (! PartTable->isEmpty()) {
|
||||
PartTableEntry *PartTentry = PartTable->last();
|
||||
PartTable->removeReference(PartTentry);
|
||||
delete PartTentry;
|
||||
}
|
||||
delete PartTable;
|
||||
}
|
||||
G4ParticleDefinition*
|
||||
G3PartTable::get(G4int partid){
|
||||
G4String _ShashID; // static
|
||||
HashID(partid, _ShashID);
|
||||
return _PTD->findValue(&_ShashID);
|
||||
};
|
||||
|
||||
G4ParticleDefinition *G3PartTable::get(G4int partid)
|
||||
{
|
||||
const void *pt;
|
||||
pt = &partid;
|
||||
PartTableEntry *PartTentry = PartTable->find(PartTableMatch, pt);
|
||||
if (PartTentry == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return PartTentry->partpt;
|
||||
}
|
||||
}
|
||||
void
|
||||
G3PartTable::put(G4int partid, G4ParticleDefinition *partpt){
|
||||
G4String* _HashID = new G4String(); // Dynamic
|
||||
HashID(partid, _HashID);
|
||||
_PTD->insertKeyAndValue(_HashID, partpt);
|
||||
};
|
||||
|
||||
void
|
||||
G3PartTable::HashID(G4int partid, G4String& _HashID){
|
||||
char s[20];
|
||||
ostrstream ostr(s, sizeof s);
|
||||
ostr << "Part" << partid << ends;
|
||||
_HashID = s;
|
||||
};
|
||||
|
||||
void
|
||||
G3PartTable::HashID(G4int partid, G4String* _HashID){
|
||||
HashID(partid, *_HashID);
|
||||
};
|
||||
|
||||
void G3PartTable::put(G4int *partid, G4ParticleDefinition *partpt)
|
||||
{
|
||||
PartTableEntry *PartTentry = new PartTableEntry;
|
||||
PartTentry->partid = *partid;
|
||||
PartTentry->partpt = partpt;
|
||||
PartTable->append(PartTentry);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3Pos.cc,v 1.4 1999/05/28 23:03:31 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G3Pos.hh"
|
||||
#include "VolTableEntry.hh"
|
||||
#include "G3VolTable.hh"
|
||||
|
||||
extern G3VolTable G3Vol;
|
||||
|
||||
G3Pos::G3Pos(G4String& LV, G4int C, G4ThreeVector* Position, G4int irot,
|
||||
G4String& Only)
|
||||
: _VTE(0),_Copy(0), _LV(" "),
|
||||
_Position(0),_Irot(0),_Only(" "){
|
||||
_VTE = G3Vol.GetVTE(LV);
|
||||
_LV = LV;
|
||||
_Copy = C;
|
||||
_Position = Position;
|
||||
_Irot = irot;
|
||||
_Only = Only;
|
||||
};
|
||||
|
||||
G3Pos::~G3Pos(){;};
|
||||
|
||||
VolTableEntry*
|
||||
G3Pos::GetVTE() {
|
||||
return _VTE;
|
||||
};
|
||||
|
||||
G4bool
|
||||
G3Pos::operator == ( const G3Pos& lv) const {
|
||||
return (this==&lv) ? true : false;
|
||||
};
|
||||
|
||||
G4String&
|
||||
G3Pos::GetName() {
|
||||
return _LV;
|
||||
};
|
||||
|
||||
G4int
|
||||
G3Pos::GetIrot() {
|
||||
return _Irot;
|
||||
};
|
||||
|
||||
G4int
|
||||
G3Pos::GetCopy() {
|
||||
return _Copy;
|
||||
};
|
||||
|
||||
G4ThreeVector*
|
||||
G3Pos::GetPos() {
|
||||
return _Position;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -5,57 +5,32 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3RotTable.cc,v 2.0 1998/07/02 16:16:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G3RotTable.cc,v 1.6 1999/05/28 21:09:06 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G3toG4RotationMatrix.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3RotTable.hh"
|
||||
|
||||
RWBoolean RotTableMatch(const RotTableEntry *RotTentry, const void *pt)
|
||||
{
|
||||
G4int rotid;
|
||||
rotid = *((G4int*) pt);
|
||||
if (RotTentry->rotid == rotid)
|
||||
{
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
G3RotTable::G3RotTable(){
|
||||
_Rot = new
|
||||
RWTPtrOrderedVector<G3toG4RotationMatrix>;
|
||||
};
|
||||
|
||||
G3RotTable::G3RotTable()
|
||||
{
|
||||
RotTable = &RotT;
|
||||
}
|
||||
G3RotTable::~G3RotTable(){
|
||||
_Rot->clearAndDestroy();
|
||||
delete _Rot;
|
||||
G4cout << "Deleted G3RotTable..." << endl;
|
||||
};
|
||||
|
||||
G3RotTable::~G3RotTable()
|
||||
{
|
||||
while (! RotTable->isEmpty()) {
|
||||
RotTableEntry *RotTentry = RotTable->last();
|
||||
RotTable->removeReference(RotTentry);
|
||||
delete RotTentry;
|
||||
}
|
||||
delete RotTable;
|
||||
}
|
||||
G3toG4RotationMatrix*
|
||||
G3RotTable::Get(G4int RotID){
|
||||
return (*_Rot)[RotID];
|
||||
};
|
||||
|
||||
G4RotationMatrix *G3RotTable::get(G4int rotid)
|
||||
{
|
||||
const void *pt;
|
||||
if ( rotid == 0 ) return NULL;
|
||||
pt = &rotid;
|
||||
RotTableEntry *RotTentry = RotTable->find(RotTableMatch, pt);
|
||||
if (RotTentry == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return RotTentry->rotpt;
|
||||
}
|
||||
}
|
||||
|
||||
void G3RotTable::put(G4int *rotid, G4RotationMatrix *rotpt)
|
||||
{
|
||||
RotTableEntry *RotTentry = new RotTableEntry;
|
||||
RotTentry->rotid = *rotid;
|
||||
RotTentry->rotpt = rotpt;
|
||||
RotTable->append(RotTentry);
|
||||
}
|
||||
void
|
||||
G3RotTable::Put(G4int RotID, G3toG4RotationMatrix *RotPT){
|
||||
_Rot->insertAt(RotID, RotPT);
|
||||
};
|
||||
|
||||
+68
-325
@@ -5,344 +5,87 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3VolTable.cc,v 2.3 1998/09/18 08:55:41 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G3VolTable.cc,v 1.13 1999/05/28 23:12:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
|
||||
#include <iomanip.h>
|
||||
#include "globals.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G3Pos.hh"
|
||||
|
||||
G4VPhysicalVolume* G3VolTable::mothPV = NULL; // physical volume of mother of all mothers initialized to NULL.
|
||||
G4LogicalVolume* G3VolTable::mothLV = NULL; // logical volume of mother of all mothers initialized to NULL.
|
||||
G3VolTable::G3VolTable()
|
||||
: _VTD(0), G3toG4TopVTE(0), _FirstKey("UnDefined"), _NVTE(0), _NG3Pos(0){
|
||||
_VTD = new RWTPtrHashDictionary<G4String,VolTableEntry>(RWCString::hash);
|
||||
};
|
||||
|
||||
RWBoolean VolTableMatch(const VolTableEntry *VolTentry, const void *pt)
|
||||
{
|
||||
G4String *vname;
|
||||
vname = (G4String*) pt;
|
||||
if (VolTentry->vname == *vname)
|
||||
{
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
G3VolTable::~G3VolTable(){
|
||||
_VTD->clearAndDestroy();
|
||||
delete _VTD;
|
||||
G4cout << "Deleted G3VolTable..." << endl;
|
||||
};
|
||||
|
||||
VolTableEntry*
|
||||
G3VolTable::GetVTE(const G4String& Vname) {
|
||||
return _VTD->findValue(&Vname);
|
||||
};
|
||||
|
||||
void
|
||||
G3VolTable::ListVTE(){
|
||||
RWTPtrHashDictionaryIterator<G4String, VolTableEntry> iter(*_VTD);
|
||||
if (_VTD->entries()>0) {
|
||||
for (int i=0;iter();i++){
|
||||
_VTE = iter.value();
|
||||
G4cout << "G3VolTable element " << setw(3) << i << " name "
|
||||
<< _VTE->GetName() << " has " << _VTE->GetNoDaughters()
|
||||
<< " daughters" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G3VolTable::G3VolTable()
|
||||
{
|
||||
VolTable = &VolT;
|
||||
G4int nent = VolTable->entries();
|
||||
ScanTmed = 0;
|
||||
Rect[0] = kXAxis;
|
||||
Rect[1] = kYAxis;
|
||||
Rect[2] = kZAxis;
|
||||
Polar[0] = kRho;
|
||||
Polar[1] = kPhi;
|
||||
Polar[2] = kZAxis;
|
||||
}
|
||||
RWTPtrHashDictionary <G4String, VolTableEntry>*
|
||||
G3VolTable::GetVTD() {return _VTD;}
|
||||
|
||||
G3VolTable::~G3VolTable()
|
||||
{
|
||||
while (! VolTable->isEmpty()) {
|
||||
VolTableEntry *VolTentry = VolTable->last();
|
||||
VolTable->removeReference(VolTentry);
|
||||
// delete VolTentry->par;
|
||||
delete VolTentry;
|
||||
}
|
||||
delete VolTable;
|
||||
}
|
||||
|
||||
G4LogicalVolume* G3VolTable::GetLVx(G4String& vname)
|
||||
{
|
||||
// loop through the G4 List of currently defined logical volumes
|
||||
VolTableEntry*
|
||||
G3VolTable::PutVTE(VolTableEntry* aVolTableEntry){
|
||||
|
||||
if (GetVTE(aVolTableEntry->GetName()) == 0 ){
|
||||
|
||||
RWTPtrOrderedVector <G4LogicalVolume>* _ptrToList;
|
||||
_ptrToList = G4LogicalVolumeStore::GetInstance();
|
||||
G4LogicalVolume* _lvol;
|
||||
G4int nentries = _ptrToList->entries();
|
||||
for (G4int i=0; i<nentries; i++){
|
||||
_lvol = (*_ptrToList)[i];
|
||||
if (_lvol->GetName() == vname) return _lvol;
|
||||
}
|
||||
return NULL;
|
||||
// create a hash key
|
||||
G4String* _HashID = new G4String(aVolTableEntry->GetName());
|
||||
|
||||
if (_FirstKey == "UnDefined") _FirstKey = *(_HashID);
|
||||
|
||||
// insert into dictionary
|
||||
_VTD->insertKeyAndValue(_HashID, aVolTableEntry);
|
||||
_NVTE++;
|
||||
}
|
||||
return GetVTE(aVolTableEntry->GetName());
|
||||
};
|
||||
|
||||
void
|
||||
G3VolTable::CountG3Pos(){
|
||||
_NG3Pos++;
|
||||
}
|
||||
|
||||
|
||||
G4LogicalVolume *G3VolTable::GetLV(G4String *vname)
|
||||
{
|
||||
curEntry = find(vname);
|
||||
if (curEntry == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return curEntry->lvpt;
|
||||
}
|
||||
void
|
||||
G3VolTable::SetFirstVTE(){
|
||||
G3toG4TopVTE = _VTD->findValue(&_FirstKey);
|
||||
if (G3toG4TopVTE->NPCopies() > 0) {
|
||||
_FirstKey = G3toG4TopVTE->GetMother()->GetName();
|
||||
SetFirstVTE();
|
||||
}
|
||||
}
|
||||
|
||||
G4LogicalVolume* G3VolTable::GetLV()
|
||||
{
|
||||
// G3Mother* TV;
|
||||
// return TV->GetLV(); // return the pointer to the top-level logical volume
|
||||
// G4cout << "LV pointer to top level logical volume" << mothLV << endl;
|
||||
return mothLV;
|
||||
VolTableEntry*
|
||||
G3VolTable::GetFirstVTE() {
|
||||
return G3toG4TopVTE;
|
||||
};
|
||||
|
||||
void
|
||||
G3VolTable::VTEStat() {
|
||||
G4cout << "VTEStat: instantiated " << _NVTE << " logical and "
|
||||
<< _NG3Pos << " positioned volumes." << endl;
|
||||
}
|
||||
|
||||
|
||||
G4VPhysicalVolume *G3VolTable::GetPV(G4int npv)
|
||||
{
|
||||
G4int ln = pVolsPtr->length();
|
||||
if (npv > ln) {
|
||||
G4cout << "G3VolTable::GetPV error: request index too high " << npv <<
|
||||
" > " << pVolsPtr->length() << endl;
|
||||
return NULL;
|
||||
} else {
|
||||
if (ln == 0) {
|
||||
// No associated physical volume. Use global mother.
|
||||
G4cout << "GetPV: returning global mother " << endl;
|
||||
return mothPV;
|
||||
} else {
|
||||
return pVolsPtr->at(npv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4VPhysicalVolume *G3VolTable::GetPV()
|
||||
{
|
||||
return mothPV;
|
||||
}
|
||||
|
||||
void G3VolTable::FindPV(G4int* nvols, G4String *vname)
|
||||
{
|
||||
const void *pt;
|
||||
pt = vname;
|
||||
curEntry = find(vname);
|
||||
if (curEntry == NULL) {
|
||||
*nvols = 0;
|
||||
return;
|
||||
} else {
|
||||
pVolsPtr = &(curEntry->pVols);
|
||||
if (pVolsPtr->length() == 0) {
|
||||
// use global mother
|
||||
pVolsPtr->insert(mothPV);
|
||||
G4cout << "Global mother set as physical volume for " << *vname << endl;
|
||||
}
|
||||
*nvols = pVolsPtr->length();
|
||||
}
|
||||
}
|
||||
|
||||
void G3VolTable::MatchPV(G4int* nvols, G4String *vname)
|
||||
{
|
||||
const void *pt;
|
||||
pt = vname;
|
||||
curEntry = find(vname);
|
||||
if (curEntry == NULL) {
|
||||
*nvols = -1;
|
||||
G4cout << "G3VolTable error: no entry for " << *vname << endl;
|
||||
return;
|
||||
} else {
|
||||
pVolsPtr = &(curEntry->pVols);
|
||||
*nvols = pVolsPtr->length();
|
||||
}
|
||||
}
|
||||
|
||||
void G3VolTable::GetLVPars(G4String *vname, G4int iaxis, G4double *rnghi,
|
||||
G4double *rnglo,
|
||||
EAxis *axis, G4String *shape, G4int *nmed,
|
||||
G4double *par[], G4int *npar, G4VSolid *solid)
|
||||
{
|
||||
const void *pt;
|
||||
pt = vname;
|
||||
curEntry = find(vname);
|
||||
if (curEntry == NULL) {
|
||||
*rnghi = 0.;
|
||||
*rnglo = 0.;
|
||||
// $$$ *axis = kUndefined;
|
||||
*shape = "";
|
||||
*nmed = 0;
|
||||
*npar = 0;
|
||||
return;
|
||||
} else {
|
||||
*rnghi = curEntry->rangehi[iaxis-1];
|
||||
*rnglo = curEntry->rangelo[iaxis-1];
|
||||
*axis = curEntry->axiscode[iaxis-1];
|
||||
*shape = curEntry->shape;
|
||||
*nmed = curEntry->tmed;
|
||||
*par = curEntry->par;
|
||||
*npar = curEntry->npar;
|
||||
solid = curEntry->solid;
|
||||
}
|
||||
}
|
||||
|
||||
void G3VolTable::GetLVInfo(G4String *vname, G4String *shape, G4int *nmed)
|
||||
{
|
||||
const void *pt;
|
||||
pt = vname;
|
||||
curEntry = find(vname);
|
||||
if (curEntry == NULL) {
|
||||
*shape = "";
|
||||
*nmed = 0;
|
||||
return;
|
||||
} else {
|
||||
*shape = curEntry->shape;
|
||||
*nmed = curEntry->tmed;
|
||||
}
|
||||
}
|
||||
|
||||
void G3VolTable::AddConstituentLVol(G4String* vname, G4LogicalVolume* lvol)
|
||||
{
|
||||
const void *pt;
|
||||
pt = vname;
|
||||
curEntry = find(vname);
|
||||
if (curEntry == NULL) {
|
||||
G4cout << "G3 LVol " << *vname << " not found" << endl;
|
||||
return;
|
||||
} else {
|
||||
curEntry->lVols.insert(lvol);
|
||||
}
|
||||
}
|
||||
|
||||
void G3VolTable::PutLV(G4String *vname, G4LogicalVolume *lvpt, G4int tmed,
|
||||
G4double rnghi[], G4double rnglo[],
|
||||
EAxis axis, G4String shape,
|
||||
G4double par[], G4int npar, G4VSolid *solid)
|
||||
{
|
||||
G4LogicalVolume *lvptold = NULL;
|
||||
if (VolTable->entries() > 0) lvptold = GetLV(vname);
|
||||
if (lvptold == NULL) { // create a new entry
|
||||
VolTableEntry *VolTentry = new VolTableEntry;
|
||||
VolTentry->vname = *vname;
|
||||
VolTentry->lvpt = lvpt;
|
||||
VolTentry->tmed = tmed;
|
||||
VolTentry->shape = shape;
|
||||
VolTentry->npar = npar;
|
||||
VolTentry->solid = solid;
|
||||
VolTentry->count = 0;
|
||||
// associated physical volume is initialized to the root mother
|
||||
// physical volume $$$
|
||||
VolTentry->pvpt = mothPV;
|
||||
|
||||
G4double *params = new G4double[npar];
|
||||
G4int i;
|
||||
for (i=0; i<npar; i++) {
|
||||
params[i] = par[i];
|
||||
}
|
||||
VolTentry->par = params;
|
||||
if (axis == kXAxis) VolTentry->axiscode = Rect;
|
||||
if (axis == kRho) VolTentry->axiscode = Polar;
|
||||
for (i=0; i<3; i++) {
|
||||
VolTentry->rangehi[i] = rnghi[i];
|
||||
VolTentry->rangelo[i] = rnglo[i];
|
||||
}
|
||||
VolTable->append(VolTentry);
|
||||
} else { // load existing entry
|
||||
curEntry->lvpt = lvpt;
|
||||
}
|
||||
}
|
||||
|
||||
// For case where nothing is known about the volume; it doesn't
|
||||
// come from G3toG4 (eg. externally specified global mother)
|
||||
void G3VolTable::PutLV(G4String *vname, G4LogicalVolume *lvpt)
|
||||
{
|
||||
G4LogicalVolume *lvptold = NULL;
|
||||
if (VolTable->entries() > 0) lvptold = GetLV(vname);
|
||||
if (lvptold == NULL) { // create a new entry
|
||||
VolTableEntry *VolTentry = new VolTableEntry;
|
||||
VolTentry->vname = *vname;
|
||||
VolTentry->lvpt = lvpt;
|
||||
VolTentry->tmed = 0;
|
||||
VolTentry->shape = "unknown";
|
||||
VolTentry->npar = 0;
|
||||
VolTentry->solid = 0;
|
||||
VolTentry->count = 0;
|
||||
// associated physical volume is initialized to the root mother
|
||||
// physical volume $$$
|
||||
VolTentry->pvpt = mothPV;
|
||||
|
||||
VolTentry->par = 0;
|
||||
VolTentry->axiscode = Rect;
|
||||
G4int i;
|
||||
for (i=0; i<3; i++) {
|
||||
VolTentry->rangehi[i] = 0.;
|
||||
VolTentry->rangelo[i] = 0.;
|
||||
}
|
||||
VolTable->append(VolTentry);
|
||||
} else { // load existing entry
|
||||
curEntry->lvpt = lvpt;
|
||||
}
|
||||
}
|
||||
|
||||
void G3VolTable::PutPV(G4String *vname, G4VPhysicalVolume *pvpt)
|
||||
{
|
||||
G4int npv=0;
|
||||
MatchPV(&npv,vname);
|
||||
if (npv >= 0) {
|
||||
curEntry->pVols.insert(pvpt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G3VolTable::PutPV1(G4String *vname, G4VPhysicalVolume *pvpt)
|
||||
{
|
||||
// Only add it if List is empty
|
||||
G4int npv=0;
|
||||
MatchPV(&npv,vname);
|
||||
if (npv == 0) {
|
||||
curEntry->pVols.insert(pvpt);
|
||||
}
|
||||
}
|
||||
|
||||
void G3VolTable::MatchTmed(G4int tmed)
|
||||
{
|
||||
// Set tmed to match with NextTmed
|
||||
ScanTmed = tmed;
|
||||
nEntry = 0;
|
||||
}
|
||||
|
||||
G4LogicalVolume *G3VolTable::NextTmed()
|
||||
{
|
||||
// Return successively all matching lvols; NULL terminates
|
||||
for (G4int i=nEntry; i<VolTable->entries(); i++) {
|
||||
VolTableEntry *vte = VolTable->at(i);
|
||||
if (vte->tmed == ScanTmed) {
|
||||
nEntry = nEntry + i + 1;
|
||||
return vte->lvpt;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void G3VolTable::SetMother(G4VPhysicalVolume *MotherOfAll)
|
||||
{
|
||||
if (!mothPV) mothPV = MotherOfAll;
|
||||
}
|
||||
|
||||
void G3VolTable::SetMother(G4LogicalVolume *MotherOfAll)
|
||||
{
|
||||
if (!mothLV) mothLV = MotherOfAll;
|
||||
}
|
||||
|
||||
void G3VolTable::SetMother()
|
||||
{
|
||||
mothLV = NULL;
|
||||
mothPV = NULL;
|
||||
}
|
||||
|
||||
VolTableEntry *G3VolTable::find(G4String *vname)
|
||||
{
|
||||
G4int nEntries = VolTable->entries();
|
||||
for (G4int i=0; i<nEntries; i++) {
|
||||
VolTableEntry *vte = VolTable->at(i);
|
||||
if (vte->vname == *vname) {
|
||||
return vte;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
G4int G3VolTable::Increment(G4String *vname)
|
||||
{
|
||||
curEntry = find(vname);
|
||||
if (curEntry == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
curEntry->count++;
|
||||
return curEntry->count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "globals.hh"
|
||||
#include "G3toG4BuildTree.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "VolTableEntry.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G3Pos.hh"
|
||||
#include "G3RotTable.hh"
|
||||
void
|
||||
G3toG4BuildTree(VolTableEntry* CurVTE){
|
||||
// create logical volume
|
||||
G4LogicalVolume* CurLog =
|
||||
new G4LogicalVolume(CurVTE->GetSolid(), // solids pointer
|
||||
CurVTE->GetMaterial(),// material pointer
|
||||
CurVTE->GetName());; // lv name
|
||||
CurVTE->SetLV(CurLog);
|
||||
|
||||
for (int ICopy=0; ICopy < CurVTE->NPCopies(); ICopy++){
|
||||
G3Pos* TheG3Pos = CurVTE->GetG3PosCopy(ICopy);
|
||||
// pointer to mother
|
||||
G4LogicalVolume* MothLV = CurVTE->GetMother()->GetLV();
|
||||
// rotation matrix
|
||||
G4int irot = TheG3Pos->GetIrot();
|
||||
//G4cout << "Positioning PV " << TheG3Pos->GetName() << " irot " << irot
|
||||
// << " inside mother " << MothLV->GetName() << " copy "
|
||||
// << TheG3Pos->GetCopy() << endl;
|
||||
// Position it
|
||||
new G4PVPlacement((G4RotationMatrix*)
|
||||
G3Rot.Get(TheG3Pos->GetIrot()), // rotation matrix
|
||||
*(TheG3Pos->GetPos()), // its position
|
||||
CurLog, // its LogicalVolume
|
||||
TheG3Pos->GetName(), // PV name
|
||||
MothLV, // Mother LV
|
||||
0, // only
|
||||
TheG3Pos->GetCopy()); // copy
|
||||
}
|
||||
// number of G3Pos daughters
|
||||
G4int Ndau = CurVTE->GetNoDaughters();
|
||||
for (int Idau=0; Idau<Ndau; Idau++){
|
||||
G3toG4BuildTree(CurVTE->GetDaughter(Idau));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G3toG4MakeSolid.cc,v 1.2 1999/05/28 02:19:36 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Trap.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Sphere.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G4Polycone.hh"
|
||||
#include "G4Polyhedra.hh"
|
||||
#include "G4Para.hh"
|
||||
#include "G4Hype.hh"
|
||||
#include "G3toG4MakeSolid.hh"
|
||||
|
||||
G4VSolid* G3toG4MakeSolid(const G4String& vname, const G4String& shape,
|
||||
const G4double* Rpar, const G4int npar,
|
||||
G4bool& NegVolPars, G4bool& Deferred,
|
||||
G4bool* OKAxis){
|
||||
|
||||
// Create the solid if no negative length parameters
|
||||
G4VSolid *solid = 0;
|
||||
|
||||
NegVolPars = false;
|
||||
|
||||
// if npar = 0 assume LV deferral
|
||||
Deferred = (npar == 0);
|
||||
|
||||
for (int i=0;i<3;i++){
|
||||
OKAxis[i]=false;
|
||||
};
|
||||
|
||||
if ( shape == "BOX" ) {
|
||||
G4double pX = Rpar[0]*cm;
|
||||
G4double pY = Rpar[1]*cm;
|
||||
G4double pZ = Rpar[2]*cm;
|
||||
|
||||
OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
|
||||
|
||||
NegVolPars = pX<0 || pY<0 || pZ<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)) {
|
||||
solid = new G4Box(vname, pX, pY, pZ);
|
||||
}
|
||||
|
||||
} else if ( shape == "TRD1" ) {
|
||||
G4double pdx1 = Rpar[0]*cm;
|
||||
G4double pdx2 = Rpar[1]*cm;
|
||||
G4double pdy1 = Rpar[2]*cm;
|
||||
G4double pdy2 = pdy1;
|
||||
G4double pdz = Rpar[3]*cm;
|
||||
|
||||
OKAxis[1]=OKAxis[2]=true;
|
||||
|
||||
NegVolPars = pdx1<0 || pdx2<0 || pdy1<0 || pdz<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)) {
|
||||
solid = new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz);
|
||||
}
|
||||
|
||||
} else if ( shape == "TRD2" ) {
|
||||
G4double pdx1 = Rpar[0]*cm;
|
||||
G4double pdx2 = Rpar[1]*cm;
|
||||
G4double pdy1 = Rpar[2]*cm;
|
||||
G4double pdy2 = Rpar[3]*cm;
|
||||
G4double pdz = Rpar[4]*cm;
|
||||
|
||||
OKAxis[2]=true;
|
||||
|
||||
NegVolPars = pdx1<0 || pdx2<0 || pdy1<0 || pdy2<0 || pdz<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)) {
|
||||
solid = new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz);
|
||||
}
|
||||
|
||||
} else if ( shape == "TRAP" ) {
|
||||
G4double pDz = Rpar[0]*cm;
|
||||
G4double pTheta = Rpar[1]*deg;
|
||||
G4double pPhi = Rpar[2]*deg;
|
||||
G4double pDy1 = Rpar[3]*cm;
|
||||
G4double pDx1 = Rpar[4]*cm;
|
||||
G4double pDx2 = Rpar[5]*cm;
|
||||
G4double pAlp1 = Rpar[6]*deg;
|
||||
G4double pDy2 = Rpar[7]*cm;
|
||||
G4double pDx3 = Rpar[8]*cm;
|
||||
G4double pDx4 = Rpar[9]*cm;
|
||||
G4double pAlp2 = Rpar[10]*deg;
|
||||
|
||||
OKAxis[2]=true;
|
||||
|
||||
NegVolPars= pDz<0 || pDy1<0 || pDx1<0 || pDx2<0 || pDy2<0 || pDx3<0 || pDx4<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)) {
|
||||
solid = new
|
||||
G4Trap(vname, pDz, pTheta, pPhi, pDy1, pDx1, pDx2, pAlp1, pDy2, pDx3,
|
||||
pDx4, pAlp2);
|
||||
}
|
||||
|
||||
} else if ( shape == "TUBE" ) {
|
||||
G4double pRMin = Rpar[0]*cm;
|
||||
G4double pRMax = Rpar[1]*cm;
|
||||
G4double pDz = Rpar[2]*cm;
|
||||
G4double pSPhi = 0.*deg;
|
||||
G4double pDPhi = 360.*deg;
|
||||
|
||||
OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
|
||||
|
||||
NegVolPars = pRMin<0 || pRMax<0 || pDz<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)) {
|
||||
solid = new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi);
|
||||
}
|
||||
|
||||
} else if ( shape == "TUBS" ) {
|
||||
G4double pRMin = Rpar[0]*cm;
|
||||
G4double pRMax = Rpar[1]*cm;
|
||||
G4double pDz = Rpar[2]*cm;
|
||||
G4double pSPhi = Rpar[3]*deg;
|
||||
G4double pDPhi = Rpar[4]*deg - pSPhi;
|
||||
if ( Rpar[4]*deg <= pSPhi ) pDPhi = pDPhi + 360.*deg;
|
||||
|
||||
OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
|
||||
|
||||
NegVolPars = pRMin<0 || pRMax<0 || pDz<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)){
|
||||
solid = new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi);
|
||||
}
|
||||
|
||||
} else if ( shape == "CONE" ) {
|
||||
G4double pDz = Rpar[0]*cm;
|
||||
G4double pRmin1 = Rpar[1]*cm;
|
||||
G4double pRmax1 = Rpar[2]*cm;
|
||||
G4double pRmin2 = Rpar[3]*cm;
|
||||
G4double pRmax2 = Rpar[4]*cm;
|
||||
G4double pSPhi = 0.*deg;
|
||||
G4double pDPhi = 360.*deg;
|
||||
|
||||
OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
|
||||
|
||||
NegVolPars = pDz<0 || pRmin1<0 || pRmax1<0 || pRmin2<0 || pRmax2<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)){
|
||||
solid = new
|
||||
G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi);
|
||||
}
|
||||
|
||||
} else if ( shape == "CONS" ) {
|
||||
G4double pDz = Rpar[0]*cm;
|
||||
G4double pRmin1 = Rpar[1]*cm;
|
||||
G4double pRmax1 = Rpar[2]*cm;
|
||||
G4double pRmin2 = Rpar[3]*cm;
|
||||
G4double pRmax2 = Rpar[4]*cm;
|
||||
G4double pSPhi = Rpar[5]*deg;
|
||||
G4double pDPhi = Rpar[6]- pSPhi;
|
||||
if ( Rpar[6]*deg <= pSPhi ) pDPhi = pDPhi + 360.*deg;
|
||||
|
||||
OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
|
||||
|
||||
NegVolPars = pDz<0 || pRmin1<0 || pRmax1<0 || pRmin2<0 || pRmax2<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)){
|
||||
solid = new
|
||||
G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi);
|
||||
}
|
||||
|
||||
} else if ( shape == "SPHE" ) {
|
||||
G4double pRmin = Rpar[0]*cm;
|
||||
G4double pRmax = Rpar[1]*cm;
|
||||
G4double pThe1 = Rpar[2]*deg;
|
||||
G4double pThe2 = Rpar[3]*deg;
|
||||
G4double pDThe = pThe2 - pThe1;
|
||||
G4double pPhi1 = Rpar[4]*deg;
|
||||
G4double pPhi2 = Rpar[5]*deg;
|
||||
G4double pDPhi = pPhi2 - pPhi1;
|
||||
|
||||
NegVolPars = pRmin<0 || pRmax<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)) {
|
||||
solid = new G4Sphere(vname, pRmin, pRmax, pThe1, pDThe, pPhi1, pDPhi);
|
||||
}
|
||||
|
||||
} else if ( shape == "PARA" ) {
|
||||
G4double pDx = Rpar[0]*cm;
|
||||
G4double pDy = Rpar[1]*cm;
|
||||
G4double pDz = Rpar[2]*cm;
|
||||
G4double pAlph = Rpar[3]*deg;
|
||||
G4double pThet = Rpar[4]*deg;
|
||||
G4double pPhi = Rpar[5]*deg;
|
||||
|
||||
OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
|
||||
|
||||
NegVolPars = pDx<0 || pDy<0 || pDz<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)){
|
||||
solid = new G4Para(vname, pDx, pDy, pDz, pAlph, pThet, pPhi);
|
||||
}
|
||||
|
||||
} else if ( shape == "PGON" ) {
|
||||
G4int i;
|
||||
G4int npdv = int(Rpar[2]);
|
||||
G4int nz = int(Rpar[3]);
|
||||
G4double pPhi1 = Rpar[0]*deg;
|
||||
G4double dPhi = Rpar[1]*deg;
|
||||
G4double *DzArray = new G4double[nz];
|
||||
G4double *Rmax = new G4double[nz];
|
||||
G4double *Rmin = new G4double[nz];
|
||||
|
||||
OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
|
||||
|
||||
NegVolPars = 0;
|
||||
|
||||
for(i=0; i<nz; i++) {
|
||||
int i4=3*i+4;
|
||||
int i5=i4+1;
|
||||
int i6=i4+2;
|
||||
DzArray[i] = Rpar[i4]*cm;
|
||||
Rmin[i] = Rpar[i5]*cm;
|
||||
Rmax[i] = Rpar[i6]*cm;
|
||||
}
|
||||
solid = new G4Polyhedra(vname, pPhi1, dPhi, npdv, nz, DzArray, Rmin, Rmax);
|
||||
delete [] DzArray;
|
||||
delete [] Rmin;
|
||||
delete [] Rmax;
|
||||
|
||||
} else if ( shape == "PCON" ) {
|
||||
G4int i;
|
||||
G4double pPhi1 = Rpar[0]*deg;
|
||||
G4double dPhi = Rpar[1]*deg;
|
||||
G4int nz = int(Rpar[2]);
|
||||
G4double *DzArray = new G4double[nz];
|
||||
G4double *Rmax = new G4double[nz];
|
||||
G4double *Rmin = new G4double[nz];
|
||||
|
||||
OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
|
||||
|
||||
NegVolPars = 0;
|
||||
|
||||
for(i=0; i<nz; i++){
|
||||
int i4=3*i+3;
|
||||
int i5=i4+1;
|
||||
int i6=i4+2;
|
||||
DzArray[i] = Rpar[i4]*cm;
|
||||
Rmin[i] = Rpar[i5]*cm;
|
||||
Rmax[i] = Rpar[i6]*cm;
|
||||
}
|
||||
solid = new G4Polycone(vname, pPhi1, dPhi, nz, DzArray, Rmin, Rmax);
|
||||
delete [] DzArray;
|
||||
delete [] Rmin;
|
||||
delete [] Rmax;
|
||||
|
||||
} else if ( shape == "ELTU" ) {
|
||||
// $$$ not implemented.
|
||||
G4cerr << "ELTU not supported" << endl;
|
||||
|
||||
} else if ( shape == "HYPE" ) {
|
||||
G4double pRmin = Rpar[0]*cm;
|
||||
G4double pRmax = Rpar[1]*cm;
|
||||
G4double pDz = Rpar[2]*cm;
|
||||
G4double pThet = Rpar[3]*deg;
|
||||
|
||||
NegVolPars = pRmin<0 || pRmax<0 || pDz<0;
|
||||
|
||||
if (!(NegVolPars || Deferred)){
|
||||
solid = new G4Hype(vname, pRmin, pRmax, pThet, pThet, pDz);
|
||||
} else {
|
||||
G4cerr << "Negative length parameters not supported for shape "
|
||||
<< shape << endl;
|
||||
}
|
||||
|
||||
} else if ( shape == "GTRA" ) {
|
||||
// $$$ not implemented.
|
||||
G4cerr << "GTRA not supported" << endl;
|
||||
|
||||
} else if ( shape == "CTUB" ) {
|
||||
// $$$ not implemented.
|
||||
G4cerr << "CTUB not supported" << endl;
|
||||
}
|
||||
return solid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include "G3toG4SetRotation.hh"
|
||||
|
||||
G3toG4SetRotation::G3toG4SetRotation()
|
||||
{
|
||||
rxx = 1;
|
||||
ryx = 0;
|
||||
rzx = 0;
|
||||
rxy = 0;
|
||||
ryy = 1;
|
||||
rzy = 0;
|
||||
|
||||
rxz = 0;
|
||||
ryz = 0;
|
||||
rzz = 1;
|
||||
|
||||
|
||||
}
|
||||
G3toG4SetRotation::G3toG4SetRotation(const G4ThreeVector& col1,
|
||||
const G4ThreeVector& col2,
|
||||
const G4ThreeVector& col3)
|
||||
{
|
||||
rxx = col1.x();
|
||||
ryx = col1.y();
|
||||
rzx = col1.z();
|
||||
|
||||
rxy = col2.x();
|
||||
ryy = col2.y();
|
||||
rzy = col2.z();
|
||||
|
||||
rxz = col3.x();
|
||||
ryz = col3.y();
|
||||
rzz = col3.z();
|
||||
|
||||
}
|
||||
@@ -5,85 +5,107 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4BuildGeom.cc,v 2.4 1998/09/18 08:56:00 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// cltog4
|
||||
//
|
||||
// Convert Geant3 call List to Geant4 init file
|
||||
//
|
||||
// T. Wenaus LLNL 6/95
|
||||
//
|
||||
// 1-27-97 Akbar Mokhtarani
|
||||
// change the name to BuildGeom for use with visualization
|
||||
//code. This routine is called by test18.cc in prototype/visualization/test
|
||||
// directory. It reads the call List 'g3calls.dat' produced by rztog4
|
||||
// code from geant 3 geometry and builds the g4 geometry
|
||||
// It returns a pointer to the logical volume of the mother of all worlds.
|
||||
// $Id: G4BuildGeom.cc,v 1.7 1999/05/26 03:47:49 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include <iomanip.h>
|
||||
#include <fstream.h>
|
||||
#include "G4ios.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3MatTable.hh"
|
||||
#include "G3MedTable.hh"
|
||||
#include "G3RotTable.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "globals.hh"
|
||||
#include "VolTableEntry.hh"
|
||||
#include "G3toG4BuildTree.hh"
|
||||
|
||||
extern ofstream ofile;
|
||||
|
||||
void G3CLRead(G4String &, char *);
|
||||
void checkLogVol(G4LogicalVolume*, G4int);
|
||||
void checkVol(G4LogicalVolume*, G4int);
|
||||
void checkVol();
|
||||
|
||||
|
||||
G4LogicalVolume* G4BuildGeom(G4String& inFile)
|
||||
{
|
||||
// Read the call List and interpret to Generate Geant4 geometry
|
||||
G4LogicalVolume* G4BuildGeom(G4String& inFile){
|
||||
|
||||
G4cout << "Reading the call List file " << inFile << "..." << endl;
|
||||
G4int irot=0;
|
||||
G4gsrotm(0, 90, 0, 90, 90, 0, 0);
|
||||
|
||||
G3CLRead(inFile, NULL);
|
||||
G4cout << "Instantiated unit rotation matrix irot=" << irot << endl;
|
||||
|
||||
// Read the call List and interpret to Generate Geant4 geometry
|
||||
|
||||
G4cout << "Call List file read completed." << endl;
|
||||
G4cout << "Reading the call List file " << inFile << "..." << endl;
|
||||
|
||||
// Retrieve the top-level G3toG4 logical mother volume pointer
|
||||
G3CLRead(inFile, NULL);
|
||||
|
||||
G4LogicalVolume* lG3toG4 = G3Vol.GetLV();
|
||||
G3Vol.VTEStat();
|
||||
|
||||
// make the top-level volume invisible
|
||||
G4cout << "Call List file read completed. Build geometry" << endl;
|
||||
|
||||
// Build the geometry
|
||||
|
||||
G4cout << "G3toG4 top level volume is " << G3Vol.GetFirstVTE()->GetName()
|
||||
<< endl;
|
||||
|
||||
G3toG4BuildTree(G3Vol.GetFirstVTE());
|
||||
|
||||
// Retrieve the top-level G3toG4 logical mother volume pointer
|
||||
|
||||
G4LogicalVolume* lG3toG4 = G3Vol.GetFirstVTE()->GetLV();
|
||||
|
||||
// mark as invisible
|
||||
|
||||
lG3toG4->SetVisAttributes(G4VisAttributes::Invisible);
|
||||
|
||||
lG3toG4 -> SetVisAttributes(G4VisAttributes::Invisible);
|
||||
G4cout << "Top-level G3toG4 logical volume " << lG3toG4->GetName() << " "
|
||||
G4cout << "Top-level G3toG4 logical volume " << lG3toG4->GetName() << " "
|
||||
<< *(lG3toG4 -> GetVisAttributes()) << endl;
|
||||
|
||||
// check the geometry here
|
||||
|
||||
G4int debug=0;
|
||||
G4int debug=0;
|
||||
|
||||
if (debug){
|
||||
G4int level=0;
|
||||
checkLogVol(lG3toG4, level);
|
||||
}
|
||||
|
||||
return lG3toG4;
|
||||
if (debug){
|
||||
G4cout << "scan through G4LogicalVolumeStore:" << endl;
|
||||
checkVol();
|
||||
}
|
||||
return lG3toG4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void checkLogVol(G4LogicalVolume* _lvol, G4int level)
|
||||
void checkVol()
|
||||
{
|
||||
G4LogicalVolume* _ldvol;
|
||||
level++;
|
||||
|
||||
G4int ndau = _lvol -> GetNoDaughters();
|
||||
|
||||
for (int idau=0; idau<ndau; idau++){
|
||||
_ldvol = _lvol-> GetDaughter(idau) -> GetLogicalVolume();
|
||||
|
||||
G4cout << "logical volume " << _lvol->GetName() << " at level " << level
|
||||
<< " contains daughter " << idau+1 << " name: "
|
||||
<< _ldvol -> GetName() << endl;
|
||||
checkLogVol(_ldvol, level);
|
||||
}
|
||||
return;
|
||||
G4LogicalVolumeStore* theStore = G4LogicalVolumeStore::GetInstance();
|
||||
G4LogicalVolume* ll = (*theStore)[0];
|
||||
G4int level=0;
|
||||
checkVol(ll, level);
|
||||
}
|
||||
|
||||
void checkVol(G4LogicalVolume* _lvol, G4int level)
|
||||
{
|
||||
G4LogicalVolume* _ldvol;
|
||||
G4VPhysicalVolume* _pdvol;
|
||||
level++;
|
||||
|
||||
G4int ndau = _lvol -> GetNoDaughters();
|
||||
|
||||
G4cout << "G44LogicalVolume " << _lvol->GetName() << " at level " << level
|
||||
<< " contains " << ndau << " daughters." << endl;
|
||||
for (int idau=0; idau<ndau; idau++){
|
||||
_pdvol = _lvol-> GetDaughter(idau);
|
||||
_ldvol = _pdvol -> GetLogicalVolume();
|
||||
G4cout << "G4VPhysical volume " << setw(5) << _pdvol -> GetName()
|
||||
<< " (G4LogicalVolume " << setw(5) << _ldvol->GetName() << ")"
|
||||
<< endl;
|
||||
checkVol(_ldvol, level);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,23 +5,18 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ggclos.cc,v 2.1 1998/07/13 16:50:30 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4ggclos.cc,v 1.4 1999/05/26 03:49:48 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "G3G4Interface.hh"
|
||||
|
||||
void PG4ggclos()
|
||||
{
|
||||
void PG4ggclos(){
|
||||
G4ggclos();
|
||||
}
|
||||
|
||||
void G4ggclos()
|
||||
{
|
||||
// close out the geometry
|
||||
|
||||
G4cout << "Closing geometry..." << endl;
|
||||
G4bool optimise=false;
|
||||
G4GeometryManager::GetInstance()->CloseGeometry(optimise);
|
||||
G4cout << "Geometry closed." << endl;
|
||||
void G4ggclos(){
|
||||
G4cout << "G4ggclos: setting top-level VolTableEntry" << endl;
|
||||
G3Vol.SetFirstVTE();
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsatt.cc,v 2.1 1998/07/12 02:54:22 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsatt.cc,v 1.3 1999/05/22 06:31:38 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include <rw/cstring.h>
|
||||
#include "G3toG4.hh"
|
||||
@@ -28,7 +28,6 @@ void PG4gsatt(RWCString tokens[])
|
||||
void G4gsatt(G4String name, G4String attr, G4int ival)
|
||||
{
|
||||
// get logical volume pointer
|
||||
G4LogicalVolume *lvol = G3Vol.GetLVx(name);
|
||||
// apply attribute
|
||||
// $$$ lvol->ApplyAttribute(attr, ival);
|
||||
}
|
||||
G4LogicalVolume *lvol = G3Vol.GetVTE(name)->GetLV();
|
||||
G4cerr << "G4gsatt not implemented" << endl;
|
||||
};
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdet.cc,v 2.0 1998/07/02 16:16:30 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdet.cc,v 1.1 1999/01/07 16:06:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G3toG4.hh"
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdeta.cc,v 2.1 1998/07/12 02:54:22 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdeta.cc,v 1.2 1999/05/07 04:16:14 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G3toG4.hh"
|
||||
#include "G3DetTable.hh"
|
||||
@@ -29,7 +29,7 @@ void PG4gsdeta(RWCString tokens[])
|
||||
void G4gsdeta(G4String chset, G4String chdet, G4String,
|
||||
G4int nwhi, G4int nwdi)
|
||||
{
|
||||
G4int idtyp = G3Det.GetID(chset);
|
||||
G4int idtyp = G3Det.GetID(chset, chdet);
|
||||
// just associate another sensitive detector structure with
|
||||
// the volume chdet
|
||||
G4gsdetv(chset, chdet, idtyp, nwhi, nwdi);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdetd.cc,v 2.0 1998/07/02 16:16:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdetd.cc,v 1.2 1999/05/07 04:16:17 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G3toG4.hh"
|
||||
#include "G3DetTable.hh"
|
||||
@@ -29,11 +29,11 @@ void PG4gsdetd(RWCString tokens[])
|
||||
G4gsdetd(chset,chdet,nd,chnmsd,nbitsd);
|
||||
}
|
||||
|
||||
void G4gsdetd(G4String chset, G4String, G4int nd, G4String chnmsd[],
|
||||
void G4gsdetd(G4String chset, G4String chdet, G4int nd, G4String chnmsd[],
|
||||
G4int nbitsd[])
|
||||
{
|
||||
// Get pointer to detector chset
|
||||
G4VSensitiveDetector* sdet = G3Det.get(chset);
|
||||
G4VSensitiveDetector* sdet = G3Det.getSD(chset, chdet);
|
||||
// Add hits to sensitive detector
|
||||
for (G4int i=0; i<nd; i++) {
|
||||
// $$$ sdet->AddDigi(chnmsd[i],nbitsd[i]);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdeth.cc,v 2.0 1998/07/02 16:16:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdeth.cc,v 1.2 1999/05/07 04:16:20 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G3toG4.hh"
|
||||
#include "G3DetTable.hh"
|
||||
@@ -31,11 +31,11 @@ void PG4gsdeth(RWCString tokens[])
|
||||
G4gsdeth(chset,chdet,nh,chnamh,nbitsh,orig,fact);
|
||||
}
|
||||
|
||||
void G4gsdeth(G4String chset, G4String, G4int nh, G4String chnamh[],
|
||||
void G4gsdeth(G4String chset, G4String chdet, G4int nh, G4String chnamh[],
|
||||
G4int nbitsh[], G4double orig[], G4double fact[])
|
||||
{
|
||||
// Get pointer to sensitive detector chset
|
||||
G4VSensitiveDetector* sdet = G3Det.get(chset);
|
||||
G4VSensitiveDetector* sdet = G3Det.getSD(chset, chdet);
|
||||
// Add hits to sensitive detector
|
||||
for (G4int i=0; i<nh; i++) {
|
||||
// $$$ sdet->AddHit(chnamh[i],nbitsh[i],orig[i],fact[i]);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdetu.cc,v 2.0 1998/07/02 16:16:45 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdetu.cc,v 1.1 1999/01/07 16:06:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G3toG4.hh"
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdetv.cc,v 2.2 1998/07/13 16:50:31 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdetv.cc,v 1.3 1999/05/12 08:10:03 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4ios.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3DetTable.hh"
|
||||
#include "G3VolTable.hh"
|
||||
@@ -30,23 +31,24 @@ void PG4gsdetv(RWCString tokens[])
|
||||
}
|
||||
|
||||
void G4gsdetv(G4String chset, G4String chdet, G4int idtyp, G4int,
|
||||
G4int)
|
||||
{
|
||||
G4int){
|
||||
|
||||
G4cout << "G4gsdetv not currently implemented." << endl;
|
||||
/*
|
||||
// get lvol for detector chdet
|
||||
G4LogicalVolume *lvol = G3Vol.GetLVx(chdet);
|
||||
G4LogicalVolume *lvol = G3Vol.GetLV(chdet);
|
||||
if (lvol == NULL) {
|
||||
G4cout << "G4gsdetv: Logical volume " << chdet << " not available. Skip." << endl;
|
||||
return;
|
||||
G4cout << "G4gsdetv: Logical volume " << chdet << " not available. Skip." << endl;
|
||||
return;
|
||||
}
|
||||
G4cout << "G4gsdetv not currently implemented." << endl;
|
||||
|
||||
// Generate a sensitive detector structure
|
||||
// G4VSensitiveDetector *sdet;
|
||||
// G4VSensitiveDetector *sdet;
|
||||
// $$$ G4VSensitiveDetector *sdet = new G4VSensitiveDetector(chset);
|
||||
// inform the logical volume of its sensitive detector
|
||||
// lvol->SetSensitiveDetector(sdet);
|
||||
// lvol->SetSensitiveDetector(sdet);
|
||||
// $$$ sdet->SetID(idtyp);
|
||||
// Add the sensitive detector to the table
|
||||
// G3Det.put(chset,idtyp,sdet);
|
||||
// G3Det.put(chset,idtyp,sdet);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdk.cc,v 2.0 1998/07/02 16:16:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdk.cc,v 1.1 1999/01/07 16:06:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4Decay.hh"
|
||||
#include "G3toG4.hh"
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdvn.cc,v 2.2 1998/07/13 16:50:32 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdvn.cc,v 1.3 1999/05/22 06:31:40 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4PVReplica.hh"
|
||||
@@ -33,6 +34,7 @@ void PG4gsdvn(RWCString tokens[])
|
||||
|
||||
void G4gsdvn(G4String vname, G4String vmoth, G4int ndiv, G4int iaxis)
|
||||
{
|
||||
/*
|
||||
// get the physical volume pointer of the mother from the name
|
||||
G4VPhysicalVolume* mothPV;
|
||||
G4int npv=0;
|
||||
@@ -45,8 +47,8 @@ void G4gsdvn(G4String vname, G4String vmoth, G4int ndiv, G4int iaxis)
|
||||
mothPV = G3Vol.GetPV(ipv);
|
||||
|
||||
// extract the needed parameters from the mother's logical volume
|
||||
G4double rangehi;
|
||||
G4double rangelo;
|
||||
G4double rangehi=0;
|
||||
G4double rangelo=0;
|
||||
EAxis axiscode;
|
||||
G4String shape;
|
||||
G4int nmed;
|
||||
@@ -54,8 +56,7 @@ void G4gsdvn(G4String vname, G4String vmoth, G4int ndiv, G4int iaxis)
|
||||
G4int npar;
|
||||
G4int zeronpar=0;
|
||||
G4VSolid *solid = NULL;
|
||||
G3Vol.GetLVPars(&vmoth, iaxis, &rangehi, &rangelo, &axiscode, &shape,
|
||||
&nmed, &Rpar, &npar, solid);
|
||||
G3Vol.GetLVPars(&vmoth, &shape, &nmed, &Rpar, &npar, solid);
|
||||
// nullify parameter values
|
||||
for (G4int i=0; i<npar; i++) Rpar[i] = 0.;
|
||||
// Generate the logical volume for the subvolumes
|
||||
@@ -67,18 +68,21 @@ void G4gsdvn(G4String vname, G4String vmoth, G4int ndiv, G4int iaxis)
|
||||
G4double *pars = NULL;
|
||||
G4double width = rangehi - rangelo;
|
||||
G4double offset = (rangehi + rangelo)/2.;
|
||||
G4bool negpars = G3NegVolPars(pars,&npar,vname,vmoth,"GSDVN");
|
||||
// G4bool negpars = G3NegVolPars(pars,&npar,vname,vmoth,"GSDVN");
|
||||
G4bool negpars = false;
|
||||
|
||||
if ( ! negpars ) {
|
||||
// Generate replicas
|
||||
G4PVReplica *pvol = new G4PVReplica(
|
||||
vname, lvol, mothPV, axiscode, ndiv, width, offset);
|
||||
G4PVReplica *pvol = new
|
||||
G4PVReplica(vname, lvol, mothPV, axiscode, ndiv, width, offset);
|
||||
G3Vol.PutPV1(&vname, pvol);
|
||||
} else {
|
||||
G4VPVParameterisation *dvnParam = new G3CalcParams(ndiv, width, offset);
|
||||
G4PVParameterised *pvol = new G4PVParameterised(
|
||||
vname, lvol, mothPV, axiscode, ndiv, dvnParam);
|
||||
G4PVParameterised *pvol = new
|
||||
G4PVParameterised(vname, lvol, mothPV, axiscode, ndiv, dvnParam);
|
||||
G3Vol.PutPV1(&vname, pvol);
|
||||
}
|
||||
}
|
||||
*/
|
||||
G4cerr << "G4gsdvn currently not supported." << endl;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdvn2.cc,v 2.2 1998/07/13 16:50:33 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdvn2.cc,v 1.4 1999/05/22 06:31:43 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
@@ -18,70 +19,72 @@
|
||||
#include "G3VolTable.hh"
|
||||
#include "G3CalcParams.hh"
|
||||
|
||||
void PG4gsdvn2(RWCString tokens[])
|
||||
{
|
||||
// fill the parameter containers
|
||||
G3fillParams(tokens,PTgsdvn2);
|
||||
void PG4gsdvn2(RWCString tokens[]) {
|
||||
// fill the parameter containers
|
||||
G3fillParams(tokens, PTgsdvn2);
|
||||
|
||||
// interpret the parameters
|
||||
G4String vname = Spar[0];
|
||||
G4String vmoth = Spar[1];
|
||||
G4int ndiv = Ipar[0];
|
||||
G4int iaxis = Ipar[1];
|
||||
G4int numed = Ipar[2];
|
||||
G4double c0 = Rpar[0];
|
||||
G4String vname = Spar[0];
|
||||
G4String vmoth = Spar[1];
|
||||
G4int ndiv = Ipar[0];
|
||||
G4int iaxis = Ipar[1];
|
||||
G4int numed = Ipar[2];
|
||||
G4double c0 = Rpar[0];
|
||||
|
||||
G4gsdvn2(vname,vmoth,ndiv,iaxis,c0,numed);
|
||||
G4gsdvn2(vname, vmoth, ndiv, iaxis, c0, numed);
|
||||
}
|
||||
|
||||
void G4gsdvn2(G4String vname, G4String vmoth, G4int ndiv, G4int iaxis,
|
||||
G4double c0, G4int numed)
|
||||
{
|
||||
// get the physical volume pointer of the mother from the name
|
||||
G4int npv=0;
|
||||
G4VPhysicalVolume* mothPV;
|
||||
G3Vol.FindPV(&npv, &vmoth);
|
||||
if (npv == 0) {
|
||||
G4cout << " G4gsdvn2 error: No physical volume for " << vmoth << endl;
|
||||
return;
|
||||
}
|
||||
for (G4int ipv=0; ipv<npv; ipv++) {
|
||||
mothPV = G3Vol.GetPV(ipv);
|
||||
|
||||
// extract the needed parameters from the mother's logical volume
|
||||
G4double rangehi;
|
||||
G4double rangelo;
|
||||
EAxis axiscode;
|
||||
G4String shape;
|
||||
G4int nmed;
|
||||
G4double *Rpar = NULL;
|
||||
G4int npar;
|
||||
G4int zeronpar=0;
|
||||
G4VSolid *solid = NULL;
|
||||
G3Vol.GetLVPars(&vmoth, iaxis, &rangehi, &rangelo, &axiscode, &shape,
|
||||
&nmed, &Rpar, &npar, solid);
|
||||
// nullify parameter values
|
||||
for (G4int i=0; i<npar; i++) Rpar[i] = 0.;
|
||||
// Generate the logical volume for the subvolumes
|
||||
G4gsvolu(vname, shape, numed, Rpar, zeronpar);
|
||||
// and obtain the pointer
|
||||
G4LogicalVolume *lvol = G3Vol.GetLVx(vname);
|
||||
// check for negative parameters in volume definition
|
||||
G4double *pars = NULL;
|
||||
G4bool negpars = G3NegVolPars(pars,&npar,vname,vmoth,"GSDVN");
|
||||
G4double width = rangehi - c0;
|
||||
G4double offset = (rangehi + c0)/2.;
|
||||
|
||||
if ( ! negpars ) {
|
||||
// Generate replicas
|
||||
G4PVReplica *pvol = new G4PVReplica(
|
||||
vname, lvol, mothPV, axiscode, ndiv, width, offset);
|
||||
G3Vol.PutPV1(&vname, pvol);
|
||||
} else {
|
||||
G4VPVParameterisation *dvnParam = new G3CalcParams(ndiv, width, offset);
|
||||
G4PVParameterised *pvol = new G4PVParameterised(
|
||||
vname, lvol, mothPV, axiscode, ndiv, dvnParam);
|
||||
G3Vol.PutPV1(&vname, pvol);
|
||||
}
|
||||
G4double c0, G4int numed){
|
||||
/*
|
||||
// get the physical volume pointer of the mother from the name
|
||||
G4int npv=0;
|
||||
G4VPhysicalVolume* mothPV;
|
||||
G3Vol.FindPV(&npv, &vmoth);
|
||||
if (npv == 0) {
|
||||
G4cout << " G4gsdvn2 error: No physical volume for " << vmoth << endl;
|
||||
return;
|
||||
}
|
||||
for (G4int ipv=0; ipv<npv; ipv++) {
|
||||
mothPV = G3Vol.GetPV(ipv);
|
||||
|
||||
// extract the needed parameters from the mother's logical volume
|
||||
G4double rangehi=0;
|
||||
G4double rangelo=0;
|
||||
G4String shape;
|
||||
G4int nmed;
|
||||
G4double *Rpar = NULL;
|
||||
G4int npar;
|
||||
G4int zeronpar=0;
|
||||
G4VSolid *solid = NULL;
|
||||
G3Vol.GetLVPars(&vmoth, &shape, &nmed, &Rpar, &npar, solid);
|
||||
// nullify parameter values
|
||||
for (G4int i=0; i<npar; i++) Rpar[i] = 0.;
|
||||
// Generate the logical volume for the subvolumes
|
||||
G4gsvolu(vname, shape, numed, Rpar, zeronpar);
|
||||
// and obtain the pointer
|
||||
G4LogicalVolume *lvol = G3Vol.GetLVx(vname);
|
||||
// check for negative parameters in volume definition
|
||||
G4double *pars = 0;
|
||||
// G4bool negpars = G3NegVolPars(pars, &npar, vname, vmoth, "GSDVN");
|
||||
G4bool negpars = false;
|
||||
G4double width = rangehi - c0;
|
||||
G4double offset = (rangehi + c0)/2.;
|
||||
|
||||
if (! negpars ) {
|
||||
Generate replicas
|
||||
G4PVReplica *pvol = new
|
||||
G4PVReplica(vname, lvol, mothPV, axiscode, ndiv, width, offset);
|
||||
G3Vol.PutPV1(&vname, pvol);
|
||||
} else {
|
||||
G4VPVParameterisation *dvnParam = new G3CalcParams(ndiv, width, offset);
|
||||
G4PVParameterised *pvol = new
|
||||
G4PVParameterised(vname, lvol, mothPV, axiscode, ndiv, dvnParam);
|
||||
G3Vol.PutPV1(&vname, pvol);
|
||||
}
|
||||
}
|
||||
*/
|
||||
G4cerr << "G4gsdvn2 currently not supported." << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdvt.cc,v 2.2 1998/07/13 16:50:34 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdvt.cc,v 1.3 1999/05/22 06:31:46 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
@@ -35,8 +35,8 @@ void PG4gsdvt(RWCString tokens[])
|
||||
}
|
||||
|
||||
void G4gsdvt(G4String vname, G4String vmoth, G4double Step, G4int iaxis,
|
||||
G4int numed, G4int ndvmx)
|
||||
{
|
||||
G4int numed, G4int ndvmx){
|
||||
/*
|
||||
// get the physical volume pointer of the mother from the name
|
||||
G4int npv=0;
|
||||
G4VPhysicalVolume* mothPV;
|
||||
@@ -77,12 +77,13 @@ void G4gsdvt(G4String vname, G4String vmoth, G4double Step, G4int iaxis,
|
||||
|
||||
// check for negative parameters in volume definition
|
||||
G4double *pars = NULL;
|
||||
G4bool negpars = G3NegVolPars(pars,&npar,vname,vmoth,"GSDVN");
|
||||
// G4bool negpars = G3NegVolPars(pars,&npar,vname,vmoth,"GSDVN");
|
||||
G4bool negpars = 0;
|
||||
G4double width = rangehi - c0;
|
||||
G4double offset = (rangehi + c0)/2.;
|
||||
|
||||
|
||||
if ( ! negpars ) {
|
||||
// Generate replicas
|
||||
// Generate replicas
|
||||
G4PVReplica *pvol = new G4PVReplica(
|
||||
vname, lvol, mothPV, axiscode, ndiv, width, offset);
|
||||
G3Vol.PutPV1(&vname, pvol);
|
||||
@@ -93,4 +94,6 @@ void G4gsdvt(G4String vname, G4String vmoth, G4double Step, G4int iaxis,
|
||||
G3Vol.PutPV1(&vname, pvol);
|
||||
}
|
||||
}
|
||||
*/
|
||||
G4cerr << "G4gsdvt currently not supported" << endl;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdvt2.cc,v 2.2 1998/07/13 16:50:35 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdvt2.cc,v 1.3 1999/05/22 06:31:49 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
@@ -36,8 +37,8 @@ void PG4gsdvt2(RWCString tokens[])
|
||||
}
|
||||
|
||||
void G4gsdvt2(G4String vname, G4String vmoth, G4double Step, G4int iaxis,
|
||||
G4double c0, G4int numed, G4int ndvmx)
|
||||
{
|
||||
G4double c0, G4int numed, G4int ndvmx){
|
||||
/*
|
||||
// get the physical volume pointer of the mother from the name
|
||||
G4int npv=0;
|
||||
G4VPhysicalVolume* mothPV;
|
||||
@@ -74,7 +75,8 @@ void G4gsdvt2(G4String vname, G4String vmoth, G4double Step, G4int iaxis,
|
||||
|
||||
// check for negative parameters in volume definition
|
||||
G4double *pars = NULL;
|
||||
G4bool negpars = G3NegVolPars(pars,&npar,vname,vmoth,"GSDVN");
|
||||
// G4bool negpars = G3NegVolPars(pars,&npar,vname,vmoth,"GSDVN");
|
||||
G4bool negpars = false;
|
||||
G4double width = rangehi - c0;
|
||||
G4double offset = (rangehi + c0)/2.;
|
||||
|
||||
@@ -90,4 +92,7 @@ void G4gsdvt2(G4String vname, G4String vmoth, G4double Step, G4int iaxis,
|
||||
G3Vol.PutPV1(&vname, pvol);
|
||||
}
|
||||
}
|
||||
*/
|
||||
G4cerr << "G4gsdvt2 currently not supported." << endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsdvx.cc,v 2.1 1998/07/12 02:54:25 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsdvx.cc,v 1.1 1999/01/07 16:06:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G3toG4.hh"
|
||||
|
||||
@@ -5,74 +5,93 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsmate.cc,v 2.2 1998/07/13 16:50:36 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsmate.cc,v 1.2 1999/05/06 04:25:48 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
// History:
|
||||
// 25-Feb-1997 Lockman - removed isMixture when calling G4Material constr.
|
||||
// to conform with P. Maire's new interface 29-Jan-1997
|
||||
// - added units to density, atomic weight
|
||||
// - added check for Vacuum
|
||||
// 14-Jun-1998 Lockman - all states initialized to kStateUndefined;
|
||||
// logic to handle G4 vacuum state modified.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include <math.h>
|
||||
#include "G3toG4.hh"
|
||||
#include "G3MatTable.hh"
|
||||
#include "G4Isotope.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G3MatTable.hh"
|
||||
|
||||
//extern int debugOn;
|
||||
|
||||
void PG4gsmate(RWCString tokens[])
|
||||
{
|
||||
// fill the parameter containers
|
||||
G3fillParams(tokens,PTgsmate);
|
||||
G4String name = Spar[0];
|
||||
G4int imate = Ipar[0];
|
||||
G4int nwbf = Ipar[1];
|
||||
G4double a = Rpar[0];
|
||||
G4double z = Rpar[1];
|
||||
G4double dens = Rpar[2];
|
||||
G4double radl = Rpar[3];
|
||||
G4double absl = Rpar[4];
|
||||
G4double *ubuf = &Rpar[5];
|
||||
// fill the parameter containers
|
||||
G3fillParams(tokens,PTgsmate);
|
||||
G4String name = Spar[0];
|
||||
G4int imate = Ipar[0];
|
||||
G4int nwbf = Ipar[1];
|
||||
G4double a = Rpar[0];
|
||||
G4double z = Rpar[1];
|
||||
G4double dens = Rpar[2];
|
||||
G4double radl = Rpar[3];
|
||||
G4double absl = Rpar[4];
|
||||
G4double *ubuf = &Rpar[5];
|
||||
|
||||
G4gsmate(imate,name,a,z,dens,radl,nwbf,ubuf);
|
||||
G4gsmate(imate, name, a, z, dens, radl, nwbf, ubuf);
|
||||
}
|
||||
|
||||
void G4gsmate(G4int imate, G4String name, G4double ain, G4double zin,
|
||||
G4double densin, G4double radl, G4int nwbf, G4double* ubuf)
|
||||
{
|
||||
|
||||
// set default arguments
|
||||
// set default arguments
|
||||
|
||||
G4double zdef = 1.;
|
||||
G4double adefval = 2.;
|
||||
G4double adef = adefval*g/mole;
|
||||
G4double G3_minimum_density = 1.e-10*g/cm3;
|
||||
G4double a = ain*g/mole;
|
||||
G4double z = zin;
|
||||
G4double dens = densin*g/cm3;
|
||||
|
||||
if (dens < G3_minimum_density) {
|
||||
dens=G3_minimum_density;
|
||||
G4cerr << "G3 vacuum state encountered for material " << name
|
||||
<< ". Set dens = " << dens*cm3/g << " g/cm3" << endl;
|
||||
G4double zdef = 1.;
|
||||
G4double adef = 1.01*g/mole;
|
||||
G4double G3_minimum_density = 1.e-10*g/cm3;
|
||||
G4double theA = ain*g/mole;
|
||||
G4double theZ = zin;
|
||||
G4double theDensity = densin*g/cm3;
|
||||
|
||||
G4Material* mte = 0;
|
||||
G4State theState = kStateUndefined;
|
||||
G4double thePressure = STP_Pressure;
|
||||
G4double theTemperature = STP_Temperature;
|
||||
G4String sname = name.strip(RWCString::both);
|
||||
G4String symbol;
|
||||
|
||||
if (sname == "AIR") {
|
||||
|
||||
// handle the built in AIR mixture
|
||||
G4double a[2], z[2], wmat[2];
|
||||
a[0] = 14.01*g/mole;
|
||||
a[1] = 16.00*g/mole;
|
||||
z[0] = 7;
|
||||
z[1] = 8;
|
||||
wmat[0] = 0.7;
|
||||
wmat[1] = 0.3;
|
||||
theDensity = 1.2931*mg/cm3;
|
||||
int n=2;
|
||||
G4gsmixt(imate, sname, a, z, theDensity, n, wmat);
|
||||
} else {
|
||||
if (theDensity < G3_minimum_density) {
|
||||
|
||||
// handle the built in VACUUM
|
||||
theDensity = universe_mean_density;
|
||||
theState = kStateGas;
|
||||
theZ = zdef;
|
||||
theA = adef;
|
||||
thePressure = 3.e-18*pascal;
|
||||
theTemperature = 2.73*kelvin;
|
||||
|
||||
G4cout << "G3 vacuum "
|
||||
<< sname << " (Z " << zin << ", A " << ain << " g/mole, density "
|
||||
<< densin << " g/cm3)" << endl
|
||||
<< "Creating G4 vacuum "
|
||||
<< "(Z " << theZ << ", A " << theA*mole/g << ", g/mole, "
|
||||
<< " density " << theDensity*cm3/g << " g/cm3, "
|
||||
<< " pressure " << thePressure/pascal
|
||||
<< " pascal, temp " << theTemperature/kelvin
|
||||
<< " kelvins)" << endl;
|
||||
}
|
||||
if (z<1) {
|
||||
z=zdef;
|
||||
a=adef;
|
||||
G4cerr << "Z<1 (" << z << ") for material " << name
|
||||
<< ". Set Z = " << z << " A = " << adefval << " g/mole" << endl;
|
||||
}
|
||||
G4Material* mte = new G4Material(name, z, a, dens);
|
||||
|
||||
// add the material to the List
|
||||
G3Mat.put(&imate,mte);
|
||||
G4Material* mte = new
|
||||
G4Material(sname, theZ, theA, theDensity, theState, theTemperature,
|
||||
thePressure);
|
||||
G3Mat.put(imate, mte);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,22 +5,16 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsmixt.cc,v 2.3 1998/11/07 04:12:12 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsmixt.cc,v 1.4 1999/05/18 02:40:46 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
// History:
|
||||
// 25-Feb-1997 Lockman - added units to density, atomic weight
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include <strstream.h>
|
||||
#include <iomanip.h>
|
||||
#include <math.h>
|
||||
#include "globals.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3EleTable.hh"
|
||||
#include "G3MatTable.hh"
|
||||
#include "G4Isotope.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4Material.hh"
|
||||
|
||||
void PG4gsmixt(RWCString tokens[])
|
||||
@@ -33,59 +27,62 @@ void PG4gsmixt(RWCString tokens[])
|
||||
G4int imate = Ipar[0];
|
||||
G4int nlmat = Ipar[1];
|
||||
G4double dens = Rpar[0]*g/cm3;
|
||||
for (int i=0; i<abs(nlmat); i++){
|
||||
Rpar[i]=Rpar[i]*g/mole;
|
||||
};
|
||||
G4double *a = &Rpar[1];
|
||||
G4double *z = &Rpar[1+abs(nlmat)];
|
||||
G4double *wmat = &Rpar[1+2*abs(nlmat)];
|
||||
G4double *a = Rpar + 1;
|
||||
G4double *z = Rpar + 1+abs(nlmat);
|
||||
G4double *wmat = Rpar + 1 + 2*abs(nlmat);
|
||||
|
||||
for (int i=0; i<abs(nlmat); i++){
|
||||
Rpar[i]=Rpar[i]*g/mole;
|
||||
};
|
||||
G4gsmixt(imate,name,a,z,dens,nlmat,wmat);
|
||||
}
|
||||
|
||||
void G4gsmixt(G4int imate, G4String name, G4double a[], G4double z[],
|
||||
G4double dens, G4int nlmat, G4double wmat[])
|
||||
{
|
||||
// Build material components as 'elements'
|
||||
char indx[5], symbol[20];
|
||||
G4Element* el;
|
||||
G4String elName, elSymbol;
|
||||
G4bool isMixture = true;
|
||||
G4Material* gmate = new G4Material(name, dens, nlmat);
|
||||
G4double dens, G4int nlmat, G4double wmat[]){
|
||||
G4int nmate = abs(nlmat);
|
||||
G4String sname = name.strip(RWCString::both);
|
||||
G4double theDensity = dens*g/cm3;
|
||||
|
||||
G4double wt=0., zeff=0., aeff=0., frac;
|
||||
|
||||
// for case of proportions given in atom counts (nlmat<0),
|
||||
// convert to weight fractions
|
||||
|
||||
ostrstream ostr_indx(indx, sizeof indx);
|
||||
ostrstream ostr_symb(symbol, sizeof symbol);
|
||||
|
||||
for (G4int i=0; i<abs(nlmat); i++) {
|
||||
// printf(indx,"%d\n",i);
|
||||
// printf(symbol,"Z%dA%d\n",int(z[i]),int(a[i]));
|
||||
ostr_indx << setw(3) << i;
|
||||
ostr_symb << setw(3) << int(z[i]) << " " << setw(3) << int(a[i]);
|
||||
elName = "Material "+name+" component "+indx;
|
||||
elSymbol = symbol;
|
||||
G4cout << "elName: " << elName << endl;
|
||||
G4cout << "elSymbol: " << elSymbol << endl;
|
||||
|
||||
//
|
||||
// mod 25-Feb-1997 Lockman, removed isMixture to match
|
||||
// G4Element interface
|
||||
//
|
||||
|
||||
// el = new G4Element(elName, elSymbol, z[i], a[i], isMixture);
|
||||
el = new G4Element(elName, elSymbol, z[i], a[i]);
|
||||
if ( nlmat < 0 ) {
|
||||
gmate->AddElement(el, int(wmat[i]));
|
||||
G4Material* theMixture = new G4Material(name, dens, nmate);
|
||||
G4bool ok=true;
|
||||
for (int i=0; i< nmate; i++){
|
||||
G4Element* theElement = G3Ele.GetEle(z[i]);
|
||||
if (nlmat>0) {
|
||||
G4double fractionmass = wmat[i];
|
||||
ok = ok && abs(fractionmass)<=1.;
|
||||
theMixture->AddElement(theElement, fractionmass);
|
||||
} else if (nlmat<0) {
|
||||
G4int natoms = wmat[i];
|
||||
ok = ok && wmat[i] == natoms;
|
||||
theMixture->AddElement(theElement, natoms);
|
||||
} else {
|
||||
gmate->AddElement(el, wmat[i]);
|
||||
ok=false;
|
||||
}
|
||||
}
|
||||
if (ok) {
|
||||
G3Mat.put(imate, theMixture);
|
||||
} else {
|
||||
if (nlmat>0) {
|
||||
G4cerr << "G4gsmixt: for mixture '" << name
|
||||
<< "' some |weights|>1 : " << endl;
|
||||
for (G4int i=0;i<nlmat; i++) {
|
||||
G4cerr << "Component " << setw(3) << i+1 << " fraction: "
|
||||
<< setw(10) << wmat[i] << endl;
|
||||
}
|
||||
} else if (nlmat<0) {
|
||||
G4cerr << "G4gsmixt: for mixture '" << name
|
||||
<< "' some #natoms are non-integer: " << endl;
|
||||
for (G4int i=0;i<nlmat; i++) {
|
||||
G4cerr << "Component " << setw(3) << i+1 << " #atoms "
|
||||
<< setw(10) << wmat[i] << endl;
|
||||
}
|
||||
} else {
|
||||
G4cerr << "G4gsmixt: Number of components for mixture '"
|
||||
<< name << "' (" << nlmat << ") not allowed." << endl;
|
||||
}
|
||||
}
|
||||
// add the material to the List
|
||||
G3Mat.put(&imate,gmate);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gspart.cc,v 2.0 1998/07/02 16:17:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gspart.cc,v 1.1 1999/01/07 16:06:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G3toG4.hh"
|
||||
|
||||
@@ -5,18 +5,15 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gspos.cc,v 2.2 1998/09/18 08:56:14 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gspos.cc,v 1.9 1999/05/28 23:03:43 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "G3RotTable.hh"
|
||||
|
||||
G4bool G3IsMany(G4String);
|
||||
#include "VolTableEntry.hh"
|
||||
#include "G3Pos.hh"
|
||||
|
||||
void PG4gspos(RWCString tokens[])
|
||||
{
|
||||
@@ -29,47 +26,52 @@ void PG4gspos(RWCString tokens[])
|
||||
G4String only = Spar[2];
|
||||
G4int num = Ipar[0];
|
||||
G4int irot = Ipar[1];
|
||||
G4double x = Rpar[0];
|
||||
G4double y = Rpar[1];
|
||||
G4double z = Rpar[2];
|
||||
G4double x = Rpar[0]*cm;
|
||||
G4double y = Rpar[1]*cm;
|
||||
G4double z = Rpar[2]*cm;
|
||||
|
||||
G4gspos(name, num, moth, x, y, z, irot, only);
|
||||
}
|
||||
|
||||
void G4gspos(G4String vname, G4int num, G4String vmoth, G4double x,
|
||||
G4double y, G4double z, G4int irot, G4String vonly)
|
||||
{
|
||||
// get the logical volume pointer from the name
|
||||
G4LogicalVolume *lvol = G3Vol.GetLVx(vname);
|
||||
|
||||
// get the rotation matrix pointer from the G3 IROT index
|
||||
G4RotationMatrix *rotm;
|
||||
if (irot>0) {
|
||||
rotm = G3Rot.get(irot);
|
||||
} else {
|
||||
rotm = NULL;
|
||||
}
|
||||
|
||||
// translation offset
|
||||
// G4ThreeVector *offset = new G4ThreeVector(x, y, z);
|
||||
G4ThreeVector *offset = new G4ThreeVector(x*cm, y*cm, z*cm);
|
||||
//added the conversion from cm to mm to offset, A.Mokhtarani 1-30-97
|
||||
void G4gspos(G4String& vname, G4int num, G4String& vmoth,
|
||||
G4double x, G4double y, G4double z, G4int irot,
|
||||
G4String& vonly){
|
||||
|
||||
// determine ONLY/MANY status
|
||||
G4bool isMany = G3IsMany(vonly);
|
||||
|
||||
// check for negative parameters in volume definition
|
||||
G4double *pars = NULL;
|
||||
G4int npar;
|
||||
G4bool negpars = G3NegVolPars(pars,&npar,vname,vmoth,"GSPOS");
|
||||
|
||||
// get the logical volume pointer of the mother from the name
|
||||
G4LogicalVolume *mothLV = G3Vol.GetLVx(vmoth);
|
||||
G4PVPlacement* pvol = new G4PVPlacement(rotm, *offset, lvol, vname,
|
||||
mothLV, isMany, num);
|
||||
VolTableEntry* _VTE = G3Vol.GetVTE(vname);
|
||||
VolTableEntry* MVTE = G3Vol.GetVTE(vmoth);
|
||||
|
||||
// add it to the List
|
||||
G3Vol.PutPV(&vname, pvol);
|
||||
delete offset;
|
||||
if (_VTE == 0) {
|
||||
G4cerr << "G4gspos: '" << vname << "' has no VolTableEntry" << endl;
|
||||
} else if (MVTE == 0) {
|
||||
G4cerr << "G4gspos: '" << vname << "' mother volume '" << vmoth
|
||||
<< "' has no VolTableEntry" << endl;
|
||||
} else {
|
||||
|
||||
// translation offset
|
||||
G4ThreeVector* offset = new G4ThreeVector(x, y, z);
|
||||
|
||||
// create a G3Pos object and add it to the G3VolTable
|
||||
|
||||
G3Pos* aG3Pos = new G3Pos(vname, num, offset, irot, vonly);
|
||||
_VTE->AddG3Pos(aG3Pos);
|
||||
|
||||
// add the VolTableEntry as a daughter to its mother if not there already
|
||||
MVTE->AddDaughter(_VTE);
|
||||
|
||||
// add the mother to the VTE
|
||||
_VTE->AddMother(MVTE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,82 +5,64 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsposp.cc,v 2.3 1998/09/18 08:56:23 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsposp.cc,v 1.9 1999/05/26 03:50:05 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "G3toG4.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "G3RotTable.hh"
|
||||
#include "G4makevol.hh"
|
||||
|
||||
G4bool G3IsMany(G4String);
|
||||
G4LogicalVolume* G4makevol(G4String vname, G4String shape, G4int nmed,
|
||||
G4double Rpar[], G4int npar);
|
||||
|
||||
void PG4gsposp(RWCString tokens[])
|
||||
{
|
||||
// fill the parameter containers
|
||||
G3fillParams(tokens,PTgsposp);
|
||||
void PG4gsposp(RWCString tokens[]){
|
||||
// fill the parameter containers
|
||||
G3fillParams(tokens,PTgsposp);
|
||||
|
||||
// interpret the parameters
|
||||
G4String name = Spar[0];
|
||||
G4String moth = Spar[1];
|
||||
G4String only = Spar[2];
|
||||
G4int num = Ipar[0];
|
||||
G4int irot = Ipar[1];
|
||||
G4int npar = Ipar[2];
|
||||
G4double x = Rpar[0];
|
||||
G4double y = Rpar[1];
|
||||
G4double z = Rpar[2];
|
||||
G4double *pars = &Rpar[3];
|
||||
G4String name = Spar[0];
|
||||
G4String moth = Spar[1];
|
||||
G4String only = Spar[2];
|
||||
G4int num = Ipar[0];
|
||||
G4int irot = Ipar[1];
|
||||
G4int npar = Ipar[2];
|
||||
G4double x = Rpar[0]*cm;
|
||||
G4double y = Rpar[1]*cm;
|
||||
G4double z = Rpar[2]*cm;
|
||||
G4double *pars = &Rpar[3];
|
||||
|
||||
G4gsposp(name, num, moth, x, y, z, irot, only, pars, npar);
|
||||
G4gsposp(name, num, moth, x, y, z, irot, only, pars, npar);
|
||||
}
|
||||
|
||||
void G4gsposp(G4String vname, G4int num, G4String vmoth, G4double x,
|
||||
G4double y, G4double z, G4int irot, G4String vonly,
|
||||
G4double pars[], G4int npar)
|
||||
{
|
||||
G4bool _debug=false;
|
||||
|
||||
// get the rotation matrix pointer from the G3 IROT index
|
||||
G4RotationMatrix* rotm = G3Rot.get(irot);
|
||||
void G4gsposp(G4String& vname, G4int num, G4String& vmoth,
|
||||
G4double x, G4double y, G4double z, G4int irot,
|
||||
G4String& vonly, G4double* pars, G4int npar){
|
||||
|
||||
// translation offset
|
||||
G4ThreeVector* offset = new G4ThreeVector(x, y, z);
|
||||
|
||||
// determine ONLY/MANY status
|
||||
G4bool isMany = G3IsMany(vonly);
|
||||
|
||||
// check for negative parameters in volume definition.
|
||||
// pars is updated if negative params are found.
|
||||
G4bool negpars = G3NegVolPars(pars,&npar,vname,vmoth,"GSPOS");
|
||||
// VTable entry
|
||||
VolTableEntry* VTE = G3Vol.GetVTE(vname);
|
||||
|
||||
// get the logical volume pointer of the mother from the name
|
||||
G4LogicalVolume *mothLV = G3Vol.GetLVx(vmoth);
|
||||
|
||||
// create a logical volume and add it to the constituent List of the
|
||||
// G3 logical volume
|
||||
G4String shape;
|
||||
G4int nmed;
|
||||
G3Vol.GetLVInfo(&vname, &shape, &nmed);
|
||||
if (_debug) {
|
||||
G4cout << "gsposp: creating lvol " << vname << " shape " << shape << " nmed " <<
|
||||
nmed << " moth " << vmoth << " mothLV " << mothLV << " pars ";
|
||||
for (int i=0; i<npar; i++) G4cout << pars[i] << " ";
|
||||
G4cout << endl;
|
||||
}
|
||||
G4LogicalVolume* lvol = G4makevol(vname, shape, nmed, pars, npar);
|
||||
// add the logical volume to the constituent List
|
||||
G3Vol.AddConstituentLVol(&vname, lvol);
|
||||
|
||||
G4VPhysicalVolume* pvol = new G4PVPlacement(rotm, *offset, lvol, vname,
|
||||
mothLV, isMany, num);
|
||||
if (VTE != 0) {
|
||||
// get some parameters from the current entry
|
||||
G4String Shape = VTE->GetShape();
|
||||
G4int Nmed = VTE->GetNmed();
|
||||
|
||||
// add it to the List
|
||||
G3Vol.PutPV(&vname, pvol);
|
||||
delete offset;
|
||||
// get pointer to key for current entry
|
||||
G4String* Key = G3Vol.GetVTD()->find(&vname);
|
||||
|
||||
// remove the current entry from the dictionary
|
||||
G3Vol.GetVTD()->remove(Key);
|
||||
|
||||
// insert a new entry
|
||||
G4makevol(vname, Shape, Nmed, pars, npar);
|
||||
|
||||
G4gspos(vname, num, vmoth, x, y, z, irot, vonly);
|
||||
|
||||
} else {
|
||||
G4cerr << "G4gsposp: no G3VolTable entry for logical volume '"
|
||||
<< vname << "'" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsrotm.cc,v 2.4 1998/11/07 04:12:16 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsrotm.cc,v 1.4 1999/05/26 03:50:18 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G3toG4.hh"
|
||||
@@ -20,12 +20,14 @@ void PG4gsrotm(RWCString tokens[])
|
||||
|
||||
// interpret the parameters
|
||||
G4int irot = Ipar[0];
|
||||
|
||||
// the angles in Geant are in degrees
|
||||
G4double theta1 = Rpar[0];
|
||||
G4double phi1 = Rpar[1];
|
||||
G4double phi1 = Rpar[1];
|
||||
G4double theta2 = Rpar[2];
|
||||
G4double phi2 = Rpar[3];
|
||||
G4double phi2 = Rpar[3];
|
||||
G4double theta3 = Rpar[4];
|
||||
G4double phi3 = Rpar[5];
|
||||
G4double phi3 = Rpar[5];
|
||||
|
||||
G4gsrotm(irot, theta1,phi1, theta2,phi2, theta3,phi3);
|
||||
}
|
||||
@@ -65,11 +67,11 @@ void G4gsrotm(G4int irot, G4double theta1, G4double phi1,
|
||||
|
||||
G3toG4RotationMatrix* rotp = new G3toG4RotationMatrix;
|
||||
|
||||
rotp->SetRotationMatrixByRow(x,y,z);
|
||||
rotp->SetRotationMatrixByRow(x, y, z);
|
||||
|
||||
// add it to the List
|
||||
|
||||
G3Rot.put(&irot, rotp);
|
||||
G3Rot.Put(irot, rotp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gstmed.cc,v 2.2 1998/09/18 08:56:41 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gstmed.cc,v 1.2 1999/05/06 04:27:09 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G3toG4.hh"
|
||||
@@ -44,14 +44,6 @@ void G4gstmed(G4int itmed, G4String, G4int nmat, G4int isvol,
|
||||
{
|
||||
// get the pointer to material nmat
|
||||
G4Material* material = G3Mat.get(nmat);
|
||||
// NB. there is the possibility for redundancy in the mag field
|
||||
// and user limits objects. Who cares.
|
||||
// Generate the mag field object
|
||||
G4MagneticField *field = NULL;
|
||||
// $$$ G4MagneticField* field = new G4MagneticField(ifield, fieldm, tmaxfd);
|
||||
// Generate the user limits object
|
||||
G4UserLimits *limits = NULL;
|
||||
// $$$ G4UserLimits* limits = new G4UserLimits(stmin, stemax);
|
||||
// Store this medium in the G3Med structure
|
||||
G3Med.put(itmed,material,field,limits,isvol,deemax,epsil);
|
||||
G3Med.put(itmed,material);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gstpar.cc,v 2.0 1998/07/02 16:17:21 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gstpar.cc,v 1.2 1999/05/12 08:10:15 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G3toG4.hh"
|
||||
#include "G3VolTable.hh"
|
||||
@@ -28,9 +28,12 @@ void G4gstpar(G4int itmed, G4String chpar, G4double parval)
|
||||
{
|
||||
// set special tracking medium parameter. Apply to all logical
|
||||
// volumes making use of the specified tracking medium.
|
||||
G4cerr << "G4gstpar: not implemented." << endl;
|
||||
/*
|
||||
G3Vol.MatchTmed(itmed);
|
||||
G4LogicalVolume *lvol;
|
||||
while (lvol = G3Vol.NextTmed()) {
|
||||
// $$$ apply tracking parameter
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -5,21 +5,20 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4gsvolu.cc,v 2.3 1998/09/18 08:56:49 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4gsvolu.cc,v 1.4 1999/05/22 06:31:58 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4ios.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "G3MedTable.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4makevol.hh"
|
||||
|
||||
G4LogicalVolume* G4makevol(G4String vname, G4String shape, G4int nmed,
|
||||
G4double Rpar[], G4int npar);
|
||||
G4bool G3CalcParamsFn(G4double *Rpar, G4int npar, G4double *Rparm,
|
||||
G4String shape, G4String shapem);
|
||||
|
||||
void PG4gsvolu(RWCString tokens[])
|
||||
{
|
||||
void PG4gsvolu(RWCString tokens[]) {
|
||||
// fill the parameter containers
|
||||
G3fillParams(tokens,PTgsvolu);
|
||||
|
||||
@@ -39,8 +38,7 @@ void G4gsvolu(G4String vname, G4String shape, G4int nmed, G4double* Rpar,
|
||||
G4double rangehi[3];
|
||||
G4double rangelo[3];
|
||||
G4bool isIndexed = npar == 0;
|
||||
G4LogicalVolume *lvol = NULL;
|
||||
EAxis axis;
|
||||
G4LogicalVolume *lvol = 0;
|
||||
G4int nmax = 11;
|
||||
|
||||
if (npar>11) nmax = npar;
|
||||
@@ -51,13 +49,13 @@ void G4gsvolu(G4String vname, G4String shape, G4int nmed, G4double* Rpar,
|
||||
|
||||
// If volume is indexed (npar=0, gsposp used, or negative length parameters)
|
||||
// cannot Build a G4LogicalVolume now.
|
||||
// Build a G3Vol table entry, with NULL pointer, and defer LV creation
|
||||
// Build a G3Vol table entry, with 0 pointer, and defer LV creation
|
||||
// to the gsposp call.
|
||||
if ( npar == 0 ) {
|
||||
isIndexed = true;
|
||||
} else {
|
||||
// Negative length parameters?
|
||||
if (G3CalcParamsFn(param, npar, NULL, shape, shape)) {
|
||||
if (G3CalcParamsFn(param, npar, 0, shape, shape)) {
|
||||
isIndexed = true;
|
||||
G4cout << "G4gsvolu: Volume " << vname << " type " << shape <<
|
||||
" is indexed via negative parameters" << endl;
|
||||
@@ -67,14 +65,12 @@ void G4gsvolu(G4String vname, G4String shape, G4int nmed, G4double* Rpar,
|
||||
}
|
||||
}
|
||||
if ( isIndexed ) {
|
||||
G4VSolid *solid = NULL;
|
||||
axis = kXAxis;
|
||||
G3Vol.PutLV(&vname,lvol,nmed,rangehi,rangelo,axis,shape,param,npar,
|
||||
solid);
|
||||
// return;
|
||||
G4VSolid *solid = 0;
|
||||
G4cerr << "G4gsvolu: indexed volumes not implemented" << endl;
|
||||
// G3Vol.PutLV(&vname, lvol, nmed, shape, param, npar, solid);
|
||||
} else {
|
||||
// Else proceed with volume creation.
|
||||
lvol = G4makevol(vname, shape, nmed, param, npar);
|
||||
G4makevol(vname, shape, nmed, param, npar);
|
||||
}
|
||||
delete [] param;
|
||||
}
|
||||
|
||||
+57
-378
@@ -5,407 +5,86 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4makevol.cc,v 2.4 1998/11/17 17:47:44 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4makevol.cc,v 1.15 1999/05/28 02:19:38 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4MagneticField.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Trap.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Sphere.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4makevol.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "G3MedTable.hh"
|
||||
#include "G4BREPSolidPCone.hh"
|
||||
#include "G4BREPSolidPolyhedra.hh"
|
||||
#include "G4Para.hh"
|
||||
#include "G3toG4MakeSolid.hh"
|
||||
|
||||
void G4makevol(G4String& vname, G4String& shape, G4int nmed,
|
||||
G4double* Rpar, G4int npar){
|
||||
G4bool OKAxis[3];
|
||||
G4bool NegVolPars;
|
||||
G4bool Deferred;
|
||||
G4VSolid* solid = G3toG4MakeSolid(vname, shape, Rpar, npar, NegVolPars,
|
||||
Deferred, OKAxis);
|
||||
|
||||
G4double G3Bound(const G4String& s, const G4double& low,
|
||||
const G4double& high, G4double val)
|
||||
{
|
||||
if (val<low){
|
||||
G4cout << "Warning (" << s << ") " << val << " reset to " << low << endl;
|
||||
val=low;
|
||||
}
|
||||
if (val>high){
|
||||
G4cout << "Warning (" << s << ") " << val << " reset to " << high << endl;
|
||||
val=high;
|
||||
}
|
||||
return val;
|
||||
// get the material corresponding to the tracking medium
|
||||
|
||||
G4Material* material=0;
|
||||
if (nmed>0) {
|
||||
material = G3Med.get(nmed);
|
||||
} else {
|
||||
G4cerr << "No material found for tracking medium index " << nmed << endl;
|
||||
assert(material != 0);
|
||||
}
|
||||
|
||||
if (G3Vol.GetVTE(vname) == 0) {
|
||||
// external store is needed to handle deferred LV creation
|
||||
VolTableEntry* VTE =
|
||||
new VolTableEntry(vname, shape, Rpar, npar, nmed, material, solid,
|
||||
Deferred, NegVolPars, OKAxis);
|
||||
G3Vol.PutVTE(VTE);
|
||||
}
|
||||
// G4cout << "Listing VTD" << endl;
|
||||
// G3Vol.ListVTE();
|
||||
}
|
||||
|
||||
|
||||
G4LogicalVolume* G4makevol(G4String vname, G4String shape, G4int nmed,
|
||||
G4double Rpar[], G4int npar)
|
||||
{
|
||||
// G4cout << "shape " << shape << " name " << vname << " nmed " << nmed
|
||||
// << " npar " << npar << " parameters: ";
|
||||
// {
|
||||
// for (G4int i=0; i<npar; i++){
|
||||
// G4cout << Rpar[i] << " ";
|
||||
// }
|
||||
// G4cout << endl;
|
||||
// }
|
||||
|
||||
G4double rangehi[3];
|
||||
G4double rangelo[3];
|
||||
EAxis axis = kXAxis;
|
||||
|
||||
// Create the solid
|
||||
G4VSolid *solid = NULL;
|
||||
|
||||
if ( shape == "BOX" ) {
|
||||
G4double pX = Rpar[0] = Rpar[0]*cm;
|
||||
G4double pY = Rpar[1] = Rpar[1]*cm;
|
||||
G4double pZ = Rpar[2] = Rpar[2]*cm;
|
||||
solid = new G4Box(vname, pX, pY, pZ);
|
||||
|
||||
for (G4int i=0; i<3; i++) {
|
||||
rangehi[i] = Rpar[i];
|
||||
rangelo[i] = -Rpar[i];
|
||||
}
|
||||
}
|
||||
if ( shape == "TRD1" ) {
|
||||
G4double pdx1 = Rpar[0] = Rpar[0]*cm;
|
||||
G4double pdx2 = Rpar[1] = Rpar[1]*cm;
|
||||
G4double pdy1 = Rpar[2] = Rpar[2]*cm;
|
||||
G4double pdy2 = pdy1;
|
||||
G4double pdz = Rpar[3] = Rpar[3]*cm;
|
||||
solid = new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz);
|
||||
|
||||
rangehi[0] = max(pdx1, pdx2);
|
||||
rangelo[0] = -rangehi[0];
|
||||
rangehi[1] = pdy1;
|
||||
rangelo[1] = -rangehi[1];
|
||||
rangehi[2] = pdz;
|
||||
rangelo[2] = -rangehi[2];
|
||||
}
|
||||
if ( shape == "TRD2" ) {
|
||||
G4double pdx1 = Rpar[0] = Rpar[0]*cm;
|
||||
G4double pdx2 = Rpar[1] = Rpar[1]*cm;
|
||||
G4double pdy1 = Rpar[2] = Rpar[2]*cm;
|
||||
G4double pdy2 = Rpar[3] = Rpar[3]*cm;
|
||||
G4double pdz = Rpar[4] = Rpar[4]*cm;
|
||||
solid = new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz);
|
||||
|
||||
rangehi[0] = max(pdx1, pdx2);
|
||||
rangelo[0] = -rangehi[0];
|
||||
rangehi[1] = max(pdy1, pdy2);
|
||||
rangelo[1] = -rangehi[1];
|
||||
rangehi[2] = pdz;
|
||||
rangelo[2] = -rangehi[2];
|
||||
}
|
||||
if ( shape == "TRAP" ) {
|
||||
G4double pDz = Rpar[0] = Rpar[0]*cm;
|
||||
G4double pTheta = Rpar[1] = Rpar[1]*deg;
|
||||
G4double pPhi = Rpar[2] = Rpar[2]*deg;
|
||||
G4double pDy1 = Rpar[3] = Rpar[3]*cm;
|
||||
G4double pDx1 = Rpar[4] = Rpar[4]*cm;
|
||||
G4double pDx2 = Rpar[5] = Rpar[5]*cm;
|
||||
G4double pAlp1 = Rpar[6] = Rpar[6]*deg;
|
||||
G4double pDy2 = Rpar[7] = Rpar[7]*cm;
|
||||
G4double pDx3 = Rpar[8] = Rpar[8]*cm;
|
||||
G4double pDx4 = Rpar[9] = Rpar[9]*cm;
|
||||
G4double pAlp2 = Rpar[10]= Rpar[10]*deg;
|
||||
solid = new G4Trap(vname, pDz, pTheta, pPhi, pDy1, pDx1, pDx2, pAlp1,
|
||||
pDy2, pDx3, pDx4, pAlp2);
|
||||
|
||||
// only legal division is along z
|
||||
rangehi[0] = 0.;
|
||||
rangelo[0] = -rangehi[0];
|
||||
rangehi[1] = 0.;
|
||||
rangelo[1] = -rangehi[1];
|
||||
rangehi[2] = pDz;
|
||||
rangelo[2] = -rangehi[2];
|
||||
}
|
||||
if ( shape == "TUBE" ) {
|
||||
G4double pRMin = Rpar[0] = Rpar[0]*cm;
|
||||
G4double pRMax = Rpar[1] = Rpar[1]*cm;
|
||||
G4double pDz = Rpar[2] = Rpar[2]*cm;
|
||||
G4double pSPhi = 0.*deg;
|
||||
G4double pDPhi = 360.*deg;
|
||||
solid = new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi);
|
||||
rangehi[0] = pRMax;
|
||||
rangelo[0] = pRMin;
|
||||
rangehi[1] = pSPhi + pDPhi;
|
||||
rangelo[1] = pSPhi;
|
||||
rangehi[2] = pDz;
|
||||
rangelo[2] = -rangehi[2];
|
||||
axis = kRho;
|
||||
}
|
||||
if ( shape == "TUBS" ) {
|
||||
G4double pRMin = Rpar[0] = Rpar[0]*cm;
|
||||
G4double pRMax = Rpar[1] = Rpar[1]*cm;
|
||||
G4double pDz = Rpar[2] = Rpar[2]*cm;
|
||||
G4double pSPhi = Rpar[3] = Rpar[3]*deg;
|
||||
Rpar[4] = Rpar[4]*deg;
|
||||
G4double pDPhi = Rpar[4] - pSPhi;
|
||||
if ( Rpar[4] <= pSPhi ) pDPhi = pDPhi + 360.*deg;
|
||||
|
||||
solid = new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi);
|
||||
rangehi[0] = pRMax;
|
||||
rangelo[0] = pRMin;
|
||||
rangehi[1] = pSPhi + pDPhi;
|
||||
rangelo[1] = pSPhi;
|
||||
rangehi[2] = pDz;
|
||||
rangelo[2] = -rangehi[2];
|
||||
axis = kRho;
|
||||
}
|
||||
if ( shape == "CONE" ) {
|
||||
G4double pDz = Rpar[0] = Rpar[0]*cm;
|
||||
G4double pRmin1 = Rpar[1] = Rpar[1]*cm;
|
||||
G4double pRmax1 = Rpar[2] = Rpar[2]*cm;
|
||||
G4double pRmin2 = Rpar[3] = Rpar[3]*cm;
|
||||
G4double pRmax2 = Rpar[4] = Rpar[4]*cm;
|
||||
G4double pSPhi = 0.*deg;
|
||||
G4double pDPhi = 360.*deg;
|
||||
solid = new G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi);
|
||||
|
||||
rangehi[0] = max(pRmax1,pRmax2);
|
||||
rangelo[0] = min(pRmin1,pRmin2);
|
||||
rangehi[1] = pSPhi + pDPhi;
|
||||
rangelo[1] = pSPhi;
|
||||
rangehi[2] = pDz;
|
||||
rangelo[2] = -pDz;
|
||||
axis = kRho;
|
||||
}
|
||||
if ( shape == "CONS" ) {
|
||||
G4double pDz = Rpar[0] = Rpar[0]*cm;
|
||||
G4double pRmin1 = Rpar[1] = Rpar[1]*cm;
|
||||
G4double pRmax1 = Rpar[2] = Rpar[2]*cm;
|
||||
G4double pRmin2 = Rpar[3] = Rpar[3]*cm;
|
||||
G4double pRmax2 = Rpar[4] = Rpar[4]*cm;
|
||||
G4double pSPhi = Rpar[5] = Rpar[5]*deg;
|
||||
Rpar[6] = Rpar[6]*deg;
|
||||
G4double pDPhi = Rpar[6]-pSPhi;
|
||||
if ( Rpar[6] <= pSPhi ) pDPhi = pDPhi + 360.*deg;
|
||||
|
||||
solid = new G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi);
|
||||
|
||||
rangehi[0] = max(pRmax1,pRmax2);
|
||||
rangelo[0] = min(pRmin1,pRmin2);
|
||||
rangehi[1] = pSPhi + pDPhi;
|
||||
rangelo[1] = pSPhi;
|
||||
rangehi[2] = pDz;
|
||||
rangelo[2] = -pDz;
|
||||
axis = kRho;
|
||||
}
|
||||
if ( shape == "SPHE" ) {
|
||||
|
||||
G4double pRmin = Rpar[0] = Rpar[0]*cm;
|
||||
G4double pRmax = Rpar[1] = Rpar[1]*cm;
|
||||
G4double pThe1 = Rpar[2] = Rpar[2]*deg;
|
||||
G4double pThe2 = Rpar[3] = Rpar[3]*deg;
|
||||
G4double pDThe = pThe2 - pThe1;
|
||||
G4double pPhi1 = Rpar[4] = Rpar[4]*deg;
|
||||
G4double pPhi2 = Rpar[5] = Rpar[5]*deg;
|
||||
G4double pDPhi = pPhi2 - pPhi1;
|
||||
|
||||
rangehi[0] = pRmax;
|
||||
rangelo[0] = pRmin;
|
||||
rangehi[1] = max(pThe1, pThe2);
|
||||
rangelo[1] = min(pThe1, pThe2);
|
||||
rangehi[2] = max(pPhi1, pPhi2);
|
||||
rangehi[2] = min(pPhi1, pPhi2);
|
||||
|
||||
solid = new G4Sphere(vname, pRmin, pRmax, pThe1, pDThe, pPhi1, pDPhi);
|
||||
|
||||
axis = kRadial3D;
|
||||
}
|
||||
if ( shape == "PARA" ) {
|
||||
G4double pDx = Rpar[0]*cm;
|
||||
G4double pDy = Rpar[1]*cm;
|
||||
G4double pDz = Rpar[2]*cm;
|
||||
G4double pAlph = Rpar[3]*deg;
|
||||
G4double pThet = Rpar[4]*deg;
|
||||
G4double pPhi = Rpar[5]*deg;
|
||||
|
||||
solid = new G4Para(vname, pDx, pDy, pDz, pAlph, pThet, pPhi);
|
||||
|
||||
// ranges given below are only correct for boxes.
|
||||
for (G4int i=0; i<2; i++) {
|
||||
rangehi[i] = Rpar[i];
|
||||
rangelo[i] = -rangehi[i];
|
||||
}
|
||||
}
|
||||
if ( shape == "PGON" ) {
|
||||
G4int i;
|
||||
G4int npdv = int(Rpar[2]);
|
||||
G4int nz = int(Rpar[3]);
|
||||
|
||||
G4double pPhi1 = Rpar[0]*deg;
|
||||
G4double dPhi = Rpar[1]*deg;
|
||||
|
||||
G4double *DzArray = new G4double[nz];
|
||||
G4double *Rmax = new G4double[nz];
|
||||
G4double *Rmin = new G4double[nz];
|
||||
|
||||
rangehi[0] = -kInfinity ;
|
||||
rangelo[0] = kInfinity ;
|
||||
rangehi[2] = -kInfinity ;
|
||||
rangelo[2] = kInfinity ;
|
||||
G4double RMIN=1.e-4*cm;
|
||||
|
||||
|
||||
for(i=0; i<nz; i++)
|
||||
{
|
||||
int i4=3*i+4;
|
||||
int i5=i4+1;
|
||||
int i6=i4+2;
|
||||
|
||||
DzArray[i] = Rpar[i4]*cm;
|
||||
G4String smin="G4makevol::PGON::";
|
||||
smin+=vname;
|
||||
G4String smax=smin;
|
||||
smin+="::Rmin";
|
||||
smax+="::Rmax";
|
||||
Rmin[i] = G3Bound(smin, RMIN, kInfinity, Rpar[i5]*cm);
|
||||
Rmax[i] = G3Bound(smax, Rmin[i]+RMIN, kInfinity,
|
||||
Rpar[i6]*cm);
|
||||
rangelo[0] = min(rangelo[0], Rmin[i]);
|
||||
rangehi[0] = max(rangehi[0], Rmax[i]);
|
||||
rangelo[2] = min(rangelo[2], DzArray[i]);
|
||||
rangehi[2] = max(rangehi[2], DzArray[i]);
|
||||
}
|
||||
for (i=0;i<nz;i++){
|
||||
assert(Rmin[i]>=0 && Rmax[i]>=Rmin[i]);
|
||||
}
|
||||
solid = new G4BREPSolidPolyhedra(vname, pPhi1, dPhi, npdv, nz,
|
||||
DzArray[0], DzArray, Rmin, Rmax);
|
||||
|
||||
rangehi[1] = pPhi1 + dPhi;
|
||||
rangelo[1] = pPhi1;
|
||||
axis = kRho;
|
||||
|
||||
delete [] DzArray;
|
||||
delete [] Rmin;
|
||||
delete [] Rmax;
|
||||
|
||||
}
|
||||
if ( shape == "PCON" ) {
|
||||
|
||||
G4int i;
|
||||
G4double pPhi1 = Rpar[0] = Rpar[0]*deg;
|
||||
G4double dPhi = Rpar[1] = Rpar[1]*deg;
|
||||
G4int nz = int(Rpar[2]);
|
||||
|
||||
G4double *DzArray = new G4double[nz];
|
||||
G4double *Rmax = new G4double[nz];
|
||||
G4double *Rmin = new G4double[nz];
|
||||
|
||||
rangehi[0] = -kInfinity ;
|
||||
rangelo[0] = kInfinity ;
|
||||
rangehi[2] = -kInfinity ;
|
||||
rangelo[2] = kInfinity ;
|
||||
|
||||
G4double RMIN=1.e-4*cm;
|
||||
|
||||
for(i=0; i<nz; i++){
|
||||
int i4=3*i+3;
|
||||
int i5=i4+1;
|
||||
int i6=i4+2;
|
||||
|
||||
DzArray[i] = Rpar[i4]*cm;
|
||||
G4String smin="G4makevol::PCON::";
|
||||
smin+=vname;
|
||||
G4String smax=smin;
|
||||
smin+="::Rmin";
|
||||
smax+="::Rmax";
|
||||
// Rmin[i] = G3Bound(smin, RMIN, kInfinity, Rpar[i5]*cm);
|
||||
Rmin[i] = G3Bound(smin, 0., kInfinity, Rpar[i5]*cm);
|
||||
Rmax[i] = G3Bound(smax, Rmin[i]+RMIN, kInfinity, Rpar[i6]*cm);
|
||||
rangelo[0] = min(rangelo[0], Rmin[i]);
|
||||
rangehi[0] = max(rangehi[0], Rmax[i]);
|
||||
rangelo[2] = min(rangelo[2], DzArray[i]);
|
||||
rangehi[2] = max(rangehi[2], DzArray[i]);
|
||||
}
|
||||
for (i=0;i<nz;i++){
|
||||
assert(Rmin[i]>=0 && Rmax[i]>=Rmin[i]);
|
||||
}
|
||||
solid = new G4BREPSolidPCone(vname, pPhi1, dPhi, nz,
|
||||
DzArray[0], DzArray, Rmin, Rmax);
|
||||
rangehi[1] = pPhi1 + dPhi;
|
||||
rangelo[1] = pPhi1;
|
||||
axis = kRho;
|
||||
|
||||
delete [] DzArray;
|
||||
delete [] Rmin;
|
||||
delete [] Rmax;
|
||||
}
|
||||
if ( shape == "ELTU" ) {
|
||||
// $$$ not implemented.
|
||||
// $$$ solid = new G4Eltu(vname, Rpar);
|
||||
}
|
||||
if ( shape == "HYPE" ) {
|
||||
// $$$ not implemented.
|
||||
// $$$ solid = new G4Hype(vname, Rpar, kDegrees);
|
||||
}
|
||||
if ( shape == "GTRA" ) {
|
||||
// $$$ not implemented.
|
||||
// $$$ solid = new G4Gtra(vname, Rpar, kDegrees);
|
||||
}
|
||||
if ( shape == "CTUB" ) {
|
||||
// $$$ not implemented.
|
||||
// $$$ solid = new G4Ctub(vname, Rpar, kDegrees);
|
||||
}
|
||||
|
||||
// get the material corresponding to the tracking medium
|
||||
G4Material *material;
|
||||
// get the magnetic field and user limits
|
||||
G4MagneticField *field;
|
||||
G4UserLimits *limits;
|
||||
G4VSensitiveDetector *sensitive = NULL;
|
||||
if (nmed>0) {
|
||||
material = G3Med.GetMat(nmed);
|
||||
field = G3Med.GetMag(nmed);
|
||||
limits = G3Med.GetLim(nmed);
|
||||
} else {
|
||||
material = NULL;
|
||||
field = NULL;
|
||||
limits = NULL;
|
||||
}
|
||||
|
||||
G4LogicalVolume* lvol;
|
||||
|
||||
// Create the logical volume
|
||||
if ( solid == NULL) {
|
||||
G4cout << "For volume " << vname << ", shape " << shape
|
||||
<< " not supported " << endl;
|
||||
lvol = NULL;
|
||||
} else {
|
||||
|
||||
// the GetLVx routine queries the G4LogicalVolumeStore to Retrieve
|
||||
// logical volume pointers by name
|
||||
|
||||
lvol = G3Vol.GetLVx(vname);
|
||||
|
||||
if (!lvol)
|
||||
{
|
||||
G4FieldManager* FieldMgr = new G4FieldManager(field);
|
||||
lvol = new G4LogicalVolume(solid, material, vname,
|
||||
FieldMgr, sensitive, limits);
|
||||
|
||||
// Store the logical volume name/pointer association
|
||||
G3Vol.PutLV(&vname,lvol,nmed,rangehi,rangelo,axis,shape,Rpar,npar,
|
||||
solid);
|
||||
}
|
||||
else{
|
||||
G4cout << "G3makevol: LV " << vname << " already defined" << endl;
|
||||
}
|
||||
|
||||
// check that the G3toG4 global mother is set
|
||||
|
||||
G3Vol.SetMother(lvol);
|
||||
|
||||
// set the visual attributes, A. Mokhtarani 2-5-97
|
||||
|
||||
lvol->SetVisAttributes(0);
|
||||
}
|
||||
return lvol;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: VolTableEntry.cc,v 1.7 1999/05/28 23:03:47 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G3VolTable.hh"
|
||||
|
||||
// This "class" remembers the top-level G3toG4 mother volume. It also returns
|
||||
// logical and physical volume pointers, given their names and PV copy numbers.
|
||||
// If no LV/PV name is given, the top-level LV/PV pointer is returned.
|
||||
|
||||
#include "globals.hh"
|
||||
#include "VolTableEntry.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G3Pos.hh"
|
||||
|
||||
VolTableEntry::VolTableEntry(G4String& Vname, G4String& Shape,
|
||||
G4double* Rpar, G4int Npar,
|
||||
G4int Nmed,
|
||||
G4Material* Mat, G4VSolid* Solid,
|
||||
G4bool Deferred, G4bool NegVolPars,
|
||||
G4bool* OKAxis)
|
||||
: _Rpar(0), _Npar(0), _Nmed(0), _Mat(0), _Solid(0), _LV(0), _Deferred(0),
|
||||
_NegVolPars(0), _Daughters(0), _G3Pos(0), _DivisionAxis(0), _Mother(0)
|
||||
{
|
||||
_Nmed = Nmed;
|
||||
_Vname = Vname;
|
||||
_Shape = Shape;
|
||||
int i;
|
||||
if (Rpar!=0 && Npar>0) {
|
||||
_Rpar = new G4double[Npar];
|
||||
for (i=0; i<Npar; i++) _Rpar[i] = Rpar[i];
|
||||
}
|
||||
_Npar = Npar;
|
||||
_Mat = Mat;
|
||||
_Solid = Solid;
|
||||
_NegVolPars = NegVolPars;
|
||||
_Deferred = Deferred;
|
||||
for (i=0;i<3;i++) {
|
||||
_OKAxis[i] = OKAxis[i];
|
||||
}
|
||||
}
|
||||
|
||||
VolTableEntry::~VolTableEntry(){
|
||||
if (_Rpar!=0 && _Npar>0) delete [] _Rpar;
|
||||
};
|
||||
|
||||
void
|
||||
VolTableEntry::SetLV(G4LogicalVolume* ll){
|
||||
_LV = ll;
|
||||
};
|
||||
|
||||
G4String
|
||||
VolTableEntry::GetName() {
|
||||
return _Vname;
|
||||
};
|
||||
|
||||
G4VSolid*
|
||||
VolTableEntry::GetSolid() {
|
||||
return _Solid;
|
||||
};
|
||||
|
||||
G4bool
|
||||
VolTableEntry::HasDeferred(){
|
||||
return _Deferred;
|
||||
};
|
||||
|
||||
G4String
|
||||
VolTableEntry::GetShape() {
|
||||
return _Shape;
|
||||
};
|
||||
|
||||
G4double*
|
||||
VolTableEntry::GetRpar() {
|
||||
return _Rpar;
|
||||
};
|
||||
|
||||
G4int
|
||||
VolTableEntry::GetNpar() {
|
||||
return _Npar;
|
||||
};
|
||||
|
||||
G4Material*
|
||||
VolTableEntry::GetMaterial() {
|
||||
return _Mat;
|
||||
}
|
||||
|
||||
G4LogicalVolume*
|
||||
VolTableEntry::GetLV() {
|
||||
return _LV;
|
||||
};
|
||||
|
||||
G4int
|
||||
VolTableEntry::GetNmed() {
|
||||
return _Nmed;
|
||||
};
|
||||
|
||||
G4bool
|
||||
VolTableEntry::HasNegVolPars(){
|
||||
return _NegVolPars;
|
||||
};
|
||||
|
||||
G3Pos*
|
||||
VolTableEntry::GetG3PosCopy(G4int copy) {
|
||||
return _G3Pos[copy];
|
||||
}
|
||||
|
||||
G4int
|
||||
VolTableEntry::NPCopies() {
|
||||
return _G3Pos.length();
|
||||
};
|
||||
|
||||
void
|
||||
VolTableEntry::AddG3Pos(G3Pos* aG3Pos){
|
||||
G3Vol.CountG3Pos();
|
||||
_G3Pos.resize(_G3Pos.length()+1);
|
||||
_G3Pos.insert(aG3Pos);
|
||||
};
|
||||
|
||||
void
|
||||
VolTableEntry::AddDaughter(VolTableEntry* aDaughter){
|
||||
if (FindDaughter(aDaughter->GetName()) == 0) {
|
||||
_Daughters.resize(_Daughters.length()+1);
|
||||
_Daughters.insert(aDaughter);
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
VolTableEntry::AddMother(VolTableEntry* itsMother){
|
||||
_Mother = itsMother;
|
||||
};
|
||||
|
||||
VolTableEntry*
|
||||
VolTableEntry::GetMother(){
|
||||
return _Mother;
|
||||
};
|
||||
|
||||
VolTableEntry*
|
||||
VolTableEntry::FindDaughter(const G4String& Dname){
|
||||
for (int idau=0; idau<GetNoDaughters(); idau++){
|
||||
if (GetDaughter(idau)->GetName() == Dname) return GetDaughter(idau);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
G4int
|
||||
VolTableEntry::GetNoDaughters() {
|
||||
return _Daughters.length();
|
||||
};
|
||||
|
||||
VolTableEntry*
|
||||
VolTableEntry::GetDaughter(G4int i) {
|
||||
return _Daughters[i];
|
||||
};
|
||||
|
||||
inline G4bool
|
||||
VolTableEntry::operator == ( const VolTableEntry& lv) const {
|
||||
return (this==&lv) ? true : false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* based on the Program) you indicate your acceptance of this statement,
|
||||
* and all its terms.
|
||||
*
|
||||
* $Id: g3routines.F,v 2.2 1998/09/18 08:57:17 lockman Exp $
|
||||
* GEANT4 tag $Name: geant4-00 $
|
||||
* $Id: g3routines.F,v 1.2 1999/05/04 21:16:52 lockman Exp $
|
||||
* GEANT4 tag $Name: geant4-00-01 $
|
||||
*
|
||||
#define CALL_GEANT
|
||||
|
||||
@@ -418,10 +418,6 @@
|
||||
+ (imate, name, a, z, dens, radl, absl, ubf, nwbf)
|
||||
#endif
|
||||
if (lunlist.ne.0) then
|
||||
* write(lunlist,
|
||||
* + '(a4,1x,a6,i5,1x,''"'',a,''"'',4e15.8,i3,<nwbf>e15.8)')
|
||||
* + context, rname, imate, name, a, z, dens, radl,
|
||||
* + nwbf, (ubf(k), k=1,nwbf)
|
||||
write(fmt,'(A,I3,A)')
|
||||
> '(a4,1x,a6,i5,1x,''"'',a,''"'',4(1x,e16.8),i3,',
|
||||
> max(nwbf,1),'(1x,e16.8))'
|
||||
@@ -466,16 +462,9 @@
|
||||
#endif
|
||||
if (lunlist.ne.0) then
|
||||
nlmata = abs(nlmat)
|
||||
* write(lunlist,
|
||||
* + '(a4,1x,a6,i5,1x,''"'',a,''"'',5e15.8,i3,<nlmata>e15.8,
|
||||
* + <nlmata>e15.8,<nlmata>e15.8)')
|
||||
* + context, rname, imate, name, dens,
|
||||
* + nlmat,
|
||||
* + (a(k), k=1,abs(nlmat)),
|
||||
* + (z(k), k=1,abs(nlmat)),
|
||||
* + (wmat(k), k=1,abs(nlmat))
|
||||
write(fmt,'(A,I3,A,I3,A,I3,A)')
|
||||
+ '(a4,1x,a6,i5,1x,",a,",5(1x,e16.8),i3,',max(nlmata,1),
|
||||
+ '(a4,1x,a6,i5,1x,''"'',a,''"'',1x,e16.8,1x,i3,',
|
||||
> max(nlmata,1),
|
||||
> '(1x,e16.8),',max(nlmata,1),'(1x,e16.8),',
|
||||
> max(nlmata,1),'(1x,e16.8))'
|
||||
write(lunlist,fmt)
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* based on the Program) you indicate your acceptance of this statement,
|
||||
* and all its terms.
|
||||
*
|
||||
* $Id: g3test.F,v 2.1 1998/09/18 08:57:27 lockman Exp $
|
||||
* GEANT4 tag $Name: geant4-00 $
|
||||
* $Id: g3test.F,v 1.1 1999/01/07 16:06:53 gunter Exp $
|
||||
* GEANT4 tag $Name: geant4-00-01 $
|
||||
*
|
||||
*
|
||||
* g3test
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* based on the Program) you indicate your acceptance of this statement,
|
||||
* and all its terms.
|
||||
*
|
||||
* $Id: g3tog4.F,v 2.1 1998/09/18 08:57:35 lockman Exp $
|
||||
* GEANT4 tag $Name: geant4-00 $
|
||||
* $Id: g3tog4.F,v 1.2 1999/05/04 21:17:03 lockman Exp $
|
||||
* GEANT4 tag $Name: geant4-00-01 $
|
||||
*
|
||||
*
|
||||
* G3toG4
|
||||
@@ -123,14 +123,6 @@ c dogeom = index(chopt,'G') + index(chopt,'g') .ne. 0
|
||||
*
|
||||
************************************************************************
|
||||
implicit none
|
||||
c call ctocp('G3VolTable G3Vol;')
|
||||
c call ctocp('G3MatTable G3Mat;')
|
||||
c call ctocp('G3MedTable G3Med;')
|
||||
c call ctocp('G3RotTable G3Rot;')
|
||||
c call ctocp('G3PartTable G3Part;')
|
||||
c call ctocp('G4int Ipar[100];')
|
||||
c call ctocp('G4double Rpar[100];')
|
||||
c call ctocp('RWCString Spar[100];')
|
||||
call g4init
|
||||
end
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* based on the Program) you indicate your acceptance of this statement,
|
||||
* and all its terms.
|
||||
*
|
||||
* $Id: jshape.F,v 2.0 1998/07/02 16:17:32 gunter Exp $
|
||||
* GEANT4 tag $Name: geant4-00 $
|
||||
* $Id: jshape.F,v 1.1 1999/01/07 16:06:54 gunter Exp $
|
||||
* GEANT4 tag $Name: geant4-00-01 $
|
||||
*
|
||||
*
|
||||
*-- Author : Jouko Vuoskoski, CERN, Jouko.Vuoskoski@cern.ch
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* based on the Program) you indicate your acceptance of this statement,
|
||||
* and all its terms.
|
||||
*
|
||||
* $Id: mztog4.F,v 2.1 1998/09/18 08:57:52 lockman Exp $
|
||||
* GEANT4 tag $Name: geant4-00 $
|
||||
* $Id: mztog4.F,v 1.1 1999/01/07 16:06:54 gunter Exp $
|
||||
* GEANT4 tag $Name: geant4-00-01 $
|
||||
*
|
||||
subroutine mztog4
|
||||
************************************************************************
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* based on the Program) you indicate your acceptance of this statement,
|
||||
* and all its terms.
|
||||
*
|
||||
* $Id: rztog4.F,v 2.1 1998/09/18 08:58:01 lockman Exp $
|
||||
* GEANT4 tag $Name: geant4-00 $
|
||||
* $Id: rztog4.F,v 1.1 1999/01/07 16:06:54 gunter Exp $
|
||||
* GEANT4 tag $Name: geant4-00-01 $
|
||||
*
|
||||
program rztog4
|
||||
************************************************************************
|
||||
|
||||
+45
-31
@@ -5,8 +5,8 @@
|
||||
* based on the Program) you indicate your acceptance of this statement,
|
||||
* and all its terms.
|
||||
*
|
||||
* $Id: tog4.F,v 2.0 1998/07/02 16:17:36 gunter Exp $
|
||||
* GEANT4 tag $Name: geant4-00 $
|
||||
* $Id: tog4.F,v 1.2 1999/05/04 21:17:14 lockman Exp $
|
||||
* GEANT4 tag $Name: geant4-00-01 $
|
||||
*
|
||||
subroutine tog4
|
||||
************************************************************************
|
||||
@@ -18,43 +18,57 @@
|
||||
************************************************************************
|
||||
implicit none
|
||||
#include "gcbank.inc"
|
||||
integer nvol, nrotm, nmate, ntmed, nset, i, j, k, nin, in
|
||||
integer jdiv, jd, iaxis, ivo, ndiv, numed, npar, natt, ivol, jin
|
||||
integer nparv, npard, nr, irot, konly, nwbuf, isvol, nmat, ifield
|
||||
integer nbits(5000), idtyp, nwhi, nwdi, iset, idet
|
||||
integer jdh, jdd, jdu, ndet, nn, nupar, npos, ndvol
|
||||
|
||||
real c0, step, x, y, z, a, dens, radl, absl
|
||||
*** real fieldm, tmaxfd, stemax, deemax, epsil, stmin, orig, fact
|
||||
*** make orig, fact arrays with same dimension as nbits, etc.
|
||||
real fieldm, tmaxfd, stemax, deemax, epsil, stmin, orig(5000),
|
||||
> fact(5000)
|
||||
real upar(5000)
|
||||
character shape*4, name*4, dname*4, chonly*4, chmat*20, chtmed*20
|
||||
character chset*4, chdet*4, chnms(5000)*4
|
||||
integer maxdivols, ndivols
|
||||
integer maxdivols
|
||||
parameter (maxdivols=20000)
|
||||
character divols(maxdivols)*4
|
||||
integer npositioned
|
||||
integer ii,iia(10000)
|
||||
integer nvol, nrotm, nmate, ntmed, nset, i, jma, nmixt, k, nin,
|
||||
> jdiv, jd, iaxis, ivo, ndiv, numed, npar, natt, ivol, jin,
|
||||
> nparv, npard, nr, irot, konly, nwbuf, isvol, nmat, ifield,
|
||||
> nbits(5000), idtyp, nwhi, nwdi, iset, idet, j, in, jmx,
|
||||
> jdh, jdd, jdu, ndet, nn, nupar, npos, ndvol, ndivols, ii,
|
||||
> npositioned, iia(10000), imate, smixt
|
||||
|
||||
real c0, step, x, y, z, a, dens, radl, absl, fact(5000),
|
||||
> fieldm, tmaxfd, stemax, deemax, epsil, stmin, orig(5000),
|
||||
> upar(5000)
|
||||
|
||||
character shape*4, name*4, dname*4, chonly*4, chmat*20, chtmed*20,
|
||||
> chset*4, chdet*4, chnms(5000)*4, divols(maxdivols)*4
|
||||
*
|
||||
npositioned = 0
|
||||
*
|
||||
*** count materials and convert
|
||||
call bankcnt(jmate,iia, nmate)
|
||||
print *,'Materials: ',nmate
|
||||
do i=1,nmate
|
||||
ii=iia(i)
|
||||
j = lq(jmate-ii)
|
||||
call uhtoc(iq(j+1),4,chmat,20)
|
||||
a = q(j+6)
|
||||
z = q(j+7)
|
||||
dens = q(j+8)
|
||||
radl = q(j+9)
|
||||
absl = q(j+10)
|
||||
nwbuf = iq(j-1)-11
|
||||
call ksmate(ii,chmat,a,z,dens,radl,absl,q(j+12),nwbuf)
|
||||
do imate=1,nmate
|
||||
ii=iia(imate)
|
||||
jma = lq(jmate-ii)
|
||||
call uhtoc(iq(jma+1),4,chmat,20)
|
||||
a = q(jma+6)
|
||||
z = q(jma+7)
|
||||
dens = q(jma+8)
|
||||
radl = q(jma+9)
|
||||
absl = q(jma+10)
|
||||
nwbuf = iq(jma-1)-11
|
||||
if (jma.gt.0) then
|
||||
smixt=q(jma+11)
|
||||
nmixt=abs(smixt)
|
||||
if (nmixt.le.1) then
|
||||
write(6,101) imate, chmat, a, z, dens, radl, absl
|
||||
call ksmate(ii, chmat, a, z, dens, radl, absl,
|
||||
> q(jma+12), nwbuf)
|
||||
else
|
||||
jmx = lq(jma-5)
|
||||
write(6,102) imate, chmat, a, z, dens, radl, absl,
|
||||
> (j,q(jmx+j),q(jmx+nmixt+j),q(jmx+2*nmixt+j),
|
||||
> j=1,nmixt)
|
||||
call ksmixt(ii, chmat, q(jmx+1), q(jmx+nmixt+1),
|
||||
> dens, smixt, q(jmx+2*nmixt+1))
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
101 format(1x,i5,1x,A12,f6.2,f5.1,f8.2,2f9.2)
|
||||
102 format(1x,i5,1x,A12,f6.2,f5.1,f8.2,2f9.2,1x,i2, f6.2, f5.1,
|
||||
> f6.2/(57x, i2, f6.2, f5.1, f6.2))
|
||||
*
|
||||
*** count tracking media and convert
|
||||
call bankcnt(jtmed,iia, ntmed)
|
||||
|
||||
Reference in New Issue
Block a user