50 {
51
52
54
55 NegVolPars = false;
56
57
58 Deferred = (npar == 0);
59
60 if (Deferred) return solid;
61
62 for (
G4int i=0;i<3;i++){
63 OKAxis[i]=false;
64 };
65
66 if ( shape == "BOX" ) {
70
71 OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
72
73 NegVolPars = pX<0 || pY<0 || pZ<0;
74
75 if (!(NegVolPars || Deferred)) {
76 solid =
new G4Box(vname, pX, pY, pZ);
77 }
78
79 } else if ( shape == "TRD1" ) {
85
86 OKAxis[1]=OKAxis[2]=true;
87
88 NegVolPars = pdx1<0 || pdx2<0 || pdy1<0 || pdz<0;
89
90 if (!(NegVolPars || Deferred)) {
91 solid =
new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz);
92 }
93
94 } else if ( shape == "TRD2" ) {
100
101 OKAxis[2]=true;
102
103 NegVolPars = pdx1<0 || pdx2<0 || pdy1<0 || pdy2<0 || pdz<0;
104
105 if (!(NegVolPars || Deferred)) {
106 solid =
new G4Trd(vname, pdx1, pdx2, pdy1, pdy2, pdz);
107 }
108
109 } else if ( shape == "TRAP" ) {
121
122 OKAxis[2]=true;
123
124 NegVolPars= pDz<0 || pDy1<0 || pDx1<0 || pDx2<0 || pDy2<0 || pDx3<0 || pDx4<0;
125
126 if (!(NegVolPars || Deferred)) {
127
128 if (!(pDz>0)) pDz += 0.001*cm;
129 if (!(pDy1>0)) pDy1 += 0.001*cm;
130 if (!(pDx1>0)) pDx1 += 0.001*cm;
131 if (!(pDx2>0)) pDx2 += 0.001*cm;
132 if (!(pDy2>0)) pDy2 += 0.001*cm;
133 if (!(pDx3>0)) pDx3 += 0.001*cm;
134 if (!(pDx4>0)) pDx4 += 0.001*cm;
135
136 solid = new
137 G4Trap(vname, pDz, pTheta, pPhi, pDy1, pDx1, pDx2, pAlp1, pDy2, pDx3,
138 pDx4, pAlp2);
139 }
140
141 } else if ( shape == "TUBE" ) {
147
148 OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
149
150 NegVolPars = pRMin<0 || pRMax<0 || pDz<0;
151
152 if (!(NegVolPars || Deferred)) {
153 solid =
new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi);
154 }
155
156 } else if ( shape == "TUBS" ) {
161 G4double pDPhi = rpar[4]*deg - pSPhi;
162 if ( rpar[4]*deg <= pSPhi ) pDPhi = pDPhi + 360.*deg;
163
164 OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
165
166 NegVolPars = pRMin<0 || pRMax<0 || pDz<0;
167
168 if (!(NegVolPars || Deferred)){
169 solid =
new G4Tubs(vname, pRMin, pRMax, pDz, pSPhi, pDPhi);
170 }
171
172 } else if ( shape == "CONE" ) {
180
181 OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
182
183 NegVolPars = pDz<0 || pRmin1<0 || pRmax1<0 || pRmin2<0 || pRmax2<0;
184
185 if (!(NegVolPars || Deferred)){
186 solid = new
187 G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi);
188 }
189
190 } else if ( shape == "CONS" ) {
197 G4double pDPhi = rpar[6]*deg - pSPhi;
198 if ( rpar[6]*deg <= pSPhi ) pDPhi = pDPhi + 360.*deg;
199
200 OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
201
202 NegVolPars = pDz<0 || pRmin1<0 || pRmax1<0 || pRmin2<0 || pRmax2<0;
203
204 if (!(NegVolPars || Deferred)){
205 solid = new
206 G4Cons(vname, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi);
207 }
208
209 } else if ( shape == "SPHE" ) {
218
219 NegVolPars = pRmin<0 || pRmax<0;
220
221 if (!(NegVolPars || Deferred)) {
222 solid =
new G4Sphere(vname, pRmin, pRmax, pPhi1, pDPhi, pThe1, pDThe);
223 }
224
225 } else if ( shape == "PARA" ) {
232
233 OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
234
235 NegVolPars = pDx<0 || pDy<0 || pDz<0;
236
237 if (!(NegVolPars || Deferred)){
238 solid =
new G4Para(vname, pDx, pDy, pDz, pAlph, pThet, pPhi);
239 }
240
241 } else if ( shape == "PGON" ) {
250
251 OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
252
253 NegVolPars = 0;
254
255 for(i=0; i<nz; i++) {
259 DzArray[i] = rpar[i4]*cm;
260 Rmin[i] = rpar[i5]*cm;
261 Rmax[i] = rpar[i6]*cm;
262 }
263 solid =
new G4Polyhedra(vname, pPhi1, dPhi, npdv, nz, DzArray, Rmin, Rmax);
264 delete [] DzArray;
265 delete [] Rmin;
266 delete [] Rmax;
267
268 } else if ( shape == "PCON" ) {
276
277 OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
278
279 NegVolPars = 0;
280
281 for(i=0; i<nz; i++){
285 DzArray[i] = rpar[i4]*cm;
286 Rmin[i] = rpar[i5]*cm;
287 Rmax[i] = rpar[i6]*cm;
288 }
289 solid =
new G4Polycone(vname, pPhi1, dPhi, nz, DzArray, Rmin, Rmax);
290 delete [] DzArray;
291 delete [] Rmin;
292 delete [] Rmax;
293
294 } else if ( shape == "ELTU" ) {
298
299 OKAxis[0]=OKAxis[1]=OKAxis[2]=true;
300
301 NegVolPars = dX<0 || dY<0 || dZ<0;
302
303 if (!(NegVolPars || Deferred)) {
305 }
306
307 } else if ( shape == "HYPE" ) {
312
313 NegVolPars = pRmin<0 || pRmax<0 || pDz<0;
314
315 if (!(NegVolPars || Deferred)){
316 solid =
new G4Hype(vname, pRmin, pRmax, pThet, pThet, pDz);
317 } else {
318 G4cerr <<
"Negative length parameters not supported for shape "
320 }
321
322 } else if ( shape == "GTRA" ) {
323
325
326 } else if ( shape == "CTUB" ) {
327
329 }
330 return solid;
331}
G4DLLIMPORT std::ostream G4cerr