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