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 "G3Division.hh"
00033 #include "G3VolTableEntry.hh"
00034 #include "G3VolTable.hh"
00035 #include "globals.hh"
00036 #include "G3toG4.hh"
00037
00038 void PG4gsdvn(G4String *tokens)
00039 {
00040
00041 G3fillParams(tokens,PTgsdvn);
00042
00043
00044 G4String vname = Spar[0];
00045 G4String vmoth = Spar[1];
00046 G4int ndiv = Ipar[0];
00047 G4int iaxis = Ipar[1];
00048
00049 G4gsdvn(vname, vmoth, ndiv, iaxis);
00050 }
00051
00052 void G4CreateCloneVTEWithDivision(G4String vname, G3VolTableEntry* mvte,
00053 G3DivType divType, G4int nofDivisions, G4int iaxis, G4int,
00054 G4double c0, G4double step)
00055 {
00056 G3VolTableEntry* vte=0;
00057
00058
00059 for (G4int i=0; i<mvte->GetNoClones(); i++) {
00060 G3VolTableEntry* mvteClone = mvte->GetClone(i);
00061 G4String shape = mvteClone->GetShape();
00062 G4int nmed = mvteClone->GetNmed();
00063 G4String mvteName = mvteClone->GetName();
00064
00065 G4String newName = vname;
00066 if (i>0) {
00067 char index[5]; sprintf(index, "%d", i);
00068 newName.append(gSeparator); newName = newName + index;
00069 }
00070
00071
00072
00073 G3VolTableEntry* vteClone
00074 = new G3VolTableEntry(newName, shape, 0, 0, nmed, 0, true);
00075 G3Vol.PutVTE(vteClone);
00076
00077
00078
00079
00080 mvteClone->AddDaughter(vteClone);
00081 vteClone->AddMother(mvteClone);
00082
00083
00084 G3Division* division
00085 = new G3Division(divType, vteClone, mvteClone,
00086 nofDivisions, iaxis, nmed, c0, step);
00087
00088
00089 vteClone->SetDivision(division);
00090 division->UpdateVTE();
00091
00092 if (i == 0) {
00093
00094 vte = vteClone;
00095 }
00096 else {
00097
00098 vte->AddClone(vteClone);
00099 }
00100 }
00101 }
00102
00103 void G4gsdvn(G4String vname, G4String vmoth, G4int ndiv, G4int iaxis)
00104 {
00105
00106 G3VolTableEntry* mvte = G3Vol.GetVTE(vmoth);
00107
00108 if (mvte == 0) {
00109 G4String text = "G4gsdvn:'" + vmoth + "' has no VolTableEntry";
00110 G4Exception("G4gsdvn()", "G3toG40013", FatalException, text);
00111 return;
00112 }
00113 else {
00114
00115
00116
00117 G4CreateCloneVTEWithDivision(vname, mvte, kDvn, ndiv, iaxis, 0, 0., 0.);
00118 }
00119 }