CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/Geometry/ForwardGeometry/src/ZdcGeometry.cc

Go to the documentation of this file.
00001 #include "Geometry/CaloGeometry/interface/CaloGenericDetId.h"
00002 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00003 #include "Geometry/ForwardGeometry/interface/ZdcGeometry.h"
00004 #include "Geometry/ForwardGeometry/interface/IdealZDCTrapezoid.h"
00005 #include "ZdcHardcodeGeometryData.h"
00006 #include <algorithm>
00007 
00008 typedef CaloCellGeometry::CCGFloat CCGFloat ;
00009 typedef CaloCellGeometry::Pt3D     Pt3D     ;
00010 typedef CaloCellGeometry::Pt3DVec  Pt3DVec  ;
00011 
00012 ZdcGeometry::ZdcGeometry() :
00013    theTopology( new ZdcTopology ),
00014    lastReqDet_(DetId::Detector(0)), 
00015    lastReqSubdet_(0),
00016    m_ownsTopology ( true ),
00017    m_cellVec ( k_NumberOfCellsForCorners )
00018 {}
00019 
00020 ZdcGeometry::ZdcGeometry( const ZdcTopology* topology) :
00021    theTopology(topology),
00022    lastReqDet_(DetId::Detector(0)), 
00023    lastReqSubdet_(0),
00024    m_ownsTopology ( false ),
00025    m_cellVec ( k_NumberOfCellsForCorners )
00026 {}
00027 
00028 ZdcGeometry::~ZdcGeometry() 
00029 {
00030   if( m_ownsTopology ) delete theTopology ;
00031 }
00032 /*
00033 DetId ZdcGeometry::getClosestCell(const GlobalPoint& r) const
00034 {
00035    DetId returnId ( 0 ) ;
00036    const std::vector<DetId>& detIds ( getValidDetIds() ) ;
00037    for( std::vector<DetId>::const_iterator it ( detIds.begin() ) ;
00038         it != detIds.end(); ++it )
00039    {
00040       const CaloCellGeometry* cell ( getGeometry( *it ) ) ;
00041       if( 0 != cell &&
00042           cell->inside( r ) )
00043       {
00044          returnId = *it ;
00045          break ;
00046       }
00047    }
00048    return returnId ;
00049 }
00050 */
00051 unsigned int
00052 ZdcGeometry::alignmentTransformIndexLocal( const DetId& id )
00053 {
00054    const CaloGenericDetId gid ( id ) ;
00055 
00056    assert( gid.isZDC() ) ;
00057 
00058    return ( 0 > HcalZDCDetId( id ).zside() ? 0 : 1 ) ;
00059 }
00060 
00061 unsigned int
00062 ZdcGeometry::alignmentTransformIndexGlobal( const DetId& /*id*/ )
00063 {
00064    return (unsigned int)DetId::Calo - 1 ;
00065 }
00066 
00067 void
00068 ZdcGeometry::localCorners( Pt3DVec&        lc  ,
00069                            const CCGFloat* pv ,
00070                            unsigned int    /*i*/  ,
00071                            Pt3D&           ref  )
00072 {
00073    IdealZDCTrapezoid::localCorners( lc, pv, ref ) ;
00074 }
00075 
00076 void
00077 ZdcGeometry::newCell( const GlobalPoint& f1 ,
00078                       const GlobalPoint& /*f2*/ ,
00079                       const GlobalPoint& /*f3*/ ,
00080                       const CCGFloat*    parm ,
00081                       const DetId&       detId   ) 
00082 {
00083    const CaloGenericDetId cgid ( detId ) ;
00084 
00085    assert( cgid.isZDC() ) ;
00086 
00087    const unsigned int di ( cgid.denseIndex() ) ;
00088 
00089    m_cellVec[ di ] = IdealZDCTrapezoid( f1, cornersMgr(), parm ) ;
00090    m_validIds.push_back( detId ) ;
00091 }
00092 
00093 const CaloCellGeometry* 
00094 ZdcGeometry::cellGeomPtr( uint32_t index ) const
00095 {
00096    const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
00097    return ( m_cellVec.size() < index ||
00098             0 == cell->param() ? 0 : cell ) ;
00099 }
00100