test
CMS 3D CMS Logo

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