Go to the documentation of this file.00001 #include "Geometry/CaloGeometry/interface/PreshowerStrip.h"
00002 #include <iostream>
00003
00004 typedef PreshowerStrip::CCGFloat CCGFloat ;
00005 typedef PreshowerStrip::Pt3D Pt3D ;
00006 typedef PreshowerStrip::Pt3DVec Pt3DVec ;
00007 typedef PreshowerStrip::Tr3D Tr3D ;
00008
00009
00010 PreshowerStrip::PreshowerStrip() :
00011 CaloCellGeometry()
00012 {
00013 }
00014
00015 PreshowerStrip::PreshowerStrip( const PreshowerStrip& tr )
00016 {
00017 *this = tr ;
00018 }
00019
00020 PreshowerStrip&
00021 PreshowerStrip::operator=( const PreshowerStrip& tr )
00022 {
00023 CaloCellGeometry::operator=( tr ) ;
00024 if( this != &tr )
00025 {
00026 }
00027 return *this ;
00028 }
00029
00030 const CaloCellGeometry::CornersVec&
00031 PreshowerStrip::getCorners() const
00032 {
00033 const CornersVec& co ( CaloCellGeometry::getCorners() ) ;
00034 if( co.uninitialized() )
00035 {
00036 CornersVec& corners ( setCorners() ) ;
00037
00038 const GlobalPoint& ctr ( getPosition() ) ;
00039 const CCGFloat x ( ctr.x() ) ;
00040 const CCGFloat y ( ctr.y() ) ;
00041 const CCGFloat z ( ctr.z() ) ;
00042
00043 const double st ( sin(tilt()) ) ;
00044 const double ct ( cos(tilt()) ) ;
00045
00046 for( unsigned int ix ( 0 ) ; ix !=2 ; ++ix )
00047 {
00048 const double sx ( 0 == ix ? -1.0 : +1.0 ) ;
00049 for( unsigned int iy ( 0 ) ; iy !=2 ; ++iy )
00050 {
00051 const double sy ( 0 == iy ? -1.0 : +1.0 ) ;
00052 for( unsigned int iz ( 0 ) ; iz !=2 ; ++iz )
00053 {
00054 const double sz ( 0 == iz ? -1.0 : +1.0 ) ;
00055 const unsigned int i ( 4*iz + 2*ix +
00056 ( 1 == ix ? 1-iy : iy ) ) ;
00057
00058 corners[ i ] = GlobalPoint(
00059 dy()>dx() ?
00060 x + sx*dx() :
00061 x + sx*dx()*ct - sz*dz()*st ,
00062 dy()<dx() ?
00063 y + sy*dy() :
00064 y + sy*dy()*ct - sz*dz()*st ,
00065 dy()>dx() ?
00066 z + sz*dz()*ct + sy*dy()*st :
00067 z + sz*dz()*ct + sx*dx()*st ) ;
00068 }
00069 }
00070 }
00071 }
00072 return co ;
00073 }
00074
00075 std::ostream& operator<<( std::ostream& s, const PreshowerStrip& cell )
00076 {
00077 s << "Center: " << cell.getPosition() << std::endl ;
00078 s << "dx = " << cell.dx() << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
00079
00080
00081
00082
00083
00084 return s;
00085 }
00086
00087 void
00088 PreshowerStrip::localCorners( Pt3DVec& lc ,
00089 const CCGFloat* pv ,
00090 Pt3D& ref )
00091 {
00092 assert( 8 == lc.size() ) ;
00093 assert( 0 != pv ) ;
00094
00095 const CCGFloat dx ( pv[0] ) ;
00096 const CCGFloat dy ( pv[1] ) ;
00097 const CCGFloat dz ( pv[2] ) ;
00098
00099 lc[0] = Pt3D( -dx, -dy, -dz ) ;
00100 lc[1] = Pt3D( -dx, dy, -dz ) ;
00101 lc[2] = Pt3D( dx, dy, -dz ) ;
00102 lc[3] = Pt3D( dx, -dy, -dz ) ;
00103 lc[4] = Pt3D( -dx, -dy, dz ) ;
00104 lc[5] = Pt3D( -dx, dy, dz ) ;
00105 lc[6] = Pt3D( dx, dy, dz ) ;
00106 lc[7] = Pt3D( dx, -dy, dz ) ;
00107
00108 ref = Pt3D(0,0,0) ;
00109 }