CMS 3D CMS Logo

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

EcalPreshowerGeometry Class Reference

#include <EcalPreshowerGeometry.h>

Inheritance diagram for EcalPreshowerGeometry:
CaloSubdetectorGeometry

List of all members.

Public Types

enum  { k_NumberOfCellsForCorners = ESDetId::kSizeForDenseIndexing }
enum  { k_NumberOfShapes = 4 }
enum  { k_NumberOfParametersPerShape = 4 }
typedef EcalPreshowerGeometryRecord AlignedRecord
typedef ESAlignmentRcd AlignmentRecord
typedef CaloCellGeometry::CCGFloat CCGFloat
typedef std::vector
< PreshowerStrip
CellVec
typedef ESDetId DetIdType
typedef IdealGeometryRecord IdealRecord
typedef
EcalPreshowerNumberingScheme 
NumberingScheme
typedef
CaloSubdetectorGeometry::ParVec 
ParVec
typedef
CaloSubdetectorGeometry::ParVecVec 
ParVecVec
typedef PEcalPreshowerRcd PGeometryRecord
typedef CaloCellGeometry::Pt3D Pt3D
typedef CaloCellGeometry::Pt3DVec Pt3DVec

Public Member Functions

 EcalPreshowerGeometry ()
virtual DetId getClosestCell (const GlobalPoint &r) const
virtual DetId getClosestCellInPlane (const GlobalPoint &r, int plane) 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
virtual unsigned int numberOfTransformParms () const
void setzPlanes (CCGFloat z1minus, CCGFloat z2minus, CCGFloat z1plus, CCGFloat z2plus)
virtual ~EcalPreshowerGeometry ()
 The EcalPreshowerGeometry will delete all its cell geometries at destruction time.

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 Attributes

CellVec m_cellVec
const CCGFloat m_xInterLadGap
const CCGFloat m_xIntraLadGap
const CCGFloat m_xWidWaf
const CCGFloat m_yCtrOff
const CCGFloat m_yWidAct
CCGFloat m_zplane [4]

Detailed Description

Definition at line 14 of file EcalPreshowerGeometry.h.


Member Typedef Documentation

Definition at line 25 of file EcalPreshowerGeometry.h.

Definition at line 26 of file EcalPreshowerGeometry.h.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 20 of file EcalPreshowerGeometry.h.

Definition at line 18 of file EcalPreshowerGeometry.h.

Definition at line 32 of file EcalPreshowerGeometry.h.

Definition at line 24 of file EcalPreshowerGeometry.h.

Definition at line 29 of file EcalPreshowerGeometry.h.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 30 of file EcalPreshowerGeometry.h.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 31 of file EcalPreshowerGeometry.h.

Definition at line 27 of file EcalPreshowerGeometry.h.

Definition at line 21 of file EcalPreshowerGeometry.h.

Definition at line 22 of file EcalPreshowerGeometry.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
k_NumberOfCellsForCorners 

Definition at line 34 of file EcalPreshowerGeometry.h.

anonymous enum
Enumerator:
k_NumberOfShapes 

Definition at line 36 of file EcalPreshowerGeometry.h.

{ k_NumberOfShapes = 4 } ;
anonymous enum
Enumerator:
k_NumberOfParametersPerShape 

Definition at line 38 of file EcalPreshowerGeometry.h.


Constructor & Destructor Documentation

EcalPreshowerGeometry::EcalPreshowerGeometry ( )

Definition at line 13 of file EcalPreshowerGeometry.cc.

References m_zplane.

                                             :
   m_xWidWaf      ( 6.3  ) ,
   m_xInterLadGap ( 0.05 ) , // additional gap between wafers in adj ladders
   m_xIntraLadGap ( 0.04 ) , // gap between wafers in same ladder
   m_yWidAct      ( 6.1  ) ,
   m_yCtrOff      ( 0.05 ) ,  // gap at center
   m_cellVec      ( k_NumberOfCellsForCorners )
{
  m_zplane[0] = 0. ;
  m_zplane[1] = 0. ;
  m_zplane[2] = 0. ;
  m_zplane[3] = 0. ;
}
EcalPreshowerGeometry::~EcalPreshowerGeometry ( ) [virtual]

The EcalPreshowerGeometry will delete all its cell geometries at destruction time.

Definition at line 28 of file EcalPreshowerGeometry.cc.

{
}

Member Function Documentation

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

Definition at line 79 of file EcalPreshowerGeometry.cc.

References DetId::Ecal.

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

Definition at line 33 of file EcalPreshowerGeometry.cc.

References CaloGenericDetId::isES(), and edm::second().

{
   const CaloGenericDetId gid ( id ) ;

   assert( gid.isES() ) ;

// plane 2 is split into 2 dees along x=0 for both signs of z

// plane 1 at zsign=-1 is split into 2 dees between six=19 and six=20 for siy<=20,
//                                             and six=21 and 22 for siy>=21

// plane 1 at zsign=+1 is split into 2 dees between six=20 and six=21 for siy<=20,
//                                             and six=19 and 20 for siy>=21


// Desired numbering 
//                LEFT    RIGHT (as one faces the Dee from the IP)
//  ES-  pl=2     0       1
//       pl=1     2       3    the reversal of pl=2 and pl=1 is intentional here (CM Kuo)
//  ES+  pl=1     4       5
//       pl=2     6       7

   const ESDetId esid ( id ) ;
   const int jx ( esid.six() - 1 ) ;
   const int jy ( esid.siy() - 1 ) ;
   const int jz ( esid.zside() + 1 ) ;
   const int pl ( esid.plane() - 1 ) ;
   const bool second ( 1 == pl ) ;
   const bool top   ( 19 < jy ) ;
   const bool negz  ( 0 == jz ) ;
   const int lrl    ( 19>jx ? 0 : 1 ) ;
   const int lrr    ( 21>jx ? 0 : 1 ) ;

   return ( second ? jx/20 + 3*jz :  // 2nd plane split along middle
            ( negz && !top ? lrl + 2 :  // 1st plane at neg z and bottom half split at six=19&20
              ( negz && top ? lrr + 2 : // 1st plane at neg z and top half split at six=21&22
                ( !negz && !top ? lrr + 4 : lrl + 4 ) ) ) ) ; // opposite at positive z
}
const CaloCellGeometry * EcalPreshowerGeometry::cellGeomPtr ( uint32_t  index) const [protected, virtual]

Implements CaloSubdetectorGeometry.

Definition at line 260 of file EcalPreshowerGeometry.cc.

References m_cellVec, and CaloCellGeometry::param().

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

Definition at line 40 of file EcalPreshowerGeometry.h.

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

Definition at line 73 of file EcalPreshowerGeometry.cc.

Referenced by WriteESAlignments::convert(), FakeCaloAlignmentEP::produceESAli(), and TestCaloAlignmentEP::produceESAli().

{
   return ESDetId( 1, 10 + 20*( iLoc%2 ), 10, 2>iLoc || 5<iLoc ? 2 : 1, 2*( iLoc/4 ) - 1 ) ;
}
DetId EcalPreshowerGeometry::getClosestCell ( const GlobalPoint r) const [virtual]

Reimplemented from CaloSubdetectorGeometry.

Definition at line 169 of file EcalPreshowerGeometry.cc.

References getClosestCellInPlane().

{
  return getClosestCellInPlane( point, 2 );
} 
DetId EcalPreshowerGeometry::getClosestCellInPlane ( const GlobalPoint r,
int  plane 
) const [virtual]

Definition at line 175 of file EcalPreshowerGeometry.cc.

References CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), ESDetId::ISTRIP_MAX, ESDetId::ISTRIP_MIN, m_xInterLadGap, m_xIntraLadGap, m_xWidWaf, m_yCtrOff, m_yWidAct, m_zplane, AlCaHLTBitMon_ParallelJobs::p, CaloSubdetectorGeometry::present(), ESDetId::validDetId(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::z(), and z.

Referenced by PreshowerHitMaker::addHit(), getClosestCell(), and ReducedESRecHitCollectionProducer::produce().

{
   const CCGFloat x ( point.x() ) ;
   const CCGFloat y ( point.y() ) ;
   const CCGFloat z ( point.z() ) ;

   if( 0 == z    ||
       1 > plane ||
       2 < plane    ) return DetId( 0 ) ;

   const unsigned int iz ( ( 0>z ? 0 : 2 ) + plane - 1 ) ;

   const CCGFloat ze ( m_zplane[iz] ) ;
   const CCGFloat xe ( x * ze/z ) ;
   const CCGFloat ye ( y * ze/z ) ;

   const CCGFloat x0 ( 1 == plane ? xe : ye ) ;
   const CCGFloat y0 ( 1 == plane ? ye : xe ) ;

   static const CCGFloat xWid ( m_xWidWaf + m_xIntraLadGap + m_xInterLadGap ) ;

   const int row ( 1 + int( y0 + 20.*m_yWidAct - m_yCtrOff )/m_yWidAct ) ;
   const int col ( 1 + int( ( x0 + 20.*xWid )/xWid ) ) ;

   CCGFloat closest ( 1e9 ) ; 

   DetId detId ( 0 ) ;

   const int jz ( 0 > ze ? -1 : 1 ) ;


//   std::cout<<"** p="<<point<<", ("<<xe<<", "<<ye<<", "<<ze<<"), row="<<row<<", col="<<col<<std::endl;

   for( int ix ( -1 ); ix != 2 ; ++ix ) // search within +-1 in row and col
   {
      for( int iy ( -1 ); iy != 2 ; ++iy )
      {
         for( int jstrip ( ESDetId::ISTRIP_MIN ) ; jstrip <= ESDetId::ISTRIP_MAX ; ++jstrip )
         {
            const int jx ( 1 == plane ? col + ix : row + iy ) ;
            const int jy ( 1 == plane ? row + iy : col + ix ) ;
            if( ESDetId::validDetId( jstrip, jx, jy, plane, jz ) )
            {
               const ESDetId esId ( jstrip, jx, jy, plane, jz ) ;
               const CaloCellGeometry* cell ( getGeometry( esId ) ) ;
               if( 0 != cell )
               {
                  const GlobalPoint& p ( cell->getPosition() ) ;
                  const CCGFloat dist2 ( (p.x()-xe)*(p.x()-xe) + (p.y()-ye)*(p.y()-ye) ) ;
                  if( dist2 < closest && present( esId ) )
                  {
                     closest = dist2 ;
                     detId   = esId  ;
                  }
               }
            }
         }
      }
   }
   return detId ;
}
static std::string EcalPreshowerGeometry::hitString ( ) [inline, static]

Definition at line 67 of file EcalPreshowerGeometry.h.

{ return "EcalHitsES" ; }
void EcalPreshowerGeometry::initializeParms ( ) [virtual]

Reimplemented from CaloSubdetectorGeometry.

Definition at line 86 of file EcalPreshowerGeometry.cc.

References CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloSubdetectorGeometry::getValidDetIds(), i, ESDetId::plane(), setzPlanes(), PV3DBase< T, PVType, FrameType >::z(), and ESDetId::zside().

{
   unsigned int n1minus ( 0 ) ;
   unsigned int n2minus ( 0 ) ;
   unsigned int n1plus ( 0 ) ;
   unsigned int n2plus ( 0 ) ;
   CCGFloat z1minus ( 0 ) ;
   CCGFloat z2minus ( 0 ) ;
   CCGFloat z1plus ( 0 ) ;
   CCGFloat z2plus ( 0 ) ;
   const std::vector<DetId>& esDetIds ( getValidDetIds() ) ;

   for( unsigned int i ( 0 ) ; i != esDetIds.size() ; ++i )
   {
      const ESDetId esid ( esDetIds[i] ) ;
      const CaloCellGeometry* cell ( getGeometry( esid ) ) ;
      if( 0 != cell )
      {
         const CCGFloat zz ( cell->getPosition().z() ) ; 
         if( 1 == esid.plane() )
         {
            if( 0 > esid.zside() )
            {
               z1minus += zz ;
               ++n1minus ;
            }
            else
            {
               z1plus += zz ;
               ++n1plus ;
            }
         }
         if( 2 == esid.plane() )
         {
            if( 0 > esid.zside() )
            {
               z2minus += zz ;
               ++n2minus ;
            }
            else
            {
               z2plus += zz ;
               ++n2plus ;
            }
         }
      }
   }
   assert( 0 != n1minus &&
           0 != n2minus &&
           0 != n1plus  &&
           0 != n2plus     ) ;
   z1minus /= (1.*n1minus) ;
   z2minus /= (1.*n2minus) ;
   z1plus /= (1.*n1plus) ;
   z2plus /= (1.*n2plus) ;
   assert( 0 != z1minus &&
           0 != z2minus &&
           0 != z1plus  &&
           0 != z2plus     ) ;
   setzPlanes( z1minus, z2minus, z1plus, z2plus ) ;
}
void EcalPreshowerGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
) [static]

Definition at line 239 of file EcalPreshowerGeometry.cc.

{
   PreshowerStrip::localCorners( lc, pv, ref ) ;
}
void EcalPreshowerGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
) [virtual]

Implements CaloSubdetectorGeometry.

Definition at line 248 of file EcalPreshowerGeometry.cc.

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

{
   const unsigned int cellIndex ( ESDetId( detId ).denseIndex() ) ;
   m_cellVec[ cellIndex ] = PreshowerStrip( f1, cornersMgr(), parm ) ;
   m_validIds.push_back( detId ) ;
}
static unsigned int EcalPreshowerGeometry::numberOfAlignments ( ) [inline, static]

Definition at line 71 of file EcalPreshowerGeometry.h.

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

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 43 of file EcalPreshowerGeometry.h.

References k_NumberOfParametersPerShape.

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 42 of file EcalPreshowerGeometry.h.

References k_NumberOfShapes.

{ return k_NumberOfShapes ; }
virtual unsigned int EcalPreshowerGeometry::numberOfTransformParms ( ) const [inline, virtual]

Reimplemented from CaloSubdetectorGeometry.

Definition at line 65 of file EcalPreshowerGeometry.h.

{ return 3 ; }
static std::string EcalPreshowerGeometry::producerTag ( ) [inline, static]

Definition at line 69 of file EcalPreshowerGeometry.h.

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

{ return "EcalPreshower" ; }
void EcalPreshowerGeometry::setzPlanes ( CCGFloat  z1minus,
CCGFloat  z2minus,
CCGFloat  z1plus,
CCGFloat  z2plus 
)

Definition at line 150 of file EcalPreshowerGeometry.cc.

References m_zplane.

Referenced by initializeParms().

{
   assert( 0 > z1minus &&
           0 > z2minus &&
           0 < z1plus  &&
           0 < z2plus     ) ;

   m_zplane[0] = z1minus ;
   m_zplane[1] = z2minus ;
   m_zplane[2] = z1plus ;
   m_zplane[3] = z2plus ;
}

Member Data Documentation

Definition at line 104 of file EcalPreshowerGeometry.h.

Referenced by cellGeomPtr(), and newCell().

Definition at line 96 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().

Definition at line 97 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().

Definition at line 95 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().

Definition at line 100 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().

Definition at line 99 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().