280 {
281
282
283
284 ServiceVolume* param = new ServiceVolume;
285
286 param->setMaterial(
m_mgr->materialName(ii));
287 param->setRmin(
m_mgr->rmin(ii));
288 param->setRmax(
m_mgr->rmax(ii));
289 param->setZmin(
m_mgr->zmin(ii));
290 param->setZmax(
m_mgr->zmax(ii));
291 param->setZsymm(
m_mgr->zsymm(ii));
292 param->setVolName(
m_mgr->volName(ii));
293
294 double zShift = 0.;
296 param->setZShift(zShift);
297
298 int volId =
m_mgr->volId(ii);
299 if (volId == 0) volId = ii + 1;
300
301 bool needsRotation = false;
302
303
304 std::string shapeType =
m_mgr->shapeType(ii);
305 if (!
m_mgr->schema().simple() && !shapeType.empty() && shapeType !=
"TUBE") {
306 double rmin2 =
m_mgr->rmin2(ii);
307 double rmax2 =
m_mgr->rmax2(ii);
308
309 if (rmin2 <= 0) rmin2 = param->rmin();
310 if (rmax2 <= 0) rmax2 = param->rmax();
311
312 int radialDiv =
m_mgr->radialDiv(ii);
313
314 double phiDelta =
m_mgr->phiDelta(ii);
315
316 bool fullPhiSector = false;
317 if (phiDelta == 0 || phiDelta >= 359.9 * Gaudi::Units::degree) {
318 phiDelta = 360 * Gaudi::Units::degree;
319 fullPhiSector = true;
320 }
321
322
323
324
325
326 if (shapeType == "UNKNOWN") {
327 if (radialDiv > 0) {
328 shapeType = "RADIAL";
329 } else if (param->rmin() == rmin2 && param->rmax() == rmax2) {
330 if (fullPhiSector) {
331 shapeType = "TUBE";
332 } else {
333 shapeType = "TUBS";
334 }
335 } else {
336 shapeType = "CONS";
337 }
338 }
339
340
341 int repeat =
m_mgr->repeat(ii);
342 if (repeat == 0) repeat = 1;
343
344 double phiStart =
m_mgr->phiStart(ii);
346
347 if (shapeType == "CONS" || shapeType == "TUBS") {
348 const double phiepsilon = 0.001 * Gaudi::Units::degree;
350 phiStart += phiepsilon;
351 }
352
353
354
355 if (shapeType == "BOX" || shapeType == "ROD" || shapeType == "ROD2" || shapeType == "TRAP") {
357 }
358
359 if (shapeType == "PGON" || shapeType == "PGON2" ||
360 shapeType == "CONE" || shapeType == "CONS" ||
361 shapeType == "PGON3" || shapeType == "PGON4") {
362 if ((rmin2 != param->rmin()) || (rmax2 != param->rmax())) {
363 needsRotation = true;
364 }
365 }
366
368 int nCopies = 1;
369 if (shapeType == "PGON" || shapeType == "PGON2" ||
370 shapeType == "PGON3" || shapeType == "PGON4") {
372 } else {
373 nCopies = repeat;
374 }
375
376
377 if (shapeType.empty() || shapeType == "TUBE" || shapeType == "CONE") {
378 nCopies = 1;
379 }
380
381 param->setShapeType(shapeType);
382 param->setRmin2(rmin2);
383 param->setRmax2(rmax2);
384 param->setPhiLoc(phiStart);
385 param->setPhiWidth(phiWidth);
386 param->setSides(sides);
387 param->setNCopies(nCopies);
388
389
390 }
391
392 param->setNeedsRotation(needsRotation);
393
394
395
396
397
398
399 if (std::abs(param->zmin()) < 0.000001) {
400 param->setZmin(-param->zmax());
401 param->setZsymm(false);
402 }
403
404 param->setLabel(
m_label, volId);
405
406 return param;
407 }
std::initializer_list< unsigned int > constexpr sides