CMS 3D CMS Logo

DDSolid.cc
Go to the documentation of this file.
3 
4 #include <ostream>
5 #include <string>
6 #include <array>
7 
26 
27 using DDI::Solid;
28 
29 std::ostream&
30 operator<<(std::ostream& os, const DDSolidShape s)
31 {
32  return os << "DDSolidShape index:" << static_cast<int>(s) << ", name: " << DDSolidShapesName::name(s);
33 }
34 
35 std::ostream &
36 operator<<(std::ostream & os, const DDSolid & solid)
37 {
39  if (defined.first) {
40  os << *(defined.first) << " ";
41  if (defined.second) {
42  os << " " << DDSolidShapesName::name(solid.shape()) << ": ";
43  solid.rep().stream(os);
44  }
45  else {
46  os << "* solid not defined * ";
47  }
48  }
49  else {
50  os << "* solid not declared * ";
51  }
52  return os;
53 }
54 
56  : DDBase< DDName, std::unique_ptr< Solid >>() { }
57 
59  : DDBase< DDName, std::unique_ptr< Solid >>()
60 {
61  create( name );
62 }
63 
64 DDSolid::DDSolid( const DDName & name, std::unique_ptr< Solid > solid )
65  : DDBase< DDName, std::unique_ptr< Solid >>()
66 {
67  create( name, std::move( solid ));
68 }
69 
70 DDSolid::DDSolid( const DDName & name, DDSolidShape shape, const std::vector<double> & pars )
71 {
72  std::unique_ptr<DDI::Solid> solid( nullptr );
73  std::vector<double> dummy;
74  switch( shape ) {
76  solid = std::make_unique< DDI::Box >( 0, 0, 0 );
77  break;
79  solid = std::make_unique< DDI::Tubs >( 0, 0, 0, 0, 0 );
80  break;
82  solid = std::make_unique< DDI::Cons >( 0, 0, 0, 0, 0, 0, 0 );
83  break;
85  solid = std::make_unique< DDI::PseudoTrap >( 0, 0, 0, 0, 0, 0, false );
86  break;
88  solid = std::make_unique< DDI::Shapeless >( );
89  break;
91  solid = std::make_unique< DDI::Trap >( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
92  break;
94  solid = std::make_unique< DDI::Polyhedra >( 0, 0, 0, dummy, dummy );
95  break;
97  solid = std::make_unique< DDI::Polyhedra >( 0, 0, 0, dummy, dummy, dummy );
98  break;
100  solid = std::make_unique< DDI::Polycone >( 0, 0, dummy, dummy );
101  break;
103  solid = std::make_unique< DDI::Polycone >( 0, 0, dummy, dummy, dummy );
104  break;
106  solid = std::make_unique< DDI::TruncTubs >( 0, 0, 0, 0, 0, 0, 0, false );
107  break;
109  solid = std::make_unique< DDI::Torus >( 0, 0, 0, 0, 0 );
110  break;
112  solid = std::make_unique< DDI::Sphere >( 0, 0, 0, 0, 0, 0 );
113  break;
115  solid = std::make_unique< DDI::EllipticalTube >( 0, 0, 0 );
116  break;
118  solid = std::make_unique< DDI::CutTubs >( 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., -1. );
119  break;
121  solid = std::make_unique< DDI::ExtrudedPolygon >( dummy, dummy, dummy, dummy, dummy, dummy );
122  break;
123  default:
124  throw cms::Exception( "DDException" )
125  << "DDSolid::DDSolid( DDName, DDSolidShape, std::vector<double> ): wrong shape.";
126  }
127  solid->setParameters( pars );
128  create( name, std::move( solid ));
129 }
130 
131 double
133 {
134  return rep().volume();
135 }
136 
139 {
140  return rep().shape();
141 }
142 
143 const std::vector<double> &
145 {
146  return rep().parameters();
147 }
148 
150 {
151  if (s.shape() != DDSolidShape::ddtrap) {
152  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDTrap.\n";
153  ex = ex + "Use a different solid interface!";
154  throw cms::Exception("DDException") << ex;
155  }
156 }
157 
158 double
159 DDTrap::halfZ() const { return rep().parameters()[0]; }
160 
161 double
162 DDTrap::theta() const { return rep().parameters()[1]; }
163 
164 double
165 DDTrap::phi() const { return rep().parameters()[2]; }
166 
167 double
168 DDTrap::y1() const { return rep().parameters()[3]; }
169 
170 double
171 DDTrap::x1() const { return rep().parameters()[4]; }
172 
173 double
174 DDTrap::x2() const { return rep().parameters()[5]; }
175 
176 double
177 DDTrap::alpha1() const { return rep().parameters()[6]; }
178 
179 double
180 DDTrap::y2() const { return rep().parameters()[7]; }
181 
182 double
183 DDTrap::x3() const { return rep().parameters()[8]; }
184 
185 double
186 DDTrap::x4() const { return rep().parameters()[9]; }
187 
188 double
189 DDTrap::alpha2() const { return rep().parameters()[10]; }
190 
192 {
193  if (s.shape() != DDSolidShape::ddtrunctubs) {
194  edm::LogError ("DDSolid") << "s.shape()=" << s.shape() << " " << s.name() << std::endl;
195  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDTruncTubs\n";
196  ex = ex + "Use a different solid interface!";
197  throw cms::Exception("DDException") << ex;
198  }
199 }
200 
201 double
202 DDTruncTubs::zHalf() const { return rep().parameters()[0];}
203 
204 double
205 DDTruncTubs::rIn() const { return rep().parameters()[1];}
206 
207 double
208 DDTruncTubs::rOut() const { return rep().parameters()[2];}
209 
210 double
211 DDTruncTubs::startPhi() const { return rep().parameters()[3];}
212 
213 double
214 DDTruncTubs::deltaPhi() const { return rep().parameters()[4];}
215 
216 double
217 DDTruncTubs::cutAtStart() const { return rep().parameters()[5];}
218 
219 double
220 DDTruncTubs::cutAtDelta() const { return rep().parameters()[6];}
221 
222 bool
223 DDTruncTubs::cutInside() const { return bool(rep().parameters()[7]);}
224 
226 {
227  if (s.shape() != DDSolidShape::ddpseudotrap) {
228  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDPseudoTrap\n";
229  ex = ex + "Use a different solid interface!";
230  throw cms::Exception("DDException") << ex;
231  }
232 }
233 
234 double
235 DDPseudoTrap::halfZ() const { return rep().parameters()[4]; }
236 
237 double
238 DDPseudoTrap::x1() const { return rep().parameters()[0]; }
239 
240 double
241 DDPseudoTrap::x2() const { return rep().parameters()[1]; }
242 
243 double
244 DDPseudoTrap::y1() const { return rep().parameters()[2]; }
245 
246 double
247 DDPseudoTrap::y2() const { return rep().parameters()[3]; }
248 
249 double
250 DDPseudoTrap::radius() const { return rep().parameters()[5]; }
251 
252 bool
253 DDPseudoTrap::atMinusZ() const { return rep().parameters()[6]; }
254 
256  : DDSolid(s)
257 {
258  if (s.shape() != DDSolidShape::ddbox) {
259  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDBox.\n";
260  ex = ex + "Use a different solid interface!";
261  throw cms::Exception("DDException") << ex;
262  }
263 }
264 
265 double
267 { return rep().parameters()[0]; }
268 
269 double
271 { return rep().parameters()[1]; }
272 
273 double
275 { return rep().parameters()[2]; }
276 
278 {
279  if (s.shape() != DDSolidShape::ddshapeless) {
280  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDShapelessSolid.\n";
281  ex = ex + "Use a different solid interface!";
282  throw cms::Exception("DDException") << ex;
283  }
284 }
285 
287  : DDBooleanSolid(s)
288 {
289  if (s.shape() != DDSolidShape::ddunion) {
290  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDUnion.\n";
291  ex = ex + "Use a different solid interface!";
292  throw cms::Exception("DDException") << ex;
293  }
294 }
295 
297  : DDBooleanSolid(s)
298 {
299  if (s.shape() != DDSolidShape::ddunion) {
300  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDIntersection.\n";
301  ex = ex + "Use a different solid interface!";
302  throw cms::Exception("DDException") << ex;
303  }
304 }
305 
307  : DDBooleanSolid(s)
308 {
309  if (s.shape() != DDSolidShape::ddsubtraction) {
310  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is no DDSubtraction.\n";
311  ex = ex + "Use a different solid interface!";
312  throw cms::Exception("DDException") << ex;
313  }
314 }
315 
317  : DDSolid(s)
318 { }
319 
320 std::vector<double>
321 DDPolySolid::getVec (const size_t& which,
322  const size_t& offset,
323  const size_t& numVecs) const
324 {
325  // which: first second or third std::vector
326  // offset: number of non-std::vector components before std::vectors start
327  if(( rep().parameters().size() - offset) % numVecs != 0 ) {
328  edm::LogError ("DDSolid") << "Could not find equal sized components of std::vectors in a PolySolid description."
329  << "rep().parameters().size()=" << rep().parameters().size() << " numVecs=" << numVecs
330  << " offset=" << offset << std::endl;
331  }
332  std::vector<double> tvec;
333  for( size_t i = offset + which; i < rep().parameters().size(); i = i + numVecs ) {
334  tvec.emplace_back( rep().parameters()[i]);
335  }
336  return tvec;
337 }
338 
340  : DDPolySolid(s)
341 {
343  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDPolycone.\n";
344  ex = ex + "Use a different solid interface!";
345  throw cms::Exception("DDException") << ex;
346  }
347 }
348 
349 double
350 DDPolycone::startPhi() const { return rep().parameters()[0]; }
351 
352 double
353 DDPolycone::deltaPhi() const { return rep().parameters()[1]; }
354 
355 std::vector<double> DDPolycone::rVec() const {
356  std::vector<double> tvec;
358  tvec = getVec(1, 2, 2);
359  return tvec;
360 }
361 
362 std::vector<double>
365  return getVec(0, 2, 2);
366  else // (shape() == DDSolidShape::ddpolycone_rrz)
367  return getVec(0, 2, 3);
368 }
369 
370 std::vector<double>
372  std::vector<double> tvec;
374  tvec = getVec(1, 2, 3);
375  return tvec;
376 }
377 
378 std::vector<double>
380  std::vector<double> tvec;
382  tvec = getVec(2, 2, 3);
383  return tvec;
384 }
385 
387  : DDPolySolid(s)
388 {
390  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDPolyhedra.\n";
391  ex = ex + "Use a different solid interface!";
392  throw cms::Exception("DDException") << ex;
393  }
394 }
395 
396 int
397 DDPolyhedra::sides() const { return int(rep().parameters()[0]); }
398 
399 double
400 DDPolyhedra::startPhi() const { return rep().parameters()[1]; }
401 
402 double
403 DDPolyhedra::deltaPhi() const { return rep().parameters()[2]; }
404 
405 std::vector<double>
407  std::vector<double> tvec;
409  tvec = getVec(1, 3, 2);
410  return tvec;
411 }
412 
413 std::vector<double>
416  return getVec(0, 3, 2);
417  else // (shape() == ddpolycone_rrz)
418  return getVec(0, 3, 3);
419 }
420 
421 std::vector<double>
423  std::vector<double> tvec;
425  tvec = getVec(1, 3, 3);
426  return tvec;
427 }
428 
429 std::vector<double>
431  std::vector<double> tvec;
433  tvec = getVec(2, 3, 3);
434  return tvec;
435 }
436 
438  : DDPolySolid(s)
439 {
441  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDExtrudedPolygon.\n";
442  ex = ex + "Use a different solid interface!";
443  throw cms::Exception("DDException") << ex;
444  }
445 }
446 
447 auto
448 DDExtrudedPolygon::xyPointsSize( void ) const -> std::size_t
449 {
450  // Compute the size of the X and Y coordinate vectors
451  // which define the vertices of the outlined polygon
452  // defined in clock-wise order
453 
454  return ( rep().parameters().size() - 4 * zSectionsSize()) * 0.5;
455 }
456 
457 auto
458 DDExtrudedPolygon::zSectionsSize( void ) const -> std::size_t
459 {
460  // The first parameters element stores a size of the four equal size vectors
461  // which form the ExtrudedPolygon shape Z sections:
462  //
463  // * first: Z coordinate of the XY polygone plane,
464  // * second and third: x and y offset of the polygone in the XY plane,
465  // * fourth: the polygone scale in each XY plane
466  //
467  // The Z sections defined by the z position in an increasing order.
468 
469  return rep().parameters()[0];
470 }
471 
472 std::vector<double>
474 {
475  return std::vector<double>( rep().parameters().begin() + 1,
476  rep().parameters().begin() + 1 + xyPointsSize());
477 }
478 
479 std::vector<double>
481 {
482  return std::vector<double>( rep().parameters().begin() + 1 + xyPointsSize(),
483  rep().parameters().begin() + 1 + 2 * xyPointsSize());
484 }
485 
486 std::vector<double>
488 {
489  return std::vector<double>( rep().parameters().end() - 4 * zSectionsSize(),
490  rep().parameters().end() - 3 * zSectionsSize());
491 }
492 
493 std::vector<double>
495 {
496  return std::vector<double>( rep().parameters().end() - 3 * zSectionsSize(),
497  rep().parameters().end() - 2 * zSectionsSize());
498 }
499 
500 std::vector<double>
502 {
503  return std::vector<double>( rep().parameters().end() - 2 * zSectionsSize(),
504  rep().parameters().end() - zSectionsSize());
505 }
506 
507 std::vector<double>
509 {
510  return std::vector<double>( rep().parameters().end() - zSectionsSize(),
511  rep().parameters().end());
512 }
513 
515  : DDSolid(s) {
516  if (s.shape() != DDSolidShape::ddcons) {
517  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDCons.\n";
518  ex = ex + "Use a different solid interface!";
519  throw cms::Exception("DDException") << ex;
520  }
521 }
522 
523 double
524 DDCons::zhalf() const { return rep().parameters()[0]; }
525 
526 double
527 DDCons::rInMinusZ() const { return rep().parameters()[1]; }
528 
529 double
530 DDCons::rOutMinusZ () const { return rep().parameters()[2]; }
531 
532 double
533 DDCons::rInPlusZ() const { return rep().parameters()[3]; }
534 
535 double
536 DDCons::rOutPlusZ() const { return rep().parameters()[4]; }
537 
538 double
539 DDCons::phiFrom() const { return rep().parameters()[5]; }
540 
541 double
542 DDCons::deltaPhi() const { return rep().parameters()[6]; }
543 
545  : DDSolid(s) {
546  if (s.shape() != DDSolidShape::ddtorus) {
547  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDTorus.\n";
548  ex = ex + "Use a different solid interface!";
549  throw cms::Exception("DDException") << ex;
550  }
551 }
552 
553 double
554 DDTorus::rMin() const { return rep().parameters()[0]; }
555 
556 double
557 DDTorus::rMax() const { return rep().parameters()[1]; }
558 
559 double
560 DDTorus::rTorus () const { return rep().parameters()[2]; }
561 
562 double
563 DDTorus::startPhi() const { return rep().parameters()[3]; }
564 
565 double
566 DDTorus::deltaPhi() const { return rep().parameters()[4]; }
567 
569  : DDSolid(s) {
570  if (s.shape() != DDSolidShape::ddtubs) {
571  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDTubs.\n";
572  ex = ex + "Use a different solid interface!";
573  throw cms::Exception("DDException") << ex;
574  }
575 }
576 
577 double
578 DDTubs::zhalf() const { return rep().parameters()[0]; }
579 
580 double
581 DDTubs::rIn() const { return rep().parameters()[1]; }
582 
583 double
584 DDTubs::rOut() const { return rep().parameters()[2]; }
585 
586 double
587 DDTubs::startPhi() const { return rep().parameters()[3]; }
588 
589 double
590 DDTubs::deltaPhi() const { return rep().parameters()[4]; }
591 
593  : DDSolid( s ),
594  boolean_( static_cast< DDI::BooleanSolid& >( s.rep()))
595 {}
596 
599 {
600  return boolean_.r();
601 }
602 
605 {
606  return boolean_.t();
607 }
608 
609 DDSolid
611 {
612  return boolean_.a();
613 }
614 
615 DDSolid
617 {
618  return boolean_.b();
619 }
620 
622  : DDSolid( s ) {
623  if( s.shape() != DDSolidShape::ddsphere ) {
624  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDSphere (or sphere section).\n";
625  ex = ex + "Use a different solid interface!";
626  throw cms::Exception("DDException") << ex;
627  }
628 }
629 
630 double
631 DDSphere::innerRadius() const { return rep().parameters()[0]; }
632 
633 double
634 DDSphere::outerRadius() const { return rep().parameters()[1]; }
635 
636 double
637 DDSphere::startPhi () const { return rep().parameters()[2]; }
638 
639 double
640 DDSphere::deltaPhi() const { return rep().parameters()[3]; }
641 
642 double
643 DDSphere::startTheta() const { return rep().parameters()[4]; }
644 
645 double
646 DDSphere::deltaTheta() const { return rep().parameters()[5]; }
647 
649  : DDSolid(s) {
651  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDEllipticalTube.\n";
652  ex = ex + "Use a different solid interface!";
653  throw cms::Exception("DDException") << ex;
654  }
655 }
656 
657 double
658 DDEllipticalTube::xSemiAxis() const { return rep().parameters()[0]; }
659 
660 double
661 DDEllipticalTube::ySemiAxis() const { return rep().parameters()[1]; }
662 
663 double
664 DDEllipticalTube::zHeight() const { return rep().parameters()[2]; }
665 
667  : DDSolid(s) {
668  if (s.shape() != DDSolidShape::ddcuttubs) {
669  std::string ex = "Solid [" + s.name().ns() + ":" + s.name().name() + "] is not a DDCutTubs.\n";
670  ex = ex + "Use a different solid interface!";
671  throw cms::Exception("DDException") << ex;
672  }
673 }
674 
675 double
676 DDCutTubs::zhalf() const { return rep().parameters()[0]; }
677 
678 double
679 DDCutTubs::rIn() const { return rep().parameters()[1]; }
680 
681 double
682 DDCutTubs::rOut() const { return rep().parameters()[2]; }
683 
684 double
685 DDCutTubs::startPhi() const { return rep().parameters()[3]; }
686 
687 double
688 DDCutTubs::deltaPhi() const { return rep().parameters()[4]; }
689 
690 std::array<double, 3>
691 DDCutTubs::lowNorm( void ) const {
692  return std::array<double, 3>{{rep().parameters()[5],rep().parameters()[6],rep().parameters()[7]}};
693 }
694 
695 std::array<double, 3>
696 DDCutTubs::highNorm( void ) const {
697  return std::array<double, 3>{{rep().parameters()[8],rep().parameters()[9],rep().parameters()[10]}};
698 }
699 
700 // =================================================================================
701 // =========================SolidFactory============================================
702 
703 DDSolid
705  double xHalf,
706  double yHalf,
707  double zHalf )
708 {
709  return DDSolid( name, std::make_unique< DDI::Box >( xHalf, yHalf, zHalf ));
710 }
711 
712 DDSolid
714  const std::vector<double> & z,
715  const std::vector<double> & rmin,
716  const std::vector<double> & rmax )
717 {
718  return DDSolid( name, std::make_unique< DDI::Polycone >( startPhi, deltaPhi, z, rmin, rmax ));
719 }
720 
721 DDSolid
723  const std::vector<double> & z,
724  const std::vector<double> & r )
725 {
726  return DDSolid(name, std::make_unique< DDI::Polycone >( startPhi, deltaPhi, z, r ));
727 }
728 
729 DDSolid
731  int sides,
732  double startPhi,
733  double deltaPhi,
734  const std::vector<double> & z,
735  const std::vector<double> & rmin,
736  const std::vector<double> & rmax )
737 {
738  return DDSolid( name, std::make_unique< DDI::Polyhedra >( sides, startPhi, deltaPhi, z, rmin, rmax ));
739 }
740 
741 DDSolid
743  int sides,
744  double startPhi,
745  double deltaPhi,
746  const std::vector<double> & z,
747  const std::vector<double> & r )
748 {
749  return DDSolid( name, std::make_unique< DDI::Polyhedra >( sides, startPhi, deltaPhi, z, r ));
750 }
751 
752 DDSolid
754  const std::vector<double> & x,
755  const std::vector<double> & y,
756  const std::vector<double> & z,
757  const std::vector<double> & zx,
758  const std::vector<double> & zy,
759  const std::vector<double> & zscale )
760 {
761  return DDSolid( name, std::make_unique< DDI::ExtrudedPolygon >( x, y, z, zx, zy, zscale ));
762 }
763 
764 DDSolid
766  const DDSolid & a, const DDSolid & b,
767  const DDTranslation & t,
768  const DDRotation & r )
769 {
770  return DDSolid( name, std::make_unique< DDI::Union >( a, b, t, r ));
771 }
772 
773 DDSolid
775  const DDSolid & a, const DDSolid & b,
776  const DDTranslation & t,
777  const DDRotation & r )
778 {
779  return DDSolid( name, std::make_unique< DDI::Subtraction >( a, b, t, r ));
780 }
781 
782 DDSolid
784  const DDSolid & a, const DDSolid & b,
785  const DDTranslation & t,
786  const DDRotation & r )
787 {
788  return DDSolid( name, std::make_unique< DDI::Intersection >( a, b, t, r ));
789 }
790 
791 DDSolid
793  double pDz,
794  double pTheta, double pPhi,
795  double pDy1, double pDx1, double pDx2,
796  double pAlp1,
797  double pDy2, double pDx3, double pDx4,
798  double pAlp2 )
799 {
800  return DDSolid( name, std::make_unique< DDI::Trap >( pDz, pTheta, pPhi,
801  pDy1, pDx1, pDx2, pAlp1,
802  pDy2, pDx3, pDx4, pAlp2 ));
803 }
804 
805 DDSolid
807  double pDx1,
808  double pDx2,
809  double pDy1,
810  double pDy2,
811  double pDz,
812  double radius,
813  bool atMinusZ
814  )
815 {
816  return DDSolid( name, std::make_unique< DDI::PseudoTrap >( pDx1, pDx2, pDy1, pDy2, pDz,
817  radius, atMinusZ ));
818 }
819 
820 DDSolid
822  double zHalf,
823  double rIn,
824  double rOut,
825  double startPhi,
826  double deltaPhi,
827  double cutAtStart,
828  double cutAtDelta,
829  bool cutInside )
830 {
831  return DDSolid( name, std::make_unique< DDI::TruncTubs >( zHalf, rIn, rOut,
832  startPhi, deltaPhi,
833  cutAtStart, cutAtDelta,
834  cutInside ));
835 }
836 
837 DDSolid
839  double zhalf,
840  double rInMinusZ,
841  double rOutMinusZ,
842  double rInPlusZ,
843  double rOutPlusZ,
844  double phiFrom,
845  double deltaPhi )
846 {
847  return DDSolid( name, std::make_unique< DDI::Cons >( zhalf,
848  rInMinusZ, rOutMinusZ,
849  rInPlusZ, rOutPlusZ,
850  phiFrom, deltaPhi ));
851 }
852 
853 DDSolid
855  double rMin,
856  double rMax,
857  double rTorus,
858  double startPhi,
859  double deltaPhi )
860 {
861  return DDSolid( name, std::make_unique< DDI::Torus >( rMin, rMax, rTorus, startPhi, deltaPhi ));
862 }
863 
864 DDSolid
866  double zhalf,
867  double rIn, double rOut,
868  double phiFrom, double deltaPhi )
869 {
870  return DDSolid( name, std::make_unique< DDI::Tubs >( zhalf, rIn, rOut, phiFrom, deltaPhi ));
871 }
872 
873 DDSolid
875  double zhalf,
876  double rIn, double rOut,
877  double phiFrom, double deltaPhi,
878  double lx, double ly, double lz,
879  double tx, double ty, double tz )
880 {
881  return DDSolid( name, std::make_unique< DDI::CutTubs >( zhalf, rIn, rOut,
882  phiFrom, deltaPhi,
883  lx, ly, lz,
884  tx, ty, tz ));
885 }
886 
887 DDSolid
889  double innerRadius,
890  double outerRadius,
891  double startPhi,
892  double deltaPhi,
893  double startTheta,
894  double deltaTheta )
895 {
896  return DDSolid( name, std::make_unique< DDI::Sphere >( innerRadius, outerRadius,
897  startPhi, deltaPhi,
898  startTheta, deltaTheta ));
899 }
900 
901 DDSolid
903  double xSemiAxis, double ySemiAxis, double zHeight )
904 {
905  return DDSolid( name, std::make_unique< DDI::EllipticalTube >( xSemiAxis, ySemiAxis, zHeight ));
906 }
907 
908 DDSolid
910 {
911  return DDSolid( name, std::make_unique< DDI::Shapeless >());
912 }
size
Write out results.
double zhalf(void) const
Definition: DDSolid.cc:524
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:854
double startPhi(void) const
Definition: DDSolid.cc:400
double zhalf(void) const
Definition: DDSolid.cc:676
double cutAtStart(void) const
truncation at begin of the tube-section
Definition: DDSolid.cc:217
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:144
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:159
DDBox(void)=delete
def_type isDefined() const
Definition: DDBase.h:107
bool cutInside(void) const
true, if truncation is on the inner side of the tube-section
Definition: DDSolid.cc:223
double halfZ(void) const
Definition: DDSolid.cc:274
DDTorus(void)=delete
std::vector< double > rVec(void) const
Definition: DDSolid.cc:355
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:171
double zHalf(void) const
half of the z-Axis
Definition: DDSolid.cc:202
const DDTranslation & t() const
Definition: Boolean.h:22
double y2(void) const
half length along y on +z
Definition: DDSolid.cc:247
auto zSectionsSize(void) const -> std::size_t
Definition: DDSolid.cc:458
double halfY(void) const
Definition: DDSolid.cc:270
double startTheta(void) const
Definition: DDSolid.cc:643
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:430
double deltaPhi(void) const
angular span of the tube-section
Definition: DDSolid.cc:214
static DDSolid pseudoTrap(const DDName &name, double pDx1, double pDx2, double pDy1, double pDy2, double pDz, double radius, bool atMinusZ)
Definition: DDSolid.cc:806
double deltaPhi(void) const
Definition: DDSolid.cc:640
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:379
Abstract class for DDPolycone and DDPolyhedra. Basically a common member function.
Definition: DDSolid.h:218
double phi(void) const
Azimuthal angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:165
DDPolySolid(void)=delete
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:321
static DDSolid cons(const DDName &name, double zhalf, double rInMinusZ, double rOutMinusZ, double rInPlusZ, double rOutPlusZ, double phiFrom, double deltaPhi)
Definition: DDSolid.cc:838
std::array< double, 3 > highNorm(void) const
Definition: DDSolid.cc:696
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:713
double rTorus(void) const
Definition: DDSolid.cc:560
DDSolidShape
Definition: DDSolidShapes.h:6
std::vector< double > rVec(void) const
Definition: DDSolid.cc:406
double cutAtDelta(void) const
truncation at end of the tube-section
Definition: DDSolid.cc:220
std::vector< double > yVec(void) const
Definition: DDSolid.cc:480
double phiFrom(void) const
Definition: DDSolid.cc:539
DDSphere(void)=delete
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:67
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
double rIn(void) const
inner radius
Definition: DDSolid.cc:205
const DDSolid & a() const
Definition: Boolean.h:20
double rOutMinusZ(void) const
Definition: DDSolid.cc:530
double rOutPlusZ(void) const
Definition: DDSolid.cc:536
std::vector< double > zyVec(void) const
Definition: DDSolid.cc:501
DDPolyhedra(void)=delete
const DDRotation & r() const
Definition: Boolean.h:23
DDTranslation translation(void) const
Definition: DDSolid.cc:604
DDIntersection(void)=delete
double innerRadius(void) const
Definition: DDSolid.cc:631
const DDI::BooleanSolid & boolean_
Definition: DDSolid.h:198
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
double y1(void) const
half length along y on -z
Definition: DDSolid.cc:244
DDSolid solidB(void) const
Definition: DDSolid.cc:616
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDTruncTubs(void)=delete
double rMax(void) const
Definition: DDSolid.cc:557
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
const DDI::rep_traits< N, C >::reference rep() const
Definition: DDBase.h:80
std::vector< double > xVec(void) const
Definition: DDSolid.cc:473
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:874
std::array< double, 3 > lowNorm(void) const
Definition: DDSolid.cc:691
double outerRadius(void) const
Definition: DDSolid.cc:634
DDTubs(void)=delete
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:23
auto xyPointsSize(void) const -> std::size_t
Definition: DDSolid.cc:448
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:186
static DDSolid intersection(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:783
DDRotation rotation(void) const
Definition: DDSolid.cc:598
bool atMinusZ(void) const
true, if cut-out or rounding is on the -z side
Definition: DDSolid.cc:253
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:235
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:371
double startPhi(void) const
Definition: DDSolid.cc:587
double startPhi(void) const
Definition: DDSolid.cc:350
double xSemiAxis(void) const
Definition: DDSolid.cc:658
static DDSolid sphere(const DDName &name, double innerRadius, double outerRadius, double startPhi, double deltaPhi, double startTheta, double deltaTheta)
Definition: DDSolid.cc:888
std::ostream & operator<<(std::ostream &os, const DDSolidShape s)
Definition: DDSolid.cc:30
const DDSolid & b() const
Definition: Boolean.h:21
double deltaPhi(void) const
Definition: DDSolid.cc:353
double startPhi(void) const
Definition: DDSolid.cc:637
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:168
double rInMinusZ(void) const
Definition: DDSolid.cc:527
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:138
double rOut(void) const
Definition: DDSolid.cc:682
double deltaTheta(void) const
Definition: DDSolid.cc:646
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:865
double ySemiAxis(void) const
Definition: DDSolid.cc:661
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:821
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:792
double rMin(void) const
Definition: DDSolid.cc:554
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:704
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:422
double rOut(void) const
Definition: DDSolid.cc:584
double deltaPhi(void) const
Definition: DDSolid.cc:688
int sides(void) const
Definition: DDSolid.cc:397
DDSolid solidA(void) const
Definition: DDSolid.cc:610
double deltaPhi(void) const
Definition: DDSolid.cc:542
double deltaPhi(void) const
Definition: DDSolid.cc:590
double startPhi(void) const
Definition: DDSolid.cc:563
DDCutTubs(void)=delete
std::vector< double > zVec(void) const
Definition: DDSolid.cc:487
double halfX(void) const
Definition: DDSolid.cc:266
std::vector< double > zxVec(void) const
Definition: DDSolid.cc:494
static DDSolid ellipticalTube(const DDName &name, double xSemiAxis, double ySemiAxis, double zHeight)
Definition: DDSolid.cc:902
std::vector< double > zVec(void) const
Definition: DDSolid.cc:414
double deltaPhi(void) const
Definition: DDSolid.cc:566
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:753
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:774
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:177
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:189
double startPhi(void) const
angular start of the tube-section
Definition: DDSolid.cc:211
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:174
double zhalf(void) const
Definition: DDSolid.cc:578
static DDSolid shapeless(const DDName &name)
Definition: DDSolid.cc:909
DDEllipticalTube(void)=delete
DDShapelessSolid(void)=delete
double zHeight(void) const
Definition: DDSolid.cc:664
std::pair< const N *, bool > def_type
Definition: DDBase.h:66
double a
Definition: hdecay.h:121
DDUnion(void)=delete
double deltaPhi(void) const
Definition: DDSolid.cc:403
double y2(void) const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:180
DDBooleanSolid(void)=delete
DDSubtraction(void)=delete
double rInPlusZ(void) const
Definition: DDSolid.cc:533
DDSolid(void)
Uninitialilzed solid reference-object; for further details on reference-objects see documentation of ...
Definition: DDSolid.cc:55
def which(cmd)
Definition: eostools.py:336
static DDSolid unionSolid(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:765
DDTrap(void)=delete
double x2(void) const
half length along x on +z
Definition: DDSolid.cc:241
double rIn(void) const
Definition: DDSolid.cc:679
double rIn(void) const
Definition: DDSolid.cc:581
double rOut(void) const
outer radius
Definition: DDSolid.cc:208
double theta(void) const
Polar angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:162
std::vector< double > zscaleVec(void) const
Definition: DDSolid.cc:508
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
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:730
def move(src, dest)
Definition: eostools.py:511
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
Definition: DDSolid.cc:183
double volume(void) const
Returns the volume of the given solid (does not work with boolean soids !)
Definition: DDSolid.cc:132
std::vector< double > zVec(void) const
Definition: DDSolid.cc:363
double x1(void) const
half length along x on -z
Definition: DDSolid.cc:238
double startPhi(void) const
Definition: DDSolid.cc:685
double radius(void) const
radius of the cut-out (neg.) or rounding (pos.)
Definition: DDSolid.cc:250
DDCons(void)=delete
void create(const DDName &name, std::unique_ptr< DDI::Solid > vals)
Definition: DDBase.h:121