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 
185 class DDBooleanSolid : public DDSolid
186 {
187 public:
188 
189  DDBooleanSolid( const DDSolid & s );
190  DDBooleanSolid( void ) = delete;
191 
192  DDSolid solidA( void ) const;
193  DDSolid solidB( void ) const;
194  DDTranslation translation( void ) const;
195  DDRotation rotation( void ) const;
196 
197 private:
198 
200 };
201 
203 {
204 public:
205 
206  DDMultiUnionSolid( const DDSolid & s );
207  DDMultiUnionSolid( void ) = delete;
208 
209  const std::vector<DDSolid>& solids( void ) const;
210  const std::vector<DDTranslation>& translations( void ) const;
211  const std::vector<DDRotation>& rotations( void ) const;
212 
213 private:
214 
215  DDI::MultiUnion * union_;
216 };
217 
219 class DDPolySolid : public DDSolid
220 {
221 public:
222 
223  DDPolySolid( const DDSolid & s );
224  DDPolySolid( void ) = delete;
225 
226 protected:
228  virtual std::vector<double> getVec( const size_t& which, const size_t& offset = 0, const size_t& nVecs = 1 ) const;
229 };
230 
231 class DDPolycone : public DDPolySolid
232 {
233 public:
234 
235  DDPolycone( const DDSolid & s );
236  DDPolycone( void ) = delete;
237 
238  double startPhi( void ) const;
239  double deltaPhi( void ) const;
240  std::vector<double> zVec( void ) const;
241  std::vector<double> rVec( void ) const;
242  std::vector<double> rMinVec( void ) const;
243  std::vector<double> rMaxVec( void ) const;
244 };
245 
246 class DDPolyhedra : public DDPolySolid
247 {
248 public:
249 
250  DDPolyhedra( const DDSolid & s );
251  DDPolyhedra( void ) = delete;
252 
253  int sides( void ) const;
254  double startPhi( void ) const;
255  double deltaPhi( void ) const;
256  std::vector<double> zVec( void ) const;
257  std::vector<double> rVec( void ) const;
258  std::vector<double> rMinVec( void ) const;
259  std::vector<double> rMaxVec( void ) const;
260 };
261 
263 {
264 public:
265 
266  DDExtrudedPolygon( const DDSolid & s );
267  DDExtrudedPolygon( void ) = delete;
268 
269  std::vector<double> xVec( void ) const;
270  std::vector<double> yVec( void ) const;
271  std::vector<double> zVec( void ) const;
272  std::vector<double> zxVec( void ) const;
273  std::vector<double> zyVec( void ) const;
274  std::vector<double> zscaleVec( void ) const;
275 
276 private:
277 
278  auto xyPointsSize( void ) const -> std::size_t;
279  auto zSectionsSize( void ) const -> std::size_t;
280 };
281 
282 class DDTubs : public DDSolid
283 {
284 public:
285 
286  DDTubs( const DDSolid & s );
287  DDTubs( void ) = delete;
288 
289  double zhalf( void ) const;
290  double rIn( void ) const;
291  double rOut( void ) const;
292  double startPhi( void ) const;
293  double deltaPhi( void ) const;
294 };
295 
296 class DDCutTubs : public DDSolid
297 {
298 public:
299 
300  DDCutTubs( const DDSolid & s );
301  DDCutTubs( 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  std::array<double, 3> lowNorm( void ) const;
309  std::array<double, 3> highNorm( void ) const;
310 };
311 
312 class DDCons : public DDSolid
313 {
314 public:
315 
316  DDCons( const DDSolid & s );
317  DDCons( void ) = delete;
318 
319  double zhalf( void ) const;
320  double rInMinusZ( void ) const;
321  double rOutMinusZ( void ) const;
322  double rInPlusZ( void ) const;
323  double rOutPlusZ( void ) const;
324  double phiFrom( void ) const;
325  double deltaPhi( void ) const;
326 };
327 
328 class DDTorus : public DDSolid
329 {
330 public:
331 
332  DDTorus( const DDSolid & s );
333  DDTorus( void ) = delete;
334 
335  double rMin( void ) const;
336  double rMax( void ) const;
337  double rTorus( void ) const;
338  double startPhi( void ) const;
339  double deltaPhi( void ) const;
340 };
341 
342 class DDUnion : public DDBooleanSolid
343 {
344 public:
345 
346  DDUnion( const DDSolid & s );
347  DDUnion( void ) = delete;
348 };
349 
351 {
352 public:
353 
354  DDMultiUnion( const DDSolid & s );
355  DDMultiUnion( void ) = delete;
356 };
357 
359 {
360 public:
361 
362  DDIntersection( const DDSolid & s );
363  DDIntersection( void ) = delete;
364 };
365 
367 {
368 public:
369 
370  DDSubtraction( const DDSolid & s );
371  DDSubtraction( void ) = delete;
372 };
373 
374 class DDSphere : public DDSolid
375 {
376 public:
377 
378  DDSphere( const DDSolid & s );
379  DDSphere( void ) = delete;
380 
381  double innerRadius( void ) const;
382  double outerRadius( void ) const;
383  double startPhi( void ) const;
384  double deltaPhi( void ) const;
385  double startTheta( void ) const;
386  double deltaTheta( void ) const;
387 };
388 
389 class DDOrb : public DDSolid
390 {
391 public:
392 
393  DDOrb( const DDSolid & s );
394  DDOrb( void ) = delete;
395 
396  double radius( void ) const;
397 };
398 
399 class DDEllipticalTube : public DDSolid
400 {
401 public:
402 
403  DDEllipticalTube( const DDSolid & s );
404  DDEllipticalTube( void ) = delete;
405 
406  double xSemiAxis( void ) const;
407  double ySemiAxis( void ) const;
408  double zHeight( void ) const;
409 };
410 
411 class DDEllipsoid : public DDSolid
412 {
413 public:
414 
415  DDEllipsoid( const DDSolid & s );
416  DDEllipsoid( void ) = delete;
417 
418  double xSemiAxis( void ) const;
419  double ySemiAxis( void ) const;
420  double zSemiAxis( void ) const;
421  double zBottomCut( void ) const;
422  double zTopCut( void ) const;
423 };
424 
425 class DDParallelepiped : public DDSolid
426 {
427 public:
428 
429  DDParallelepiped( const DDSolid & s );
430  DDParallelepiped( void ) = delete;
431 
432  double xHalf( void ) const;
433  double yHalf( void ) const;
434  double zHalf( void ) const;
435  double alpha( void ) const;
436  double theta( void ) const;
437  double phi( void ) const;
438 };
439 
440 // Solid generation functions
441 //
443 {
445 
451  static DDSolid box( const DDName & name,
452  double xHalf,
453  double yHalf,
454  double zHalf );
455 
457 
460  static DDSolid polycone( const DDName & name, double startPhi, double deltaPhi,
461  const std::vector<double> & z,
462  const std::vector<double> & rmin,
463  const std::vector<double> & rmax );
464 
466 
469  static DDSolid polycone( const DDName & name, double startPhi, double deltaPhi,
470  const std::vector<double> & z,
471  const std::vector<double> & r );
472 
474 
477  static DDSolid polyhedra( const DDName & name,
478  int sides,
479  double startPhi, double deltaPhi,
480  const std::vector<double> & z,
481  const std::vector<double> & rmin,
482  const std::vector<double> & rmax );
483 
485 
488  static DDSolid polyhedra( const DDName & name,
489  int sides,
490  double startPhi, double deltaPhi,
491  const std::vector<double> & z,
492  const std::vector<double> & r );
493 
494  static DDSolid unionSolid( const DDName & name,
495  const DDSolid & a,
496  const DDSolid & b,
497  const DDTranslation & t,
498  const DDRotation & r );
499 
500  static DDSolid multiUnionSolid( const DDName & name,
501  const std::vector<DDSolid> & a,
502  const std::vector<DDTranslation> & t,
503  const std::vector<DDRotation> & r );
504 
505  static DDSolid intersection( const DDName & name,
506  const DDSolid & a,
507  const DDSolid & b,
508  const DDTranslation & t,
509  const DDRotation & r );
510 
511  static DDSolid subtraction( const DDName & name,
512  const DDSolid & a,
513  const DDSolid & b,
514  const DDTranslation & t,
515  const DDRotation & r );
516 
517  static DDSolid trap( const DDName & name,
518  double pDz,
519  double pTheta, double pPhi,
520  double pDy1, double pDx1, double pDx2,
521  double pAlp1,
522  double pDy2, double pDx3, double pDx4,
523  double pAlp2 );
524 
525  static DDSolid pseudoTrap( const DDName & name,
526  double pDx1,
527  double pDx2,
528  double pDy1,
529  double pDy2,
530  double pDz,
531  double radius,
532  bool atMinusZ );
534  static DDSolid truncTubs( const DDName & name,
535  double zHalf,
536  double rIn,
537  double rOut,
538  double startPhi,
539  double deltaPhi,
540  double cutAtStart,
541  double cutAtDelta,
542  bool cutInside );
543 
544  static DDSolid tubs( const DDName & name,
545  double zhalf,
546  double rIn, double rOut,
547  double startPhi,
548  double deltaPhi );
549 
550  static DDSolid cuttubs( const DDName & name,
551  double zhalf,
552  double rIn, double rOut,
553  double startPhi,
554  double deltaPhi,
555  double lx, double ly, double lz,
556  double tx, double ty, double tz);
557 
558  static DDSolid cons( const DDName & name,
559  double zhalf,
560  double rInMinusZ,
561  double rOutMinusZ,
562  double rInPlusZ,
563  double rOutPlusZ,
564  double phiFrom,
565  double deltaPhi );
566 
567  static DDSolid torus( const DDName & name,
568  double rMin,
569  double rMax,
570  double rTorus,
571  double startPhi,
572  double deltaPhi );
573 
574  static DDSolid sphere( const DDName & name,
575  double innerRadius,
576  double outerRadius,
577  double startPhi,
578  double deltaPhi,
579  double startTheta,
580  double deltaTheta );
581 
582  static DDSolid orb( const DDName & name,
583  double radius );
584 
585  static DDSolid ellipticalTube( const DDName & name,
586  double xSemiAxis,
587  double ySemiAxis,
588  double zHeight );
589 
590  static DDSolid ellipsoid( const DDName & name,
591  double xSemiAxis,
592  double ySemiAxis,
593  double zSemiAxis,
594  double zBottomCut = 0.,
595  double zTopCut = 0. );
596 
597  static DDSolid parallelepiped( const DDName & name,
598  double xHalf, double yHalf, double zHalf,
599  double alpha, double theta, double phi );
600 
601  static DDSolid extrudedpolygon( const DDName & name,
602  const std::vector<double> & x,
603  const std::vector<double> & y,
604  const std::vector<double> & z,
605  const std::vector<double> & zx,
606  const std::vector<double> & zy,
607  const std::vector<double> & zscale );
608 
609  static DDSolid shapeless( const DDName & name );
610 
611  static DDSolid reflection( const DDName & name,
612  const DDSolid & s );
613 };
614 
615 #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:219
This is simply a handle on the solid.
Definition: DDSolid.h:177
DDSolidShape
Definition: DDSolidShapes.h:4
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:199
Interface to a Trapezoid.
Definition: DDSolid.h:79
DDI::MultiUnion * union_
Definition: DDSolid.h:215
Interface to a Box.
Definition: DDSolid.h:164
double b
Definition: hdecay.h:120
Definition: DDSolid.h:389
double a
Definition: hdecay.h:121
def which(cmd)
Definition: eostools.py:335
std::ostream & operator<<(std::ostream &, const DDSolid &)
Definition: DDSolid.cc:37