CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Geometry/CaloGeometry/src/PreshowerStrip.cc

Go to the documentation of this file.
00001 #include "Geometry/CaloGeometry/interface/PreshowerStrip.h"
00002 #include <iostream>
00003 
00004 
00005 const CaloCellGeometry::CornersVec& 
00006 PreshowerStrip::getCorners() const 
00007 {
00008    const CornersVec& co ( CaloCellGeometry::getCorners() ) ;
00009    if( co.uninitialized() ) 
00010    {
00011       CornersVec& corners ( setCorners() ) ;
00012 
00013       const GlobalPoint& ctr ( getPosition() ) ;
00014       const float x ( ctr.x() ) ;
00015       const float y ( ctr.y() ) ;
00016       const float z ( ctr.z() ) ;
00017 
00018       corners[ 0 ] = GlobalPoint( x - dx(), y - dy(), z - dz() ) ;
00019       corners[ 1 ] = GlobalPoint( x - dx(), y + dy(), z - dz() ) ;
00020       corners[ 2 ] = GlobalPoint( x + dx(), y + dy(), z - dz() ) ;
00021       corners[ 3 ] = GlobalPoint( x + dx(), y - dy(), z - dz() ) ;
00022       corners[ 4 ] = GlobalPoint( x - dx(), y - dy(), z + dz() ) ;
00023       corners[ 5 ] = GlobalPoint( x - dx(), y + dy(), z + dz() ) ;
00024       corners[ 6 ] = GlobalPoint( x + dx(), y + dy(), z + dz() ) ;
00025       corners[ 7 ] = GlobalPoint( x + dx(), y - dy(), z + dz() ) ;
00026    }
00027    return co ;
00028 }
00029 
00030 std::ostream& operator<<( std::ostream& s, const PreshowerStrip& cell ) 
00031 {
00032    s << "Center: " <<  cell.getPosition() << std::endl ;
00033    s << "dx = " << cell.dx() << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
00034 /*   const CaloCellGeometry::CornerVec& corners ( cell.getCorners() ) ; 
00035    for( unsigned int ci ( 0 ) ; ci != corners.size(); ci++ ) 
00036    {
00037       s  << "Corner: " << corners[ci] << std::endl;
00038    }*/
00039    return s;
00040 }
00041 
00042 std::vector<HepGeom::Point3D<double> >
00043 PreshowerStrip::localCorners( const double* pv,
00044                               HepGeom::Point3D<double> &   ref )
00045 {
00046    assert( 0 != pv ) ;
00047 
00048    const double dx ( pv[0] ) ;
00049    const double dy ( pv[1] ) ;
00050    const double dz ( pv[2] ) ;
00051 
00052    std::vector<HepGeom::Point3D<double> > lc ( 8, HepGeom::Point3D<double> (0,0,0) ) ;
00053 
00054    lc[0] = HepGeom::Point3D<double> ( -dx, -dy, -dz ) ;
00055    lc[1] = HepGeom::Point3D<double> ( -dx,  dy, -dz ) ;
00056    lc[2] = HepGeom::Point3D<double> (  dx,  dy, -dz ) ;
00057    lc[3] = HepGeom::Point3D<double> (  dx, -dy, -dz ) ;
00058    lc[4] = HepGeom::Point3D<double> ( -dx, -dy,  dz ) ;
00059    lc[5] = HepGeom::Point3D<double> ( -dx,  dy,  dz ) ;
00060    lc[6] = HepGeom::Point3D<double> (  dx,  dy,  dz ) ;
00061    lc[7] = HepGeom::Point3D<double> (  dx, -dy,  dz ) ;
00062 
00063    ref   = HepGeom::Point3D<double> (0,0,0) ;
00064 
00065    return lc ;
00066 }