CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public 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 = 2 }
enum  { k_NumberOfParametersPerShape = 3 }
typedef EcalPreshowerGeometryRecord AlignedRecord
typedef ESAlignmentRcd AlignmentRecord
typedef ESDetId DetIdType
typedef IdealGeometryRecord IdealRecord
typedef
EcalPreshowerNumberingScheme 
NumberingScheme
typedef
CaloSubdetectorGeometry::ParVec 
ParVec
typedef
CaloSubdetectorGeometry::ParVecVec 
ParVecVec
typedef PEcalPreshowerRcd PGeometryRecord

Public Member Functions

 EcalPreshowerGeometry ()
virtual DetId getClosestCell (const GlobalPoint &r) const
virtual DetId getClosestCellInPlane (const GlobalPoint &r, int plane) const
virtual void initializeParms ()
virtual unsigned int numberOfParametersPerShape () const
virtual unsigned int numberOfShapes () const
virtual unsigned int numberOfTransformParms () const
void setzPlanes (float z1minus, float z2minus, float z1plus, float 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 std::vector
< HepGeom::Point3D< double > > 
localCorners (const double *pv, unsigned int i, HepGeom::Point3D< double > &ref)
static CaloCellGeometrynewCell (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, CaloCellGeometry::CornersMgr *mgr, const double *parm, const DetId &detId)
static unsigned int numberOfAlignments ()
static std::string producerTag ()

Private Attributes

const double m_xInterLadGap
const double m_xIntraLadGap
const double m_xWidWaf
const double m_yCtrOff
const double m_yWidAct
double m_zplane [4]

Detailed Description

Definition at line 13 of file EcalPreshowerGeometry.h.


Member Typedef Documentation

Definition at line 18 of file EcalPreshowerGeometry.h.

Definition at line 19 of file EcalPreshowerGeometry.h.

Definition at line 25 of file EcalPreshowerGeometry.h.

Definition at line 17 of file EcalPreshowerGeometry.h.

Definition at line 22 of file EcalPreshowerGeometry.h.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 23 of file EcalPreshowerGeometry.h.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 24 of file EcalPreshowerGeometry.h.

Definition at line 20 of file EcalPreshowerGeometry.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
k_NumberOfCellsForCorners 

Definition at line 27 of file EcalPreshowerGeometry.h.

anonymous enum
Enumerator:
k_NumberOfShapes 

Definition at line 29 of file EcalPreshowerGeometry.h.

{ k_NumberOfShapes = 2 } ;
anonymous enum
Enumerator:
k_NumberOfParametersPerShape 

Definition at line 31 of file EcalPreshowerGeometry.h.


Constructor & Destructor Documentation

EcalPreshowerGeometry::EcalPreshowerGeometry ( )

Definition at line 8 of file EcalPreshowerGeometry.cc.

                                             :
   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
{
}
EcalPreshowerGeometry::~EcalPreshowerGeometry ( ) [virtual]

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

Definition at line 18 of file EcalPreshowerGeometry.cc.

{}

Member Function Documentation

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

Definition at line 67 of file EcalPreshowerGeometry.cc.

References DetId::Ecal.

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

Definition at line 21 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    ( 20>jx ? 0 : 1 ) ;
   const int lrr    ( 22>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
}
static std::string EcalPreshowerGeometry::dbString ( ) [inline, static]

Definition at line 33 of file EcalPreshowerGeometry.h.

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

Definition at line 61 of file EcalPreshowerGeometry.cc.

Referenced by 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 155 of file EcalPreshowerGeometry.cc.

References getClosestCellInPlane().

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

Definition at line 161 of file EcalPreshowerGeometry.cc.

References CaloSubdetectorGeometry::cellGeometries(), ESDetId::denseIndex(), getHLTprescales::index, ESDetId::ISTRIP_MAX, ESDetId::ISTRIP_MIN, m_xInterLadGap, m_xIntraLadGap, m_xWidWaf, m_yCtrOff, m_yWidAct, m_zplane, L1TEmulatorMonitor_cff::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 double x ( point.x() ) ;
   const double y ( point.y() ) ;
   const double z ( point.z() ) ;

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

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

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

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

   static const double 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 ) ) ;

   double 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 unsigned int index ( esId.denseIndex() ) ;
               const GlobalPoint& p ( cellGeometries()[ index ]->getPosition() ) ;
               const double 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 60 of file EcalPreshowerGeometry.h.

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 74 of file EcalPreshowerGeometry.cc.

References CaloSubdetectorGeometry::cellGeometries(), CaloSubdetectorGeometry::getValidDetIds(), i, ESDetId::plane(), setzPlanes(), and ESDetId::zside().

{
   typedef CaloSubdetectorGeometry::CellCont Cont ;
   unsigned int n1minus ( 0 ) ;
   unsigned int n2minus ( 0 ) ;
   unsigned int n1plus ( 0 ) ;
   unsigned int n2plus ( 0 ) ;
   double z1minus ( 0 ) ;
   double z2minus ( 0 ) ;
   double z1plus ( 0 ) ;
   double z2plus ( 0 ) ;
   const Cont& con ( cellGeometries() ) ;
   for( unsigned int i ( 0 ) ; i != con.size() ; ++i )
   {
      const ESDetId esid ( getValidDetIds()[i] ) ;
      if( 1 == esid.plane() )
      {
         if( 0 > esid.zside() )
         {
            z1minus += con[i]->getPosition().z() ;
            ++n1minus ;
         }
         else
         {
            z1plus += con[i]->getPosition().z() ;
            ++n1plus ;
         }
      }
      if( 2 == esid.plane() )
      {
         if( 0 > esid.zside() )
         {
            z2minus += con[i]->getPosition().z() ;
            ++n2minus ;
         }
         else
         {
            z2plus += con[i]->getPosition().z() ;
            ++n2plus ;
         }
      }
//      if( 0 == z1 && 1 == esid.plane() ) z1 = fabs( i->second->getPosition().z() ) ;
//      if( 0 == z2 && 2 == esid.plane() ) z2 = fabs( i->second->getPosition().z() ) ;
//      if( 0 != z1 && 0 != z2 ) break ;
   }
   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 ) ;
}
std::vector< HepGeom::Point3D< double > > EcalPreshowerGeometry::localCorners ( const double *  pv,
unsigned int  i,
HepGeom::Point3D< double > &  ref 
) [static]

Definition at line 222 of file EcalPreshowerGeometry.cc.

References PreshowerStrip::localCorners().

{
   return ( PreshowerStrip::localCorners( pv, ref ) ) ;
}
CaloCellGeometry * EcalPreshowerGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
CaloCellGeometry::CornersMgr mgr,
const double *  parm,
const DetId detId 
) [static]

Definition at line 230 of file EcalPreshowerGeometry.cc.

{
   return ( new PreshowerStrip( f1, mgr , parm ) ) ;
}
static unsigned int EcalPreshowerGeometry::numberOfAlignments ( ) [inline, static]

Definition at line 64 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 36 of file EcalPreshowerGeometry.h.

References k_NumberOfParametersPerShape.

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 35 of file EcalPreshowerGeometry.h.

References k_NumberOfShapes.

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 58 of file EcalPreshowerGeometry.h.

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

Definition at line 62 of file EcalPreshowerGeometry.h.

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

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

Definition at line 136 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

const double EcalPreshowerGeometry::m_xInterLadGap [private]

Definition at line 86 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().

const double EcalPreshowerGeometry::m_xIntraLadGap [private]

Definition at line 87 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().

const double EcalPreshowerGeometry::m_xWidWaf [private]

Definition at line 85 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().

const double EcalPreshowerGeometry::m_yCtrOff [private]

Definition at line 90 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().

const double EcalPreshowerGeometry::m_yWidAct [private]

Definition at line 89 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane().

double EcalPreshowerGeometry::m_zplane[4] [private]

Definition at line 92 of file EcalPreshowerGeometry.h.

Referenced by getClosestCellInPlane(), and setzPlanes().