CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

EcalEndcapGeometry Class Reference

#include <EcalEndcapGeometry.h>

Inheritance diagram for EcalEndcapGeometry:
CaloSubdetectorGeometry

List of all members.

Public Types

enum  { k_NumberOfCellsForCorners = EEDetId::kSizeForDenseIndexing }
enum  { k_NumberOfShapes = 1 }
enum  { k_NumberOfParametersPerShape = 11 }
typedef EcalEndcapGeometryRecord AlignedRecord
typedef EEAlignmentRcd AlignmentRecord
typedef CaloCellGeometry::CCGFloat CCGFloat
typedef std::vector
< TruncatedPyramid
CellVec
typedef EEDetId DetIdType
typedef IdealGeometryRecord IdealRecord
typedef EcalEndcapNumberingScheme NumberingScheme
typedef EZArrayFL< EBDetIdOrderedListOfEBDetId
typedef PEcalEndcapRcd PGeometryRecord
typedef CaloCellGeometry::Pt3D Pt3D
typedef CaloCellGeometry::Pt3DVec Pt3DVec
typedef std::vector
< OrderedListOfEBDetId * > 
VecOrdListEBDetIdPtr

Public Member Functions

CCGFloat avgAbsZFrontFaceCenter () const
 EcalEndcapGeometry ()
virtual
CaloSubdetectorGeometry::DetIdSet 
getCells (const GlobalPoint &r, double dR) const
 Get a list of all cells within a dR of the given cell.
const OrderedListOfEBDetIdgetClosestBarrelCells (EEDetId id) const
virtual DetId getClosestCell (const GlobalPoint &r) const
int getNumberOfCrystalPerModule () const
int getNumberOfModules () const
virtual void initializeParms ()
virtual void newCell (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
virtual unsigned int numberOfParametersPerShape () const
virtual unsigned int numberOfShapes () const
void setNumberOfCrystalPerModule (const int nncrys)
void setNumberOfModules (const int nnmods)
virtual ~EcalEndcapGeometry ()

Static Public Member Functions

static unsigned int alignmentTransformIndexGlobal (const DetId &id)
static unsigned int alignmentTransformIndexLocal (const DetId &id)
static std::string dbString ()
static DetId detIdFromLocalAlignmentIndex (unsigned int iLoc)
static std::string hitString ()
static void localCorners (Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
static unsigned int numberOfAlignments ()
static std::string producerTag ()

Protected Member Functions

virtual const CaloCellGeometrycellGeomPtr (uint32_t index) const

Private Member Functions

EEDetId gId (float x, float y, float z) const
unsigned int xindex (CCGFloat x, CCGFloat z) const
unsigned int yindex (CCGFloat y, CCGFloat z) const

Static Private Member Functions

static int myPhi (int i)

Private Attributes

int _nncrys
 number of crystals per module
int _nnmods
 number of modules
CCGFloat m_avgZ
EZMgrFL< EBDetId > * m_borderMgr
VecOrdListEBDetIdPtrm_borderPtrVec
CellVec m_cellVec
CCGFloat m_del
unsigned int m_nref
CCGFloat m_wref
CCGFloat m_xhi [2]
CCGFloat m_xlo [2]
CCGFloat m_xoff [2]
CCGFloat m_yhi [2]
CCGFloat m_ylo [2]
CCGFloat m_yoff [2]
CCGFloat zeN
CCGFloat zeP

Detailed Description

Definition at line 18 of file EcalEndcapGeometry.h.


Member Typedef Documentation

Definition at line 29 of file EcalEndcapGeometry.h.

Definition at line 30 of file EcalEndcapGeometry.h.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 24 of file EcalEndcapGeometry.h.

Definition at line 22 of file EcalEndcapGeometry.h.

Definition at line 39 of file EcalEndcapGeometry.h.

Definition at line 28 of file EcalEndcapGeometry.h.

Definition at line 37 of file EcalEndcapGeometry.h.

Definition at line 33 of file EcalEndcapGeometry.h.

Definition at line 31 of file EcalEndcapGeometry.h.

Definition at line 25 of file EcalEndcapGeometry.h.

Definition at line 26 of file EcalEndcapGeometry.h.

Definition at line 35 of file EcalEndcapGeometry.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
k_NumberOfCellsForCorners 

Definition at line 41 of file EcalEndcapGeometry.h.

anonymous enum
Enumerator:
k_NumberOfShapes 

Definition at line 43 of file EcalEndcapGeometry.h.

{ k_NumberOfShapes = 1 } ;
anonymous enum
Enumerator:
k_NumberOfParametersPerShape 

Definition at line 45 of file EcalEndcapGeometry.h.


Constructor & Destructor Documentation

EcalEndcapGeometry::EcalEndcapGeometry ( void  )

Definition at line 14 of file EcalEndcapGeometry.cc.

References m_xhi, m_xlo, m_xoff, m_yhi, m_ylo, and m_yoff.

  : _nnmods( 316 ),
    _nncrys( 25 ),
    zeP( 0. ),
    zeN( 0. ),
    m_wref( 0. ),
    m_del( 0. ),
    m_nref( 0 ),
    m_borderMgr( 0 ),
    m_borderPtrVec( 0 ),
    m_avgZ( -1 ),
    m_cellVec( k_NumberOfCellsForCorners )
{
  m_xlo[0] = 999.;
  m_xlo[1] = 999.;
  m_xhi[0] = -999.;
  m_xhi[1] = -999.;
  m_ylo[0] = 999.;
  m_ylo[1] = 999.;
  m_yhi[0] = -999.;
  m_yhi[1] = -999.;
  m_xoff[0] = 0.;
  m_xoff[1] = 0.;
  m_yoff[0] = 0.;
  m_yoff[0] = 0.;
}
EcalEndcapGeometry::~EcalEndcapGeometry ( ) [virtual]

Definition at line 41 of file EcalEndcapGeometry.cc.

References m_borderMgr, and m_borderPtrVec.

{
   delete m_borderPtrVec ;
   delete m_borderMgr ;
}

Member Function Documentation

unsigned int EcalEndcapGeometry::alignmentTransformIndexGlobal ( const DetId id) [static]

Definition at line 65 of file EcalEndcapGeometry.cc.

References DetId::Ecal.

{
   return (unsigned int)DetId::Ecal - 1 ;
}
unsigned int EcalEndcapGeometry::alignmentTransformIndexLocal ( const DetId id) [static]

Definition at line 48 of file EcalEndcapGeometry.cc.

References getHLTprescales::index, and CaloGenericDetId::isEE().

{
   const CaloGenericDetId gid ( id ) ;

   assert( gid.isEE() ) ;
   unsigned int index ( EEDetId(id).ix()/51 + ( EEDetId(id).zside()<0 ? 0 : 2 ) ) ;

   return index ;
}
CCGFloat EcalEndcapGeometry::avgAbsZFrontFaceCenter ( ) const

Definition at line 495 of file EcalEndcapGeometry.cc.

References cellGeomPtr(), CaloCellGeometry::getPosition(), i, m_avgZ, m_cellVec, and PV3DBase< T, PVType, FrameType >::z().

{
   if( 0 > m_avgZ )
   {
      CCGFloat sum ( 0 ) ;
      for( unsigned int i ( 0 ) ; i != m_cellVec.size() ; ++i )
      {
         const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
         if( 0 != cell )
         {
            sum += fabs( cell->getPosition().z() ) ;
         }
      }
      m_avgZ = sum/m_cellVec.size() ;
   }
   return m_avgZ ;
}
const CaloCellGeometry * EcalEndcapGeometry::cellGeomPtr ( uint32_t  index) const [protected, virtual]

Implements CaloSubdetectorGeometry.

Definition at line 514 of file EcalEndcapGeometry.cc.

References m_cellVec, and CaloCellGeometry::param().

Referenced by avgAbsZFrontFaceCenter(), and initializeParms().

{
   const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
   return ( m_cellVec.size() < index ||
            0 == cell->param() ? 0 : cell ) ;
}
static std::string EcalEndcapGeometry::dbString ( ) [inline, static]

Definition at line 48 of file EcalEndcapGeometry.h.

{ return "PEcalEndcapRcd" ; }
DetId EcalEndcapGeometry::detIdFromLocalAlignmentIndex ( unsigned int  iLoc) [static]

Definition at line 59 of file EcalEndcapGeometry.cc.

Referenced by FakeCaloAlignmentEP::produceEEAli(), and TestCaloAlignmentEP::produceEEAli().

{
   return EEDetId( 20 + 50*( iLoc%2 ), 50, 2*( iLoc/2 ) - 1 ) ;
}
CaloSubdetectorGeometry::DetIdSet EcalEndcapGeometry::getCells ( const GlobalPoint r,
double  dR 
) const [virtual]

Get a list of all cells within a dR of the given cell.

The default implementation makes a loop over all cell geometries. Cleverer implementations are suggested to use rough conversions between eta/phi and ieta/iphi and test on the boundaries.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 345 of file EcalEndcapGeometry.cc.

References reco::deltaR2(), eta(), PV3DBase< T, PVType, FrameType >::eta(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), errorMatrix2Lands_multiChannel::id, m_nref, M_PI, m_wref, m_xhi, m_xlo, m_yhi, m_ylo, AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::phi(), phi, corrVsCorr::rx, corrVsCorr::ry, funct::tan(), EEDetId::validDetId(), PV3DBase< T, PVType, FrameType >::x(), xindex(), PV3DBase< T, PVType, FrameType >::y(), yindex(), PV3DBase< T, PVType, FrameType >::z(), and zeP.

{
   CaloSubdetectorGeometry::DetIdSet dis ; // return object
   if( 0.000001 < dR )
   {
      if( dR > M_PI/2. ) // this code assumes small dR
      {
         dis = CaloSubdetectorGeometry::getCells( r, dR ) ; // base class version
      }
      else
      {
         const double dR2  ( dR*dR ) ;
         const double reta ( r.eta() ) ;
         const double rphi ( r.phi() ) ;
         const double rx   ( r.x() ) ;
         const double ry   ( r.y() ) ;
         const double rz   ( r.z() ) ;
         const double fac  ( fabs( zeP/rz ) ) ;
         const double xx   ( rx*fac ) ; // xyz at endcap z
         const double yy   ( ry*fac ) ; 
         const double zz   ( rz*fac ) ; 

         const double xang  ( atan( xx/zz ) ) ;
         const double lowX  ( zz>0 ? zz*tan( xang - dR ) : zz*tan( xang + dR ) ) ;
         const double highX ( zz>0 ? zz*tan( xang + dR ) : zz*tan( xang - dR ) ) ;
         const double yang  ( atan( yy/zz ) ) ;
         const double lowY  ( zz>0 ? zz*tan( yang - dR ) : zz*tan( yang + dR ) ) ;
         const double highY ( zz>0 ? zz*tan( yang + dR ) : zz*tan( yang - dR ) ) ;

         const double refxlo ( 0 > rz ? m_xlo[0] : m_xlo[1] ) ;
         const double refxhi ( 0 > rz ? m_xhi[0] : m_xhi[1] ) ;
         const double refylo ( 0 > rz ? m_ylo[0] : m_ylo[1] ) ;
         const double refyhi ( 0 > rz ? m_yhi[0] : m_yhi[1] ) ;

         if( lowX  <  refxhi &&   // proceed if any possible overlap with the endcap
             lowY  <  refyhi &&
             highX >  refxlo &&
             highY >  refylo    )
         {
            const int ix_ctr ( xindex( xx, rz ) ) ;
            const int iy_ctr ( yindex( yy, rz ) ) ;
            const int iz     ( rz>0 ? 1 : -1 ) ;
            
            const int ix_hi  ( ix_ctr + int( ( highX - xx )/m_wref ) + 2 ) ;
            const int ix_lo  ( ix_ctr - int( ( xx - lowX  )/m_wref ) - 2 ) ;
            
            const int iy_hi  ( iy_ctr + int( ( highY - yy )/m_wref ) + 2 ) ;
            const int iy_lo  ( iy_ctr - int( ( yy - lowY  )/m_wref ) - 2 ) ;
            
            for( int kx ( ix_lo ) ; kx <= ix_hi ; ++kx ) 
            {
               if( kx >  0      && 
                   kx <= (int) m_nref    )
               {
                  for( int ky ( iy_lo ) ; ky <= iy_hi ; ++ky ) 
                  {
                     if( ky >  0      && 
                         ky <= (int) m_nref    )
                     {
                        if( EEDetId::validDetId( kx, ky, iz ) ) // reject invalid ids
                        {
                           const EEDetId id ( kx, ky, iz ) ;
                           const CaloCellGeometry* cell ( getGeometry( id ) );
                           if( 0 != cell )
                           {
                              const GlobalPoint& p    ( cell->getPosition() ) ;
                              const double       eta  ( p.eta() ) ;
                              const double       phi  ( p.phi() ) ;
                              if( reco::deltaR2( eta, phi, reta, rphi ) < dR2 ) dis.insert( id ) ;
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
   return dis;
}
const EcalEndcapGeometry::OrderedListOfEBDetId * EcalEndcapGeometry::getClosestBarrelCells ( EEDetId  id) const

Definition at line 428 of file EcalEndcapGeometry.cc.

References degrees(), CaloSubdetectorGeometry::getGeometry(), i, m_borderMgr, m_borderPtrVec, myPhi(), and phi.

Referenced by spr::simpleMove(), and PFRecHitProducerECAL::stdsimplemove().

{
   OrderedListOfEBDetId* ptr ( 0 ) ;
   if( 0 != id.rawId() &&
       0 != getGeometry( id ) )
   {
      const float phi ( 370. +
                        getGeometry( id )->getPosition().phi().degrees() );
      const int iPhi ( 1 + int(phi)%360 ) ;
      const int iz ( id.zside() ) ;
      if( 0 == m_borderMgr )
      {
         m_borderMgr = new EZMgrFL<EBDetId>( 720*9, 9 ) ;
      }
      if( 0 == m_borderPtrVec )
      {
         m_borderPtrVec = new VecOrdListEBDetIdPtr() ;
         m_borderPtrVec->reserve( 720 ) ;
         for( unsigned int i ( 0 ) ; i != 720 ; ++i )
         {
            const int kz     ( 360>i ? -1 : 1 ) ;
            const int iEta   ( kz*85 ) ;
            const int iEtam1 ( kz*84 ) ;
            const int iEtam2 ( kz*83 ) ;
            const int jPhi   ( i%360 + 1 ) ;
            OrderedListOfEBDetId& olist ( *new OrderedListOfEBDetId( m_borderMgr ) );
            olist[0]=EBDetId( iEta  ,        jPhi     ) ;
            olist[1]=EBDetId( iEta  , myPhi( jPhi+1 ) ) ;
            olist[2]=EBDetId( iEta  , myPhi( jPhi-1 ) ) ;
            olist[3]=EBDetId( iEtam1,        jPhi     ) ;
            olist[4]=EBDetId( iEtam1, myPhi( jPhi+1 ) ) ;
            olist[5]=EBDetId( iEtam1, myPhi( jPhi-1 ) ) ;
            olist[6]=EBDetId( iEta  , myPhi( jPhi+2 ) ) ;
            olist[7]=EBDetId( iEta  , myPhi( jPhi-2 ) ) ;
            olist[8]=EBDetId( iEtam2,        jPhi     ) ;
            m_borderPtrVec->push_back( &olist ) ;
         }
      }
      ptr = (*m_borderPtrVec)[ ( iPhi - 1 ) + ( 0>iz ? 0 : 360 ) ] ;
   }
   return ptr ;
}
DetId EcalEndcapGeometry::getClosestCell ( const GlobalPoint r) const [virtual]

Reimplemented from CaloSubdetectorGeometry.

Definition at line 230 of file EcalEndcapGeometry.cc.

References funct::A, funct::C, alignCSCRings::e, CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), gId(), i, EEDetId::ix(), EEDetId::iy(), evf::evtn::offset(), point, EEDetId::validDetId(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::z(), z, and EEDetId::zside().

Referenced by spr::chargeIsolationEcal(), CaloGeometryHelper::getClosestCell(), and spr::propagateCALO().

{
   try
   {
      EEDetId mycellID ( gId( r.x(), r.y(), r.z() ) ) ; // educated guess

      if( EEDetId::validDetId( mycellID.ix(), 
                               mycellID.iy(),
                               mycellID.zside() ) )
      {
         // now get points in convenient ordering

         Pt3D A;
         Pt3D B;
         Pt3D C;
         Pt3D point(r.x(),r.y(),r.z());
         // D.K. : equation of plane : AA*x+BB*y+CC*z+DD=0;
         // finding equation for each edge
         
         // ================================================================
         CCGFloat x,y,z;
         unsigned offset=0;
         int zsign=1;
         //================================================================
         std::vector<CCGFloat> SS;
      
         // compute the distance of the point with respect of the 4 crystal lateral planes

         
         if( 0 != getGeometry(mycellID) )
         {
            const GlobalPoint& myPosition=getGeometry(mycellID)->getPosition();
         
            x=myPosition.x();
            y=myPosition.y();
            z=myPosition.z();
         
            offset=0;
            // This will disappear when Andre has applied his fix
            zsign=1;
         
            if(z>0)
            {
               if(x>0&&y>0)
                  offset=1;
               else  if(x<0&&y>0)
                  offset=2;
               else if(x>0&&y<0)
                  offset=0;
               else if (x<0&&y<0)
                  offset=3;
               zsign=1;
            }
            else
            {
               if(x>0&&y>0)
                  offset=3;
               else if(x<0&&y>0)
                  offset=2;
               else if(x>0&&y<0)
                  offset=0;
               else if(x<0&&y<0)
                  offset=1;
               zsign=-1;
            }
            std::vector<GlobalPoint> corners;
            corners.clear();
            corners.resize(8);
            for(unsigned ic=0;ic<4;++ic)
            {
               corners[ic]=getGeometry(mycellID)->getCorners()[(unsigned)((zsign*ic+offset)%4)];
               corners[4+ic]=getGeometry(mycellID)->getCorners()[(unsigned)(4+(zsign*ic+offset)%4)];
            }
            
            for (short i=0; i < 4 ; ++i)
            {
               A = Pt3D(corners[i%4].x(),corners[i%4].y(),corners[i%4].z());
               B = Pt3D(corners[(i+1)%4].x(),corners[(i+1)%4].y(),corners[(i+1)%4].z());
               C = Pt3D(corners[4+(i+1)%4].x(),corners[4+(i+1)%4].y(),corners[4+(i+1)%4].z());
               Pl3D plane(A,B,C);
               plane.normalize();
               CCGFloat distance = plane.distance(point);
               if (corners[0].z()<0.) distance=-distance;
               SS.push_back(distance);
            }
         
            // Only one move in necessary direction
         
            const bool yout ( 0 > SS[0]*SS[2] ) ;
            const bool xout ( 0 > SS[1]*SS[3] ) ;
         
            if( yout || xout )
            {
               const int ydel ( !yout ? 0 :  ( 0 < SS[0] ? -1 : 1 ) ) ;
               const int xdel ( !xout ? 0 :  ( 0 < SS[1] ? -1 : 1 ) ) ;
               const unsigned int ix ( mycellID.ix() + xdel ) ;
               const unsigned int iy ( mycellID.iy() + ydel ) ;
               const unsigned int iz ( mycellID.zside()     ) ;
               if( EEDetId::validDetId( ix, iy, iz ) ) 
                  mycellID = EEDetId( ix, iy, iz ) ;
            }
  
            return mycellID;
         }
         return DetId(0);
      }
   }
   catch ( cms::Exception &e ) 
   { 
      return DetId(0);
   }
   return DetId(0);
}
int EcalEndcapGeometry::getNumberOfCrystalPerModule ( ) const [inline]

Definition at line 59 of file EcalEndcapGeometry.h.

References _nncrys.

{ return _nncrys ; }
int EcalEndcapGeometry::getNumberOfModules ( ) const [inline]

Definition at line 57 of file EcalEndcapGeometry.h.

References _nnmods.

{ return _nnmods ; }
EEDetId EcalEndcapGeometry::gId ( float  x,
float  y,
float  z 
) const [private]

Definition at line 194 of file EcalEndcapGeometry.cc.

References i, gen::k, EEDetId::validDetId(), xindex(), yindex(), zeN, and zeP.

Referenced by getClosestCell().

{
   const CCGFloat     fac ( fabs( ( 0 > z ? zeN : zeP )/z ) ) ;
   const unsigned int ix  ( xindex( x*fac, z ) ) ; 
   const unsigned int iy  ( yindex( y*fac, z ) ) ; 
   const unsigned int iz  ( z>0 ? 1 : -1 ) ;

   if( EEDetId::validDetId( ix, iy, iz ) ) 
   {
      return EEDetId( ix, iy, iz ) ; // first try is on target
   }
   else // try nearby coordinates, spiraling out from center
   {
      for( unsigned int i ( 1 ) ; i != 6 ; ++i )
      {
         for( unsigned int k ( 0 ) ; k != 8 ; ++k )
         {
            const int jx ( 0 == k || 4 == k || 5 == k ? +i :
                           ( 1 == k || 5 < k ? -i : 0 ) ) ;
            const int jy ( 2 == k || 4 == k || 6 == k ? +i :
                           ( 3 == k || 5 == k || 7 == k ? -i : 0 ) ) ;
            if( EEDetId::validDetId( ix + jx, iy + jy, iz ) ) 
            {
               return EEDetId( ix + jx, iy + jy, iz ) ;
            }
         }
      }
   }
   return EEDetId() ; // nowhere near any crystal
}
static std::string EcalEndcapGeometry::hitString ( ) [inline, static]

Definition at line 76 of file EcalEndcapGeometry.h.

{ return "EcalHitsEE" ; }
void EcalEndcapGeometry::initializeParms ( ) [virtual]

Reimplemented from CaloSubdetectorGeometry.

Definition at line 71 of file EcalEndcapGeometry.cc.

References cellGeomPtr(), EEDetId::detIdFromDenseIndex(), CaloCellGeometry::getPosition(), i, EEDetId::ix(), EEDetId::iy(), m_cellVec, m_del, m_nref, m_wref, m_xhi, m_xlo, m_xoff, m_yhi, m_ylo, m_yoff, errorMatrix2Lands_multiChannel::nN, AlCaHLTBitMon_ParallelJobs::p, x, detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::z(), z, zeN, and zeP.

{
  zeP=0.;
  zeN=0.;
  unsigned nP=0;
  unsigned nN=0;
  m_nref = 0 ;

  for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
  {
     const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
     if( 0 != cell )
     {
        const CCGFloat z ( cell->getPosition().z() ) ;
        if(z>0.)
        {
           zeP+=z;
           ++nP;
        }
        else
        {
           zeN+=z;
           ++nN;
        }
        const EEDetId myId ( EEDetId::detIdFromDenseIndex(i) ) ;
        const unsigned int ix ( myId.ix() ) ;
        const unsigned int iy ( myId.iy() ) ;
        if( ix > m_nref ) m_nref = ix ;
        if( iy > m_nref ) m_nref = iy ;
     }
  }
  if( 0 < nP ) zeP/=(CCGFloat)nP;
  if( 0 < nN ) zeN/=(CCGFloat)nN;

  m_xlo[0] =  999 ;
  m_xhi[0] = -999 ;
  m_ylo[0] =  999 ;
  m_yhi[0] = -999 ;
  m_xlo[1] =  999 ;
  m_xhi[1] = -999 ;
  m_ylo[1] =  999 ;
  m_yhi[1] = -999 ;
  for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
  {
     const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
     if( 0 != cell )
     {
        const GlobalPoint p ( cell->getPosition()  ) ;
        const CCGFloat z ( p.z() ) ;
        const CCGFloat zz ( 0 > z ? zeN : zeP ) ;
        const CCGFloat x ( p.x()*zz/z ) ;
        const CCGFloat y ( p.y()*zz/z ) ;

        if( 0 > z && x < m_xlo[0] ) m_xlo[0] = x ;
        if( 0 < z && x < m_xlo[1] ) m_xlo[1] = x ;
        if( 0 > z && y < m_ylo[0] ) m_ylo[0] = y ;
        if( 0 < z && y < m_ylo[1] ) m_ylo[1] = y ;
     
        if( 0 > z && x > m_xhi[0] ) m_xhi[0] = x ;
        if( 0 < z && x > m_xhi[1] ) m_xhi[1] = x ;
        if( 0 > z && y > m_yhi[0] ) m_yhi[0] = y ;
        if( 0 < z && y > m_yhi[1] ) m_yhi[1] = y ;
     }
  }

  m_xoff[0] = ( m_xhi[0] + m_xlo[0] )/2. ;
  m_xoff[1] = ( m_xhi[1] + m_xlo[1] )/2. ;
  m_yoff[0] = ( m_yhi[0] + m_ylo[0] )/2. ;
  m_yoff[1] = ( m_yhi[1] + m_ylo[1] )/2. ;

  m_del = ( m_xhi[0] - m_xlo[0] + m_xhi[1] - m_xlo[1] +
            m_yhi[0] - m_ylo[0] + m_yhi[1] - m_ylo[1]   ) ;

  if( 1 != m_nref ) m_wref = m_del/(4.*(m_nref-1)) ;

  m_xlo[0] -= m_wref/2 ;
  m_xlo[1] -= m_wref/2 ;
  m_xhi[0] += m_wref/2 ;
  m_xhi[1] += m_wref/2 ;

  m_ylo[0] -= m_wref/2 ;
  m_ylo[1] -= m_wref/2 ;
  m_yhi[0] += m_wref/2 ;
  m_yhi[1] += m_wref/2 ;

  m_del += m_wref ;
/*
  std::cout<<"zeP="<<zeP<<", zeN="<<zeN<<", nP="<<nP<<", nN="<<nN<<std::endl ;

  std::cout<<"xlo[0]="<<m_xlo[0]<<", xlo[1]="<<m_xlo[1]<<", xhi[0]="<<m_xhi[0]<<", xhi[1]="<<m_xhi[1]
           <<"\nylo[0]="<<m_ylo[0]<<", ylo[1]="<<m_ylo[1]<<", yhi[0]="<<m_yhi[0]<<", yhi[1]="<<m_yhi[1]<<std::endl ;

  std::cout<<"xoff[0]="<<m_xoff[0]<<", xoff[1]"<<m_xoff[1]<<", yoff[0]="<<m_yoff[0]<<", yoff[1]"<<m_yoff[1]<<std::endl ;

  std::cout<<"nref="<<m_nref<<", m_wref="<<m_wref<<std::endl ;
*/  
}
void EcalEndcapGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
) [static]

Definition at line 472 of file EcalEndcapGeometry.cc.

{
   TruncatedPyramid::localCorners( lc, pv, ref ) ;
}
static int EcalEndcapGeometry::myPhi ( int  i) [inline, static, private]

Definition at line 105 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells().

{ i+=720; return ( 1 + (i-1)%360 ) ; }
void EcalEndcapGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
) [virtual]

Implements CaloSubdetectorGeometry.

Definition at line 481 of file EcalEndcapGeometry.cc.

References CaloSubdetectorGeometry::cornersMgr(), m_cellVec, and CaloSubdetectorGeometry::m_validIds.

{
   const unsigned int cellIndex ( EEDetId( detId ).denseIndex() ) ;
   m_cellVec[ cellIndex ] =
      TruncatedPyramid( cornersMgr(), f1, f2, f3, parm ) ;
   m_validIds.push_back( detId ) ;
}
static unsigned int EcalEndcapGeometry::numberOfAlignments ( ) [inline, static]

Definition at line 80 of file EcalEndcapGeometry.h.

Referenced by FakeCaloAlignmentEP::produceEEAli(), and TestCaloAlignmentEP::produceEEAli().

{ return 4 ; }
virtual unsigned int EcalEndcapGeometry::numberOfParametersPerShape ( ) const [inline, virtual]

Reimplemented from CaloSubdetectorGeometry.

Definition at line 51 of file EcalEndcapGeometry.h.

References k_NumberOfParametersPerShape.

virtual unsigned int EcalEndcapGeometry::numberOfShapes ( ) const [inline, virtual]

Reimplemented from CaloSubdetectorGeometry.

Definition at line 50 of file EcalEndcapGeometry.h.

References k_NumberOfShapes.

{ return k_NumberOfShapes ; }
static std::string EcalEndcapGeometry::producerTag ( ) [inline, static]

Definition at line 78 of file EcalEndcapGeometry.h.

Referenced by PCaloGeometryBuilder::beginRun(), and CaloGeometryBuilder::produceAligned().

{ return "EcalEndcap" ; }
void EcalEndcapGeometry::setNumberOfCrystalPerModule ( const int  nncrys) [inline]

Definition at line 63 of file EcalEndcapGeometry.h.

References _nncrys.

{ _nncrys=nncrys ; }
void EcalEndcapGeometry::setNumberOfModules ( const int  nnmods) [inline]

Definition at line 61 of file EcalEndcapGeometry.h.

References _nnmods.

{ _nnmods=nnmods ; }
unsigned int EcalEndcapGeometry::xindex ( CCGFloat  x,
CCGFloat  z 
) const [private]

Definition at line 171 of file EcalEndcapGeometry.cc.

References i, m_nref, m_wref, and m_xlo.

Referenced by getCells(), and gId().

{
   const CCGFloat xlo ( 0 > z ? m_xlo[0]  : m_xlo[1]  ) ;
   const int i ( 1 + int( ( x - xlo )/m_wref ) ) ;

   return ( 1 > i ? 1 :
            ( m_nref < (unsigned int) i ? m_nref : (unsigned int) i ) ) ;

}
unsigned int EcalEndcapGeometry::yindex ( CCGFloat  y,
CCGFloat  z 
) const [private]

Definition at line 183 of file EcalEndcapGeometry.cc.

References i, m_nref, m_wref, and m_ylo.

Referenced by getCells(), and gId().

{
   const CCGFloat ylo ( 0 > z ? m_ylo[0]  : m_ylo[1]  ) ;
   const int i ( 1 + int( ( y - ylo )/m_wref ) ) ;

   return ( 1 > i ? 1 :
            ( m_nref < (unsigned int) i ? m_nref : (unsigned int) i ) ) ;
}

Member Data Documentation

number of crystals per module

Definition at line 111 of file EcalEndcapGeometry.h.

Referenced by getNumberOfCrystalPerModule(), and setNumberOfCrystalPerModule().

number of modules

Definition at line 108 of file EcalEndcapGeometry.h.

Referenced by getNumberOfModules(), and setNumberOfModules().

Definition at line 128 of file EcalEndcapGeometry.h.

Referenced by avgAbsZFrontFaceCenter().

Definition at line 124 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells(), and ~EcalEndcapGeometry().

Definition at line 126 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells(), and ~EcalEndcapGeometry().

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by initializeParms().

unsigned int EcalEndcapGeometry::m_nref [private]

Definition at line 117 of file EcalEndcapGeometry.h.

Referenced by getCells(), initializeParms(), xindex(), and yindex().

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by getCells(), initializeParms(), xindex(), and yindex().

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), and initializeParms().

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), initializeParms(), and xindex().

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), and initializeParms().

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), initializeParms(), and yindex().

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

Definition at line 113 of file EcalEndcapGeometry.h.

Referenced by gId(), and initializeParms().

Definition at line 113 of file EcalEndcapGeometry.h.

Referenced by getCells(), gId(), and initializeParms().