Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -1,21 +1,26 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the 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: G4gspos.cc,v 1.9 1999/05/28 23:03:43 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4gspos.cc,v 1.11 1999/12/05 17:50:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
// by I.Hrivnacova, 13.10.99
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3G4Interface.hh"
|
||||
#include "G3VolTable.hh"
|
||||
#include "VolTableEntry.hh"
|
||||
#include "G3toG4.hh"
|
||||
#include "G3Pos.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
void PG4gspos(RWCString tokens[])
|
||||
void G4CreateCloneVTE(G3VolTableEntry* vte, G3VolTableEntry* mvte,
|
||||
G4double pars[], G4int npar, G4int num,
|
||||
G4double x, G4double y, G4double z, G4int irot, G4String vonly);
|
||||
|
||||
void PG4gspos(G4String tokens[])
|
||||
{
|
||||
// fill the parameter containers
|
||||
G3fillParams(tokens,PTgspos);
|
||||
@@ -26,52 +31,56 @@ void PG4gspos(RWCString tokens[])
|
||||
G4String only = Spar[2];
|
||||
G4int num = Ipar[0];
|
||||
G4int irot = Ipar[1];
|
||||
G4double x = Rpar[0]*cm;
|
||||
G4double y = Rpar[1]*cm;
|
||||
G4double z = Rpar[2]*cm;
|
||||
// all parameters are passed to G4gsxxx methods
|
||||
// in G3 default units
|
||||
//G4double x = Rpar[0]*cm;
|
||||
//G4double y = Rpar[1]*cm;
|
||||
//G4double z = Rpar[2]*cm;
|
||||
G4double x = Rpar[0];
|
||||
G4double y = Rpar[1];
|
||||
G4double z = Rpar[2];
|
||||
|
||||
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){
|
||||
void G4gspos(G4String vname, G4int num, G4String vmoth, G4double x,
|
||||
G4double y, G4double z, G4int irot, G4String vonly)
|
||||
{
|
||||
// find VTEs
|
||||
G3VolTableEntry* vte = G3Vol.GetVTE(vname);
|
||||
G3VolTableEntry* mvte = G3Vol.GetVTE(vmoth);
|
||||
|
||||
VolTableEntry* _VTE = G3Vol.GetVTE(vname);
|
||||
VolTableEntry* MVTE = G3Vol.GetVTE(vmoth);
|
||||
if (vte == 0) {
|
||||
G4Exception("G4gspos: '" + vname + "' has no VolTableEntry");
|
||||
}
|
||||
else if (mvte == 0) {
|
||||
G4Exception("G4gspos: '" + vmoth + "' has no VolTableEntry");
|
||||
}
|
||||
else {
|
||||
if (!vte->HasNegPars()) {
|
||||
// position vector
|
||||
G4ThreeVector* offset = new G4ThreeVector(x*cm, y*cm, z*cm);
|
||||
|
||||
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
|
||||
// create a G3Pos object and add it to the vte
|
||||
G3Pos* aG3Pos = new G3Pos(vmoth, num, offset, irot, vonly);
|
||||
vte->AddG3Pos(aG3Pos);
|
||||
|
||||
G3Pos* aG3Pos = new G3Pos(vname, num, offset, irot, vonly);
|
||||
_VTE->AddG3Pos(aG3Pos);
|
||||
// loop over all mothers
|
||||
for (G4int i=0; i<mvte->GetNoClones(); i++) {
|
||||
// (mvte is retrieved from its "master" name
|
||||
// -> there is no need to call GetMasterClone()
|
||||
G3VolTableEntry* mvteClone = mvte->GetClone(i);
|
||||
vte->AddMother(mvteClone);
|
||||
mvteClone->AddDaughter(vte);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// if vte has neg parameters
|
||||
// a new vte clone copy is created for each mother (clone copy)
|
||||
// and its parameters are derived from it if possible
|
||||
|
||||
// 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);
|
||||
}
|
||||
G4CreateCloneVTE(vte, mvte, vte->GetRpar(), vte->GetNpar(), num,
|
||||
x, y, z, irot, vonly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user