CMS 3D CMS Logo

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

ESDetId Class Reference

#include <ESDetId.h>

Inheritance diagram for ESDetId:
DetId

List of all members.

Public Types

enum  { Subdet = EcalPreshower }
enum  { kSizeForDenseIndexing = kLa }

Public Member Functions

uint32_t denseIndex () const
 ESDetId (uint32_t rawid)
 ESDetId (const DetId &id)
 ESDetId ()
 ESDetId (int strip, int ixs, int iys, int plane, int iz)
 constructor from strip, ix, iy, plane, and iz
int hashedIndex () const
 get a compact index for arrays [TODO: NEEDS WORK]
ESDetIdoperator= (const DetId &id)
int plane () const
int six () const
int siy () const
int strip () const
EcalSubdetector subdet () const
 get the subdetector
int zside () const

Static Public Member Functions

static ESDetId detIdFromDenseIndex (uint32_t din)
static ESDetId unhashIndex (int hi)
 get a DetId from a compact index for arrays
static bool validDenseIndex (uint32_t din)
static bool validDetId (int istrip, int ixs, int iys, int iplane, int iz)
 check if a valid index combination
static bool validHashIndex (int hi)

Static Public Attributes

static const int ISTRIP_MAX = 32
static const int ISTRIP_MIN = 1
static const int IX_MAX = 40
static const int IX_MIN = 1
static const int IY_MAX = 40
static const int IY_MIN = 1
static const int IZ_NUM = 2
static const int PLANE_MAX = 2
static const int PLANE_MIN = 1

Private Types

enum  {
  kXYMAX = 1072, kXYMIN = 1, kXMAX = 40, kYMAX = 40,
  kXMIN = 1, kYMIN = 1, kNa = IZ_NUM, kNb = PLANE_MAX - PLANE_MIN + 1,
  kNc = kXYMAX - kXYMIN + 1, kNd = ISTRIP_MAX - ISTRIP_MIN + 1, kLd = kNd, kLc = kLd*kNc,
  kLb = kLc*kNb, kLa = kLb*kNa
}

Static Private Attributes

static const unsigned short hx1 [kXYMAX]
static const unsigned short hx2 [kXYMAX]
static const unsigned short hxy1 [kXMAX][kYMAX]
static const unsigned short hxy2 [kXMAX][kYMAX]
static const unsigned short hy1 [kXYMAX]
static const unsigned short hy2 [kXYMAX]

Detailed Description

Det id for a preshower (endcap) strip

Id:
ESDetId.h,v 1.8 2012/11/02 13:07:52 innocent Exp

Definition at line 15 of file ESDetId.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
Subdet 

Definition at line 18 of file ESDetId.h.

anonymous enum [private]
Enumerator:
kXYMAX 
kXYMIN 
kXMAX 
kYMAX 
kXMIN 
kYMIN 
kNa 
kNb 
kNc 
kNd 
kLd 
kLc 
kLb 
kLa 

Definition at line 69 of file ESDetId.h.

           { kXYMAX=1072,
             kXYMIN=   1,
             kXMAX =  40,
             kYMAX =  40,
             kXMIN =   1,
             kYMIN =   1,
             // now normalize to A-D notation for ease of use
             kNa   =IZ_NUM,
             kNb   =PLANE_MAX - PLANE_MIN + 1,
             kNc   =kXYMAX - kXYMIN + 1,
             kNd   =ISTRIP_MAX - ISTRIP_MIN + 1,
             kLd   =kNd,
             kLc   =kLd*kNc,
             kLb   =kLc*kNb,
             kLa   =kLb*kNa } ;
anonymous enum
Enumerator:
kSizeForDenseIndexing 

Definition at line 95 of file ESDetId.h.


Constructor & Destructor Documentation

ESDetId::ESDetId ( )

Constructor of a null id

Definition at line 6 of file ESDetId.cc.

Referenced by unhashIndex().

                 : DetId() 
{
}
ESDetId::ESDetId ( uint32_t  rawid)

Constructor from a raw value

Definition at line 10 of file ESDetId.cc.

                                 : 
   DetId( rawid ) 
{
}
ESDetId::ESDetId ( int  strip,
int  ixs,
int  iys,
int  plane,
int  iz 
)

constructor from strip, ix, iy, plane, and iz

Definition at line 15 of file ESDetId.cc.

References Exception, hxy1, hxy2, DetId::id_, and validDetId().

                               :
   DetId( Ecal, EcalPreshower ) 
{
   if( !validDetId( strip, ixs, iys, plane, iz) )
      throw cms::Exception("InvalidDetId") 
         << "ESDetId:  Cannot create object.  Indexes out of bounds \n" 
         << " strip = " << strip << " x = " << ixs << " y = " << iys << "\n" 
         << " plane = " << plane << " z = " << iz
         << " hxy = " << (1==plane?hxy1[ixs-1][iys-1]:hxy2[ixs-1][iys-1])
         << "\n";

   id_ |=
      (strip&0x3F) |
      ((ixs&0x3F)<<6) |
      ((iys&0x3F)<<12) |
      (((plane-1)&0x1)<<18) |
      ((iz>0)?(1<<19):(0));
}
ESDetId::ESDetId ( const DetId id)

constructor from a generic DetId

Definition at line 38 of file ESDetId.cc.

References DetId::det(), DetId::Ecal, EcalPreshower, Exception, DetId::id_, DetId::null(), DetId::rawId(), and DetId::subdetId().

{
   if( !gen.null() && 
       ( gen.det()      != Ecal          ||
         gen.subdetId() != EcalPreshower    ) ) 
   {
      throw cms::Exception("InvalidDetId");
   }
   id_ = gen.rawId() ;
}

Member Function Documentation

uint32_t ESDetId::denseIndex ( ) const [inline]

Definition at line 45 of file ESDetId.h.

References hashedIndex().

{ return hashedIndex() ; }
static ESDetId ESDetId::detIdFromDenseIndex ( uint32_t  din) [inline, static]

Definition at line 49 of file ESDetId.h.

References unhashIndex().

Referenced by CaloGenericDetId::CaloGenericDetId(), and ESHitResponse::ESHitResponse().

{ return unhashIndex( din ) ; }
int ESDetId::hashedIndex ( ) const

get a compact index for arrays [TODO: NEEDS WORK]

Definition at line 85 of file ESDetId.cc.

References hxy1, hxy2, kLb, kLc, kLd, plane(), six(), siy(), strip(), and zside().

Referenced by denseIndex().

{
   const int ia ( 1 == zside() ? 2 : 1 ) ;
   const int ib ( plane() ) ;
   const int ix ( six() ) ;
   const int iy ( siy() ) ;
   const int ic ( 1 == ib ?
                  hxy1[ ix - 1 ][ iy - 1 ] :
                  hxy2[ ix - 1 ][ iy - 1 ] ) ;
   const int id ( strip() ) ;

   return ( ( ia - 1 )*kLb +
            ( ib - 1 )*kLc +
            ( ic - 1 )*kLd + 
            id             - 1 ) ;
}
ESDetId & ESDetId::operator= ( const DetId id)

assignment from a generic DetId

Definition at line 72 of file ESDetId.cc.

References DetId::det(), DetId::Ecal, EcalPreshower, Exception, DetId::id_, DetId::null(), DetId::rawId(), and DetId::subdetId().

{
   if (!gen.null() &&
       ( gen.det()      != Ecal          ||
         gen.subdetId() != EcalPreshower    ) ) 
   {
      throw cms::Exception("InvalidDetId");
   }
   id_=gen.rawId();
   return *this;
}
int ESDetId::plane ( ) const [inline]
int ESDetId::six ( ) const [inline]
int ESDetId::siy ( ) const [inline]
int ESDetId::strip ( ) const [inline]
EcalSubdetector ESDetId::subdet ( ) const [inline]

get the subdetector

Definition at line 31 of file ESDetId.h.

References DetId::subdetId().

{ return EcalSubdetector(subdetId()); }
ESDetId ESDetId::unhashIndex ( int  hi) [static]

get a DetId from a compact index for arrays

Definition at line 103 of file ESDetId.cc.

References ESDetId(), hx1, hx2, hy1, hy2, kLb, kLc, kLd, and validHashIndex().

Referenced by detIdFromDenseIndex(), and ESTrivialConditionRetriever::getChannelStatusFromConfiguration().

{
   if( validHashIndex( hi ) )
   {
      const int id ( hi%kLd + 1 ) ;
      const int nd ( hi - id + 1 ) ;
      const int ic ( ( nd%kLc )/kLd + 1 ) ;
      const int nc ( nd - ( ic - 1 )*kLd ) ;
      const int ib ( ( nc%kLb )/kLc + 1 ) ;
      const int nb ( nc - ( ib - 1 )*kLc ) ;
      const int ia ( nb/kLb + 1 );// + 1 ) ;

      const int st    ( id ) ;
      const int pl    ( ib ) ;
      int ix ;
      int iy ;
      const int ic1 ( ic - 1 ) ;
      if( 1 == pl )
      {
         ix = hx1[ ic1 ] ;
         iy = hy1[ ic1 ] ;
      }
      else
      {
         ix = hx2[ ic1 ] ;
         iy = hy2[ ic1 ] ;
      }
      const int iz ( 1 == ia ? -1 : 1 ) ;

      return ESDetId( st, ix, iy, pl, iz ) ;
   }
   else
   {
      return ESDetId() ;
   }
}
static bool ESDetId::validDenseIndex ( uint32_t  din) [inline, static]

Definition at line 47 of file ESDetId.h.

References validHashIndex().

{ return validHashIndex( din ) ; }
bool ESDetId::validDetId ( int  istrip,
int  ixs,
int  iys,
int  iplane,
int  iz 
) [static]

check if a valid index combination

Definition at line 50 of file ESDetId.cc.

References abs, hxy1, hxy2, ISTRIP_MAX, ISTRIP_MIN, IX_MAX, IX_MIN, IY_MAX, IY_MIN, PLANE_MAX, and PLANE_MIN.

Referenced by EcalPreshowerTopology::decrementIx(), EcalPreshowerTopology::decrementIy(), EcalPreshowerTopology::decrementIz(), ESDetId(), EcalPreshowerGeometry::getClosestCellInPlane(), EcalPreshowerTopology::incrementIx(), EcalPreshowerTopology::incrementIy(), EcalPreshowerTopology::incrementIz(), and ESUnpacker::word2digi().

{
  return ( !( ( istrip < ISTRIP_MIN ) ||
              ( istrip > ISTRIP_MAX ) ||
              ( ixs    < IX_MIN     ) || 
              ( ixs    > IX_MAX     ) ||
              ( iys    < IY_MIN     ) ||
              ( iys    > IY_MAX     ) ||
              ( abs( iz ) != 1      ) ||
              ( iplane < PLANE_MIN  ) ||
              ( iplane > PLANE_MAX  ) ||
              ( ( 1 == iplane ) &&
                0 == hxy1[ixs-1][iys-1]  ) ||
              ( ( 2 == iplane ) &&
                0 == hxy2[ixs-1][iys-1]  )    ) ) ;
}
static bool ESDetId::validHashIndex ( int  hi) [inline, static]

Definition at line 53 of file ESDetId.h.

References kSizeForDenseIndexing.

Referenced by unhashIndex(), and validDenseIndex().

{ return ( hi < kSizeForDenseIndexing ) ; }
int ESDetId::zside ( ) const [inline]

Member Data Documentation

const unsigned short ESDetId::hx1 [static, private]

Definition at line 86 of file ESDetId.h.

Referenced by unhashIndex().

const unsigned short ESDetId::hx2 [static, private]

Definition at line 90 of file ESDetId.h.

Referenced by unhashIndex().

const unsigned short ESDetId::hxy1 [static, private]

Definition at line 85 of file ESDetId.h.

Referenced by ESDetId(), hashedIndex(), and validDetId().

const unsigned short ESDetId::hxy2 [static, private]

Definition at line 89 of file ESDetId.h.

Referenced by ESDetId(), hashedIndex(), and validDetId().

const unsigned short ESDetId::hy1 [static, private]

Definition at line 87 of file ESDetId.h.

Referenced by unhashIndex().

const unsigned short ESDetId::hy2 [static, private]

Definition at line 91 of file ESDetId.h.

Referenced by unhashIndex().

const int ESDetId::ISTRIP_MAX = 32 [static]
const int ESDetId::ISTRIP_MIN = 1 [static]
const int ESDetId::IX_MAX = 40 [static]
const int ESDetId::IX_MIN = 1 [static]
const int ESDetId::IY_MAX = 40 [static]
const int ESDetId::IY_MIN = 1 [static]
const int ESDetId::IZ_NUM = 2 [static]

Definition at line 65 of file ESDetId.h.

const int ESDetId::PLANE_MAX = 2 [static]

Definition at line 64 of file ESDetId.h.

Referenced by validDetId().

const int ESDetId::PLANE_MIN = 1 [static]

Definition at line 63 of file ESDetId.h.

Referenced by validDetId().