CMS 3D CMS Logo

DDSolid.h
Go to the documentation of this file.
1 #ifndef DETECTOR_DESCRIPTION_CORE_DD_SOLID_H
2 #define DETECTOR_DESCRIPTION_CORE_DD_SOLID_H
3 
4 #include <stddef.h>
5 #include <iosfwd>
6 #include <vector>
7 
13 
14 class DDSolid;
15 
16 namespace DDI {
17  class BooleanSolid;
18  class MultiUnion;
19  class Reflection;
20  class Solid;
21 }
22 struct DDSolidFactory;
23 
24 std::ostream & operator<<( std::ostream &, const DDSolid & );
25 
27 
38 class DDSolid : public DDBase<DDName, DDI::Solid*>
39 {
40  friend std::ostream & operator <<( std::ostream &, const DDSolid & );
41  friend struct DDSolidFactory;
42  friend class DDDToPersFactory;
43  friend class DDPersToDDDFactory;
44 
45 public:
47  DDSolid( void );
48 
50 
58  DDSolid( const DDName & name );
59 
61  const std::vector<double> & parameters( void ) const;
62 
64  double volume( void ) const;
65 
67  DDSolidShape shape( void ) const;
68 
69 private:
70  DDSolid( const DDName &, DDI::Solid * );
71  DDSolid( const DDName &, DDSolidShape, const std::vector<double> & );
72 };
73 
75 
79 class DDTrap : public DDSolid
80 {
81 public:
82  DDTrap( const DDSolid & s );
84  double halfZ( void ) const;
86  double theta( void ) const;
88  double phi( void ) const;
90  double y1( void ) const;
92  double x1( void ) const;
94  double x2( void ) const;
96  double alpha1( void ) const;
98  double y2( void ) const;
100  double x3( void ) const;
102  double x4( void ) const;
104  double alpha2( void ) const;
105 
106 private:
107  DDTrap( void );
108 };
109 
110 class DDPseudoTrap : public DDSolid
111 {
112 public:
113  DDPseudoTrap( const DDSolid & s );
115  double halfZ( void ) const;
117  double x1( void ) const;
119  double x2( void ) const;
121  double y1( void ) const;
123  double y2( void ) const;
125  double radius( void ) const;
127  bool atMinusZ( void ) const;
128 
129 private:
130  DDPseudoTrap( void );
131 };
132 
134 class DDTruncTubs : public DDSolid
135 {
136 public:
137  DDTruncTubs( const DDSolid & s );
139  double zHalf( void ) const;
141  double rIn( void ) const;
143  double rOut( void ) const;
145  double startPhi( void ) const;
147  double deltaPhi( void ) const;
149  double cutAtStart( void ) const;
151  double cutAtDelta( void ) const;
153  bool cutInside( void ) const;
154 
155 private:
156  DDTruncTubs( void );
157 };
158 
160 
164 class DDBox : public DDSolid
165 {
166 public:
167  DDBox( const DDSolid & s );
168  double halfX( void ) const;
169  double halfY( void ) const;
170  double halfZ( void ) const;
171 
172 private:
173  DDBox( void );
174 };
175 
177 class DDShapelessSolid : public DDSolid
178 {
179 public:
180  DDShapelessSolid( const DDSolid & s );
181 
182 private:
183  DDShapelessSolid( void );
184 };
185 
187 {
188 public:
189  DDReflectionSolid( const DDSolid & s );
190  DDSolid unreflected( void ) const;
191 
192 private:
193  DDReflectionSolid( void );
195 };
196 
197 class DDBooleanSolid : public DDSolid
198 {
199 public:
200  DDBooleanSolid( const DDSolid & s );
201  DDSolid solidA( void ) const;
202  DDSolid solidB( void ) const;
203  DDTranslation translation( void ) const;
204  DDRotation rotation( void ) const;
205 
206 private:
207  DDBooleanSolid( void );
209 };
210 
212 {
213 public:
214  DDMultiUnionSolid( const DDSolid & s );
215  const std::vector<DDSolid>& solids( void ) const;
216  const std::vector<DDTranslation>& translations( void ) const;
217  const std::vector<DDRotation>& rotations( void ) const;
218 
219 private:
220  DDMultiUnionSolid( void );
222 };
223 
225 class DDPolySolid : public DDSolid
226 {
227 public:
228  DDPolySolid( const DDSolid & s );
229 
230 protected:
232  virtual std::vector<double> getVec( const size_t& which, const size_t& offset = 0, const size_t& nVecs = 1 ) const;
233  DDPolySolid( void );
234 };
235 
236 class DDPolycone : public DDPolySolid
237 {
238 public:
239  DDPolycone( const DDSolid & s );
240  double startPhi( void ) const;
241  double deltaPhi( void ) const;
242  std::vector<double> zVec( void ) const;
243  std::vector<double> rVec( void ) const;
244  std::vector<double> rMinVec( void ) const;
245  std::vector<double> rMaxVec( void ) const;
246 
247 private:
248  DDPolycone( void );
249 };
250 
251 class DDPolyhedra : public DDPolySolid
252 {
253 public:
254  DDPolyhedra( const DDSolid & s );
255  int sides( void ) const;
256  double startPhi( void ) const;
257  double deltaPhi( void ) const;
258  std::vector<double> zVec( void ) const;
259  std::vector<double> rVec( void ) const;
260  std::vector<double> rMinVec( void ) const;
261  std::vector<double> rMaxVec( void ) const;
262 
263 private:
264  DDPolyhedra( void );
265 };
266 
268 {
269 public:
270  DDExtrudedPolygon( const DDSolid & s );
271  std::vector<double> xVec( void ) const;
272  std::vector<double> yVec( void ) const;
273  std::vector<double> zVec( void ) const;
274  std::vector<double> zxVec( void ) const;
275  std::vector<double> zyVec( void ) const;
276  std::vector<double> zscaleVec( void ) const;
277 
278 private:
279  DDExtrudedPolygon( void );
280  auto xyPointsSize( void ) const -> std::size_t;
281  auto zSectionsSize( void ) const -> std::size_t;
282 };
283 
284 class DDTubs : public DDSolid
285 {
286 public:
287  DDTubs( const DDSolid & s );
288  double zhalf( void ) const;
289  double rIn( void ) const;
290  double rOut( void ) const;
291  double startPhi( void ) const;
292  double deltaPhi( void ) const;
293 
294 private:
295  DDTubs( void );
296 };
297 
298 class DDCutTubs : public DDSolid
299 {
300 public:
301  DDCutTubs( const DDSolid & s );
302  double zhalf( void ) const;
303  double rIn( void ) const;
304  double rOut( void ) const;
305  double startPhi( void ) const;
306  double deltaPhi( void ) const;
307  std::array<double, 3> lowNorm( void ) const;
308  std::array<double, 3> highNorm( void ) const;
309 
310 private:
311  DDCutTubs( void );
312 };
313 
314 class DDCons : public DDSolid
315 {
316 public:
317  DDCons( const DDSolid & s );
318  double zhalf( void ) const;
319  double rInMinusZ( void ) const;
320  double rOutMinusZ( void ) const;
321  double rInPlusZ( void ) const;
322  double rOutPlusZ( void ) const;
323  double phiFrom( void ) const;
324  double deltaPhi( void ) const;
325 
326 private:
327  DDCons( void );
328 };
329 
330 class DDTorus : public DDSolid
331 {
332 public:
333  DDTorus( const DDSolid & s );
334  double rMin( void ) const;
335  double rMax( void ) const;
336  double rTorus( void ) const;
337  double startPhi( void ) const;
338  double deltaPhi( void ) const;
339 
340 private:
341  DDTorus( void );
342 };
343 
344 class DDUnion : public DDBooleanSolid
345 {
346 public:
347  DDUnion( const DDSolid & s );
348 
349 private:
350  DDUnion( void );
351 };
352 
354 {
355 public:
356  DDMultiUnion( const DDSolid & s );
357 
358 private:
359  DDMultiUnion( void );
360 };
361 
363 {
364 public:
365  DDIntersection( const DDSolid & s );
366 
367 private:
368  DDIntersection( void );
369 };
370 
372 {
373 public:
374  DDSubtraction( const DDSolid & s );
375 
376 private:
377  DDSubtraction( void );
378 };
379 
380 class DDSphere : public DDSolid
381 {
382 public:
383  DDSphere( const DDSolid & s );
384  double innerRadius( void ) const;
385  double outerRadius( void ) const;
386  double startPhi( void ) const;
387  double deltaPhi( void ) const;
388  double startTheta( void ) const;
389  double deltaTheta( void ) const;
390 
391 private:
392  DDSphere( void );
393 };
394 
395 class DDOrb : public DDSolid
396 {
397 public:
398  DDOrb( const DDSolid & s );
399  double radius( void ) const;
400 
401 private:
402  DDOrb( void );
403 };
404 
405 class DDEllipticalTube : public DDSolid
406 {
407 public:
408  DDEllipticalTube( const DDSolid & s );
409  double xSemiAxis( void ) const;
410  double ySemiAxis( void ) const;
411  double zHeight( void ) const;
412 
413 private:
414  DDEllipticalTube( void );
415 };
416 
417 class DDEllipsoid : public DDSolid
418 {
419 public:
420  DDEllipsoid( const DDSolid & s );
421  double xSemiAxis( void ) const;
422  double ySemiAxis( void ) const;
423  double zSemiAxis( void ) const;
424  double zBottomCut( void ) const;
425  double zTopCut( void ) const;
426 
427 private:
428  DDEllipsoid( void );
429 };
430 
431 class DDParallelepiped : public DDSolid
432 {
433 public:
434  DDParallelepiped( const DDSolid & s );
435  double xHalf( void ) const;
436  double yHalf( void ) const;
437  double zHalf( void ) const;
438  double alpha( void ) const;
439  double theta( void ) const;
440  double phi( void ) const;
441 
442 private:
443  DDParallelepiped( void );
444 };
445 
446 // Solid generation functions
447 //
449 {
451 
457  static DDSolid box( const DDName & name,
458  double xHalf,
459  double yHalf,
460  double zHalf );
461 
463 
466  static DDSolid polycone( const DDName & name, double startPhi, double deltaPhi,
467  const std::vector<double> & z,
468  const std::vector<double> & rmin,
469  const std::vector<double> & rmax );
470 
472 
475  static DDSolid polycone( const DDName & name, double startPhi, double deltaPhi,
476  const std::vector<double> & z,
477  const std::vector<double> & r );
478 
480 
483  static DDSolid polyhedra( const DDName & name,
484  int sides,
485  double startPhi, double deltaPhi,
486  const std::vector<double> & z,
487  const std::vector<double> & rmin,
488  const std::vector<double> & rmax );
489 
491 
494  static DDSolid polyhedra( const DDName & name,
495  int sides,
496  double startPhi, double deltaPhi,
497  const std::vector<double> & z,
498  const std::vector<double> & r );
499 
500  static DDSolid unionSolid( const DDName & name,
501  const DDSolid & a,
502  const DDSolid & b,
503  const DDTranslation & t,
504  const DDRotation & r );
505 
506  static DDSolid multiUnionSolid( const DDName & name,
507  const std::vector<DDSolid> & a,
508  const std::vector<DDTranslation> & t,
509  const std::vector<DDRotation> & r );
510 
511  static DDSolid intersection( const DDName & name,
512  const DDSolid & a,
513  const DDSolid & b,
514  const DDTranslation & t,
515  const DDRotation & r );
516 
517  static DDSolid subtraction( const DDName & name,
518  const DDSolid & a,
519  const DDSolid & b,
520  const DDTranslation & t,
521  const DDRotation & r );
522 
523  static DDSolid trap( const DDName & name,
524  double pDz,
525  double pTheta, double pPhi,
526  double pDy1, double pDx1, double pDx2,
527  double pAlp1,
528  double pDy2, double pDx3, double pDx4,
529  double pAlp2 );
530 
531  static DDSolid pseudoTrap( const DDName & name,
532  double pDx1,
533  double pDx2,
534  double pDy1,
535  double pDy2,
536  double pDz,
537  double radius,
538  bool atMinusZ );
540  static DDSolid truncTubs( const DDName & name,
541  double zHalf,
542  double rIn,
543  double rOut,
544  double startPhi,
545  double deltaPhi,
546  double cutAtStart,
547  double cutAtDelta,
548  bool cutInside );
549 
550  static DDSolid tubs( const DDName & name,
551  double zhalf,
552  double rIn, double rOut,
553  double startPhi,
554  double deltaPhi );
555 
556  static DDSolid cuttubs( const DDName & name,
557  double zhalf,
558  double rIn, double rOut,
559  double startPhi,
560  double deltaPhi,
561  double lx, double ly, double lz,
562  double tx, double ty, double tz);
563 
564  static DDSolid cons( const DDName & name,
565  double zhalf,
566  double rInMinusZ,
567  double rOutMinusZ,
568  double rInPlusZ,
569  double rOutPlusZ,
570  double phiFrom,
571  double deltaPhi );
572 
573  static DDSolid torus( const DDName & name,
574  double rMin,
575  double rMax,
576  double rTorus,
577  double startPhi,
578  double deltaPhi );
579 
580  static DDSolid sphere( const DDName & name,
581  double innerRadius,
582  double outerRadius,
583  double startPhi,
584  double deltaPhi,
585  double startTheta,
586  double deltaTheta );
587 
588  static DDSolid orb( const DDName & name,
589  double radius );
590 
591  static DDSolid ellipticalTube( const DDName & name,
592  double xSemiAxis,
593  double ySemiAxis,
594  double zHeight );
595 
596  static DDSolid ellipsoid( const DDName & name,
597  double xSemiAxis,
598  double ySemiAxis,
599  double zSemiAxis,
600  double zBottomCut = 0.,
601  double zTopCut = 0. );
602 
603  static DDSolid parallelepiped( const DDName & name,
604  double xHalf, double yHalf, double zHalf,
605  double alpha, double theta, double phi );
606 
607  static DDSolid extrudedpolygon( const DDName & name,
608  const std::vector<double> & x,
609  const std::vector<double> & y,
610  const std::vector<double> & z,
611  const std::vector<double> & zx,
612  const std::vector<double> & zy,
613  const std::vector<double> & zscale );
614 
615  static DDSolid shapeless( const DDName & name );
616 
617  static DDSolid reflection( const DDName & name,
618  const DDSolid & s );
619 };
620 
621 #endif
Definition: DDBase.h:10
float alpha
Definition: AMPTWrapper.h:95
A truncated tube section.
Definition: DDSolid.h:134
Abstract class for DDPolycone and DDPolyhedra. Basically a common member function.
Definition: DDSolid.h:225
This is simply a handle on the solid.
Definition: DDSolid.h:177
DDSolidShape
Definition: DDSolidShapes.h:6
Geom::Theta< T > theta() const
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
T x() const
Cartesian x coordinate.
DDI::BooleanSolid * boolean_
Definition: DDSolid.h:208
DDI::Reflection * reflected_
Definition: DDSolid.h:194
Interface to a Trapezoid.
Definition: DDSolid.h:79
DDI::MultiUnion * union_
Definition: DDSolid.h:221
Interface to a Box.
Definition: DDSolid.h:164
double b
Definition: hdecay.h:120
Definition: DDSolid.h:395
double a
Definition: hdecay.h:121
def which(cmd)
Definition: eostools.py:335
std::ostream & operator<<(std::ostream &, const DDSolid &)
Definition: DDSolid.cc:34