Go to the source code of this file.
Defines | |
#define | G3TOG4MAKESOLID_HH 1 |
Functions | |
G4VSolid * | G3toG4MakeSolid (const G4String &vname, const G4String &shape, const G4double *Rpar, const G4int npar, G4bool &NegVolPars, G4bool &Deferred, G4bool *OKAxis) |
#define G3TOG4MAKESOLID_HH 1 |
Definition at line 50 of file G3toG4MakeSolid.hh.
G4VSolid* G3toG4MakeSolid | ( | const G4String & | vname, | |
const G4String & | shape, | |||
const G4double * | Rpar, | |||
const G4int | npar, | |||
G4bool & | NegVolPars, | |||
G4bool & | Deferred, | |||
G4bool * | OKAxis | |||
) |
Definition at line 47 of file G3toG4MakeSolid.cc.
References G4cerr, and G4endl.
Referenced by G4CreateCloneVTE(), G4CreateVTE(), and G4ProcessDaughters().
00050 { 00051 00052 // Create the solid if no negative length parameters 00053 G4VSolid *solid = 0; 00054 00055 NegVolPars = false; 00056 00057 // if npar = 0 assume LV deferral 00058 Deferred = (npar == 0); 00059 // modified 00060 if (Deferred) return solid; 00061 00062 for (G4int i=0;i<3;i++){ 00063 OKAxis[i]=false; 00064 }; 00065 00066 if ( shape == "BOX" ) { 00067 G4double pX = rpar[0]*cm; 00068 G4double pY = rpar[1]*cm; 00069 G4double pZ = rpar[2]*cm; 00070 00071 OKAxis[0]=OKAxis[1]=OKAxis[2]=true; 00072 00073 NegVolPars = pX<0 || pY<0 || pZ<0; 00074 00075 if (!(NegVolPars || Deferred)) { 00076 solid = new G4Box(vname, pX, pY, pZ); 00077 } 00078 00079 } else if ( shape == "TRD1" ) { 00080 G4double pdx1 = rpar[0]*cm; 00081 G4double pdx2 = rpar[1]*cm; 00082 G4double pdy1 = rpar[2]*cm; 00083 G4double pdy2 = pdy1; 00084 G4double pdz = rpar[3]*cm; 00085 00086 OKAxis[1]=OKAxis[2]=true; 00087 00088 NegVolPars = pdx1<0 || pdx2<0 || pdy1<0 || pdz<0; 00089 00090 if (!(NegVolPars || Deferred)) { 00091 solid = new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz); 00092 } 00093 00094 } else if ( shape == "TRD2" ) { 00095 G4double pdx1 = rpar[0]*cm; 00096 G4double pdx2 = rpar[1]*cm; 00097 G4double pdy1 = rpar[2]*cm; 00098 G4double pdy2 = rpar[3]*cm; 00099 G4double pdz = rpar[4]*cm; 00100 00101 OKAxis[2]=true; 00102 00103 NegVolPars = pdx1<0 || pdx2<0 || pdy1<0 || pdy2<0 || pdz<0; 00104 00105 if (!(NegVolPars || Deferred)) { 00106 solid = new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz); 00107 } 00108 00109 } else if ( shape == "TRAP" ) { 00110 G4double pDz = rpar[0]*cm; 00111 G4double pTheta = rpar[1]*deg; 00112 G4double pPhi = rpar[2]*deg; 00113 G4double pDy1 = rpar[3]*cm; 00114 G4double pDx1 = rpar[4]*cm; 00115 G4double pDx2 = rpar[5]*cm; 00116 G4double pAlp1 = rpar[6]*deg; 00117 G4double pDy2 = rpar[7]*cm; 00118 G4double pDx3 = rpar[8]*cm; 00119 G4double pDx4 = rpar[9]*cm; 00120 G4double pAlp2 = rpar[10]*deg; 00121 00122 OKAxis[2]=true; 00123 00124 NegVolPars= pDz<0 || pDy1<0 || pDx1<0 || pDx2<0 || pDy2<0 || pDx3<0 || pDx4<0; 00125 00126 if (!(NegVolPars || Deferred)) { 00127 // added for test only 00128 if (!(pDz>0)) pDz += 0.001*cm; 00129 if (!(pDy1>0)) pDy1 += 0.001*cm; 00130 if (!(pDx1>0)) pDx1 += 0.001*cm; 00131 if (!(pDx2>0)) pDx2 += 0.001*cm; 00132 if (!(pDy2>0)) pDy2 += 0.001*cm; 00133 if (!(pDx3>0)) pDx3 += 0.001*cm; 00134 if (!(pDx4>0)) pDx4 += 0.001*cm; 00135 00136 solid = new 00137 G4Trap(vname, pDz, pTheta, pPhi, pDy1, pDx1, pDx2, pAlp1, pDy2, pDx3, 00138 pDx4, pAlp2); 00139 } 00140 00141 } else if ( shape == "TUBE" ) { 00142 G4double pRMin = rpar[0]*cm; 00143 G4double pRMax = rpar[1]*cm; 00144 G4double pDz = rpar[2]*cm; 00145 G4double pSPhi = 0.*deg; 00146 G4double pDPhi = 360.*deg; 00147 00148 OKAxis[0]=OKAxis[1]=OKAxis[2]=true; 00149 00150 NegVolPars = pRMin<0 || pRMax<0 || pDz<0; 00151 00152 if (!(NegVolPars || Deferred)) { 00153 solid = new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi); 00154 } 00155 00156 } else if ( shape == "TUBS" ) { 00157 G4double pRMin = rpar[0]*cm; 00158 G4double pRMax = rpar[1]*cm; 00159 G4double pDz = rpar[2]*cm; 00160 G4double pSPhi = rpar[3]*deg; 00161 G4double pDPhi = rpar[4]*deg - pSPhi; 00162 if ( rpar[4]*deg <= pSPhi ) pDPhi = pDPhi + 360.*deg; 00163 00164 OKAxis[0]=OKAxis[1]=OKAxis[2]=true; 00165 00166 NegVolPars = pRMin<0 || pRMax<0 || pDz<0; 00167 00168 if (!(NegVolPars || Deferred)){ 00169 solid = new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi); 00170 } 00171 00172 } else if ( shape == "CONE" ) { 00173 G4double pDz = rpar[0]*cm; 00174 G4double pRmin1 = rpar[1]*cm; 00175 G4double pRmax1 = rpar[2]*cm; 00176 G4double pRmin2 = rpar[3]*cm; 00177 G4double pRmax2 = rpar[4]*cm; 00178 G4double pSPhi = 0.*deg; 00179 G4double pDPhi = 360.*deg; 00180 00181 OKAxis[0]=OKAxis[1]=OKAxis[2]=true; 00182 00183 NegVolPars = pDz<0 || pRmin1<0 || pRmax1<0 || pRmin2<0 || pRmax2<0; 00184 00185 if (!(NegVolPars || Deferred)){ 00186 solid = new 00187 G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi); 00188 } 00189 00190 } else if ( shape == "CONS" ) { 00191 G4double pDz = rpar[0]*cm; 00192 G4double pRmin1 = rpar[1]*cm; 00193 G4double pRmax1 = rpar[2]*cm; 00194 G4double pRmin2 = rpar[3]*cm; 00195 G4double pRmax2 = rpar[4]*cm; 00196 G4double pSPhi = rpar[5]*deg; 00197 G4double pDPhi = rpar[6]*deg - pSPhi; 00198 if ( rpar[6]*deg <= pSPhi ) pDPhi = pDPhi + 360.*deg; 00199 00200 OKAxis[0]=OKAxis[1]=OKAxis[2]=true; 00201 00202 NegVolPars = pDz<0 || pRmin1<0 || pRmax1<0 || pRmin2<0 || pRmax2<0; 00203 00204 if (!(NegVolPars || Deferred)){ 00205 solid = new 00206 G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi); 00207 } 00208 00209 } else if ( shape == "SPHE" ) { 00210 G4double pRmin = rpar[0]*cm; 00211 G4double pRmax = rpar[1]*cm; 00212 G4double pThe1 = rpar[2]*deg; 00213 G4double pThe2 = rpar[3]*deg; 00214 G4double pDThe = pThe2 - pThe1; 00215 G4double pPhi1 = rpar[4]*deg; 00216 G4double pPhi2 = rpar[5]*deg; 00217 G4double pDPhi = pPhi2 - pPhi1; 00218 00219 NegVolPars = pRmin<0 || pRmax<0; 00220 00221 if (!(NegVolPars || Deferred)) { 00222 solid = new G4Sphere(vname, pRmin, pRmax, pPhi1, pDPhi, pThe1, pDThe); 00223 } 00224 00225 } else if ( shape == "PARA" ) { 00226 G4double pDx = rpar[0]*cm; 00227 G4double pDy = rpar[1]*cm; 00228 G4double pDz = rpar[2]*cm; 00229 G4double pAlph = rpar[3]*deg; 00230 G4double pThet = rpar[4]*deg; 00231 G4double pPhi = rpar[5]*deg; 00232 00233 OKAxis[0]=OKAxis[1]=OKAxis[2]=true; 00234 00235 NegVolPars = pDx<0 || pDy<0 || pDz<0; 00236 00237 if (!(NegVolPars || Deferred)){ 00238 solid = new G4Para(vname, pDx, pDy, pDz, pAlph, pThet, pPhi); 00239 } 00240 00241 } else if ( shape == "PGON" ) { 00242 G4int i; 00243 G4int npdv = G4int(rpar[2]); 00244 G4int nz = G4int(rpar[3]); 00245 G4double pPhi1 = rpar[0]*deg; 00246 G4double dPhi = rpar[1]*deg; 00247 G4double *DzArray = new G4double[nz]; 00248 G4double *Rmax = new G4double[nz]; 00249 G4double *Rmin = new G4double[nz]; 00250 00251 OKAxis[0]=OKAxis[1]=OKAxis[2]=true; 00252 00253 NegVolPars = 0; 00254 00255 for(i=0; i<nz; i++) { 00256 G4int i4=3*i+4; 00257 G4int i5=i4+1; 00258 G4int i6=i4+2; 00259 DzArray[i] = rpar[i4]*cm; 00260 Rmin[i] = rpar[i5]*cm; 00261 Rmax[i] = rpar[i6]*cm; 00262 } 00263 solid = new G4Polyhedra(vname, pPhi1, dPhi, npdv, nz, DzArray, Rmin, Rmax); 00264 delete [] DzArray; 00265 delete [] Rmin; 00266 delete [] Rmax; 00267 00268 } else if ( shape == "PCON" ) { 00269 G4int i; 00270 G4double pPhi1 = rpar[0]*deg; 00271 G4double dPhi = rpar[1]*deg; 00272 G4int nz = G4int(rpar[2]); 00273 G4double *DzArray = new G4double[nz]; 00274 G4double *Rmax = new G4double[nz]; 00275 G4double *Rmin = new G4double[nz]; 00276 00277 OKAxis[0]=OKAxis[1]=OKAxis[2]=true; 00278 00279 NegVolPars = 0; 00280 00281 for(i=0; i<nz; i++){ 00282 G4int i4=3*i+3; 00283 G4int i5=i4+1; 00284 G4int i6=i4+2; 00285 DzArray[i] = rpar[i4]*cm; 00286 Rmin[i] = rpar[i5]*cm; 00287 Rmax[i] = rpar[i6]*cm; 00288 } 00289 solid = new G4Polycone(vname, pPhi1, dPhi, nz, DzArray, Rmin, Rmax); 00290 delete [] DzArray; 00291 delete [] Rmin; 00292 delete [] Rmax; 00293 00294 } else if ( shape == "ELTU" ) { 00295 G4double dX = rpar[0]*cm; 00296 G4double dY = rpar[1]*cm; 00297 G4double dZ = rpar[2]*cm; 00298 00299 OKAxis[0]=OKAxis[1]=OKAxis[2]=true; 00300 00301 NegVolPars = dX<0 || dY<0 || dZ<0; 00302 00303 if (!(NegVolPars || Deferred)) { 00304 solid = new G4EllipticalTube(vname, dX, dY, dZ); 00305 } 00306 00307 } else if ( shape == "HYPE" ) { 00308 G4double pRmin = rpar[0]*cm; 00309 G4double pRmax = rpar[1]*cm; 00310 G4double pDz = rpar[2]*cm; 00311 G4double pThet = rpar[3]*deg; 00312 00313 NegVolPars = pRmin<0 || pRmax<0 || pDz<0; 00314 00315 if (!(NegVolPars || Deferred)){ 00316 solid = new G4Hype(vname, pRmin, pRmax, pThet, pThet, pDz); 00317 } else { 00318 G4cerr << "Negative length parameters not supported for shape " 00319 << shape << G4endl; 00320 } 00321 00322 } else if ( shape == "GTRA" ) { 00323 // $$$ not implemented. 00324 G4cerr << "GTRA not supported" << G4endl; 00325 00326 } else if ( shape == "CTUB" ) { 00327 // $$$ not implemented. 00328 G4cerr << "CTUB not supported" << G4endl; 00329 } 00330 return solid; 00331 }