StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiCylindricalShape.h
1 #ifndef STI_CYLINDRICAL_SHAPE_H
2 #define STI_CYLINDRICAL_SHAPE_H
3 
4 #include "StiShape.h"
5 
11 public:
12 
13  // constructor
14  StiCylindricalShape(): StiShape(), _outerRadius(0.), _openingAngle(0.){}
15  StiCylindricalShape(const string &name,
16  float halfDepth_,
17  float thickness_,
18  float outerRadius_,
19  float openingAngle_)
20  : StiShape(name,halfDepth_, thickness_),
21  _outerRadius(outerRadius_),
22  _openingAngle(openingAngle_) {}// StiCylindricalShape()
23  // accessors
24  float getOuterRadius() const { return _outerRadius; }
25  float getOpeningAngle() const { return _openingAngle; }
26  float getHalfWidth() const;
27  StiShapeCode getShapeCode() const { return kCylindrical; };
28  virtual double getVolume() const;
29 
30  // mutators
31  void setOuterRadius(float val) {if (val >= 0.) _outerRadius = val; }
32  void setOpeningAngle(float val){_openingAngle = val;}
33 
34 protected:
35 
36  float _outerRadius; // >= 0
37  float _openingAngle; // azimuthal extent of cylinder in radians in [0, 2pi]
38 
39 };
40 
41 inline float StiCylindricalShape::getHalfWidth() const
42 {
43  return _outerRadius*sin(_openingAngle/2.);
44 }
45 inline double StiCylindricalShape::getVolume() const
46 {
47  double rmax = _outerRadius,rmin=rmax-getThickness();
48  return _openingAngle*(rmax-rmin)*(rmax+rmin)*getHalfDepth();
49 }
50 
51 
52 #endif