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 <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 
83  DDTrap( const DDSolid & s );
84  DDTrap( void ) = delete;
85 
87  double halfZ( void ) const;
89  double theta( void ) const;
91  double phi( void ) const;
93  double y1( void ) const;
95  double x1( void ) const;
97  double x2( void ) const;
99  double alpha1( void ) const;
101  double y2( void ) const;
103  double x3( void ) const;
105  double x4( void ) const;
107  double alpha2( void ) const;
108 };
109 
110 class DDPseudoTrap : public DDSolid
111 {
112 public:
113 
114  DDPseudoTrap( const DDSolid & s );
115  DDPseudoTrap( void ) = delete;
116 
118  double halfZ( void ) const;
120  double x1( void ) const;
122  double x2( void ) const;
124  double y1( void ) const;
126  double y2( void ) const;
128  double radius( void ) const;
130  bool atMinusZ( void ) const;
131 };
132 
134 class DDTruncTubs : public DDSolid
135 {
136 public:
137 
138  DDTruncTubs( const DDSolid & s );
139  DDTruncTubs( void ) = delete;
140 
142  double zHalf( void ) const;
144  double rIn( void ) const;
146  double rOut( void ) const;
148  double startPhi( void ) const;
150  double deltaPhi( void ) const;
152  double cutAtStart( void ) const;
154  double cutAtDelta( void ) const;
156  bool cutInside( void ) const;
157 };
158 
160 
164 class DDBox : public DDSolid
165 {
166 public:
167 
168  DDBox( const DDSolid & s );
169  DDBox( void ) = delete;
170 
171  double halfX( void ) const;
172  double halfY( void ) const;
173  double halfZ( void ) const;
174 };
175 
177 class DDShapelessSolid : public DDSolid
178 {
179 public:
180 
181  DDShapelessSolid( const DDSolid & s );
182  DDShapelessSolid( void ) = delete;
183 };
184 
186 {
187 public:
188 
189  DDReflectionSolid( const DDSolid & s );
190  DDReflectionSolid( void ) = delete;
191 
192  DDSolid unreflected( void ) const;
193 
194 private:
195 
197 };
198 
199 class DDBooleanSolid : public DDSolid
200 {
201 public:
202 
203  DDBooleanSolid( const DDSolid & s );
204  DDBooleanSolid( void ) = delete;
205 
206  DDSolid solidA( void ) const;
207  DDSolid solidB( void ) const;
208  DDTranslation translation( void ) const;
209  DDRotation rotation( void ) const;
210 
211 private:
212 
214 };
215 
217 {
218 public:
219 
220  DDMultiUnionSolid( const DDSolid & s );
221  DDMultiUnionSolid( void ) = delete;
222 
223  const std::vector<DDSolid>& solids( void ) const;
224  const std::vector<DDTranslation>& translations( void ) const;
225  const std::vector<DDRotation>& rotations( void ) const;
226 
227 private:
228 
230 };
231 
233 class DDPolySolid : public DDSolid
234 {
235 public:
236 
237  DDPolySolid( const DDSolid & s );
238  DDPolySolid( void ) = delete;
239 
240 protected:
242  virtual std::vector<double> getVec( const size_t& which, const size_t& offset = 0, const size_t& nVecs = 1 ) const;
243 };
244 
245 class DDPolycone : public DDPolySolid
246 {
247 public:
248 
249  DDPolycone( const DDSolid & s );
250  DDPolycone( void ) = delete;
251 
252  double startPhi( void ) const;
253  double deltaPhi( void ) const;
254  std::vector<double> zVec( void ) const;
255  std::vector<double> rVec( void ) const;
256  std::vector<double> rMinVec( void ) const;
257  std::vector<double> rMaxVec( void ) const;
258 };
259 
260 class DDPolyhedra : public DDPolySolid
261 {
262 public:
263 
264  DDPolyhedra( const DDSolid & s );
265  DDPolyhedra( void ) = delete;
266 
267  int sides( void ) const;
268  double startPhi( void ) const;
269  double deltaPhi( void ) const;
270  std::vector<double> zVec( void ) const;
271  std::vector<double> rVec( void ) const;
272  std::vector<double> rMinVec( void ) const;
273  std::vector<double> rMaxVec( void ) const;
274 };
275 
277 {
278 public:
279 
280  DDExtrudedPolygon( const DDSolid & s );
281  DDExtrudedPolygon( void ) = delete;
282 
283  std::vector<double> xVec( void ) const;
284  std::vector<double> yVec( void ) const;
285  std::vector<double> zVec( void ) const;
286  std::vector<double> zxVec( void ) const;
287  std::vector<double> zyVec( void ) const;
288  std::vector<double> zscaleVec( void ) const;
289 
290 private:
291 
292  auto xyPointsSize( void ) const -> std::size_t;
293  auto zSectionsSize( void ) const -> std::size_t;
294 };
295 
296 class DDTubs : public DDSolid
297 {
298 public:
299 
300  DDTubs( const DDSolid & s );
301  DDTubs( void ) = delete;
302 
303  double zhalf( void ) const;
304  double rIn( void ) const;
305  double rOut( void ) const;
306  double startPhi( void ) const;
307  double deltaPhi( void ) const;
308 };
309 
310 class DDCutTubs : public DDSolid
311 {
312 public:
313 
314  DDCutTubs( const DDSolid & s );
315  DDCutTubs( void ) = delete;
316 
317  double zhalf( void ) const;
318  double rIn( void ) const;
319  double rOut( void ) const;
320  double startPhi( void ) const;
321  double deltaPhi( void ) const;
322  std::array<double, 3> lowNorm( void ) const;
323  std::array<double, 3> highNorm( void ) const;
324 };
325 
326 class DDCons : public DDSolid
327 {
328 public:
329 
330  DDCons( const DDSolid & s );
331  DDCons( void ) = delete;
332 
333  double zhalf( void ) const;
334  double rInMinusZ( void ) const;
335  double rOutMinusZ( void ) const;
336  double rInPlusZ( void ) const;
337  double rOutPlusZ( void ) const;
338  double phiFrom( void ) const;
339  double deltaPhi( void ) const;
340 };
341 
342 class DDTorus : public DDSolid
343 {
344 public:
345 
346  DDTorus( const DDSolid & s );
347  DDTorus( void ) = delete;
348 
349  double rMin( void ) const;
350  double rMax( void ) const;
351  double rTorus( void ) const;
352  double startPhi( void ) const;
353  double deltaPhi( void ) const;
354 };
355 
356 class DDUnion : public DDBooleanSolid
357 {
358 public:
359 
360  DDUnion( const DDSolid & s );
361  DDUnion( void ) = delete;
362 };
363 
365 {
366 public:
367 
368  DDMultiUnion( const DDSolid & s );
369  DDMultiUnion( void ) = delete;
370 };
371 
373 {
374 public:
375 
376  DDIntersection( const DDSolid & s );
377  DDIntersection( void ) = delete;
378 };
379 
381 {
382 public:
383 
384  DDSubtraction( const DDSolid & s );
385  DDSubtraction( void ) = delete;
386 };
387 
388 class DDSphere : public DDSolid
389 {
390 public:
391 
392  DDSphere( const DDSolid & s );
393  DDSphere( void ) = delete;
394 
395  double innerRadius( void ) const;
396  double outerRadius( void ) const;
397  double startPhi( void ) const;
398  double deltaPhi( void ) const;
399  double startTheta( void ) const;
400  double deltaTheta( void ) const;
401 };
402 
403 class DDOrb : public DDSolid
404 {
405 public:
406 
407  DDOrb( const DDSolid & s );
408  DDOrb( void ) = delete;
409 
410  double radius( void ) const;
411 };
412 
413 class DDEllipticalTube : public DDSolid
414 {
415 public:
416 
417  DDEllipticalTube( const DDSolid & s );
418  DDEllipticalTube( void ) = delete;
419 
420  double xSemiAxis( void ) const;
421  double ySemiAxis( void ) const;
422  double zHeight( void ) const;
423 };
424 
425 class DDEllipsoid : public DDSolid
426 {
427 public:
428 
429  DDEllipsoid( const DDSolid & s );
430  DDEllipsoid( void ) = delete;
431 
432  double xSemiAxis( void ) const;
433  double ySemiAxis( void ) const;
434  double zSemiAxis( void ) const;
435  double zBottomCut( void ) const;
436  double zTopCut( void ) const;
437 };
438 
439 class DDParallelepiped : public DDSolid
440 {
441 public:
442 
443  DDParallelepiped( const DDSolid & s );
444  DDParallelepiped( void ) = delete;
445 
446  double xHalf( void ) const;
447  double yHalf( void ) const;
448  double zHalf( void ) const;
449  double alpha( void ) const;
450  double theta( void ) const;
451  double phi( void ) const;
452 };
453 
454 // Solid generation functions
455 //
457 {
459 
465  static DDSolid box( const DDName & name,
466  double xHalf,
467  double yHalf,
468  double zHalf );
469 
471 
474  static DDSolid polycone( const DDName & name, double startPhi, double deltaPhi,
475  const std::vector<double> & z,
476  const std::vector<double> & rmin,
477  const std::vector<double> & rmax );
478 
480 
483  static DDSolid polycone( const DDName & name, double startPhi, double deltaPhi,
484  const std::vector<double> & z,
485  const std::vector<double> & r );
486 
488 
491  static DDSolid polyhedra( const DDName & name,
492  int sides,
493  double startPhi, double deltaPhi,
494  const std::vector<double> & z,
495  const std::vector<double> & rmin,
496  const std::vector<double> & rmax );
497 
499 
502  static DDSolid polyhedra( const DDName & name,
503  int sides,
504  double startPhi, double deltaPhi,
505  const std::vector<double> & z,
506  const std::vector<double> & r );
507 
508  static DDSolid unionSolid( const DDName & name,
509  const DDSolid & a,
510  const DDSolid & b,
511  const DDTranslation & t,
512  const DDRotation & r );
513 
514  static DDSolid multiUnionSolid( const DDName & name,
515  const std::vector<DDSolid> & a,
516  const std::vector<DDTranslation> & t,
517  const std::vector<DDRotation> & r );
518 
519  static DDSolid intersection( const DDName & name,
520  const DDSolid & a,
521  const DDSolid & b,
522  const DDTranslation & t,
523  const DDRotation & r );
524 
525  static DDSolid subtraction( const DDName & name,
526  const DDSolid & a,
527  const DDSolid & b,
528  const DDTranslation & t,
529  const DDRotation & r );
530 
531  static DDSolid trap( const DDName & name,
532  double pDz,
533  double pTheta, double pPhi,
534  double pDy1, double pDx1, double pDx2,
535  double pAlp1,
536  double pDy2, double pDx3, double pDx4,
537  double pAlp2 );
538 
539  static DDSolid pseudoTrap( const DDName & name,
540  double pDx1,
541  double pDx2,
542  double pDy1,
543  double pDy2,
544  double pDz,
545  double radius,
546  bool atMinusZ );
548  static DDSolid truncTubs( const DDName & name,
549  double zHalf,
550  double rIn,
551  double rOut,
552  double startPhi,
553  double deltaPhi,
554  double cutAtStart,
555  double cutAtDelta,
556  bool cutInside );
557 
558  static DDSolid tubs( const DDName & name,
559  double zhalf,
560  double rIn, double rOut,
561  double startPhi,
562  double deltaPhi );
563 
564  static DDSolid cuttubs( const DDName & name,
565  double zhalf,
566  double rIn, double rOut,
567  double startPhi,
568  double deltaPhi,
569  double lx, double ly, double lz,
570  double tx, double ty, double tz);
571 
572  static DDSolid cons( const DDName & name,
573  double zhalf,
574  double rInMinusZ,
575  double rOutMinusZ,
576  double rInPlusZ,
577  double rOutPlusZ,
578  double phiFrom,
579  double deltaPhi );
580 
581  static DDSolid torus( const DDName & name,
582  double rMin,
583  double rMax,
584  double rTorus,
585  double startPhi,
586  double deltaPhi );
587 
588  static DDSolid sphere( const DDName & name,
589  double innerRadius,
590  double outerRadius,
591  double startPhi,
592  double deltaPhi,
593  double startTheta,
594  double deltaTheta );
595 
596  static DDSolid orb( const DDName & name,
597  double radius );
598 
599  static DDSolid ellipticalTube( const DDName & name,
600  double xSemiAxis,
601  double ySemiAxis,
602  double zHeight );
603 
604  static DDSolid ellipsoid( const DDName & name,
605  double xSemiAxis,
606  double ySemiAxis,
607  double zSemiAxis,
608  double zBottomCut = 0.,
609  double zTopCut = 0. );
610 
611  static DDSolid parallelepiped( const DDName & name,
612  double xHalf, double yHalf, double zHalf,
613  double alpha, double theta, double phi );
614 
615  static DDSolid extrudedpolygon( const DDName & name,
616  const std::vector<double> & x,
617  const std::vector<double> & y,
618  const std::vector<double> & z,
619  const std::vector<double> & zx,
620  const std::vector<double> & zy,
621  const std::vector<double> & zscale );
622 
623  static DDSolid shapeless( const DDName & name );
624 
625  static DDSolid reflection( const DDName & name,
626  const DDSolid & s );
627 };
628 
629 #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:233
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:67
DDI::BooleanSolid * boolean_
Definition: DDSolid.h:213
DDI::Reflection * reflected_
Definition: DDSolid.h:196
Interface to a Trapezoid.
Definition: DDSolid.h:79
DDI::MultiUnion * union_
Definition: DDSolid.h:229
Interface to a Box.
Definition: DDSolid.h:164
double b
Definition: hdecay.h:120
Definition: DDSolid.h:403
double a
Definition: hdecay.h:121
def which(cmd)
Definition: eostools.py:335
std::ostream & operator<<(std::ostream &, const DDSolid &)
Definition: DDSolid.cc:34