CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/Geometry/HcalTowerAlgo/src/CaloTowerGeometry.cc

Go to the documentation of this file.
00001 #include "Geometry/CaloGeometry/interface/CaloGenericDetId.h"
00002 #include "Geometry/HcalTowerAlgo/interface/CaloTowerGeometry.h"
00003 
00004 typedef CaloCellGeometry::CCGFloat CCGFloat ;
00005 typedef CaloCellGeometry::Pt3D     Pt3D     ;
00006 typedef CaloCellGeometry::Pt3DVec  Pt3DVec  ;
00007 
00008 CaloTowerGeometry::CaloTowerGeometry() :
00009    m_cellVec ( k_NumberOfCellsForCorners ) 
00010 {
00011 }
00012   
00013 
00014 CaloTowerGeometry::~CaloTowerGeometry() {}
00015 
00016 
00017 unsigned int
00018 CaloTowerGeometry::alignmentTransformIndexLocal( const DetId& id )
00019 {
00020    const CaloGenericDetId gid ( id ) ;
00021 
00022    assert( gid.isCaloTower() ) ;
00023 
00024    const CaloTowerDetId cid ( id ) ;
00025 
00026    const unsigned int iea ( cid.ietaAbs() ) ;
00027 
00028    const unsigned int ip ( ( cid.iphi() - 1 )/4 ) ;
00029 
00030    const int izoff ( ( cid.zside() + 1 )/2 ) ;
00031 
00032    const unsigned int offset ( izoff*3*18) ;
00033 
00034    return ( offset + ip + ( CaloTowerDetId::kEndIEta < iea ? 36 :
00035                             ( CaloTowerDetId::kBarIEta < iea ? 18 : 0 ) ) ) ;
00036 }
00037 
00038 unsigned int
00039 CaloTowerGeometry::alignmentTransformIndexGlobal( const DetId& id )
00040 {
00041    return (unsigned int) DetId::Calo - 1 ;
00042 }
00043 
00044 void
00045 CaloTowerGeometry::localCorners( Pt3DVec&        lc  ,
00046                                  const CCGFloat* pv  ,
00047                                  unsigned int    i   ,
00048                                  Pt3D&           ref  )
00049 {
00050    IdealObliquePrism::localCorners( lc, pv, ref ) ;
00051 }
00052 
00053 void
00054 CaloTowerGeometry::newCell( const GlobalPoint& f1 ,
00055                             const GlobalPoint& f2 ,
00056                             const GlobalPoint& f3 ,
00057                             const CCGFloat*    parm ,
00058                             const DetId&       detId   ) 
00059 {
00060    const CaloGenericDetId cgid ( detId ) ;
00061 
00062    assert( cgid.isCaloTower() ) ;
00063 
00064    const unsigned int di ( cgid.denseIndex() ) ;
00065 
00066    m_cellVec[ di ] = IdealObliquePrism( f1, cornersMgr(), parm ) ;
00067    m_validIds.push_back( detId ) ;
00068 }
00069 
00070 const CaloCellGeometry* 
00071 CaloTowerGeometry::cellGeomPtr( uint32_t index ) const
00072 {
00073    const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
00074    return  ( m_cellVec.size() < index ||
00075              0 == cell->param() ? 0 : cell ) ;
00076 }