GeoModel - GeoModelCore
GeoTrap.cxx
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GeoModelKernel/GeoTrap.h"
6 #include "GeoModelKernel/GeoShapeAction.h"
7 
8 const std::string GeoTrap::s_classType = "Trap";
9 const ShapeType GeoTrap::s_classTypeID = 0x15;
10 
11 GeoTrap::GeoTrap (double ZHalfLength, double Theta, double Phi, double Dydzn, double Dxdyndzn, double Dxdypdzn, double Angleydzn, double Dydzp, double Dxdyndzp, double Dxdypdzp, double Angleydzp)
12  : m_zHalfLength (ZHalfLength)
13  , m_theta (Theta)
14  , m_phi (Phi)
15  , m_dydzn (Dydzn)
16  , m_dxdyndzn (Dxdyndzn)
17  , m_dxdypdzn (Dxdypdzn)
18  , m_angleydzn (Angleydzn)
19  , m_dydzp (Dydzp)
20  , m_dxdyndzp (Dxdyndzp)
21  , m_dxdypdzp (Dxdypdzp)
22  , m_angleydzp (Angleydzp)
23 {
24 }
25 
26 GeoTrap::~GeoTrap()
27 {
28 }
29 
30 double GeoTrap::volume () const
31 {
32  double fDz = m_zHalfLength;
33  double fDy1 = m_dydzn;
34  double pDx1 = m_dxdyndzn;
35  double pDx2 = m_dxdypdzn;
36  double fDy2 = m_dydzp;
37  double pDx3 = m_dxdyndzp;
38  double pDx4 = m_dxdypdzp;
39 
40 
41  double fDx1 = 0.5 * (pDx1 + pDx2);
42  double fDx2 = 0.5 * (pDx3 + pDx4);
43 
44  return 4.0 * ((fDx1 + fDx2) * (fDy1 + fDy2) * (fDz * 0.5) +
45  (fDx2 - fDx1) * (fDy2 - fDy1) * (fDz * (1./6)));
46 }
47 
48 const std::string & GeoTrap::type () const
49 {
50  return s_classType;
51 }
52 
53 ShapeType GeoTrap::typeID () const
54 {
55  return s_classTypeID;
56 }
57 
58 void GeoTrap::exec (GeoShapeAction *action) const
59 {
60  action->handleTrap(this);
61 }
This class is a visitor for shapes. It allows a navigation of the boolean expression tree for shapes...