CMS 3D CMS Logo

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

EcalScDetId Class Reference

#include <EcalScDetId.h>

Inheritance diagram for EcalScDetId:
DetId

List of all members.

Public Types

enum  { kSizeForDenseIndexing = SC_PER_EE_CNT * 2 }

Public Member Functions

uint32_t denseIndex () const
 EcalScDetId (uint32_t rawid)
 EcalScDetId (const DetId &id)
 EcalScDetId ()
 EcalScDetId (int ix, int iy, int iz)
int hashedIndex () const
int iquadrant () const
int ix () const
int iy () const
EcalScDetIdoperator= (const DetId &id)
EcalSubdetector subdet () const
int zside () const

Static Public Member Functions

static EcalScDetId unhashIndex (int hi)
static bool validDenseIndex (uint32_t din)
static bool validDetId (int ix, int iy, int iz)
static bool validHashIndex (int hi)

Static Public Attributes

static const int IHASHED_MAX = SC_PER_EE_CNT*2 - 1
static const int IHASHED_MIN = 0
static const int IX_MAX = 20
static const int IX_MIN = 1
static const int IY_MAX = 20
static const int IY_MIN = 1
static const int SC_PER_EE_CNT = 312

Static Private Member Functions

static void checkHashedIndexMap ()

Static Private Attributes

static EcalScDetId hashedIndex2DetId [kSizeForDenseIndexing]
static const int nEndcaps = 2
static short xyz2HashedIndex [IX_MAX][IY_MAX][nEndcaps]

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 25 of file EcalScDetId.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
kSizeForDenseIndexing 

Number of dense supercrystal indices.

Definition at line 188 of file EcalScDetId.h.


Constructor & Destructor Documentation

EcalScDetId::EcalScDetId ( )

Constructor of a null id

Definition at line 12 of file EcalScDetId.cc.

Referenced by checkHashedIndexMap(), and unhashIndex().

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

Constructor from a raw value

Parameters:
rawiddet ID number of the supecrystal, as defined in this class description.

Definition at line 15 of file EcalScDetId.cc.

                                       : DetId(rawid) {
}
EcalScDetId::EcalScDetId ( int  ix,
int  iy,
int  iz 
)

Constructor from supercrystal ix,iy,iz (iz=+1/-1) ix x-index runs from 1 to 20 along x-axis of standard CMS coordinates iy y-index runs from 1 to 20 along y-axis of standard CMS coordinates iz z-index (also called "z-side") is -1 for EE- and +1 for EE+

Parameters:
ixx-index
iyy-index
izz-side /z-index: -1 for EE-, +1 for EE+

Definition at line 18 of file EcalScDetId.cc.

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

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

Constructor from a raw value

Parameters:
iddet ID number

Definition at line 30 of file EcalScDetId.cc.

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

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

Member Function Documentation

void EcalScDetId::checkHashedIndexMap ( ) [static, private]

Initializes x,y,z <-> hashed index map if not yet done.

Definition at line 93 of file EcalScDetId.cc.

References EcalScDetId(), hashedIndex(), hashedIndex2DetId, IX_MAX, IX_MIN, IY_MAX, IY_MIN, validDetId(), and xyz2HashedIndex.

Referenced by hashedIndex(), and unhashIndex().

                                     {
  static bool initialized = false;
  if(initialized) return;
  int hashedIndex = -1;
  for(int iZ = -1; iZ <= +1; iZ+=2){
    for(int iY = IY_MIN; iY <= IY_MAX; ++iY){
      for(int iX = IX_MIN; iX <= IX_MAX; ++iX){
        if(validDetId(iX,iY,iZ)){
          xyz2HashedIndex[iX-IX_MIN][iY-IY_MIN][iZ>0?1:0] = ++hashedIndex;
          assert((unsigned)hashedIndex < sizeof(hashedIndex2DetId)/sizeof(hashedIndex2DetId[0]));
             hashedIndex2DetId[hashedIndex] = EcalScDetId(iX, iY, iZ);
        }
      }
    }
  }
  initialized = true;
}
uint32_t EcalScDetId::denseIndex ( ) const [inline]

Same as hashed index.

Returns:
the dense/hashed index

Definition at line 128 of file EcalScDetId.h.

References hashedIndex().

{ return hashedIndex() ; }
int EcalScDetId::hashedIndex ( ) const [inline]

Gets a compact index for arrays. Index runs from 0 to 623. They are ordered by increasing z (EE- then EE+), then for same z by increasing y. then for same z and y by increasing x

Definition at line 109 of file EcalScDetId.h.

References checkHashedIndexMap(), ix(), IX_MIN, iy(), IY_MIN, validDetId(), xyz2HashedIndex, and zside().

Referenced by checkHashedIndexMap(), and denseIndex().

                         {
    checkHashedIndexMap();
    if(!validDetId(ix(),iy(),zside())) return -1;
    return xyz2HashedIndex[ix()-IX_MIN][iy()-IY_MIN][zside()>0?1:0];
  }
int EcalScDetId::iquadrant ( ) const

Gets the quadrant of the DetId.

Quadrant number definition for EE+, x and y in std CMS coordinates:

   *                 A y
   *                 |
   *          Q2     |    Q1
   *                 |
   *       ----------o---------> x
   *                 |
   *          Q3     |    Q4
   *                 |
   * 

This method will return the same quadrant number independently of z: that is two supercrystals which are face to face will be considered will have the same quadrant number. It is not clear it is the correct or usual definition.

See also:
EEDetId::iquadrant()
Returns:
quadrant number, from 1 to 4.

Definition at line 45 of file EcalScDetId.cc.

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

                                 {
  const int xMiddle = IX_MAX/2; //y = 0 between xMiddle and xMiddle+1
  const int yMiddle = IY_MAX/2; //x = 0 between yMiddle and yMiddle+1
  if (iy()>yMiddle){// y>0
    if(ix()>xMiddle)   //             A y            
      return 1;        //             |              
    else               //      Q2     |    Q1        
      return 2;        //             |              
  } else{// y<0        //   ----------o---------> x   
    if(ix()>xMiddle)   //             |               
      return 4;        //      Q3     |    Q4       
    else               //             |               
      return 3;
  }
  //Should never be reached
  return -1;
}  
int EcalScDetId::ix ( ) const [inline]
int EcalScDetId::iy ( ) const [inline]
EcalScDetId & EcalScDetId::operator= ( const DetId id)

Assignment operator

Parameters:
idsource det id

Definition at line 37 of file EcalScDetId.cc.

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

                                                    {
  if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalEndcap )) {
    throw cms::Exception("InvalidDetId"); 
  }
  id_=gen.rawId();
  return *this;
}
EcalSubdetector EcalScDetId::subdet ( ) const [inline]

Gets the subdetector

Returns:
subdetectot ID, that is EcalEndcap

Definition at line 61 of file EcalScDetId.h.

References DetId::subdetId().

{ return EcalSubdetector(subdetId()); }
static EcalScDetId EcalScDetId::unhashIndex ( int  hi) [inline, static]

Gets EcalScDetId from hasedIndex as defined by hashedIndex method

Parameters:
hihashed index
Returns:
the EcalScDetId. If hi is invalid return a null EcalScDetId.

Definition at line 119 of file EcalScDetId.h.

References checkHashedIndexMap(), EcalScDetId(), hashedIndex2DetId, and kSizeForDenseIndexing.

Referenced by EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::plot(), EcalDCSTowerStatusXMLTranslator::plot(), and cond::PayLoadInspector< DataT >::plot().

                                        {
    checkHashedIndexMap();
    if(hi < 0 || hi >= kSizeForDenseIndexing) return EcalScDetId();
    return hashedIndex2DetId[hi];
  }
static bool EcalScDetId::validDenseIndex ( uint32_t  din) [inline, static]

Validates a hashed index.

Parameters:
dinhashed index to validate
Returns:
true if the index is valid, false if it is invalid.

Definition at line 134 of file EcalScDetId.h.

References kSizeForDenseIndexing.

Referenced by validHashIndex().

{ return din < kSizeForDenseIndexing; }
bool EcalScDetId::validDetId ( int  ix,
int  iy,
int  iz 
) [static]

Checks validity of a crystal (x,y.z) index triplet.

Parameters:
ixsupercrystal x-index
iysupercrystal y-index
izsupercrystal z-index (aka z-side)
See also:
EEDetId(int, int, int) for index definition
Returns:
true if valid, false otherwise

Definition at line 63 of file EcalScDetId.cc.

References abs.

Referenced by EcalDQMStatusReader::beginRun(), checkHashedIndexMap(), EcalScDetId(), popcon::EcalDCSHandler::getNewObjects(), popcon::EcalDAQHandler::getNewObjects(), hashedIndex(), popcon::EcalDCSHandler::insertHVDataSetToOffline(), popcon::EcalDCSHandler::insertLVDataSetToOffline(), EcalSelectiveReadout::printDccChMap(), EcalSelectiveReadout::printEndcap(), EcalTrivialConditionRetriever::produceEcalDAQTowerStatus(), EcalTrivialConditionRetriever::produceEcalDCSTowerStatus(), EcalTrivialConditionRetriever::produceEcalDQMTowerStatus(), EcalDQMStatusWriter::readEcalDQMTowerStatusFromFile(), EcalSelectiveReadoutSuppressor::run(), and Numbers::validEESc().

                                                   {
  static const char endcapMap[401] = {
    "       XXXXXX       "
    "    XXXXXXXXXXXX    "
    "   XXXXXXXXXXXXXX   "
    "  XXXXXXXXXXXXXXXX  "
    " XXXXXXXXXXXXXXXXXX "
    " XXXXXXXXXXXXXXXXXX "             //    Z
    " XXXXXXXXXXXXXXXXXX "             //     x-----> X
    "XXXXXXXXXXXXXXXXXXXX"             //     |
    "XXXXXXXXX  XXXXXXXXX"             //     |
    "XXXXXXXX    XXXXXXXX"//_          //     |
    "XXXXXXXX    XXXXXXXX"             //     V Y
    "XXXXXXXXX  XXXXXXXXX"
    "XXXXXXXXXXXXXXXXXXXX"
    " XXXXXXXXXXXXXXXXXX "
    " XXXXXXXXXXXXXXXXXX "
    " XXXXXXXXXXXXXXXXXX "
    "  XXXXXXXXXXXXXXXX  "
    "   XXXXXXXXXXXXXX   "
    "    XXXXXXXXXXXX    "
    "       XXXXXX       "};

  return abs(iZ)==1 && endcapMap[iX-1+(iY-1)*20]!=' ';
}
static bool EcalScDetId::validHashIndex ( int  hi) [inline, static]

Validates a hashed index.

Parameters:
hihashed index to validate
Returns:
true if the index is valid, false if it is invalid.

Definition at line 141 of file EcalScDetId.h.

References validDenseIndex().

Referenced by EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::plot(), EcalDCSTowerStatusXMLTranslator::plot(), and cond::PayLoadInspector< DataT >::plot().

{ return validDenseIndex(hi) ; }
int EcalScDetId::zside ( ) const [inline]

Member Data Documentation

Map of hased index to x,y,z. See hashedIndex/

Definition at line 203 of file EcalScDetId.h.

Referenced by checkHashedIndexMap(), and unhashIndex().

const int EcalScDetId::IHASHED_MAX = SC_PER_EE_CNT*2 - 1 [static]

Upper bound for hashed/dense index

Definition at line 169 of file EcalScDetId.h.

const int EcalScDetId::IHASHED_MIN = 0 [static]

Lower bound for hashed/dense index

Definition at line 165 of file EcalScDetId.h.

const int EcalScDetId::IX_MAX = 20 [static]

Upper bound of EE crystal y-index

Definition at line 157 of file EcalScDetId.h.

Referenced by checkHashedIndexMap(), and iquadrant().

const int EcalScDetId::IX_MIN = 1 [static]

Lower bound of EE supercrystal x-index

Definition at line 149 of file EcalScDetId.h.

Referenced by checkHashedIndexMap(), and hashedIndex().

const int EcalScDetId::IY_MAX = 20 [static]

Upper bound of EE crystal y-index

Definition at line 161 of file EcalScDetId.h.

Referenced by checkHashedIndexMap(), and iquadrant().

const int EcalScDetId::IY_MIN = 1 [static]

Lower bound of EE supercrystal y-index

Definition at line 153 of file EcalScDetId.h.

Referenced by checkHashedIndexMap(), and hashedIndex().

const int EcalScDetId::nEndcaps = 2 [static, private]

Definition at line 195 of file EcalScDetId.h.

const int EcalScDetId::SC_PER_EE_CNT = 312 [static]

Number of supercrystals per endcap

Definition at line 145 of file EcalScDetId.h.

short EcalScDetId::xyz2HashedIndex [static, private]

Map of z,x,y index to hashed index. See hashedIndex/

Definition at line 199 of file EcalScDetId.h.

Referenced by checkHashedIndexMap(), and hashedIndex().