CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Types

enum  { kSizeForDenseIndexing = SC_PER_EE_CNT * 2 }
 
- Public Types inherited from DetId
enum  Detector {
  Tracker =1, Muon =2, Ecal =3, Hcal =4,
  Calo =5
}
 

Public Member Functions

uint32_t denseIndex () const
 
 EcalScDetId ()
 
 EcalScDetId (uint32_t rawid)
 
 EcalScDetId (int ix, int iy, int iz)
 
 EcalScDetId (const DetId &id)
 
int hashedIndex () const
 
int iquadrant () const
 
int ix () const
 
int iy () const
 
EcalScDetIdoperator= (const DetId &id)
 
EcalSubdetector subdet () const
 
int zside () const
 
- Public Member Functions inherited from DetId
Detector det () const
 get the detector field from this detid More...
 
 DetId ()
 Create an empty or null id (also for persistence) More...
 
 DetId (uint32_t id)
 Create an id from a raw number. More...
 
 DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
bool null () const
 is this a null id ? More...
 
 operator uint32_t () const
 
bool operator!= (DetId id) const
 inequality More...
 
uint32_t operator() () const
 
bool operator< (DetId id) const
 comparison More...
 
bool operator== (DetId id) const
 equality More...
 
uint32_t rawId () const
 get the raw id More...
 
int subdetId () const
 get the contents of the subdetector field (not cast into any detector's numbering enum) More...
 

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 Public Attributes inherited from DetId
static const int kDetOffset = 28
 
static const int kSubdetOffset = 25
 

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]
 

Additional Inherited Members

- Protected Attributes inherited from DetId
uint32_t id_
 

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.

188  {
192  };
static const int SC_PER_EE_CNT
Definition: EcalScDetId.h:145

Constructor & Destructor Documentation

EcalScDetId::EcalScDetId ( )

Constructor of a null id

Definition at line 12 of file EcalScDetId.cc.

Referenced by checkHashedIndexMap(), and unhashIndex().

12  : DetId() {
13 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
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.

15  : DetId(rawid) {
16 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
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 edm::hlt::Exception, DetId::id_, and validDetId().

19 {
20  if(!validDetId(ix,iy,iz))
21  {
22  throw cms::Exception("InvalidDetId") << "EcalScDetId: Cannot create object. Indexes out of bounds \n"
23  << "x = " << ix << " y = " << iy << " z = " << iz;
24  }
25  const int scBit = 1<<15; //bit set to 1 to distinguish from crystal id (EEDetId)
26  // and for a reasonale behaviour of DetId ccomparison operators.
27  id_|=(iy&0x7f)|((ix&0x7f)<<7)|((iz>0)?(1<<14):(0))|scBit;
28 }
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:63
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
int ix() const
Definition: EcalScDetId.h:72
int iy() const
Definition: EcalScDetId.h:78
uint32_t id_
Definition: DetId.h:57
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, edm::hlt::Exception, DetId::id_, DetId::null(), DetId::rawId(), and DetId::subdetId().

30  {
31  if (!gen.null() && (gen.det()!=Ecal || gen.subdetId()!=EcalEndcap)) {
32  throw cms::Exception("InvalidDetId");
33  }
34  id_=gen.rawId();
35 }
uint32_t id_
Definition: DetId.h:57

Member Function Documentation

void EcalScDetId::checkHashedIndexMap ( )
staticprivate

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().

93  {
94  static bool initialized = false;
95  if(initialized) return;
96  int hashedIndex = -1;
97  for(int iZ = -1; iZ <= +1; iZ+=2){
98  for(int iY = IY_MIN; iY <= IY_MAX; ++iY){
99  for(int iX = IX_MIN; iX <= IX_MAX; ++iX){
100  if(validDetId(iX,iY,iZ)){
101  xyz2HashedIndex[iX-IX_MIN][iY-IY_MIN][iZ>0?1:0] = ++hashedIndex;
102  assert((unsigned)hashedIndex < sizeof(hashedIndex2DetId)/sizeof(hashedIndex2DetId[0]));
104  }
105  }
106  }
107  }
108  initialized = true;
109 }
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:63
static EcalScDetId hashedIndex2DetId[kSizeForDenseIndexing]
Definition: EcalScDetId.h:203
static const int IY_MIN
Definition: EcalScDetId.h:153
static const int IX_MIN
Definition: EcalScDetId.h:149
static const int IY_MAX
Definition: EcalScDetId.h:161
int hashedIndex() const
Definition: EcalScDetId.h:109
static const int IX_MAX
Definition: EcalScDetId.h:157
static short xyz2HashedIndex[IX_MAX][IY_MAX][nEndcaps]
Definition: EcalScDetId.h:199
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().

128 { return hashedIndex() ; }
int hashedIndex() const
Definition: EcalScDetId.h:109
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().

109  {
111  if(!validDetId(ix(),iy(),zside())) return -1;
112  return xyz2HashedIndex[ix()-IX_MIN][iy()-IY_MIN][zside()>0?1:0];
113  }
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:63
static const int IY_MIN
Definition: EcalScDetId.h:153
static const int IX_MIN
Definition: EcalScDetId.h:149
int ix() const
Definition: EcalScDetId.h:72
int iy() const
Definition: EcalScDetId.h:78
static void checkHashedIndexMap()
Definition: EcalScDetId.cc:93
int zside() const
Definition: EcalScDetId.h:66
static short xyz2HashedIndex[IX_MAX][IY_MAX][nEndcaps]
Definition: EcalScDetId.h:199
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.

45  {
46  const int xMiddle = IX_MAX/2; //y = 0 between xMiddle and xMiddle+1
47  const int yMiddle = IY_MAX/2; //x = 0 between yMiddle and yMiddle+1
48  if (iy()>yMiddle){// y>0
49  if(ix()>xMiddle) // A y
50  return 1; // |
51  else // Q2 | Q1
52  return 2; // |
53  } else{// y<0 // ----------o---------> x
54  if(ix()>xMiddle) // |
55  return 4; // Q3 | Q4
56  else // |
57  return 3;
58  }
59  //Should never be reached
60  return -1;
61 }
int ix() const
Definition: EcalScDetId.h:72
static const int IY_MAX
Definition: EcalScDetId.h:161
int iy() const
Definition: EcalScDetId.h:78
static const int IX_MAX
Definition: EcalScDetId.h:157
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, edm::hlt::Exception, DetId::id_, DetId::null(), DetId::rawId(), and DetId::subdetId().

37  {
38  if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalEndcap )) {
39  throw cms::Exception("InvalidDetId");
40  }
41  id_=gen.rawId();
42  return *this;
43 }
uint32_t id_
Definition: DetId.h:57
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().

61 { return EcalSubdetector(subdetId()); }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
EcalSubdetector
static EcalScDetId EcalScDetId::unhashIndex ( int  hi)
inlinestatic

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 EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::plot(), EcalDAQTowerStatusXMLTranslator::plot(), and cond::PayLoadInspector< DataT >::plot().

119  {
121  if(hi < 0 || hi >= kSizeForDenseIndexing) return EcalScDetId();
122  return hashedIndex2DetId[hi];
123  }
static EcalScDetId hashedIndex2DetId[kSizeForDenseIndexing]
Definition: EcalScDetId.h:203
static void checkHashedIndexMap()
Definition: EcalScDetId.cc:93
static bool EcalScDetId::validDenseIndex ( uint32_t  din)
inlinestatic

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().

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 EEDaqInfoTask::beginLuminosityBlock(), EEDcsInfoTask::beginLuminosityBlock(), EcalDQMStatusReader::beginRun(), checkHashedIndexMap(), EcalScDetId(), popcon::EcalDAQHandler::getNewObjects(), popcon::EcalDCSHandler::getNewObjects(), hashedIndex(), popcon::EcalDCSHandler::insertHVDataSetToOffline(), popcon::EcalDCSHandler::insertLVDataSetToOffline(), EcalSelectiveReadout::printDccChMap(), EcalSelectiveReadout::printEndcap(), EcalTrivialConditionRetriever::produceEcalDAQTowerStatus(), EcalTrivialConditionRetriever::produceEcalDCSTowerStatus(), EcalTrivialConditionRetriever::produceEcalDQMTowerStatus(), EcalDQMStatusWriter::readEcalDQMTowerStatusFromFile(), and EcalSelectiveReadoutSuppressor::run().

63  {
64  static const char endcapMap[401] = {
65  " XXXXXX "
66  " XXXXXXXXXXXX "
67  " XXXXXXXXXXXXXX "
68  " XXXXXXXXXXXXXXXX "
69  " XXXXXXXXXXXXXXXXXX "
70  " XXXXXXXXXXXXXXXXXX " // Z
71  " XXXXXXXXXXXXXXXXXX " // x-----> X
72  "XXXXXXXXXXXXXXXXXXXX" // |
73  "XXXXXXXXX XXXXXXXXX" // |
74  "XXXXXXXX XXXXXXXX"//_ // |
75  "XXXXXXXX XXXXXXXX" // V Y
76  "XXXXXXXXX XXXXXXXXX"
77  "XXXXXXXXXXXXXXXXXXXX"
78  " XXXXXXXXXXXXXXXXXX "
79  " XXXXXXXXXXXXXXXXXX "
80  " XXXXXXXXXXXXXXXXXX "
81  " XXXXXXXXXXXXXXXX "
82  " XXXXXXXXXXXXXX "
83  " XXXXXXXXXXXX "
84  " XXXXXX "};
85 
86  return abs(iZ)==1 && endcapMap[iX-1+(iY-1)*20]!=' ';
87 }
#define abs(x)
Definition: mlp_lapack.h:159
static bool EcalScDetId::validHashIndex ( int  hi)
inlinestatic

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 EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::plot(), EcalDAQTowerStatusXMLTranslator::plot(), and cond::PayLoadInspector< DataT >::plot().

141 { return validDenseIndex(hi) ; }
static bool validDenseIndex(uint32_t din)
Definition: EcalScDetId.h:134
int EcalScDetId::zside ( ) const
inline

Member Data Documentation

EcalScDetId EcalScDetId::hashedIndex2DetId
staticprivate

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
staticprivate

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
staticprivate

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

Definition at line 199 of file EcalScDetId.h.

Referenced by checkHashedIndexMap(), and hashedIndex().