GeoModel - GeoModelCore
GeoPara.cxx
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <cmath>
6 #include "GeoModelKernel/GeoDefinitions.h"
7 #include "GeoModelKernel/GeoShapeAction.h"
8 #include "GeoModelKernel/GeoPara.h"
9 
10 const std::string GeoPara::s_classType = "Para";
11 const ShapeType GeoPara::s_classTypeID = 0x12;
12 GeoPara::GeoPara (double XHalfLength, double YHalfLength, double ZHalfLength, double Alpha, double Theta, double Phi)
13  :
14 m_xHalfLength (XHalfLength),
15 m_yHalfLength (YHalfLength),
16 m_zHalfLength (ZHalfLength),
17 m_theta (Theta),
18 m_alpha (Alpha),
19 m_phi (Phi)
20 {}
21 
22 GeoPara::~GeoPara()
23 {}
24 
25  double GeoPara::volume () const
26 {
27  //## begin GeoPara::volume%3CD2A6DB00FC.body preserve=yes
28  GeoTrf::Vector3D
29  v0 (1, 0, 0),
30  v1 (sin (m_alpha), cos (m_alpha), 0),
31  v2 (sin (m_theta) * cos (m_phi), sin (m_theta) * sin (m_phi), cos (m_theta));
32  double factor = (v0.cross (v1).dot (v2));
33 
34  return 8.0 * factor * m_xHalfLength * m_yHalfLength * m_zHalfLength;
35 }
36 
37 const std::string & GeoPara::type () const
38 {
39  return s_classType;
40 }
41 
42 ShapeType GeoPara::typeID () const
43 {
44  return s_classTypeID;
45 }
46 
47 void GeoPara::exec (GeoShapeAction *action) const
48 {
49  action->handlePara(this);
50 }
51 
This class is a visitor for shapes. It allows a navigation of the boolean expression tree for shapes...