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