CMS 3D CMS Logo

DDSolid.cc
Go to the documentation of this file.
3 
4 #include <ostream>
5 #include <string>
6 #include <array>
7 
27 
28 using DDI::Solid;
29 
30 std::ostream& operator<<(std::ostream& os, const DDSolidShape s) {
31  return os << "DDSolidShape index:" << static_cast<int>(s) << ", name: " << DDSolidShapesName::name(s);
32 }
33 
34 std::ostream& operator<<(std::ostream& os, const DDSolid& solid) {
36  if (defined.first) {
37  os << *(defined.first) << " ";
38  if (defined.second) {
39  os << " " << DDSolidShapesName::name(solid.shape()) << ": ";
40  solid.rep().stream(os);
41  } else {
42  os << "* solid not defined * ";
43  }
44  } else {
45  os << "* solid not declared * ";
46  }
47  return os;
48 }
49 
51 
53 
54 DDSolid::DDSolid(const DDName& name, std::unique_ptr<Solid> solid) : DDBase<DDName, std::unique_ptr<Solid>>() {
55  create(name, std::move(solid));
56 }
57 
58 DDSolid::DDSolid(const DDName& name, DDSolidShape shape, const std::vector<double>& pars) {
59  std::unique_ptr<DDI::Solid> solid(nullptr);
60  std::vector<double> dummy;
61  switch (shape) {
63  solid = std::make_unique<DDI::Box>(0, 0, 0);
64  break;
66  solid = std::make_unique<DDI::Tubs>(0, 0, 0, 0, 0);
67  break;
69  solid = std::make_unique<DDI::Cons>(0, 0, 0, 0, 0, 0, 0);
70  break;
72  solid = std::make_unique<DDI::PseudoTrap>(0, 0, 0, 0, 0, 0, false);
73  break;
75  solid = std::make_unique<DDI::Shapeless>();
76  break;
78  solid = std::make_unique<DDI::Trap>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
79  break;
81  solid = std::make_unique<DDI::Polyhedra>(0, 0, 0, dummy, dummy);
82  break;
84  solid = std::make_unique<DDI::Polyhedra>(0, 0, 0, dummy, dummy, dummy);
85  break;
87  solid = std::make_unique<DDI::Polycone>(0, 0, dummy, dummy);
88  break;
90  solid = std::make_unique<DDI::Polycone>(0, 0, dummy, dummy, dummy);
91  break;
93  solid = std::make_unique<DDI::TruncTubs>(0, 0, 0, 0, 0, 0, 0, false);
94  break;
96  solid = std::make_unique<DDI::Torus>(0, 0, 0, 0, 0);
97  break;
99  solid = std::make_unique<DDI::Sphere>(0, 0, 0, 0, 0, 0);
100  break;
102  solid = std::make_unique<DDI::EllipticalTube>(0, 0, 0);
103  break;
105  solid = std::make_unique<DDI::CutTubs>(0., 0., 0., 0., 0., 0., 0., 1., 0., 0., -1.);
106  break;
108  solid = std::make_unique<DDI::ExtrudedPolygon>(dummy, dummy, dummy, dummy, dummy, dummy);
109  break;
111  solid = std::make_unique<DDI::Assembly>();
112  break;
113  default:
114  throw cms::Exception("DDException")
115  << "DDSolid::DDSolid( DDName, DDSolidShape, std::vector<double> ): wrong shape.";
116  }
117  solid->setParameters(pars);
118  create(name, std::move(solid));
119 }
120 
121 double DDSolid::volume() const { return rep().volume(); }
122 
123 DDSolidShape DDSolid::shape() const { return rep().shape(); }
124 
125 const std::vector<double>& DDSolid::parameters() const { return rep().parameters(); }
126 
128  if (s.shape() != DDSolidShape::ddtrap) {
129  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDTrap.\n";
130  ex = ex + "Use a different solid interface!";
131  throw cms::Exception("DDException") << ex;
132  }
133 }
134 
135 double DDTrap::halfZ() const { return rep().parameters()[0]; }
136 
137 double DDTrap::theta() const { return rep().parameters()[1]; }
138 
139 double DDTrap::phi() const { return rep().parameters()[2]; }
140 
141 double DDTrap::y1() const { return rep().parameters()[3]; }
142 
143 double DDTrap::x1() const { return rep().parameters()[4]; }
144 
145 double DDTrap::x2() const { return rep().parameters()[5]; }
146 
147 double DDTrap::alpha1() const { return rep().parameters()[6]; }
148 
149 double DDTrap::y2() const { return rep().parameters()[7]; }
150 
151 double DDTrap::x3() const { return rep().parameters()[8]; }
152 
153 double DDTrap::x4() const { return rep().parameters()[9]; }
154 
155 double DDTrap::alpha2() const { return rep().parameters()[10]; }
156 
158  if (s.shape() != DDSolidShape::ddtrunctubs) {
159  edm::LogError("DDSolid") << "s.shape()=" << s.shape() << " " << s.name() << std::endl;
160  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDTruncTubs\n";
161  ex = ex + "Use a different solid interface!";
162  throw cms::Exception("DDException") << ex;
163  }
164 }
165 
166 double DDTruncTubs::zHalf() const { return rep().parameters()[0]; }
167 
168 double DDTruncTubs::rIn() const { return rep().parameters()[1]; }
169 
170 double DDTruncTubs::rOut() const { return rep().parameters()[2]; }
171 
172 double DDTruncTubs::startPhi() const { return rep().parameters()[3]; }
173 
174 double DDTruncTubs::deltaPhi() const { return rep().parameters()[4]; }
175 
176 double DDTruncTubs::cutAtStart() const { return rep().parameters()[5]; }
177 
178 double DDTruncTubs::cutAtDelta() const { return rep().parameters()[6]; }
179 
180 bool DDTruncTubs::cutInside() const { return bool(rep().parameters()[7]); }
181 
183  if (s.shape() != DDSolidShape::ddpseudotrap) {
184  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDPseudoTrap\n";
185  ex = ex + "Use a different solid interface!";
186  throw cms::Exception("DDException") << ex;
187  }
188 }
189 
190 double DDPseudoTrap::halfZ() const { return rep().parameters()[4]; }
191 
192 double DDPseudoTrap::x1() const { return rep().parameters()[0]; }
193 
194 double DDPseudoTrap::x2() const { return rep().parameters()[1]; }
195 
196 double DDPseudoTrap::y1() const { return rep().parameters()[2]; }
197 
198 double DDPseudoTrap::y2() const { return rep().parameters()[3]; }
199 
200 double DDPseudoTrap::radius() const { return rep().parameters()[5]; }
201 
202 bool DDPseudoTrap::atMinusZ() const { return rep().parameters()[6]; }
203 
205  if (s.shape() != DDSolidShape::ddbox) {
206  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDBox.\n";
207  ex = ex + "Use a different solid interface!";
208  throw cms::Exception("DDException") << ex;
209  }
210 }
211 
212 double DDBox::halfX() const { return rep().parameters()[0]; }
213 
214 double DDBox::halfY() const { return rep().parameters()[1]; }
215 
216 double DDBox::halfZ() const { return rep().parameters()[2]; }
217 
219  if (s.shape() != DDSolidShape::ddshapeless) {
220  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDShapelessSolid.\n";
221  ex = ex + "Use a different solid interface!";
222  throw cms::Exception("DDException") << ex;
223  }
224 }
225 
227  if (s.shape() != DDSolidShape::ddunion) {
228  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDUnion.\n";
229  ex = ex + "Use a different solid interface!";
230  throw cms::Exception("DDException") << ex;
231  }
232 }
233 
235  if (s.shape() != DDSolidShape::ddunion) {
236  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDIntersection.\n";
237  ex = ex + "Use a different solid interface!";
238  throw cms::Exception("DDException") << ex;
239  }
240 }
241 
243  if (s.shape() != DDSolidShape::ddsubtraction) {
244  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDSubtraction.\n";
245  ex = ex + "Use a different solid interface!";
246  throw cms::Exception("DDException") << ex;
247  }
248 }
249 
251 
252 std::vector<double> DDPolySolid::getVec(const size_t& which, const size_t& offset, const size_t& numVecs) const {
253  // which: first second or third std::vector
254  // offset: number of non-std::vector components before std::vectors start
255  if ((rep().parameters().size() - offset) % numVecs != 0) {
256  edm::LogError("DDSolid") << "Could not find equal sized components of std::vectors in a PolySolid description."
257  << "rep().parameters().size()=" << rep().parameters().size() << " numVecs=" << numVecs
258  << " offset=" << offset << std::endl;
259  }
260  std::vector<double> tvec;
261  for (size_t i = offset + which; i < rep().parameters().size(); i = i + numVecs) {
262  tvec.emplace_back(rep().parameters()[i]);
263  }
264  return tvec;
265 }
266 
268  if (s.shape() != DDSolidShape::ddpolycone_rz && s.shape() != DDSolidShape::ddpolycone_rrz) {
269  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDPolycone.\n";
270  ex = ex + "Use a different solid interface!";
271  throw cms::Exception("DDException") << ex;
272  }
273 }
274 
275 double DDPolycone::startPhi() const { return rep().parameters()[0]; }
276 
277 double DDPolycone::deltaPhi() const { return rep().parameters()[1]; }
278 
279 std::vector<double> DDPolycone::rVec() const {
280  std::vector<double> tvec;
282  tvec = getVec(1, 2, 2);
283  return tvec;
284 }
285 
286 std::vector<double> DDPolycone::zVec() const {
288  return getVec(0, 2, 2);
289  else // (shape() == DDSolidShape::ddpolycone_rrz)
290  return getVec(0, 2, 3);
291 }
292 
293 std::vector<double> DDPolycone::rMinVec() const {
294  std::vector<double> tvec;
296  tvec = getVec(1, 2, 3);
297  return tvec;
298 }
299 
300 std::vector<double> DDPolycone::rMaxVec() const {
301  std::vector<double> tvec;
303  tvec = getVec(2, 2, 3);
304  return tvec;
305 }
306 
308  if (s.shape() != DDSolidShape::ddpolyhedra_rz && s.shape() != DDSolidShape::ddpolyhedra_rrz) {
309  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDPolyhedra.\n";
310  ex = ex + "Use a different solid interface!";
311  throw cms::Exception("DDException") << ex;
312  }
313 }
314 
315 int DDPolyhedra::sides() const { return int(rep().parameters()[0]); }
316 
317 double DDPolyhedra::startPhi() const { return rep().parameters()[1]; }
318 
319 double DDPolyhedra::deltaPhi() const { return rep().parameters()[2]; }
320 
321 std::vector<double> DDPolyhedra::rVec() const {
322  std::vector<double> tvec;
324  tvec = getVec(1, 3, 2);
325  return tvec;
326 }
327 
328 std::vector<double> DDPolyhedra::zVec() const {
330  return getVec(0, 3, 2);
331  else // (shape() == ddpolycone_rrz)
332  return getVec(0, 3, 3);
333 }
334 
335 std::vector<double> DDPolyhedra::rMinVec() const {
336  std::vector<double> tvec;
338  tvec = getVec(1, 3, 3);
339  return tvec;
340 }
341 
342 std::vector<double> DDPolyhedra::rMaxVec() const {
343  std::vector<double> tvec;
345  tvec = getVec(2, 3, 3);
346  return tvec;
347 }
348 
350  if (s.shape() != DDSolidShape::ddextrudedpolygon) {
351  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDExtrudedPolygon.\n";
352  ex = ex + "Use a different solid interface!";
353  throw cms::Exception("DDException") << ex;
354  }
355 }
356 
357 auto DDExtrudedPolygon::xyPointsSize(void) const -> std::size_t {
358  // Compute the size of the X and Y coordinate vectors
359  // which define the vertices of the outlined polygon
360  // defined in clock-wise order
361 
362  return (rep().parameters().size() - 4 * zSectionsSize()) * 0.5;
363 }
364 
365 auto DDExtrudedPolygon::zSectionsSize(void) const -> std::size_t {
366  // The first parameters element stores a size of the four equal size vectors
367  // which form the ExtrudedPolygon shape Z sections:
368  //
369  // * first: Z coordinate of the XY polygone plane,
370  // * second and third: x and y offset of the polygone in the XY plane,
371  // * fourth: the polygone scale in each XY plane
372  //
373  // The Z sections defined by the z position in an increasing order.
374 
375  return rep().parameters()[0];
376 }
377 
378 std::vector<double> DDExtrudedPolygon::xVec(void) const {
379  return std::vector<double>(rep().parameters().begin() + 1, rep().parameters().begin() + 1 + xyPointsSize());
380 }
381 
382 std::vector<double> DDExtrudedPolygon::yVec(void) const {
383  return std::vector<double>(rep().parameters().begin() + 1 + xyPointsSize(),
384  rep().parameters().begin() + 1 + 2 * xyPointsSize());
385 }
386 
387 std::vector<double> DDExtrudedPolygon::zVec(void) const {
388  return std::vector<double>(rep().parameters().end() - 4 * zSectionsSize(),
389  rep().parameters().end() - 3 * zSectionsSize());
390 }
391 
392 std::vector<double> DDExtrudedPolygon::zxVec(void) const {
393  return std::vector<double>(rep().parameters().end() - 3 * zSectionsSize(),
394  rep().parameters().end() - 2 * zSectionsSize());
395 }
396 
397 std::vector<double> DDExtrudedPolygon::zyVec(void) const {
398  return std::vector<double>(rep().parameters().end() - 2 * zSectionsSize(),
399  rep().parameters().end() - zSectionsSize());
400 }
401 
402 std::vector<double> DDExtrudedPolygon::zscaleVec(void) const {
403  return std::vector<double>(rep().parameters().end() - zSectionsSize(), rep().parameters().end());
404 }
405 
407  if (s.shape() != DDSolidShape::ddcons) {
408  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDCons.\n";
409  ex = ex + "Use a different solid interface!";
410  throw cms::Exception("DDException") << ex;
411  }
412 }
413 
414 double DDCons::zhalf() const { return rep().parameters()[0]; }
415 
416 double DDCons::rInMinusZ() const { return rep().parameters()[1]; }
417 
418 double DDCons::rOutMinusZ() const { return rep().parameters()[2]; }
419 
420 double DDCons::rInPlusZ() const { return rep().parameters()[3]; }
421 
422 double DDCons::rOutPlusZ() const { return rep().parameters()[4]; }
423 
424 double DDCons::phiFrom() const { return rep().parameters()[5]; }
425 
426 double DDCons::deltaPhi() const { return rep().parameters()[6]; }
427 
429  if (s.shape() != DDSolidShape::ddtorus) {
430  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDTorus.\n";
431  ex = ex + "Use a different solid interface!";
432  throw cms::Exception("DDException") << ex;
433  }
434 }
435 
436 double DDTorus::rMin() const { return rep().parameters()[0]; }
437 
438 double DDTorus::rMax() const { return rep().parameters()[1]; }
439 
440 double DDTorus::rTorus() const { return rep().parameters()[2]; }
441 
442 double DDTorus::startPhi() const { return rep().parameters()[3]; }
443 
444 double DDTorus::deltaPhi() const { return rep().parameters()[4]; }
445 
447  if (s.shape() != DDSolidShape::ddtubs) {
448  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDTubs.\n";
449  ex = ex + "Use a different solid interface!";
450  throw cms::Exception("DDException") << ex;
451  }
452 }
453 
454 double DDTubs::zhalf() const { return rep().parameters()[0]; }
455 
456 double DDTubs::rIn() const { return rep().parameters()[1]; }
457 
458 double DDTubs::rOut() const { return rep().parameters()[2]; }
459 
460 double DDTubs::startPhi() const { return rep().parameters()[3]; }
461 
462 double DDTubs::deltaPhi() const { return rep().parameters()[4]; }
463 
464 DDBooleanSolid::DDBooleanSolid(const DDSolid& s) : DDSolid(s), boolean_(static_cast<DDI::BooleanSolid&>(s.rep())) {}
465 
467 
469 
471 
473 
475  if (s.shape() != DDSolidShape::ddsphere) {
476  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDSphere (or sphere section).\n";
477  ex = ex + "Use a different solid interface!";
478  throw cms::Exception("DDException") << ex;
479  }
480 }
481 
482 double DDSphere::innerRadius() const { return rep().parameters()[0]; }
483 
484 double DDSphere::outerRadius() const { return rep().parameters()[1]; }
485 
486 double DDSphere::startPhi() const { return rep().parameters()[2]; }
487 
488 double DDSphere::deltaPhi() const { return rep().parameters()[3]; }
489 
490 double DDSphere::startTheta() const { return rep().parameters()[4]; }
491 
492 double DDSphere::deltaTheta() const { return rep().parameters()[5]; }
493 
495  if (s.shape() != DDSolidShape::ddellipticaltube) {
496  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDEllipticalTube.\n";
497  ex = ex + "Use a different solid interface!";
498  throw cms::Exception("DDException") << ex;
499  }
500 }
501 
502 double DDEllipticalTube::xSemiAxis() const { return rep().parameters()[0]; }
503 
504 double DDEllipticalTube::ySemiAxis() const { return rep().parameters()[1]; }
505 
506 double DDEllipticalTube::zHeight() const { return rep().parameters()[2]; }
507 
509  if (s.shape() != DDSolidShape::ddcuttubs) {
510  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDCutTubs.\n";
511  ex = ex + "Use a different solid interface!";
512  throw cms::Exception("DDException") << ex;
513  }
514 }
515 
516 double DDCutTubs::zhalf() const { return rep().parameters()[0]; }
517 
518 double DDCutTubs::rIn() const { return rep().parameters()[1]; }
519 
520 double DDCutTubs::rOut() const { return rep().parameters()[2]; }
521 
522 double DDCutTubs::startPhi() const { return rep().parameters()[3]; }
523 
524 double DDCutTubs::deltaPhi() const { return rep().parameters()[4]; }
525 
526 std::array<double, 3> DDCutTubs::lowNorm(void) const {
527  return std::array<double, 3>{{rep().parameters()[5], rep().parameters()[6], rep().parameters()[7]}};
528 }
529 
530 std::array<double, 3> DDCutTubs::highNorm(void) const {
531  return std::array<double, 3>{{rep().parameters()[8], rep().parameters()[9], rep().parameters()[10]}};
532 }
533 
535  if (s.shape() != DDSolidShape::ddassembly) {
536  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDAssembly.\n";
537  ex = ex + "Use a different solid interface!";
538  throw cms::Exception("DDException") << ex;
539  }
540 }
541 
542 // =================================================================================
543 // =========================SolidFactory============================================
544 
545 DDSolid DDSolidFactory::assembly(const DDName& name) { return DDSolid(name, std::make_unique<DDI::Assembly>()); }
546 
547 DDSolid DDSolidFactory::box(const DDName& name, double xHalf, double yHalf, double zHalf) {
548  return DDSolid(name, std::make_unique<DDI::Box>(xHalf, yHalf, zHalf));
549 }
550 
552  double startPhi,
553  double deltaPhi,
554  const std::vector<double>& z,
555  const std::vector<double>& rmin,
556  const std::vector<double>& rmax) {
557  return DDSolid(name, std::make_unique<DDI::Polycone>(startPhi, deltaPhi, z, rmin, rmax));
558 }
559 
561  const DDName& name, double startPhi, double deltaPhi, const std::vector<double>& z, const std::vector<double>& r) {
562  return DDSolid(name, std::make_unique<DDI::Polycone>(startPhi, deltaPhi, z, r));
563 }
564 
566  int sides,
567  double startPhi,
568  double deltaPhi,
569  const std::vector<double>& z,
570  const std::vector<double>& rmin,
571  const std::vector<double>& rmax) {
572  return DDSolid(name, std::make_unique<DDI::Polyhedra>(sides, startPhi, deltaPhi, z, rmin, rmax));
573 }
574 
576  int sides,
577  double startPhi,
578  double deltaPhi,
579  const std::vector<double>& z,
580  const std::vector<double>& r) {
581  return DDSolid(name, std::make_unique<DDI::Polyhedra>(sides, startPhi, deltaPhi, z, r));
582 }
583 
585  const std::vector<double>& x,
586  const std::vector<double>& y,
587  const std::vector<double>& z,
588  const std::vector<double>& zx,
589  const std::vector<double>& zy,
590  const std::vector<double>& zscale) {
591  return DDSolid(name, std::make_unique<DDI::ExtrudedPolygon>(x, y, z, zx, zy, zscale));
592 }
593 
595  const DDName& name, const DDSolid& a, const DDSolid& b, const DDTranslation& t, const DDRotation& r) {
596  return DDSolid(name, std::make_unique<DDI::Union>(a, b, t, r));
597 }
598 
600  const DDName& name, const DDSolid& a, const DDSolid& b, const DDTranslation& t, const DDRotation& r) {
601  return DDSolid(name, std::make_unique<DDI::Subtraction>(a, b, t, r));
602 }
603 
605  const DDName& name, const DDSolid& a, const DDSolid& b, const DDTranslation& t, const DDRotation& r) {
606  return DDSolid(name, std::make_unique<DDI::Intersection>(a, b, t, r));
607 }
608 
610  double pDz,
611  double pTheta,
612  double pPhi,
613  double pDy1,
614  double pDx1,
615  double pDx2,
616  double pAlp1,
617  double pDy2,
618  double pDx3,
619  double pDx4,
620  double pAlp2) {
621  return DDSolid(name,
622  std::make_unique<DDI::Trap>(pDz, pTheta, pPhi, pDy1, pDx1, pDx2, pAlp1, pDy2, pDx3, pDx4, pAlp2));
623 }
624 
626  double pDx1,
627  double pDx2,
628  double pDy1,
629  double pDy2,
630  double pDz,
631  double radius,
632  bool atMinusZ
633 ) {
634  return DDSolid(name, std::make_unique<DDI::PseudoTrap>(pDx1, pDx2, pDy1, pDy2, pDz, radius, atMinusZ));
635 }
636 
638  double zHalf,
639  double rIn,
640  double rOut,
641  double startPhi,
642  double deltaPhi,
643  double cutAtStart,
644  double cutAtDelta,
645  bool cutInside) {
646  return DDSolid(
647  name, std::make_unique<DDI::TruncTubs>(zHalf, rIn, rOut, startPhi, deltaPhi, cutAtStart, cutAtDelta, cutInside));
648 }
649 
651  double zhalf,
652  double rInMinusZ,
653  double rOutMinusZ,
654  double rInPlusZ,
655  double rOutPlusZ,
656  double phiFrom,
657  double deltaPhi) {
658  return DDSolid(name,
659  std::make_unique<DDI::Cons>(zhalf, rInMinusZ, rOutMinusZ, rInPlusZ, rOutPlusZ, phiFrom, deltaPhi));
660 }
661 
663  const DDName& name, double rMin, double rMax, double rTorus, double startPhi, double deltaPhi) {
664  return DDSolid(name, std::make_unique<DDI::Torus>(rMin, rMax, rTorus, startPhi, deltaPhi));
665 }
666 
668  const DDName& name, double zhalf, double rIn, double rOut, double phiFrom, double deltaPhi) {
669  return DDSolid(name, std::make_unique<DDI::Tubs>(zhalf, rIn, rOut, phiFrom, deltaPhi));
670 }
671 
673  double zhalf,
674  double rIn,
675  double rOut,
676  double phiFrom,
677  double deltaPhi,
678  double lx,
679  double ly,
680  double lz,
681  double tx,
682  double ty,
683  double tz) {
684  return DDSolid(name, std::make_unique<DDI::CutTubs>(zhalf, rIn, rOut, phiFrom, deltaPhi, lx, ly, lz, tx, ty, tz));
685 }
686 
688  double innerRadius,
689  double outerRadius,
690  double startPhi,
691  double deltaPhi,
692  double startTheta,
693  double deltaTheta) {
694  return DDSolid(name,
695  std::make_unique<DDI::Sphere>(innerRadius, outerRadius, startPhi, deltaPhi, startTheta, deltaTheta));
696 }
697 
698 DDSolid DDSolidFactory::ellipticalTube(const DDName& name, double xSemiAxis, double ySemiAxis, double zHeight) {
699  return DDSolid(name, std::make_unique<DDI::EllipticalTube>(xSemiAxis, ySemiAxis, zHeight));
700 }
701 
702 DDSolid DDSolidFactory::shapeless(const DDName& name) { return DDSolid(name, std::make_unique<DDI::Shapeless>()); }
size
Write out results.
DDPseudoTrap(void)=delete
DDExtrudedPolygon(void)=delete
Definition: DDBase.h:10
static DDSolid torus(const DDName &name, double rMin, double rMax, double rTorus, double startPhi, double deltaPhi)
Definition: DDSolid.cc:662
const DDSolid & b() const
Definition: Boolean.h:17
double radius(void) const
radius of the cut-out (neg.) or rounding (pos.)
Definition: DDSolid.cc:200
DDSolid solidA(void) const
Definition: DDSolid.cc:470
DDRotation rotation(void) const
Definition: DDSolid.cc:466
std::vector< double > yVec(void) const
Definition: DDSolid.cc:382
DDBox(void)=delete
std::vector< double > zscaleVec(void) const
Definition: DDSolid.cc:402
double zHeight(void) const
Definition: DDSolid.cc:506
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:335
double zhalf(void) const
Definition: DDSolid.cc:516
DDTorus(void)=delete
const DDRotation & r() const
Definition: Boolean.h:19
double halfZ(void) const
Definition: DDSolid.cc:216
double outerRadius(void) const
Definition: DDSolid.cc:484
double startPhi(void) const
angular start of the tube-section
Definition: DDSolid.cc:172
static DDSolid pseudoTrap(const DDName &name, double pDx1, double pDx2, double pDy1, double pDy2, double pDz, double radius, bool atMinusZ)
Definition: DDSolid.cc:625
double rInPlusZ(void) const
Definition: DDSolid.cc:420
double rIn(void) const
Definition: DDSolid.cc:456
Abstract class for DDPolycone and DDPolyhedra. Basically a common member function.
Definition: DDSolid.h:212
DDPolySolid(void)=delete
std::vector< double > xVec(void) const
Definition: DDSolid.cc:378
static DDSolid cons(const DDName &name, double zhalf, double rInMinusZ, double rOutMinusZ, double rInPlusZ, double rOutPlusZ, double phiFrom, double deltaPhi)
Definition: DDSolid.cc:650
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:293
std::vector< double > zVec(void) const
Definition: DDSolid.cc:328
static DDSolid polycone(const DDName &name, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polycone (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:551
double volume(void) const
Returns the volume of the given solid (does not work with boolean soids !)
Definition: DDSolid.cc:121
double deltaPhi(void) const
Definition: DDSolid.cc:488
double rOutMinusZ(void) const
Definition: DDSolid.cc:418
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:342
double ySemiAxis(void) const
Definition: DDSolid.cc:504
std::array< double, 3 > highNorm(void) const
Definition: DDSolid.cc:530
double innerRadius(void) const
Definition: DDSolid.cc:482
double rOut(void) const
Definition: DDSolid.cc:458
auto xyPointsSize(void) const -> std::size_t
Definition: DDSolid.cc:357
double cutAtStart(void) const
truncation at begin of the tube-section
Definition: DDSolid.cc:176
double phi(void) const
Azimuthal angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:139
DDSphere(void)=delete
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:135
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::array< double, 3 > lowNorm(void) const
Definition: DDSolid.cc:526
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
DDPolyhedra(void)=delete
bool cutInside(void) const
true, if truncation is on the inner side of the tube-section
Definition: DDSolid.cc:180
Log< level::Error, false > LogError
const DDI::rep_traits< N, C >::reference rep() const
Definition: DDBase.h:65
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
DDIntersection(void)=delete
const DDI::BooleanSolid & boolean_
Definition: DDSolid.h:195
float float float z
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
std::vector< double > zVec(void) const
Definition: DDSolid.cc:387
DDTruncTubs(void)=delete
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
double startPhi(void) const
Definition: DDSolid.cc:442
static DDSolid cuttubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi, double lx, double ly, double lz, double tx, double ty, double tz)
Definition: DDSolid.cc:672
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:190
double startTheta(void) const
Definition: DDSolid.cc:490
DDTubs(void)=delete
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
Definition: DDSolid.cc:151
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:33
DDTranslation translation(void) const
Definition: DDSolid.cc:468
double x2(void) const
half length along x on +z
Definition: DDSolid.cc:194
DDPolycone(void)=delete
int sides(void) const
Definition: DDSolid.cc:315
double phiFrom(void) const
Definition: DDSolid.cc:424
static DDSolid intersection(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:604
double rIn(void) const
Definition: DDSolid.cc:518
const DDSolid & a() const
Definition: Boolean.h:16
double y2(void) const
half length along y on +z
Definition: DDSolid.cc:198
static DDSolid sphere(const DDName &name, double innerRadius, double outerRadius, double startPhi, double deltaPhi, double startTheta, double deltaTheta)
Definition: DDSolid.cc:687
double zHalf(void) const
half of the z-Axis
Definition: DDSolid.cc:166
virtual std::vector< double > getVec(const size_t &which, const size_t &offset=0, const size_t &nVecs=1) const
note defaults please.
Definition: DDSolid.cc:252
std::ostream & operator<<(std::ostream &os, const DDSolidShape s)
Definition: DDSolid.cc:30
double deltaPhi(void) const
Definition: DDSolid.cc:426
static DDSolid assembly(const DDName &name)
Creates an assembly.
Definition: DDSolid.cc:545
double y2(void) const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:149
std::vector< double > rVec(void) const
Definition: DDSolid.cc:279
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:667
double rOut(void) const
Definition: DDSolid.cc:520
double deltaPhi(void) const
Definition: DDSolid.cc:444
DDSolid solidB(void) const
Definition: DDSolid.cc:472
static DDSolid truncTubs(const DDName &name, double zHalf, double rIn, double rOut, double startPhi, double deltaPhi, double cutAtStart, double cutAtDelta, bool cutInside)
Definition: DDSolid.cc:637
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
Definition: DDSolid.cc:609
rep
Definition: cuy.py:1189
std::vector< double > zxVec(void) const
Definition: DDSolid.cc:392
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:547
double rInMinusZ(void) const
Definition: DDSolid.cc:416
double x4(void) const
Half-length along x of the side at y=+pDy2 of the face at +pDz.
Definition: DDSolid.cc:153
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
double rIn(void) const
inner radius
Definition: DDSolid.cc:168
double rOutPlusZ(void) const
Definition: DDSolid.cc:422
std::vector< double > zyVec(void) const
Definition: DDSolid.cc:397
double deltaTheta(void) const
Definition: DDSolid.cc:492
double deltaPhi(void) const
Definition: DDSolid.cc:462
DDCutTubs(void)=delete
double rMax(void) const
Definition: DDSolid.cc:438
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:145
static DDSolid ellipticalTube(const DDName &name, double xSemiAxis, double ySemiAxis, double zHeight)
Definition: DDSolid.cc:698
double rOut(void) const
outer radius
Definition: DDSolid.cc:170
static DDSolid extrudedpolygon(const DDName &name, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< double > &zx, const std::vector< double > &zy, const std::vector< double > &zscale)
Definition: DDSolid.cc:584
Definition: Assembly.h:7
double x1(void) const
half length along x on -z
Definition: DDSolid.cc:192
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:599
DDSolidShape
Definition: DDSolidShapes.h:6
double startPhi(void) const
Definition: DDSolid.cc:522
double alpha1(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy1 to the centre at y=+pDy1 of t...
Definition: DDSolid.cc:147
double deltaPhi(void) const
Definition: DDSolid.cc:524
double b
Definition: hdecay.h:118
double startPhi(void) const
Definition: DDSolid.cc:317
auto zSectionsSize(void) const -> std::size_t
Definition: DDSolid.cc:365
double alpha2(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy2 to the centre at y=+pDy2 of t...
Definition: DDSolid.cc:155
DDAssembly(void)=delete
double halfX(void) const
Definition: DDSolid.cc:212
static DDSolid shapeless(const DDName &name)
Definition: DDSolid.cc:702
DDEllipticalTube(void)=delete
double zhalf(void) const
Definition: DDSolid.cc:454
std::vector< double > zVec(void) const
Definition: DDSolid.cc:286
double startPhi(void) const
Definition: DDSolid.cc:460
DDShapelessSolid(void)=delete
std::vector< double > rVec(void) const
Definition: DDSolid.cc:321
double a
Definition: hdecay.h:119
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:300
double halfY(void) const
Definition: DDSolid.cc:214
double xSemiAxis(void) const
Definition: DDSolid.cc:502
DDUnion(void)=delete
double deltaPhi(void) const
angular span of the tube-section
Definition: DDSolid.cc:174
double deltaPhi(void) const
Definition: DDSolid.cc:277
std::pair< const N *, bool > def_type
Definition: DDBase.h:51
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:141
DDBooleanSolid(void)=delete
float x
DDSubtraction(void)=delete
DDSolid(void)
Uninitialilzed solid reference-object; for further details on reference-objects see documentation of ...
Definition: DDSolid.cc:50
def which(cmd)
Definition: eostools.py:336
double rMin(void) const
Definition: DDSolid.cc:436
static DDSolid unionSolid(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:594
const DDTranslation & t() const
Definition: Boolean.h:18
double startPhi(void) const
Definition: DDSolid.cc:275
DDTrap(void)=delete
double deltaPhi(void) const
Definition: DDSolid.cc:319
double rTorus(void) const
Definition: DDSolid.cc:440
double startPhi(void) const
Definition: DDSolid.cc:486
def_type isDefined() const
Definition: DDBase.h:90
bool atMinusZ(void) const
true, if cut-out or rounding is on the -z side
Definition: DDSolid.cc:202
double y1(void) const
half length along y on -z
Definition: DDSolid.cc:196
double theta(void) const
Polar angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:137
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
double cutAtDelta(void) const
truncation at end of the tube-section
Definition: DDSolid.cc:178
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:565
def move(src, dest)
Definition: eostools.py:511
double zhalf(void) const
Definition: DDSolid.cc:414
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:143
DDCons(void)=delete
void create(const DDName &name, std::unique_ptr< DDI::Solid > vals)
Definition: DDBase.h:96