CMS 3D CMS Logo

DDSolid.cc
Go to the documentation of this file.
2 
3 #include <ostream>
4 #include <string>
5 #include <array>
6 
30 
31 using DDI::Solid;
32 
33 std::ostream &
34 operator<<(std::ostream & os, const DDSolid & solid)
35 {
37  if (defined.first) {
38  os << *(defined.first) << " ";
39  if (defined.second) {
40  os << " " << DDSolidShapesName::name(solid.shape()) << ": ";
41  solid.rep().stream(os);
42  }
43  else {
44  os << "* solid not defined * ";
45  }
46  }
47  else {
48  os << "* solid not declared * ";
49  }
50  return os;
51 }
52 
54  : DDBase<DDName,Solid*>() { }
55 
57  : DDBase<DDName,Solid*>()
58 {
59  prep_ = StoreT::instance().create(n);
60 }
61 
63  : DDBase<DDName,Solid*>()
64 {
65  prep_ = StoreT::instance().create(n,s);
66 }
67 
68 DDSolid::DDSolid( const DDName & n, DDSolidShape s, const std::vector<double> & p )
69 {
70  DDI::Solid * solid(nullptr);
71  std::vector<double> dummy;
72  switch(s) {
73  case ddbox:
74  solid = new DDI::Box(0,0,0);
75  break;
76  case ddtubs:
77  solid = new DDI::Tubs(0,0,0,0,0);
78  break;
79  case ddcons:
80  solid = new DDI::Cons(0,0,0,0,0,0,0);
81  break;
82  case ddpseudotrap:
83  solid = new DDI::PseudoTrap(0,0,0,0,0,0,false);
84  break;
85  case ddshapeless:
86  solid = new DDI::Shapeless();
87  break;
88  case ddtrap:
89  solid = new DDI::Trap(0,0,0,0,0,0,0,0,0,0,0);
90  break;
91  case ddpolyhedra_rz:
92  solid = new DDI::Polyhedra(0,0,0,dummy,dummy);
93  break;
94  case ddpolyhedra_rrz:
95  solid = new DDI::Polyhedra(0,0,0,dummy,dummy,dummy);
96  break;
97  case ddpolycone_rz:
98  solid = new DDI::Polycone(0,0,dummy,dummy);
99  break;
100  case ddpolycone_rrz:
101  solid = new DDI::Polycone(0,0,dummy,dummy,dummy);
102  break;
103  case ddtrunctubs:
104  solid = new DDI::TruncTubs(0,0,0,0,0,0,0,false);
105  break;
106  case ddtorus:
107  solid = new DDI::Torus(0,0,0,0,0);
108  break;
109  case ddsphere:
110  solid = new DDI::Sphere(0,0,0,0,0,0);
111  break;
112  case ddorb:
113  solid = new DDI::Orb(0);
114  break;
115  case ddellipticaltube:
116  solid = new DDI::EllipticalTube(0,0,0);
117  break;
118  case ddellipsoid:
119  solid = new DDI::Ellipsoid(0,0,0,0,0);
120  break;
121  case ddparallelepiped:
122  solid = new DDI::Parallelepiped(0,0,0,0,0,0);
123  break;
124  case ddcuttubs:
125  solid = new DDI::CutTubs(0.,0.,0.,0.,0.,0.,0.,1.,0.,0.,-1.);
126  break;
127  case ddextrudedpolygon:
128  solid = new DDI::ExtrudedPolygon( dummy, dummy, dummy, dummy, dummy, dummy );
129  break;
130  default:
131  throw cms::Exception("DDException") << "DDSolid::DDSolid(DDName,DDSolidShape,std::vector<double>: wrong shape";
132  }
133  solid->setParameters(p);
134  prep_ = StoreT::instance().create(n,solid);
135 }
136 
137 double
139 {
140  return rep().volume();
141 }
142 
145 {
146  return rep().shape();
147 }
148 
149 const std::vector<double> &
151 {
152  return rep().parameters();
153 }
154 
156 {
157  if (s.shape() != ddtrap) {
158  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDTrap.\n";
159  ex = ex + "Use a different solid interface!";
160  throw cms::Exception("DDException") << ex;
161  }
162 }
163 
164 double
165 DDTrap::halfZ() const { return rep().parameters()[0]; }
166 
167 double
168 DDTrap::theta() const { return rep().parameters()[1]; }
169 
170 double
171 DDTrap::phi() const { return rep().parameters()[2]; }
172 
173 double
174 DDTrap::y1() const { return rep().parameters()[3]; }
175 
176 double
177 DDTrap::x1() const { return rep().parameters()[4]; }
178 
179 double
180 DDTrap::x2() const { return rep().parameters()[5]; }
181 
182 double
183 DDTrap::alpha1() const { return rep().parameters()[6]; }
184 
185 double
186 DDTrap::y2() const { return rep().parameters()[7]; }
187 
188 double
189 DDTrap::x3() const { return rep().parameters()[8]; }
190 
191 double
192 DDTrap::x4() const { return rep().parameters()[9]; }
193 
194 double
195 DDTrap::alpha2() const { return rep().parameters()[10]; }
196 
198 {
199  if (s.shape() != ddtrunctubs) {
200  edm::LogError ("DDSolid") << "s.shape()=" << s.shape() << " " << s << std::endl;
201  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDTruncTubs\n";
202  ex = ex + "Use a different solid interface!";
203  throw cms::Exception("DDException") << ex;
204  }
205 }
206 
207 double
208 DDTruncTubs::zHalf() const { return rep().parameters()[0];}
209 
210 double
211 DDTruncTubs::rIn() const { return rep().parameters()[1];}
212 
213 double
214 DDTruncTubs::rOut() const { return rep().parameters()[2];}
215 
216 double
217 DDTruncTubs::startPhi() const { return rep().parameters()[3];}
218 
219 double
220 DDTruncTubs::deltaPhi() const { return rep().parameters()[4];}
221 
222 double
223 DDTruncTubs::cutAtStart() const { return rep().parameters()[5];}
224 
225 double
226 DDTruncTubs::cutAtDelta() const { return rep().parameters()[6];}
227 
228 bool
229 DDTruncTubs::cutInside() const { return bool(rep().parameters()[7]);}
230 
232 {
233  if (s.shape() != ddpseudotrap) {
234  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDPseudoTrap\n";
235  ex = ex + "Use a different solid interface!";
236  throw cms::Exception("DDException") << ex;
237  }
238 }
239 
240 double
241 DDPseudoTrap::halfZ() const { return rep().parameters()[4]; }
242 
243 double
244 DDPseudoTrap::x1() const { return rep().parameters()[0]; }
245 
246 double
247 DDPseudoTrap::x2() const { return rep().parameters()[1]; }
248 
249 double
250 DDPseudoTrap::y1() const { return rep().parameters()[2]; }
251 
252 double
253 DDPseudoTrap::y2() const { return rep().parameters()[3]; }
254 
255 double
256 DDPseudoTrap::radius() const { return rep().parameters()[5]; }
257 
258 bool
259 DDPseudoTrap::atMinusZ() const { return rep().parameters()[6]; }
260 
262  : DDSolid(s)
263 {
264  if (s.shape() != ddbox) {
265  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDBox.\n";
266  ex = ex + "Use a different solid interface!";
267  throw cms::Exception("DDException") << ex;
268  }
269 }
270 
271 double
273 { return rep().parameters()[0]; }
274 
275 double
277 { return rep().parameters()[1]; }
278 
279 double
281 { return rep().parameters()[2]; }
282 
284  : DDSolid(s), reflected_(nullptr)
285 {
286  //FIXME: exception handling!
287  reflected_ = dynamic_cast<DDI::Reflection*>(&s.rep());
288 }
289 
290 DDSolid
292 { return reflected_->solid();}
293 
295 {
296  if (s.shape() != ddshapeless) {
297  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDShapelessSolid.\n";
298  ex = ex + "Use a different solid interface!";
299  throw cms::Exception("DDException") << ex;
300  }
301 }
302 
304  : DDBooleanSolid(s)
305 {
306  if (s.shape() != ddunion) {
307  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDUnion.\n";
308  ex = ex + "Use a different solid interface!";
309  throw cms::Exception("DDException") << ex;
310  }
311 }
312 
314  : DDMultiUnionSolid(s)
315 {
316  if (s.shape() != ddmultiunion) {
317  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDMultiUnion.\n";
318  ex = ex + "Use a different solid interface!";
319  throw cms::Exception("DDException") << ex;
320  }
321 }
322 
324  : DDBooleanSolid(s)
325 {
326  if (s.shape() != ddunion) {
327  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDIntersection.\n";
328  ex = ex + "Use a different solid interface!";
329  throw cms::Exception("DDException") << ex;
330  }
331 }
332 
334  : DDBooleanSolid(s)
335 {
336  if (s.shape() != ddsubtraction) {
337  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDSubtraction.\n";
338  ex = ex + "Use a different solid interface!";
339  throw cms::Exception("DDException") << ex;
340  }
341 }
342 
344  : DDSolid(s)
345 { }
346 
347 std::vector<double>
348 DDPolySolid::getVec (const size_t& which,
349  const size_t& offset,
350  const size_t& numVecs) const
351 {
352  // which: first second or third std::vector
353  // offset: number of non-std::vector components before std::vectors start
354  if(( rep().parameters().size() - offset) % numVecs != 0 ) {
355  edm::LogError ("DDSolid") << "Could not find equal sized components of std::vectors in a PolySolid description."
356  << "rep().parameters().size()=" << rep().parameters().size() << " numVecs=" << numVecs
357  << " offset=" << offset << std::endl;
358  }
359  std::vector<double> tvec;
360  for( size_t i = offset + which; i < rep().parameters().size(); i = i + numVecs ) {
361  tvec.emplace_back( rep().parameters()[i]);
362  }
363  return tvec;
364 }
365 
367  : DDPolySolid(s)
368 {
369  if( s.shape() != ddpolycone_rz && s.shape() != ddpolycone_rrz ) {
370  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDPolycone.\n";
371  ex = ex + "Use a different solid interface!";
372  throw cms::Exception("DDException") << ex;
373  }
374 }
375 
376 double
377 DDPolycone::startPhi() const { return rep().parameters()[0]; }
378 
379 double
380 DDPolycone::deltaPhi() const { return rep().parameters()[1]; }
381 
382 std::vector<double> DDPolycone::rVec() const {
383  std::vector<double> tvec;
384  if (shape() == ddpolycone_rz)
385  tvec = getVec(1, 2, 2);
386  return tvec;
387 }
388 
389 std::vector<double>
391  if (shape() == ddpolycone_rz)
392  return getVec(0, 2, 2);
393  else // (shape() == ddpolycone_rrz)
394  return getVec(0, 2, 3);
395 }
396 
397 std::vector<double>
399  std::vector<double> tvec;
400  if (shape() == ddpolycone_rrz)
401  tvec = getVec(1, 2, 3);
402  return tvec;
403 }
404 
405 std::vector<double>
407  std::vector<double> tvec;
408  if (shape() == ddpolycone_rrz)
409  tvec = getVec(2, 2, 3);
410  return tvec;
411 }
412 
414  : DDPolySolid(s)
415 {
416  if (s.shape() != ddpolyhedra_rz && s.shape() != ddpolyhedra_rrz) {
417  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDPolyhedra.\n";
418  ex = ex + "Use a different solid interface!";
419  throw cms::Exception("DDException") << ex;
420  }
421 }
422 
423 int
424 DDPolyhedra::sides() const { return int(rep().parameters()[0]); }
425 
426 double
427 DDPolyhedra::startPhi() const { return rep().parameters()[1]; }
428 
429 double
430 DDPolyhedra::deltaPhi() const { return rep().parameters()[2]; }
431 
432 std::vector<double>
434  std::vector<double> tvec;
435  if (shape() == ddpolyhedra_rz)
436  tvec = getVec(1, 3, 2);
437  return tvec;
438 }
439 
440 std::vector<double>
442  if (shape() == ddpolyhedra_rz)
443  return getVec(0, 3, 2);
444  else // (shape() == ddpolycone_rrz)
445  return getVec(0, 3, 3);
446 }
447 
448 std::vector<double>
450  std::vector<double> tvec;
451  if (shape() == ddpolyhedra_rrz)
452  tvec = getVec(1, 3, 3);
453  return tvec;
454 }
455 
456 std::vector<double>
458  std::vector<double> tvec;
459  if (shape() == ddpolyhedra_rrz)
460  tvec = getVec(2, 3, 3);
461  return tvec;
462 }
463 
465  : DDPolySolid(s)
466 {
467  if( s.shape() != ddextrudedpolygon ) {
468  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDExtrudedPolygon.\n";
469  ex = ex + "Use a different solid interface!";
470  throw cms::Exception("DDException") << ex;
471  }
472 }
473 
474 auto
475 DDExtrudedPolygon::xyPointsSize( void ) const -> std::size_t
476 {
477  // Compute the size of the X and Y coordinate vectors
478  // which define the vertices of the outlined polygon
479  // defined in clock-wise order
480 
481  return ( rep().parameters().size() - 4 * zSectionsSize()) * 0.5;
482 }
483 
484 auto
485 DDExtrudedPolygon::zSectionsSize( void ) const -> std::size_t
486 {
487  // The first parameters element stores a size of the four equal size vectors
488  // which form the ExtrudedPolygon shape Z sections:
489  //
490  // * first: Z coordinate of the XY polygone plane,
491  // * second and third: x and y offset of the polygone in the XY plane,
492  // * fourth: the polygone scale in each XY plane
493  //
494  // The Z sections defined by the z position in an increasing order.
495 
496  return rep().parameters()[0];
497 }
498 
499 std::vector<double>
501 {
502  return std::vector<double>( rep().parameters().begin() + 1,
503  rep().parameters().begin() + 1 + xyPointsSize());
504 }
505 
506 std::vector<double>
508 {
509  return std::vector<double>( rep().parameters().begin() + 1 + xyPointsSize(),
510  rep().parameters().begin() + 1 + 2 * xyPointsSize());
511 }
512 
513 std::vector<double>
515 {
516  return std::vector<double>( rep().parameters().end() - 4 * zSectionsSize(),
517  rep().parameters().end() - 3 * zSectionsSize());
518 }
519 
520 std::vector<double>
522 {
523  return std::vector<double>( rep().parameters().end() - 3 * zSectionsSize(),
524  rep().parameters().end() - 2 * zSectionsSize());
525 }
526 
527 std::vector<double>
529 {
530  return std::vector<double>( rep().parameters().end() - 2 * zSectionsSize(),
531  rep().parameters().end() - zSectionsSize());
532 }
533 
534 std::vector<double>
536 {
537  return std::vector<double>( rep().parameters().end() - zSectionsSize(),
538  rep().parameters().end());
539 }
540 
542  : DDSolid(s) {
543  if (s.shape() != ddcons) {
544  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDCons.\n";
545  ex = ex + "Use a different solid interface!";
546  throw cms::Exception("DDException") << ex;
547  }
548 }
549 
550 double
551 DDCons::zhalf() const { return rep().parameters()[0]; }
552 
553 double
554 DDCons::rInMinusZ() const { return rep().parameters()[1]; }
555 
556 double
557 DDCons::rOutMinusZ () const { return rep().parameters()[2]; }
558 
559 double
560 DDCons::rInPlusZ() const { return rep().parameters()[3]; }
561 
562 double
563 DDCons::rOutPlusZ() const { return rep().parameters()[4]; }
564 
565 double
566 DDCons::phiFrom() const { return rep().parameters()[5]; }
567 
568 double
569 DDCons::deltaPhi() const { return rep().parameters()[6]; }
570 
572  : DDSolid(s) {
573  if (s.shape() != ddtorus) {
574  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDTorus.\n";
575  ex = ex + "Use a different solid interface!";
576  throw cms::Exception("DDException") << ex;
577  }
578 }
579 
580 double
581 DDTorus::rMin() const { return rep().parameters()[0]; }
582 
583 double
584 DDTorus::rMax() const { return rep().parameters()[1]; }
585 
586 double
587 DDTorus::rTorus () const { return rep().parameters()[2]; }
588 
589 double
590 DDTorus::startPhi() const { return rep().parameters()[3]; }
591 
592 double
593 DDTorus::deltaPhi() const { return rep().parameters()[4]; }
594 
596  : DDSolid(s) {
597  if (s.shape() != ddtubs) {
598  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDTubs.\n";
599  ex = ex + "Use a different solid interface!";
600  throw cms::Exception("DDException") << ex;
601  }
602 }
603 
604 double
605 DDTubs::zhalf() const { return rep().parameters()[0]; }
606 
607 double
608 DDTubs::rIn() const { return rep().parameters()[1]; }
609 
610 double
611 DDTubs::rOut() const { return rep().parameters()[2]; }
612 
613 double
614 DDTubs::startPhi() const { return rep().parameters()[3]; }
615 
616 double
617 DDTubs::deltaPhi() const { return rep().parameters()[4]; }
618 
620  : DDSolid( s ), union_(nullptr)
621 {
622  union_ = dynamic_cast<DDI::MultiUnion*>(&s.rep());
623 }
624 
625 const std::vector<DDSolid> &
627 {
628  return union_->solids();
629 }
630 
631 const std::vector<DDTranslation> &
633 {
634  return union_->t();
635 }
636 
637 const std::vector<DDRotation> &
639 {
640  return union_->r();
641 }
642 
644  : DDSolid(s), boolean_(nullptr)
645 {
646  boolean_ = dynamic_cast<DDI::BooleanSolid*>(&s.rep());
647 }
648 
651 {
652  return boolean_->r();
653 }
654 
657 {
658  return boolean_->t();
659 }
660 
661 DDSolid
663 {
664  return boolean_->a();
665 }
666 
667 DDSolid
669 {
670  return boolean_->b();
671 }
672 
674  : DDSolid(s) {
675  if (s.shape() != ddsphere) {
676  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDSphere (or sphere section).\n";
677  ex = ex + "Use a different solid interface!";
678  throw cms::Exception("DDException") << ex;
679  }
680 }
681 
682 double
683 DDSphere::innerRadius() const { return rep().parameters()[0]; }
684 
685 double
686 DDSphere::outerRadius() const { return rep().parameters()[1]; }
687 
688 double
689 DDSphere::startPhi () const { return rep().parameters()[2]; }
690 
691 double
692 DDSphere::deltaPhi() const { return rep().parameters()[3]; }
693 
694 double
695 DDSphere::startTheta() const { return rep().parameters()[4]; }
696 
697 double
698 DDSphere::deltaTheta() const { return rep().parameters()[5]; }
699 
701  : DDSolid(s) {
702  if (s.shape() != ddorb) {
703  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDOrb.\n";
704  ex = ex + "Use a different solid interface!";
705  throw cms::Exception("DDException") << ex;
706  }
707 }
708 
709 double
710 DDOrb::radius() const { return rep().parameters()[0]; }
711 
713  : DDSolid(s) {
714  if (s.shape() != ddellipticaltube) {
715  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDEllipticalTube.\n";
716  ex = ex + "Use a different solid interface!";
717  throw cms::Exception("DDException") << ex;
718  }
719 }
720 
721 double
722 DDEllipticalTube::xSemiAxis() const { return rep().parameters()[0]; }
723 
724 double
725 DDEllipticalTube::ySemiAxis() const { return rep().parameters()[1]; }
726 
727 double
728 DDEllipticalTube::zHeight() const { return rep().parameters()[2]; }
729 
731  : DDSolid(s) {
732  if (s.shape() != ddellipsoid) {
733  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDEllipsoid (or truncated ellipsoid).\n";
734  ex = ex + "Use a different solid interface!";
735  throw cms::Exception("DDException") << ex;
736  }
737 }
738 
739 double
740 DDEllipsoid::xSemiAxis() const { return rep().parameters()[0]; }
741 
742 double
743 DDEllipsoid::ySemiAxis() const { return rep().parameters()[1]; }
744 
745 double
746 DDEllipsoid::zSemiAxis() const { return rep().parameters()[2]; }
747 
748 double
749 DDEllipsoid::zBottomCut() const { return rep().parameters()[3]; }
750 
751 double
752 DDEllipsoid::zTopCut() const { return rep().parameters()[4]; }
753 
755  : DDSolid(s) {
756  if (s.shape() != ddparallelepiped) {
757  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDParallelepiped.\n";
758  ex = ex + "Use a different solid interface!";
759  throw cms::Exception("DDException") << ex;
760  }
761 }
762 
763 double
764 DDParallelepiped::xHalf() const { return rep().parameters()[0]; }
765 
766 double
767 DDParallelepiped::yHalf() const { return rep().parameters()[1]; }
768 
769 double
770 DDParallelepiped::zHalf () const { return rep().parameters()[2]; }
771 
772 double
773 DDParallelepiped::alpha() const { return rep().parameters()[3]; }
774 
775 double
776 DDParallelepiped::theta() const { return rep().parameters()[4]; }
777 
778 double
779 DDParallelepiped::phi() const { return rep().parameters()[5]; }
780 
782  : DDSolid(s) {
783  if (s.shape() != ddcuttubs) {
784  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDCutTubs.\n";
785  ex = ex + "Use a different solid interface!";
786  throw cms::Exception("DDException") << ex;
787  }
788 }
789 
790 double
791 DDCutTubs::zhalf() const { return rep().parameters()[0]; }
792 
793 double
794 DDCutTubs::rIn() const { return rep().parameters()[1]; }
795 
796 double
797 DDCutTubs::rOut() const { return rep().parameters()[2]; }
798 
799 double
800 DDCutTubs::startPhi() const { return rep().parameters()[3]; }
801 
802 double
803 DDCutTubs::deltaPhi() const { return rep().parameters()[4]; }
804 
805 std::array<double, 3>
806 DDCutTubs::lowNorm( void ) const {
807  return std::array<double, 3>{{rep().parameters()[5],rep().parameters()[6],rep().parameters()[7]}};
808 }
809 
810 std::array<double, 3>
811 DDCutTubs::highNorm( void ) const {
812  return std::array<double, 3>{{rep().parameters()[8],rep().parameters()[9],rep().parameters()[10]}};
813 }
814 
815 // =================================================================================
816 // =========================SolidFactory============================================
817 
818 DDSolid
820  double xHalf,
821  double yHalf,
822  double zHalf )
823 {
824  return DDSolid(name, new DDI::Box(xHalf, yHalf, zHalf ));
825 }
826 
827 DDSolid
829  const std::vector<double> & z,
830  const std::vector<double> & rmin,
831  const std::vector<double> & rmax)
832 {
833  return DDSolid(name, new DDI::Polycone(startPhi, deltaPhi, z, rmin, rmax));
834 }
835 
836 DDSolid
838  const std::vector<double> & z,
839  const std::vector<double> & r)
840 {
841  return DDSolid(name, new DDI::Polycone(startPhi, deltaPhi, z, r));
842 }
843 
844 
845 DDSolid
847  int sides,
848  double startPhi,
849  double deltaPhi,
850  const std::vector<double> & z,
851  const std::vector<double> & rmin,
852  const std::vector<double> & rmax)
853 {
854  return DDSolid(name, new DDI::Polyhedra( sides, startPhi, deltaPhi, z, rmin, rmax ));
855 }
856 
857 DDSolid
859  int sides,
860  double startPhi,
861  double deltaPhi,
862  const std::vector<double> & z,
863  const std::vector<double> & r)
864 {
865  return DDSolid(name, new DDI::Polyhedra( sides, startPhi, deltaPhi, z, r ));
866 }
867 
868 DDSolid
870  const std::vector<double> & x,
871  const std::vector<double> & y,
872  const std::vector<double> & z,
873  const std::vector<double> & zx,
874  const std::vector<double> & zy,
875  const std::vector<double> & zscale )
876 {
877  return DDSolid( name, new DDI::ExtrudedPolygon( x, y, z, zx, zy, zscale ));
878 }
879 
880 DDSolid
882  const DDSolid & a, const DDSolid & b,
883  const DDTranslation & t,
884  const DDRotation & r)
885 {
886  return DDSolid(name, new DDI::Union(a,b,t,r));
887 }
888 
889 DDSolid
891  const std::vector<DDSolid> & a,
892  const std::vector<DDTranslation> & t,
893  const std::vector<DDRotation> & r )
894 {
895  return DDSolid(name, new DDI::MultiUnion(a,t,r));
896 }
897 
898 DDSolid
900  const DDSolid & a, const DDSolid & b,
901  const DDTranslation & t,
902  const DDRotation & r)
903 {
904  return DDSolid(name, new DDI::Subtraction(a,b,t,r));
905 }
906 
907 DDSolid
909  const DDSolid & a, const DDSolid & b,
910  const DDTranslation & t,
911  const DDRotation & r)
912 {
913  return DDSolid(name, new DDI::Intersection(a,b,t,r));
914 }
915 
916 DDSolid
918  double pDz,
919  double pTheta, double pPhi,
920  double pDy1, double pDx1, double pDx2,
921  double pAlp1,
922  double pDy2, double pDx3, double pDx4,
923  double pAlp2)
924 {
925  return DDSolid(name, new DDI::Trap(pDz, pTheta, pPhi,
926  pDy1, pDx1, pDx2, pAlp1,
927  pDy2, pDx3, pDx4, pAlp2));
928 }
929 
930 DDSolid
932  double pDx1,
933  double pDx2,
934  double pDy1,
935  double pDy2,
936  double pDz,
937  double radius,
938  bool atMinusZ
939  )
940 {
941  return DDSolid(name, new DDI::PseudoTrap(pDx1, pDx2, pDy1, pDy2, pDz, radius, atMinusZ));
942 }
943 
944 DDSolid
946  double zHalf,
947  double rIn,
948  double rOut,
949  double startPhi,
950  double deltaPhi,
951  double cutAtStart,
952  double cutAtDelta,
953  bool cutInside )
954 {
955  return DDSolid(name, new DDI::TruncTubs(zHalf,rIn,rOut,startPhi,deltaPhi,cutAtStart,cutAtDelta,cutInside));
956 }
957 
958 DDSolid
960  double zhalf,
961  double rInMinusZ,
962  double rOutMinusZ,
963  double rInPlusZ,
964  double rOutPlusZ,
965  double phiFrom,
966  double deltaPhi)
967 {
968  return DDSolid(name, new DDI::Cons(zhalf,
969  rInMinusZ, rOutMinusZ,
970  rInPlusZ, rOutPlusZ,
971  phiFrom, deltaPhi));
972 }
973 
974 DDSolid
976  double rMin,
977  double rMax,
978  double rTorus,
979  double startPhi,
980  double deltaPhi)
981 {
982  return DDSolid(name, new DDI::Torus(rMin, rMax, rTorus, startPhi, deltaPhi));
983 }
984 
985 DDSolid
987  double zhalf,
988  double rIn, double rOut,
989  double phiFrom, double deltaPhi)
990 {
991  return DDSolid(name, new DDI::Tubs(zhalf,rIn,rOut,phiFrom,deltaPhi));
992 }
993 
994 DDSolid
996  double zhalf,
997  double rIn, double rOut,
998  double phiFrom, double deltaPhi,
999  double lx, double ly, double lz,
1000  double tx, double ty, double tz)
1001 {
1002  return DDSolid(name, new DDI::CutTubs(zhalf,rIn,rOut,phiFrom,deltaPhi,lx,ly,lz,tx,ty,tz));
1003 }
1004 
1005 DDSolid
1007  double innerRadius,
1008  double outerRadius,
1009  double startPhi,
1010  double deltaPhi,
1011  double startTheta,
1012  double deltaTheta)
1013 {
1014  return DDSolid(name, new DDI::Sphere(innerRadius, outerRadius,
1015  startPhi, deltaPhi,
1016  startTheta, deltaTheta));
1017 }
1018 
1019 DDSolid
1021 {
1022  return DDSolid(name, new DDI::Orb(radius));
1023 }
1024 
1025 DDSolid
1027  double xSemiAxis, double ySemiAxis, double zHeight)
1028 {
1029  return DDSolid(name, new DDI::EllipticalTube(xSemiAxis, ySemiAxis, zHeight));
1030 }
1031 
1032 DDSolid
1034  double xSemiAxis,
1035  double ySemiAxis,
1036  double zSemiAxis,
1037  double zBottomCut,
1038  double zTopCut
1039  )
1040 {
1041  return DDSolid(name, new DDI::Ellipsoid( xSemiAxis,
1042  ySemiAxis,
1043  zSemiAxis,
1044  zBottomCut,
1045  zTopCut
1046  ));
1047 }
1048 
1049 DDSolid
1051  double xHalf, double yHalf, double zHalf,
1052  double alpha, double theta, double phi)
1053 {
1054  return DDSolid(name, new DDI::Parallelepiped(xHalf, yHalf, zHalf,
1055  alpha, theta, phi));
1056 }
1057 
1058 DDSolid
1060 {
1061  return DDSolid(name, new DDI::Shapeless());
1062 }
1063 
1064 DDSolid
1066  const DDSolid & s)
1067 {
1068  return DDSolid(name, new DDI::Reflection(s));
1069 }
double zhalf(void) const
Definition: DDSolid.cc:551
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:975
double startPhi(void) const
Definition: DDSolid.cc:427
double zhalf(void) const
Definition: DDSolid.cc:791
double cutAtStart(void) const
truncation at begin of the tube-section
Definition: DDSolid.cc:223
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
const DDI::rep_traits< N, C >::reference rep() const
Definition: DDBase.h:84
double xHalf(void) const
Definition: DDSolid.cc:764
double xSemiAxis(void) const
Definition: DDSolid.cc:740
float alpha
Definition: AMPTWrapper.h:95
double phi(void) const
Definition: DDSolid.cc:779
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:165
DDBox(void)=delete
def_type isDefined() const
Definition: DDBase.h:110
bool cutInside(void) const
true, if truncation is on the inner side of the tube-section
Definition: DDSolid.cc:229
double halfZ(void) const
Definition: DDSolid.cc:280
DDTorus(void)=delete
std::vector< double > rVec(void) const
Definition: DDSolid.cc:382
double theta(void) const
Definition: DDSolid.cc:776
const std::vector< DDRotation > & rotations(void) const
Definition: DDSolid.cc:638
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:177
const N & name() const
Definition: DDBase.h:78
double zHalf(void) const
half of the z-Axis
Definition: DDSolid.cc:208
const DDTranslation & t() const
Definition: Boolean.h:22
double y2(void) const
half length along y on +z
Definition: DDSolid.cc:253
auto zSectionsSize(void) const -> std::size_t
Definition: DDSolid.cc:485
double halfY(void) const
Definition: DDSolid.cc:276
double startTheta(void) const
Definition: DDSolid.cc:695
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:457
double deltaPhi(void) const
angular span of the tube-section
Definition: DDSolid.cc:220
static DDSolid pseudoTrap(const DDName &name, double pDx1, double pDx2, double pDy1, double pDy2, double pDz, double radius, bool atMinusZ)
Definition: DDSolid.cc:931
Definition: Trap.h:9
double deltaPhi(void) const
Definition: DDSolid.cc:692
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:406
static DDSolid parallelepiped(const DDName &name, double xHalf, double yHalf, double zHalf, double alpha, double theta, double phi)
Definition: DDSolid.cc:1050
Abstract class for DDPolycone and DDPolyhedra. Basically a common member function.
Definition: DDSolid.h:233
double phi(void) const
Azimuthal angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:171
DDPolySolid(void)=delete
DDOrb(void)=delete
static DDSolid multiUnionSolid(const DDName &name, const std::vector< DDSolid > &a, const std::vector< DDTranslation > &t, const std::vector< DDRotation > &r)
Definition: DDSolid.cc:890
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:348
const std::vector< DDSolid > & solids(void) const
Definition: DDSolid.cc:626
static DDSolid cons(const DDName &name, double zhalf, double rInMinusZ, double rOutMinusZ, double rInPlusZ, double rOutPlusZ, double phiFrom, double deltaPhi)
Definition: DDSolid.cc:959
std::array< double, 3 > highNorm(void) const
Definition: DDSolid.cc:811
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:828
double rTorus(void) const
Definition: DDSolid.cc:587
DDSolidShape
Definition: DDSolidShapes.h:6
std::vector< double > rVec(void) const
Definition: DDSolid.cc:433
double cutAtDelta(void) const
truncation at end of the tube-section
Definition: DDSolid.cc:226
std::vector< double > yVec(void) const
Definition: DDSolid.cc:507
double phiFrom(void) const
Definition: DDSolid.cc:566
Geom::Theta< T > theta() const
DDReflectionSolid(void)=delete
DDSphere(void)=delete
double zTopCut(void) const
Definition: DDSolid.cc:752
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:104
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
double radius(void) const
Definition: DDSolid.cc:710
double rIn(void) const
inner radius
Definition: DDSolid.cc:211
const DDSolid & a() const
Definition: Boolean.h:20
double rOutMinusZ(void) const
Definition: DDSolid.cc:557
const std::vector< DDTranslation > & t() const
Definition: Boolean.h:39
double rOutPlusZ(void) const
Definition: DDSolid.cc:563
std::vector< double > zyVec(void) const
Definition: DDSolid.cc:528
DDPolyhedra(void)=delete
const DDRotation & r() const
Definition: Boolean.h:23
DDTranslation translation(void) const
Definition: DDSolid.cc:656
#define nullptr
double ySemiAxis(void) const
Definition: DDSolid.cc:743
DDIntersection(void)=delete
double innerRadius(void) const
Definition: DDSolid.cc:683
Definition: Tubs.h:9
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
double y1(void) const
half length along y on -z
Definition: DDSolid.cc:250
DDSolid solidB(void) const
Definition: DDSolid.cc:668
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDTruncTubs(void)=delete
double rMax(void) const
Definition: DDSolid.cc:584
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
std::vector< double > xVec(void) const
Definition: DDSolid.cc:500
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:995
std::array< double, 3 > lowNorm(void) const
Definition: DDSolid.cc:806
void setParameters(std::vector< double > const &p)
Definition: Solid.h:28
static value_type & instance()
Definition: Orb.h:13
double outerRadius(void) const
Definition: DDSolid.cc:686
DDTubs(void)=delete
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:22
DDSolid unreflected(void) const
Definition: DDSolid.cc:291
auto xyPointsSize(void) const -> std::size_t
Definition: DDSolid.cc:475
DDPolycone(void)=delete
double x4(void) const
Half-length along x of the side at y=+pDy2 of the face at +pDz.
Definition: DDSolid.cc:192
static size_t size()
Definition: DDBase.h:69
DDI::BooleanSolid * boolean_
Definition: DDSolid.h:213
static DDSolid intersection(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:908
DDRotation rotation(void) const
Definition: DDSolid.cc:650
std::ostream & operator<<(std::ostream &os, const DDSolid &solid)
Definition: DDSolid.cc:34
double yHalf(void) const
Definition: DDSolid.cc:767
bool atMinusZ(void) const
true, if cut-out or rounding is on the -z side
Definition: DDSolid.cc:259
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:241
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:398
DDParallelepiped(void)=delete
double startPhi(void) const
Definition: DDSolid.cc:614
double startPhi(void) const
Definition: DDSolid.cc:377
double xSemiAxis(void) const
Definition: DDSolid.cc:722
static DDSolid sphere(const DDName &name, double innerRadius, double outerRadius, double startPhi, double deltaPhi, double startTheta, double deltaTheta)
Definition: DDSolid.cc:1006
static DDSolid orb(const DDName &name, double radius)
Definition: DDSolid.cc:1020
const DDSolid & b() const
Definition: Boolean.h:21
DDI::Reflection * reflected_
Definition: DDSolid.h:196
double deltaPhi(void) const
Definition: DDSolid.cc:380
static DDSolid ellipsoid(const DDName &name, double xSemiAxis, double ySemiAxis, double zSemiAxis, double zBottomCut=0., double zTopCut=0.)
Definition: DDSolid.cc:1033
double startPhi(void) const
Definition: DDSolid.cc:689
double alpha(void) const
Definition: DDSolid.cc:773
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:174
double rInMinusZ(void) const
Definition: DDSolid.cc:554
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144
double rOut(void) const
Definition: DDSolid.cc:797
double deltaTheta(void) const
Definition: DDSolid.cc:698
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:986
DDI::MultiUnion * union_
Definition: DDSolid.h:229
double ySemiAxis(void) const
Definition: DDSolid.cc:725
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:945
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:917
double rMin(void) const
Definition: DDSolid.cc:581
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:819
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:449
double rOut(void) const
Definition: DDSolid.cc:611
double deltaPhi(void) const
Definition: DDSolid.cc:803
DDMultiUnion(void)=delete
int sides(void) const
Definition: DDSolid.cc:424
DDSolid solidA(void) const
Definition: DDSolid.cc:662
double deltaPhi(void) const
Definition: DDSolid.cc:569
double deltaPhi(void) const
Definition: DDSolid.cc:617
double startPhi(void) const
Definition: DDSolid.cc:590
DDCutTubs(void)=delete
std::vector< double > zVec(void) const
Definition: DDSolid.cc:514
double halfX(void) const
Definition: DDSolid.cc:272
std::vector< double > zxVec(void) const
Definition: DDSolid.cc:521
static DDSolid ellipticalTube(const DDName &name, double xSemiAxis, double ySemiAxis, double zHeight)
Definition: DDSolid.cc:1026
std::vector< double > zVec(void) const
Definition: DDSolid.cc:441
double deltaPhi(void) const
Definition: DDSolid.cc:593
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:869
const std::vector< DDTranslation > & translations(void) const
Definition: DDSolid.cc:632
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:899
double b
Definition: hdecay.h:120
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:183
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:195
double startPhi(void) const
angular start of the tube-section
Definition: DDSolid.cc:217
double zBottomCut(void) const
Definition: DDSolid.cc:749
const std::vector< DDSolid > & solids() const
Definition: Boolean.h:38
DDEllipsoid(void)=delete
Definition: Cons.h:9
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:180
double zhalf(void) const
Definition: DDSolid.cc:605
static DDSolid reflection(const DDName &name, const DDSolid &s)
Definition: DDSolid.cc:1065
static DDSolid shapeless(const DDName &name)
Definition: DDSolid.cc:1059
DDEllipticalTube(void)=delete
DDShapelessSolid(void)=delete
double zHeight(void) const
Definition: DDSolid.cc:728
double a
Definition: hdecay.h:121
double zSemiAxis(void) const
Definition: DDSolid.cc:746
DDUnion(void)=delete
const std::vector< DDRotation > & r() const
Definition: Boolean.h:40
double deltaPhi(void) const
Definition: DDSolid.cc:430
double y2(void) const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:186
DDBooleanSolid(void)=delete
DDSubtraction(void)=delete
double rInPlusZ(void) const
Definition: DDSolid.cc:560
Definition: Box.h:13
DDSolid(void)
Uninitialilzed solid reference-object; for further details on reference-objects see documentation of ...
Definition: DDSolid.cc:53
def which(cmd)
Definition: eostools.py:335
double zHalf(void) const
Definition: DDSolid.cc:770
static DDSolid unionSolid(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:881
DDTrap(void)=delete
double x2(void) const
half length along x on +z
Definition: DDSolid.cc:247
const DDSolid & solid() const
Definition: Reflection.h:16
double rIn(void) const
Definition: DDSolid.cc:794
double rIn(void) const
Definition: DDSolid.cc:608
double rOut(void) const
outer radius
Definition: DDSolid.cc:214
double theta(void) const
Polar angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:168
DDMultiUnionSolid(void)=delete
std::vector< double > zscaleVec(void) const
Definition: DDSolid.cc:535
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
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:846
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
Definition: DDSolid.cc:189
double volume(void) const
Returns the volume of the given solid (does not work with boolean soids !)
Definition: DDSolid.cc:138
std::vector< double > zVec(void) const
Definition: DDSolid.cc:390
double x1(void) const
half length along x on -z
Definition: DDSolid.cc:244
double startPhi(void) const
Definition: DDSolid.cc:800
double radius(void) const
radius of the cut-out (neg.) or rounding (pos.)
Definition: DDSolid.cc:256
DDCons(void)=delete