Go to the documentation of this file.00001 #ifndef TruncatedPyramid_h
00002 #define TruncatedPyramid_h
00003
00004 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00005 #include <CLHEP/Geometry/Point3D.h>
00006 #include <CLHEP/Geometry/Plane3D.h>
00007 #include <CLHEP/Geometry/Vector3D.h>
00008 #include <CLHEP/Geometry/Transform3D.h>
00009 #include <vector>
00010
00011
00025 class TruncatedPyramid : public CaloCellGeometry
00026 {
00027 public:
00028
00029 typedef std::vector< HepGeom::Plane3D<double> > BoundaryVec ;
00030
00031 TruncatedPyramid( const CornersMgr* cMgr ,
00032 const GlobalPoint& fCtr ,
00033 const GlobalPoint& bCtr ,
00034 const GlobalPoint& cor1 ,
00035 const double* parV ) :
00036 CaloCellGeometry ( fCtr, cMgr, parV ) ,
00037 m_axis ( ( bCtr - fCtr ).unit() ) ,
00038 m_corOne ( new HepGeom::Point3D<double> ( cor1.x(), cor1.y(), cor1.z() ) )
00039 {}
00040
00041 TruncatedPyramid( const CornersVec& corn,
00042 const double* par ) :
00043 CaloCellGeometry ( corn, par ) ,
00044 m_axis ( makeAxis() ) ,
00045 m_corOne ( new HepGeom::Point3D<double> ( corn[0].x(),
00046 corn[0].y(),
00047 corn[0].z() ) ) {}
00048
00049 virtual ~TruncatedPyramid() { delete m_corOne ; }
00050
00056 const GlobalPoint getPosition( float depth ) const
00057 { return CaloCellGeometry::getPosition() + depth*m_axis ; }
00058
00059 virtual const CornersVec& getCorners() const ;
00060
00061
00062 float getThetaAxis() const { return m_axis.theta() ; }
00063
00064
00065 float getPhiAxis() const { return m_axis.phi() ; }
00066
00067 const GlobalVector& axis() const { return m_axis ; }
00068
00069
00070
00071 static void createCorners( const std::vector<double>& pv ,
00072 const HepGeom::Transform3D& tr ,
00073 CornersVec& co ) ;
00074
00075 virtual std::vector<HepGeom::Point3D<double> > vocalCorners( const double* pv,
00076 HepGeom::Point3D<double> & ref ) const
00077 { return localCorners( pv, ref ) ; }
00078
00079 static std::vector<HepGeom::Point3D<double> > localCorners( const double* pv,
00080 HepGeom::Point3D<double> & ref ) ;
00081 static std::vector<HepGeom::Point3D<double> > localCornersReflection( const double* pv,
00082 HepGeom::Point3D<double> & ref ) ;
00083
00084 static std::vector<HepGeom::Point3D<double> > localCornersSwap( const double* pv,
00085 HepGeom::Point3D<double> & ref ) ;
00086
00087 virtual HepGeom::Transform3D getTransform( std::vector<HepGeom::Point3D<double> >* lptr ) const ;
00088
00089 private:
00090
00091
00092 GlobalVector makeAxis()
00093 {
00094 return GlobalVector( backCtr() -
00095 CaloCellGeometry::getPosition() ).unit() ;
00096 }
00097
00098 const GlobalPoint backCtr() const
00099 {
00100 return GlobalPoint( 0.25*( getCorners()[4].x() + getCorners()[5].x() +
00101 getCorners()[6].x() + getCorners()[7].x() ),
00102 0.25*( getCorners()[4].y() + getCorners()[5].y() +
00103 getCorners()[6].y() + getCorners()[7].y() ),
00104 0.25*( getCorners()[4].z() + getCorners()[5].z() +
00105 getCorners()[6].z() + getCorners()[7].z() ) ) ;
00106 }
00107
00108 GlobalVector m_axis ;
00109
00110 mutable HepGeom::Point3D<double> * m_corOne ;
00111 };
00112
00113 std::ostream& operator<<( std::ostream& s, const TruncatedPyramid& cell ) ;
00114
00115 #endif