CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDSolid.h
Go to the documentation of this file.
1 #ifndef DDSolid_h
2 #define DDSolid_h
3 
4 #include <iosfwd>
5 #include <vector>
6 
12 
13 namespace DDI { class Solid; }
14 namespace DDI { class Reflection; }
15 namespace DDI { class BooleanSolid; }
16 
17 class DDSolid;
18 struct DDSolidFactory;
19 class DDStreamer;
20 
21 std::ostream & operator<<( std::ostream &, const DDSolid & );
22 
24 
35 class DDSolid : public DDBase<DDName, DDI::Solid*>
36 {
37  friend std::ostream & operator<<( std::ostream &, const DDSolid & );
38  friend struct DDSolidFactory;
39  friend class DDDToPersFactory;
40  friend class DDPersToDDDFactory;
41  friend class DDStreamer;
42 
43 public:
45  DDSolid( void );
46 
48 
56  DDSolid( const DDName & name );
57 
59  const std::vector<double> & parameters( void ) const;
60 
62  double volume( void ) const;
63 
65  DDSolidShape shape( void ) const;
66 
67 private:
68  DDSolid( const DDName &, DDI::Solid * );
69  DDSolid( const DDName &, DDSolidShape, const std::vector<double> & );
70 };
71 
73 
77 class DDTrap : public DDSolid
78 {
79 public:
80  DDTrap( const DDSolid & s );
82  double halfZ( void ) const;
84  double theta( void ) const;
86  double phi( void ) const;
88  double y1( void ) const;
90  double x1( void ) const;
92  double x2( void ) const;
94  double alpha1( void ) const;
96  double y2( void ) const;
98  double x3( void ) const;
100  double x4( void ) const;
102  double alpha2( void ) const;
103 
104 private:
105  DDTrap( void );
106 };
107 
108 class DDPseudoTrap : public DDSolid
109 {
110 public:
111  DDPseudoTrap( const DDSolid & s );
113  double halfZ( void ) const;
115  double x1( void ) const;
117  double x2( void ) const;
119  double y1( void ) const;
121  double y2( void ) const;
123  double radius( void ) const;
125  bool atMinusZ( void ) const;
126 
127 private:
128  DDPseudoTrap( void );
129 };
130 
132 class DDTruncTubs : public DDSolid
133 {
134 public:
135  DDTruncTubs( const DDSolid & s );
137  double zHalf( void ) const;
139  double rIn( void ) const;
141  double rOut( void ) const;
143  double startPhi( void ) const;
145  double deltaPhi( void ) const;
147  double cutAtStart( void ) const;
149  double cutAtDelta( void ) const;
151  bool cutInside( void ) const;
152 
153 private:
154  DDTruncTubs( void );
155 };
156 
158 
162 class DDBox : public DDSolid
163 {
164 public:
165  DDBox( const DDSolid & s );
166  double halfX( void ) const;
167  double halfY( void ) const;
168  double halfZ( void ) const;
169 
170 private:
171  DDBox( void );
172 };
173 
175 class DDShapelessSolid : public DDSolid
176 {
177 public:
178  DDShapelessSolid( const DDSolid & s );
179 
180 private:
181  DDShapelessSolid( void );
182 };
183 
185 {
186 public:
187  DDReflectionSolid( const DDSolid & s );
188  DDSolid unreflected( void ) const;
189 
190 private:
191  DDReflectionSolid( void );
193 };
194 
195 class DDBooleanSolid : public DDSolid
196 {
197 public:
198  DDBooleanSolid( const DDSolid & s );
199  DDSolid solidA( void ) const;
200  DDSolid solidB( void ) const;
201  DDTranslation translation( void ) const;
202  DDRotation rotation( void ) const;
203 
204 private:
205  DDBooleanSolid( void );
207 };
208 
210 class DDPolySolid : public DDSolid
211 {
212 public:
213  DDPolySolid( const DDSolid & s );
214 
215 protected:
217  virtual std::vector<double> getVec( const size_t& which, const size_t& offset = 0, const size_t& nVecs = 1 ) const;
218  DDPolySolid( void );
219 };
220 
221 class DDPolycone : public DDPolySolid
222 {
223 public:
224  DDPolycone( const DDSolid & s );
225  double startPhi( void ) const;
226  double deltaPhi( void ) const;
227  std::vector<double> zVec( void ) const;
228  std::vector<double> rVec( void ) const;
229  std::vector<double> rMinVec( void ) const;
230  std::vector<double> rMaxVec( void ) const;
231 
232 private:
233  DDPolycone( void );
234 };
235 
236 class DDPolyhedra : public DDPolySolid
237 {
238 public:
239  DDPolyhedra( const DDSolid & s );
240  int sides( void ) const;
241  double startPhi( void ) const;
242  double deltaPhi( void ) const;
243  std::vector<double> zVec( void ) const;
244  std::vector<double> rVec( void ) const;
245  std::vector<double> rMinVec( void ) const;
246  std::vector<double> rMaxVec( void ) const;
247 
248 private:
249  DDPolyhedra( void );
250 };
251 
252 class DDTubs : public DDSolid
253 {
254 public:
255  DDTubs( const DDSolid & s );
256  double zhalf( void ) const;
257  double rIn( void ) const;
258  double rOut( void ) const;
259  double startPhi( void ) const;
260  double deltaPhi( void ) const;
261 
262 private:
263  DDTubs( void );
264 };
265 
266 class DDCons : public DDSolid
267 {
268 public:
269  DDCons( const DDSolid & s );
270  double zhalf( void ) const;
271  double rInMinusZ( void ) const;
272  double rOutMinusZ( void ) const;
273  double rInPlusZ( void ) const;
274  double rOutPlusZ( void ) const;
275  double phiFrom( void ) const;
276  double deltaPhi( void ) const;
277 
278 private:
279  DDCons( void );
280 };
281 
282 class DDTorus : public DDSolid
283 {
284 public:
285  DDTorus( const DDSolid & s );
286  double rMin( void ) const;
287  double rMax( void ) const;
288  double rTorus( void ) const;
289  double startPhi( void ) const;
290  double deltaPhi( void ) const;
291 
292 private:
293  DDTorus( void );
294 };
295 
296 class DDUnion : public DDBooleanSolid
297 {
298 public:
299  DDUnion( const DDSolid & s );
300 
301 private:
302  DDUnion( void );
303 };
304 
306 {
307 public:
308  DDIntersection( const DDSolid & s );
309 
310 private:
311  DDIntersection( void );
312 };
313 
315 {
316 public:
317  DDSubtraction( const DDSolid & s );
318 
319 private:
320  DDSubtraction( void );
321 };
322 
323 class DDSphere : public DDSolid
324 {
325 public:
326  DDSphere( const DDSolid & s );
327  double innerRadius( void ) const;
328  double outerRadius( void ) const;
329  double startPhi( void ) const;
330  double deltaPhi( void ) const;
331  double startTheta( void ) const;
332  double deltaTheta( void ) const;
333 
334 private:
335  DDSphere( void );
336 };
337 
338 class DDOrb : public DDSolid
339 {
340 public:
341  DDOrb( const DDSolid & s );
342  double radius( void ) const;
343 
344 private:
345  DDOrb( void );
346 };
347 
348 class DDEllipticalTube : public DDSolid
349 {
350 public:
351  DDEllipticalTube( const DDSolid & s );
352  double xSemiAxis( void ) const;
353  double ySemiAxis( void ) const;
354  double zHeight( void ) const;
355 
356 private:
357  DDEllipticalTube( void );
358 };
359 
360 class DDEllipsoid : public DDSolid
361 {
362 public:
363  DDEllipsoid( const DDSolid & s );
364  double xSemiAxis( void ) const;
365  double ySemiAxis( void ) const;
366  double zSemiAxis( void ) const;
367  double zBottomCut( void ) const;
368  double zTopCut( void ) const;
369 
370 private:
371  DDEllipsoid( void );
372 };
373 
374 class DDParallelepiped : public DDSolid
375 {
376 public:
377  DDParallelepiped( const DDSolid & s );
378  double xHalf( void ) const;
379  double yHalf( void ) const;
380  double zHalf( void ) const;
381  double alpha( void ) const;
382  double theta( void ) const;
383  double phi( void ) const;
384 
385 private:
386  DDParallelepiped( void );
387 };
388 
389 // Solid generation functions
390 //
392 {
394 
400  static DDSolid box( const DDName & name,
401  double xHalf,
402  double yHalf,
403  double zHalf );
404 
406 
409  static DDSolid polycone( const DDName & name, double startPhi, double deltaPhi,
410  const std::vector<double> & z,
411  const std::vector<double> & rmin,
412  const std::vector<double> & rmax );
413 
415 
418  static DDSolid polycone( const DDName & name, double startPhi, double deltaPhi,
419  const std::vector<double> & z,
420  const std::vector<double> & r );
421 
423 
426  static DDSolid polyhedra( const DDName & name,
427  int sides,
428  double startPhi, double deltaPhi,
429  const std::vector<double> & z,
430  const std::vector<double> & rmin,
431  const std::vector<double> & rmax );
432 
434 
437  static DDSolid polyhedra( const DDName & name,
438  int sides,
439  double startPhi, double deltaPhi,
440  const std::vector<double> & z,
441  const std::vector<double> & r );
442 
443  static DDSolid unionSolid( const DDName & name,
444  const DDSolid & a,
445  const DDSolid & b,
446  const DDTranslation & t,
447  const DDRotation & r );
448 
449  static DDSolid intersection( const DDName & name,
450  const DDSolid & a,
451  const DDSolid & b,
452  const DDTranslation & t,
453  const DDRotation & r );
454 
455  static DDSolid subtraction( const DDName & name,
456  const DDSolid & a,
457  const DDSolid & b,
458  const DDTranslation & t,
459  const DDRotation & r );
460 
461  static DDSolid trap( const DDName & name,
462  double pDz,
463  double pTheta, double pPhi,
464  double pDy1, double pDx1, double pDx2,
465  double pAlp1,
466  double pDy2, double pDx3, double pDx4,
467  double pAlp2 );
468 
469  static DDSolid pseudoTrap( const DDName & name,
470  double pDx1,
471  double pDx2,
472  double pDy1,
473  double pDy2,
474  double pDz,
475  double radius,
476  bool atMinusZ );
478  static DDSolid truncTubs( const DDName & name,
479  double zHalf,
480  double rIn,
481  double rOut,
482  double startPhi,
483  double deltaPhi,
484  double cutAtStart,
485  double cutAtDelta,
486  bool cutInside );
487 
488  static DDSolid tubs( const DDName & name,
489  double zhalf,
490  double rIn, double rOut,
491  double startPhi,
492  double deltaPhi );
493 
494  static DDSolid cons( const DDName & name,
495  double zhalf,
496  double rInMinusZ,
497  double rOutMinusZ,
498  double rInPlusZ,
499  double rOutPlusZ,
500  double phiFrom,
501  double deltaPhi );
502 
503  static DDSolid torus( const DDName & name,
504  double rMin,
505  double rMax,
506  double rTorus,
507  double startPhi,
508  double deltaPhi );
509 
510  static DDSolid sphere( const DDName & name,
511  double innerRadius,
512  double outerRadius,
513  double startPhi,
514  double deltaPhi,
515  double startTheta,
516  double deltaTheta );
517 
518  static DDSolid orb( const DDName & name,
519  double radius );
520 
521  static DDSolid ellipticalTube( const DDName & name,
522  double xSemiAxis,
523  double ySemiAxis,
524  double zHeight );
525 
526  static DDSolid ellipsoid( const DDName & name,
527  double xSemiAxis,
528  double ySemiAxis,
529  double zSemiAxis,
530  double zBottomCut = 0.,
531  double zTopCut = 0. );
532 
533  static DDSolid parallelepiped( const DDName & name,
534  double xHalf, double yHalf, double zHalf,
535  double alpha, double theta, double phi );
536 
537 
538  static DDSolid shapeless( const DDName & name );
539 
540  static DDSolid reflection( const DDName & name,
541  const DDSolid & s );
542 };
543 
544 #endif
double zhalf(void) const
Definition: DDSolid.cc:458
Definition: DDBase.h:10
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
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
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 which
Definition: eostools.py:335
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
A truncated tube section.
Definition: DDSolid.h:132
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 DDName & name() const
Definition: DDBase.h:78
double zHalf(void) const
half of the z-Axis
Definition: DDSolid.cc:201
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
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
This is simply a handle on the solid.
Definition: DDSolid.h:175
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
friend class DDPersToDDDFactory
Definition: DDSolid.h:40
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
Streaming the DDD transient store from/into a std::istream/std::ostream */.
Definition: DDStreamer.h:41
double zTopCut(void) const
Definition: DDSolid.cc:627
DDTorus(void)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:14
double radius(void) const
Definition: DDSolid.cc:589
double rIn(void) const
inner radius
Definition: DDSolid.cc:203
double rOutMinusZ(void) const
Definition: DDSolid.cc:462
double rOutPlusZ(void) const
Definition: DDSolid.cc:466
DDTranslation translation(void) const
Definition: DDSolid.cc:540
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
double ySemiAxis(void) const
Definition: DDSolid.cc:621
double innerRadius(void) const
Definition: DDSolid.cc:566
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)
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
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
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
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
Interface to a Trapezoid.
Definition: DDSolid.h:77
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
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
Interface to a Box.
Definition: DDSolid.h:162
DDIntersection(void)
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:705
friend class DDDToPersFactory
Definition: DDSolid.h:39
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: DDSolid.h:338
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
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
friend std::ostream & operator<<(std::ostream &, const DDSolid &)
Definition: DDSolid.cc:33
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
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