CMS 3D CMS Logo

EcalScDetId Class Reference

Supercrystal identifier class for the ECAL endcap. More...

#include <DataFormats/EcalDetId/interface/EcalScDetId.h>

Inheritance diagram for EcalScDetId:

DetId

List of all members.

Public Member Functions

 EcalScDetId (const DetId &id)
 Constructor from a generic cell id.
 EcalScDetId (int ix, int iy, int iz)
 Constructor from crystal ix,iy,iz (iz=+1/-1) or from sc,cr,iz.
 EcalScDetId (uint32_t rawid)
 Constructor from a raw value.
 EcalScDetId ()
 Constructor of a null id.
int hashedIndex () const
 Gets a compact index for arrays.
int iquadrant () const
 Gets the quadrant of the DetId.
int isc () const
 Gets the SuperCrystal number.
int ix () const
 Gets the crystal ix.
int iy () const
 Gets the crystal iy.
EcalScDetIdoperator= (const DetId &id)
 assignment operator
EcalSubdetector subdet () const
 Gets the subdetector.
int zside () const
 Gets the z-side of the crystal (1/-1).

Static Public Member Functions

static bool validDetId (int i, int j, int iz)
 check if a valid index combination

Static Public Attributes

static const int ISC_MAX = 316
static const int ISC_MIN = 1
static const int IX_MAX = 20
static const int IX_MIN = 1
static const int IY_MAX = 20
static const int IY_MIN = 1

Private Member Functions

int ix (int iSC, int iCrys) const
int ixQuadrantOne () const
int iy (int iSC, int iCrys) const
int iyQuadrantOne () const

Static Private Attributes

static const int iYoffset [nCols+1] = { 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }
static const int nCols = 10
static const int nCrys = 5
static const int QuadColLimits [nCols+1] = { 0, 8,17,27,36,45,54,62,70,76,79 }


Detailed Description

Supercrystal identifier class for the ECAL endcap.

Note: internal representation of ScDetId: 31 . 15 . 0 |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-| | det |sudet| 0 |1|z| ix | iy | +-------+-----+-----------------+-+-+-------------+-------------+

Definition at line 23 of file EcalScDetId.h.


Constructor & Destructor Documentation

EcalScDetId::EcalScDetId (  ) 

Constructor of a null id.

Definition at line 8 of file EcalScDetId.cc.

00008                          : DetId() {
00009 }

EcalScDetId::EcalScDetId ( uint32_t  rawid  ) 

Constructor from a raw value.

Definition at line 10 of file EcalScDetId.cc.

00010                                        : DetId(rawid) {
00011 }

EcalScDetId::EcalScDetId ( int  ix,
int  iy,
int  iz 
)

Constructor from crystal ix,iy,iz (iz=+1/-1) or from sc,cr,iz.

Definition at line 12 of file EcalScDetId.cc.

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

00012                                                : DetId(Ecal,EcalEndcap) 
00013 {
00014   if(!validDetId(ix,iy,iz))
00015     {
00016       throw cms::Exception("InvalidDetId") << "EcalScDetId:  Cannot create object.  Indexes out of bounds \n" 
00017                                            << "x = " << ix << " y = " << iy << " z = " << iz;
00018     }
00019   const int scBit = 1<<15; //bit set to 1 to distinguish from crystal id (EEDetId)
00020   //                         and for a reasonale behaviour of DetId ccomparison operators.
00021   id_|=(iy&0x7f)|((ix&0x7f)<<7)|((iz>0)?(1<<14):(0))|scBit;
00022 }

EcalScDetId::EcalScDetId ( const DetId id  ) 

Constructor from a generic cell id.

Definition at line 24 of file EcalScDetId.cc.

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

00024                                          {
00025   if (!gen.null() && (gen.det()!=Ecal || gen.subdetId()!=EcalEndcap)) {
00026     throw cms::Exception("InvalidDetId"); 
00027   }
00028   id_=gen.rawId();
00029 }


Member Function Documentation

int EcalScDetId::hashedIndex (  )  const

Gets a compact index for arrays.

Definition at line 39 of file EcalScDetId.cc.

References ix(), IX_MAX, iy(), IY_MAX, and zside().

00039                                    {
00040   return ((zside()>0)?(IX_MAX*IY_MAX):(0))+(iy()-1)*IX_MAX+(ix()-1);
00041 }

int EcalScDetId::iquadrant (  )  const

Gets the quadrant of the DetId.

Definition at line 65 of file EcalScDetId.cc.

References ix(), and iy().

Referenced by isc(), ixQuadrantOne(), and iyQuadrantOne().

00065                                  {
00066   if (ix()>10)
00067     {
00068       if(iy()>10)
00069         return 1;
00070       else
00071         return 4;
00072     }
00073   else
00074     {
00075       if(iy()>10)
00076         return 2;
00077       else
00078         return 3;
00079     }
00080   //Should never be reached
00081   return -1;
00082 }  

int EcalScDetId::isc (  )  const

Gets the SuperCrystal number.

Definition at line 84 of file EcalScDetId.cc.

References iquadrant(), ix(), iy(), iYoffset, nCols, and QuadColLimits.

00085 {
00086   /*
00087    *  Return SC number from (x,y) coordinates.
00088    *
00089    *  Copied from code originally written by B W Kennedy
00090    */
00091   
00092   int iCol = ix();
00093   int iRow = iy();
00094   int nSCinQuadrant = QuadColLimits[nCols];
00095   int iSC;
00096   
00097   if (iRow <= iYoffset[iCol]) 
00098     return -1;
00099   else 
00100     iSC = QuadColLimits[iCol-1] + iRow - iYoffset[iCol];
00101 
00102   if (iSC > QuadColLimits[iCol]) 
00103     return -2;
00104   
00105   if (iSC>0) 
00106       iSC += nSCinQuadrant*(iquadrant()-1);
00107   
00108   return iSC;
00109 }  

int EcalScDetId::ix ( int  iSC,
int  iCrys 
) const [private]

int EcalScDetId::ix (  )  const [inline]

Gets the crystal ix.

Definition at line 42 of file EcalScDetId.h.

References DetId::id_.

Referenced by EcalSimRawData::getSrfs(), EcalSelectiveReadout::getSuperCrystalInterest(), hashedIndex(), iquadrant(), isc(), and ixQuadrantOne().

00042 { return (id_>>7)&0x7F; }

int EcalScDetId::ixQuadrantOne (  )  const [private]

Definition at line 43 of file EcalScDetId.cc.

References iquadrant(), and ix().

00044 { 
00045   int iQuadrant = iquadrant();
00046   if ( iQuadrant == 1 || iQuadrant == 4)
00047     return (ix() - 10);
00048   else if ( iQuadrant == 2 || iQuadrant == 3)
00049     return (11 - ix());
00050   //Should never be reached
00051   return -1;
00052 }

int EcalScDetId::iy ( int  iSC,
int  iCrys 
) const [private]

int EcalScDetId::iy (  )  const [inline]

Gets the crystal iy.

Definition at line 44 of file EcalScDetId.h.

References DetId::id_.

Referenced by EcalSimRawData::getSrfs(), EcalSelectiveReadout::getSuperCrystalInterest(), hashedIndex(), iquadrant(), isc(), and iyQuadrantOne().

00044 { return id_&0x7F; }  

int EcalScDetId::iyQuadrantOne (  )  const [private]

Definition at line 54 of file EcalScDetId.cc.

References iquadrant(), and iy().

00055 { 
00056   int iQuadrant = iquadrant();
00057   if ( iQuadrant == 1 || iQuadrant == 2)
00058     return (iy() - 10);
00059   else if ( iQuadrant == 3 || iQuadrant == 4)
00060     return 11 - iy();
00061   //Should never be reached
00062   return -1;
00063 }

EcalScDetId & EcalScDetId::operator= ( const DetId id  ) 

assignment operator

Definition at line 31 of file EcalScDetId.cc.

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

00031                                                     {
00032   if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalEndcap )) {
00033     throw cms::Exception("InvalidDetId"); 
00034   }
00035   id_=gen.rawId();
00036   return *this;
00037 }

EcalSubdetector EcalScDetId::subdet (  )  const [inline]

Gets the subdetector.

Definition at line 38 of file EcalScDetId.h.

References DetId::subdetId().

00038 { return EcalSubdetector(subdetId()); }

bool EcalScDetId::validDetId ( int  i,
int  j,
int  iz 
) [static]

check if a valid index combination

Definition at line 111 of file EcalScDetId.cc.

References funct::abs().

Referenced by EcalScDetId(), and EcalSelectiveReadoutSuppressor::run().

00111                                                    {
00112   static const char endcapMap[401] = {
00113     "       XXXXXX       "
00114     "    XXXXXXXXXXXX    "
00115     "   XXXXXXXXXXXXXX   "
00116     "  XXXXXXXXXXXXXXXX  "
00117     " XXXXXXXXXXXXXXXXXX "
00118     " XXXXXXXXXXXXXXXXXX "             //    Z
00119     " XXXXXXXXXXXXXXXXXX "             //     x-----> X
00120     "XXXXXXXXXXXXXXXXXXXX"             //     |
00121     "XXXXXXXXX  XXXXXXXXX"             //     |
00122     "XXXXXXXX    XXXXXXXX"//_          //     |
00123     "XXXXXXXX    XXXXXXXX"             //     V Y
00124     "XXXXXXXXX  XXXXXXXXX"
00125     "XXXXXXXXXXXXXXXXXXXX"
00126     " XXXXXXXXXXXXXXXXXX "
00127     " XXXXXXXXXXXXXXXXXX "
00128     " XXXXXXXXXXXXXXXXXX "
00129     "  XXXXXXXXXXXXXXXX  "
00130     "   XXXXXXXXXXXXXX   "
00131     "    XXXXXXXXXXXX    "
00132     "       XXXXXX       "};
00133 
00134   return abs(iZ)==1 && endcapMap[iX-1+(iY-1)*20]!=' ';
00135 }

int EcalScDetId::zside (  )  const [inline]

Gets the z-side of the crystal (1/-1).

Definition at line 40 of file EcalScDetId.h.

References DetId::id_.

Referenced by EcalSimRawData::getSrfs(), EcalSelectiveReadout::getSuperCrystalInterest(), and hashedIndex().

00040 { return (id_&0x4000)?(1):(-1); }


Member Data Documentation

const int EcalScDetId::ISC_MAX = 316 [static]

Definition at line 57 of file EcalScDetId.h.

const int EcalScDetId::ISC_MIN = 1 [static]

Definition at line 56 of file EcalScDetId.h.

const int EcalScDetId::IX_MAX = 20 [static]

Definition at line 54 of file EcalScDetId.h.

Referenced by hashedIndex().

const int EcalScDetId::IX_MIN = 1 [static]

Definition at line 52 of file EcalScDetId.h.

const int EcalScDetId::IY_MAX = 20 [static]

Definition at line 55 of file EcalScDetId.h.

Referenced by hashedIndex().

const int EcalScDetId::IY_MIN = 1 [static]

Definition at line 53 of file EcalScDetId.h.

const int EcalScDetId::iYoffset = { 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 } [static, private]

Definition at line 70 of file EcalScDetId.h.

Referenced by isc().

const int EcalScDetId::nCols = 10 [static, private]

Definition at line 67 of file EcalScDetId.h.

Referenced by isc().

const int EcalScDetId::nCrys = 5 [static, private]

Definition at line 68 of file EcalScDetId.h.

const int EcalScDetId::QuadColLimits = { 0, 8,17,27,36,45,54,62,70,76,79 } [static, private]

Definition at line 69 of file EcalScDetId.h.

Referenced by isc().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:52 2009 for CMSSW by  doxygen 1.5.4