57 Deferred = (npar == 0);
59 if (Deferred)
return solid;
61 for (
G4int i=0;i<3;i++){
65 if ( shape ==
"BOX" ) {
70 OKAxis[0]=OKAxis[1]=OKAxis[2]=
true;
72 NegVolPars = pX<0 || pY<0 || pZ<0;
74 if (!(NegVolPars || Deferred)) {
75 solid =
new G4Box(vname, pX, pY, pZ);
78 }
else if ( shape ==
"TRD1" ) {
85 OKAxis[1]=OKAxis[2]=
true;
87 NegVolPars = pdx1<0 || pdx2<0 || pdy1<0 || pdz<0;
89 if (!(NegVolPars || Deferred)) {
90 solid =
new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz);
93 }
else if ( shape ==
"TRD2" ) {
102 NegVolPars = pdx1<0 || pdx2<0 || pdy1<0 || pdy2<0 || pdz<0;
104 if (!(NegVolPars || Deferred)) {
105 solid =
new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz);
108 }
else if ( shape ==
"TRAP" ) {
123 NegVolPars= pDz<0 || pDy1<0 || pDx1<0 || pDx2<0 || pDy2<0 || pDx3<0 || pDx4<0;
125 if (!(NegVolPars || Deferred)) {
127 if (!(pDz>0)) pDz += 0.001*cm;
128 if (!(pDy1>0)) pDy1 += 0.001*cm;
129 if (!(pDx1>0)) pDx1 += 0.001*cm;
130 if (!(pDx2>0)) pDx2 += 0.001*cm;
131 if (!(pDy2>0)) pDy2 += 0.001*cm;
132 if (!(pDx3>0)) pDx3 += 0.001*cm;
133 if (!(pDx4>0)) pDx4 += 0.001*cm;
136 G4Trap(vname, pDz, pTheta, pPhi, pDy1, pDx1, pDx2, pAlp1, pDy2, pDx3,
140 }
else if ( shape ==
"TUBE" ) {
147 OKAxis[0]=OKAxis[1]=OKAxis[2]=
true;
149 NegVolPars = pRMin<0 || pRMax<0 || pDz<0;
151 if (!(NegVolPars || Deferred)) {
152 solid =
new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi);
155 }
else if ( shape ==
"TUBS" ) {
160 G4double pDPhi = rpar[4]*deg - pSPhi;
161 if ( rpar[4]*deg <= pSPhi ) pDPhi = pDPhi + 360.*deg;
163 OKAxis[0]=OKAxis[1]=OKAxis[2]=
true;
165 NegVolPars = pRMin<0 || pRMax<0 || pDz<0;
167 if (!(NegVolPars || Deferred)){
168 solid =
new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi);
171 }
else if ( shape ==
"CONE" ) {
180 OKAxis[0]=OKAxis[1]=OKAxis[2]=
true;
182 NegVolPars = pDz<0 || pRmin1<0 || pRmax1<0 || pRmin2<0 || pRmax2<0;
184 if (!(NegVolPars || Deferred)){
186 G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi);
189 }
else if ( shape ==
"CONS" ) {
196 G4double pDPhi = rpar[6]*deg - pSPhi;
197 if ( rpar[6]*deg <= pSPhi ) pDPhi = pDPhi + 360.*deg;
199 OKAxis[0]=OKAxis[1]=OKAxis[2]=
true;
201 NegVolPars = pDz<0 || pRmin1<0 || pRmax1<0 || pRmin2<0 || pRmax2<0;
203 if (!(NegVolPars || Deferred)){
205 G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi);
208 }
else if ( shape ==
"SPHE" ) {
218 NegVolPars = pRmin<0 || pRmax<0;
220 if (!(NegVolPars || Deferred)) {
221 solid =
new G4Sphere(vname, pRmin, pRmax, pPhi1, pDPhi, pThe1, pDThe);
224 }
else if ( shape ==
"PARA" ) {
232 OKAxis[0]=OKAxis[1]=OKAxis[2]=
true;
234 NegVolPars = pDx<0 || pDy<0 || pDz<0;
236 if (!(NegVolPars || Deferred)){
237 solid =
new G4Para(vname, pDx, pDy, pDz, pAlph, pThet, pPhi);
240 }
else if ( shape ==
"PGON" ) {
250 OKAxis[0]=OKAxis[1]=OKAxis[2]=
true;
254 for(i=0; i<nz; i++) {
258 DzArray[i] = rpar[i4]*cm;
259 Rmin[i] = rpar[i5]*cm;
260 Rmax[i] = rpar[i6]*cm;
262 solid =
new G4Polyhedra(vname, pPhi1, dPhi, npdv, nz, DzArray, Rmin, Rmax);
267 }
else if ( shape ==
"PCON" ) {
276 OKAxis[0]=OKAxis[1]=OKAxis[2]=
true;
284 DzArray[i] = rpar[i4]*cm;
285 Rmin[i] = rpar[i5]*cm;
286 Rmax[i] = rpar[i6]*cm;
288 solid =
new G4Polycone(vname, pPhi1, dPhi, nz, DzArray, Rmin, Rmax);
293 }
else if ( shape ==
"ELTU" ) {
298 OKAxis[0]=OKAxis[1]=OKAxis[2]=
true;
300 NegVolPars = dX<0 || dY<0 || dZ<0;
302 if (!(NegVolPars || Deferred)) {
306 }
else if ( shape ==
"HYPE" ) {
312 NegVolPars = pRmin<0 || pRmax<0 || pDz<0;
314 if (!(NegVolPars || Deferred)){
315 solid =
new G4Hype(vname, pRmin, pRmax, pThet, pThet, pDz);
317 G4cerr <<
"Negative length parameters not supported for shape "
321 }
else if ( shape ==
"GTRA" ) {
325 }
else if ( shape ==
"CTUB" ) {
G4VSolid * G3toG4MakeSolid(const G4String &vname, const G4String &shape, const G4double *rpar, const G4int npar, G4bool &NegVolPars, G4bool &Deferred, G4bool *OKAxis)
G4GLOB_DLL std::ostream G4cerr