#include <EcalScDetId.h>
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 |
EcalScDetId & | operator= (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] |
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.
anonymous enum |
Definition at line 188 of file EcalScDetId.h.
{ kSizeForDenseIndexing = SC_PER_EE_CNT * 2 };
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
rawid | det 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+
ix | x-index |
iy | y-index |
iz | z-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
id | det 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(); }
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.
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.
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] |
Gets the crystal x-index.
Definition at line 72 of file EcalScDetId.h.
References DetId::id_.
Referenced by EESelectiveReadoutTask::analyze(), EcalSelectiveReadoutValidation::analyzeEE(), EESelectiveReadoutTask::dccNumOfRU(), EcalSimRawData::getSrfs(), hashedIndex(), iquadrant(), EcalDAQTowerStatusXMLTranslator::plot(), EcalDCSTowerStatusXMLTranslator::plot(), cond::PayLoadInspector< DataT >::plot(), EcalSelectiveReadoutProducer::printSrFlags(), EcalDetIdToBeRecoveredProducer::produce(), EcalRecHitWorkerRecover::run(), and xuti::writeCell().
{ return (id_>>7)&0x7F; }
int EcalScDetId::iy | ( | ) | const [inline] |
Get the crystal y-index
Definition at line 78 of file EcalScDetId.h.
References DetId::id_.
Referenced by EcalSelectiveReadoutValidation::analyzeEE(), EESelectiveReadoutTask::dccNumOfRU(), EcalSimRawData::getSrfs(), hashedIndex(), iquadrant(), EcalDCSTowerStatusXMLTranslator::plot(), EcalDAQTowerStatusXMLTranslator::plot(), cond::PayLoadInspector< DataT >::plot(), EcalSelectiveReadoutProducer::printSrFlags(), EcalDetIdToBeRecoveredProducer::produce(), EcalRecHitWorkerRecover::run(), and xuti::writeCell().
{ return id_&0x7F; }
EcalScDetId & EcalScDetId::operator= | ( | const DetId & | id | ) |
Assignment operator
id | source 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
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
hi | hashed index |
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.
din | hashed index to validate |
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.
ix | supercrystal x-index |
iy | supercrystal y-index |
iz | supercrystal z-index (aka z-side) |
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.
hi | hashed index to validate |
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] |
Gets the z-side of the crystal (1/-1)
Definition at line 66 of file EcalScDetId.h.
References DetId::id_.
Referenced by EcalSelectiveReadoutValidation::analyzeEE(), EESelectiveReadoutTask::dccNumOfRU(), EcalSelectiveReadout::eeRuInterest(), EcalSimRawData::getSrfs(), hashedIndex(), EcalDCSTowerStatusXMLTranslator::plot(), EcalDAQTowerStatusXMLTranslator::plot(), cond::PayLoadInspector< DataT >::plot(), EcalSelectiveReadoutProducer::printSrFlags(), EcalDetIdToBeRecoveredProducer::produce(), EcalRecHitWorkerRecover::run(), and xuti::writeCell().
{ return (id_&0x4000)?(1):(-1); }
EcalScDetId EcalScDetId::hashedIndex2DetId [static, private] |
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().