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