00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "G3G4Interface.hh"
00032 #include "G3VolTable.hh"
00033 #include "G3toG4.hh"
00034 #include "G3Pos.hh"
00035 #include "globals.hh"
00036 #include "G4SystemOfUnits.hh"
00037
00038 void G4CreateCloneVTE(G3VolTableEntry* vte, G3VolTableEntry* mvte,
00039 G4double pars[], G4int npar, G4int num,
00040 G4double x, G4double y, G4double z, G4int irot, G4String vonly);
00041
00042 void PG4gspos(G4String *tokens)
00043 {
00044
00045 G3fillParams(tokens,PTgspos);
00046
00047
00048 G4String name = Spar[0];
00049 G4String moth = Spar[1];
00050 G4String only = Spar[2];
00051 G4int num = Ipar[0];
00052 G4int irot = Ipar[1];
00053
00054
00055
00056
00057
00058 G4double x = Rpar[0];
00059 G4double y = Rpar[1];
00060 G4double z = Rpar[2];
00061
00062 G4gspos(name, num, moth, x, y, z, irot, only);
00063 }
00064
00065 void G4gspos(G4String vname, G4int num, G4String vmoth, G4double x,
00066 G4double y, G4double z, G4int irot, G4String vonly)
00067 {
00068
00069 G3VolTableEntry* vte = G3Vol.GetVTE(vname);
00070 G3VolTableEntry* mvte = G3Vol.GetVTE(vmoth);
00071
00072 if (vte == 0) {
00073 G4String text = "G4gspos: '" + vname + "' has no VolTableEntry";
00074 G4Exception("G4gspos()", "G3toG40017", FatalException, text);
00075 return;
00076 }
00077 else if (mvte == 0) {
00078 G4String text = "G4gspos: '" + vmoth + "' has no VolTableEntry";
00079 G4Exception("G4gspos()", "G3toG40018", FatalException, text);
00080 return;
00081 }
00082 else {
00083 if (!vte->HasNegPars()) {
00084
00085 G4ThreeVector* offset = new G4ThreeVector(x*cm, y*cm, z*cm);
00086
00087
00088 G3Pos* aG3Pos = new G3Pos(vmoth, num, offset, irot, vonly);
00089 vte->AddG3Pos(aG3Pos);
00090
00091
00092 for (G4int i=0; i<mvte->GetNoClones(); i++) {
00093
00094
00095 G3VolTableEntry* mvteClone = mvte->GetClone(i);
00096 vte->AddMother(mvteClone);
00097 mvteClone->AddDaughter(vte);
00098 }
00099 }
00100 else {
00101
00102
00103
00104
00105 G4CreateCloneVTE(vte, mvte, vte->GetRpar(), vte->GetNpar(), num,
00106 x, y, z, irot, vonly);
00107 }
00108 }
00109 }