GeoModel - GeoModelCore
GeoTrd.cxx
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GeoModelKernel/GeoTrd.h"
6 #include "GeoModelKernel/GeoShapeAction.h"
7 
8 const std::string GeoTrd::s_classType = "Trd";
9 const ShapeType GeoTrd::s_classTypeID = 0x16;
10 
11 GeoTrd::GeoTrd (double XHalfLength1, double XHalfLength2, double YHalfLength1, double YHalfLength2, double ZHalfLength)
12  : m_xHalfLength1 (XHalfLength1)
13  , m_xHalfLength2 (XHalfLength2)
14  , m_yHalfLength1 (YHalfLength1)
15  , m_yHalfLength2 (YHalfLength2)
16  , m_zHalfLength (ZHalfLength)
17 {}
18 
19 GeoTrd::~GeoTrd()
20 {}
21 
22 double GeoTrd::volume () const
23 {
24  double fDz = m_zHalfLength;
25  double fDy1 = m_yHalfLength1;
26  double fDx1 = m_xHalfLength1;
27  double fDx2 = m_xHalfLength2;
28  double fDy2 = m_yHalfLength2;
29  return 4.0 * ((fDx1 + fDx2) * (fDy1 + fDy2) * (fDz * 0.5) +
30  (fDx2 - fDx1) * (fDy2 - fDy1) * (fDz * (1./6)));
31 }
32 
33 const std::string & GeoTrd::type () const
34 {
35  return s_classType;
36 }
37 
38 ShapeType GeoTrd::typeID () const
39 {
40  return s_classTypeID;
41 }
42 
43 void GeoTrd::exec (GeoShapeAction *action) const
44 {
45  action->handleTrd(this);
46 }
47 
This class is a visitor for shapes. It allows a navigation of the boolean expression tree for shapes...