GeoModel - GeoModelCore
GeoTube.cxx
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GeoModelKernel/GeoTube.h"
6 #include "GeoModelKernel/GeoPolyhedrizeAction.h"
7 #include "GeoModelKernel/GeoShapeAction.h"
8 #include <cmath>
9 
10 const std::string GeoTube::s_classType = "Tube";
11 const ShapeType GeoTube::s_classTypeID = 0x17;
12 
13 GeoTube::GeoTube (double RMin, double RMax, double ZHalfLength)
14  : m_rMin (RMin)
15  , m_rMax (RMax)
16  , m_zHalfLength (ZHalfLength)
17 {
18 }
19 
20 GeoTube::~GeoTube()
21 {
22 }
23 
24 double GeoTube::volume () const
25 {
26 #ifndef M_PI
27  double M_PI = acos (-1.0);
28 #endif
29  return 2 * M_PI * (m_rMax * m_rMax - m_rMin * m_rMin) * m_zHalfLength;
30 }
31 
32 const std::string & GeoTube::type () const
33 {
34  return s_classType;
35 }
36 
37 ShapeType GeoTube::typeID () const
38 {
39  return s_classTypeID;
40 }
41 
42 void GeoTube::exec (GeoShapeAction *action) const
43 {
44  action->handleTube(this);
45 }
This class is a visitor for shapes. It allows a navigation of the boolean expression tree for shapes...