GeoModel - GeoModelCore
GeoPgon.h
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef GEOMODELKERNEL_GEOPGON_H
6 #define GEOMODELKERNEL_GEOPGON_H
7 
8 #include "GeoModelKernel/GeoShape.h"
9 #include <vector>
10 
11 class GeoPgon : public GeoShape
12 {
13  public:
14  // Constructor for the PGON. Note that the constructor
15  // does not fully build this object. The PGON is not valid
16  // until at least two polygon planes have been added.
17  GeoPgon (double SPhi, double DPhi, unsigned int NSides);
18 
19  // Returns the volume of the shape, for mass inventory
20  virtual double volume () const;
21 
22  // Returns the PGON shape type, as a string.
23  virtual const std::string & type () const;
24 
25  // Returns the PGON shape type, as a coded integer.
26  virtual ShapeType typeID () const;
27 
28  // Add another plane to the polygon. A minimum of two
29  // planes are required to create a valid polygon.
30  void addPlane (double ZPlane, double RMinPlane, double RMaxPlane);
31 
32  // Returns the number of planes that have been created for
33  // the polygon.
34  unsigned int getNPlanes () const;
35 
36  // True if the polygon has at least two planes. False
37  // otherwise.
38  bool isValid () const;
39 
40  // Get the Z Position of the specified plane.
41  const double & getZPlane (unsigned int i) const;
42 
43  // Get the RMin of the specified plane.
44  const double & getRMinPlane (unsigned int i) const;
45 
46  // Get the Z Position of the specified plane.
47  const double & getRMaxPlane (unsigned int i) const;
48 
49  // Executes a GeoShapeAction
50  virtual void exec (GeoShapeAction *action) const;
51 
52  // For type identification.
53  static const std::string& getClassType ();
54 
55  // For type identification.
56  static ShapeType getClassTypeID ();
57 
58  // Starting angle of the segment in radians.
59  const double& getSPhi () const;
60 
61  // Delta angle of the segment in radians.
62  const double& getDPhi () const;
63 
64  // Number of sides in each polygonal segment.
65  const unsigned int& getNSides () const;
66 
67  protected:
68  virtual ~GeoPgon();
69 
70  private:
71  GeoPgon(const GeoPgon &right);
72  GeoPgon & operator=(const GeoPgon &right);
73 
74  static const std::string s_classType;
75  static const ShapeType s_classTypeID;
76 
77  double m_sPhi;
78  double m_dPhi;
79  unsigned int m_nSides;
80 
81  // Z Position of polygon planes.
82  std::vector<double> m_zPlane;
83 
84  // Minimum radius of polygon planes.
85  std::vector<double> m_rMinPlane;
86 
87  // Maximum radius of polygon planes.
88  std::vector<double> m_rMaxPlane;
89 };
90 
91 inline unsigned int GeoPgon::getNPlanes () const
92 {
93  return m_zPlane.size ();
94 }
95 
96 inline bool GeoPgon::isValid () const
97 {
98  return m_zPlane.size () >= 2;
99 }
100 
101 inline const double & GeoPgon::getZPlane (unsigned int i) const
102 {
103  return m_zPlane[i];
104 }
105 
106 inline const double & GeoPgon::getRMinPlane (unsigned int i) const
107 {
108  return m_rMinPlane[i];
109 }
110 
111 inline const double & GeoPgon::getRMaxPlane (unsigned int i) const
112 {
113  return m_rMaxPlane[i];
114 }
115 
116 inline const std::string& GeoPgon::getClassType ()
117 {
118  return s_classType;
119 }
120 
121 inline ShapeType GeoPgon::getClassTypeID ()
122 {
123  return s_classTypeID;
124 }
125 
126 inline const double& GeoPgon::getSPhi () const
127 {
128  return m_sPhi;
129 }
130 
131 inline const double& GeoPgon::getDPhi () const
132 {
133  return m_dPhi;
134 }
135 
136 inline const unsigned int& GeoPgon::getNSides () const
137 {
138  return m_nSides;
139 }
140 
141 #endif
This class is a visitor for shapes. It allows a navigation of the boolean expression tree for shapes...
This class describes a Shape. Shapes will be able to do the following things:
Definition: GeoShape.h:38