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