//============================================================================= // // File: IsoscelesPentagon.cpp // Created: 3-FEB-1998 by Stephen Kahn // Purpose: provide IsoscelesPentagon methods primarily for MHmodule // and MHfloor in End Calorimeter // //============================================================================ #include #include #include using namespace dgs; // // local_to_global // SpacePoint IsoscelesPentagon::local_to_global(const CartesianCoordinate& lpt) const { return GeometryElement::local_to_global( lpt); } // // global_to_local // CartesianCoordinate IsoscelesPentagon::global_to_local(const SpacePoint& gpt) const { CartesianCoordinate lxyz = get_position().invert(gpt); return lxyz; } // // xform_to_local // Purpose : Convert a (local) transformation describing a point in // a trapezoid to its local cartesian coordinates // CartesianCoordinate IsoscelesPentagon::xform_to_local(const GeometryXform& xf) const { CartesianCoordinate lxyz( xf[0], xf[1], xf[2]); return lxyz; } // // local_to_xform // GeometryXform IsoscelesPentagon::local_to_xform(const CartesianCoordinate& lpt) const { return GeometryXform(lpt.x(),lpt.y(),lpt.z(),0.,0.,0.); } // // set_center_xyz // void IsoscelesPentagon::set_center_xyz() { CartesianCoordinate zero( 0., 0., 0.); SpacePoint gc = local_to_global( zero); CartesianCoordinate gcen( gc.x(), gc.y(), gc.z()); _PentCenter = gcen; } void IsoscelesPentagon::set_center_xyz( double xx, double yy, double zz) { _PentCenter = CartesianCoordinate( xx, yy, zz); } // // set_Xform // void IsoscelesPentagon::set_Xform( double xx, double yy, double zz, double psi) { GeometryXform Tform( xx, yy, zz, 0., 0., -psi); GeometryElement::set_position( Tform); CartesianCoordinate zero( 0., 0., 0.); SpacePoint gc = local_to_global( zero); CartesianCoordinate gcen( gc.x(), gc.y(), gc.z()); _PentCenter = gcen; } // // fill_Pentagon // void IsoscelesPentagon::fill_Pentagon( double dxi, double dxo, double dz, double dhi, double dho) { _inner_half_width = dxi; _outer_half_width = dxo; _half_length = dz; _pent_half_height = dho; _trap_half_height = dhi; } // // position_child_at // bool IsoscelesPentagon::position_child_at( const CartesianCoordinate& lpt, GeometryElement& kid) { GeometryXform gxf = local_to_xform(lpt); gxf = get_position().apply(gxf); kid.set_position(gxf); return true; } bool IsoscelesPentagon::position_child_at( const GeometryXform& lpt, GeometryElement& kid) { GeometryXform gxf = get_position().apply(lpt); kid.set_position(gxf); return true; }