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