test
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, Forward =6, VeryForward =7
}
 

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

Member Enumeration Documentation

anonymous enum
Enumerator
kSizeForDenseIndexing 

Number of dense supercrystal indices.

Definition at line 187 of file EcalScDetId.h.

187  {
191  };
static const int SC_PER_EE_CNT
Definition: EcalScDetId.h:144

Constructor & Destructor Documentation

EcalScDetId::EcalScDetId ( )

Constructor of a null id

Definition at line 13 of file EcalScDetId.cc.

Referenced by checkHashedIndexMap(), and unhashIndex().

13  : DetId() {
14 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
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 16 of file EcalScDetId.cc.

16  : DetId(rawid) {
17 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
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 19 of file EcalScDetId.cc.

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

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

Constructor from a raw value

Parameters
iddet ID number

Definition at line 31 of file EcalScDetId.cc.

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

31  {
32  if (!gen.null() && (gen.det()!=Ecal || gen.subdetId()!=EcalEndcap)) {
33  throw cms::Exception("InvalidDetId");
34  }
35  id_=gen.rawId();
36 }
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
uint32_t id_
Definition: DetId.h:55

Member Function Documentation

void EcalScDetId::checkHashedIndexMap ( )
staticprivate

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

Definition at line 96 of file EcalScDetId.cc.

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

Referenced by hashedIndex(), and unhashIndex().

96  {
97  std::call_once(initializedFlag, []()
98  {
99  int hashedIndex = -1;
100  for(int iZ = -1; iZ <= +1; iZ+=2){
101  for(int iY = IY_MIN; iY <= IY_MAX; ++iY){
102  for(int iX = IX_MIN; iX <= IX_MAX; ++iX){
103  if(validDetId(iX,iY,iZ)){
104  xyz2HashedIndex[iX-IX_MIN][iY-IY_MIN][iZ>0?1:0] = ++hashedIndex;
105  assert((unsigned)hashedIndex < sizeof(hashedIndex2DetId)/sizeof(hashedIndex2DetId[0]));
107  }
108  }
109  }
110  }
111  });
112 }
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:64
assert(m_qm.get())
static EcalScDetId hashedIndex2DetId[kSizeForDenseIndexing]
Definition: EcalScDetId.h:202
static std::once_flag initializedFlag
Definition: EcalScDetId.cc:95
static const int IY_MIN
Definition: EcalScDetId.h:152
static const int IX_MIN
Definition: EcalScDetId.h:148
static const int IY_MAX
Definition: EcalScDetId.h:160
int hashedIndex() const
Definition: EcalScDetId.h:108
static const int IX_MAX
Definition: EcalScDetId.h:156
static short xyz2HashedIndex[IX_MAX][IY_MAX][nEndcaps]
Definition: EcalScDetId.h:198
uint32_t EcalScDetId::denseIndex ( ) const
inline

Same as hashed index.

Returns
the dense/hashed index

Definition at line 127 of file EcalScDetId.h.

References hashedIndex().

127 { return hashedIndex() ; }
int hashedIndex() const
Definition: EcalScDetId.h:108
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 108 of file EcalScDetId.h.

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

Referenced by checkHashedIndexMap(), denseIndex(), ecaldqm::SelectiveReadoutTask::runOnDigis(), and ecaldqm::SelectiveReadoutTask::runOnSrFlags().

108  {
110  if(!validDetId(ix(),iy(),zside())) return -1;
111  return xyz2HashedIndex[ix()-IX_MIN][iy()-IY_MIN][zside()>0?1:0];
112  }
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:64
static const int IY_MIN
Definition: EcalScDetId.h:152
static const int IX_MIN
Definition: EcalScDetId.h:148
int ix() const
Definition: EcalScDetId.h:71
int iy() const
Definition: EcalScDetId.h:77
static void checkHashedIndexMap()
Definition: EcalScDetId.cc:96
int zside() const
Definition: EcalScDetId.h:65
static short xyz2HashedIndex[IX_MAX][IY_MAX][nEndcaps]
Definition: EcalScDetId.h:198
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 46 of file EcalScDetId.cc.

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

46  {
47  const int xMiddle = IX_MAX/2; //y = 0 between xMiddle and xMiddle+1
48  const int yMiddle = IY_MAX/2; //x = 0 between yMiddle and yMiddle+1
49  if (iy()>yMiddle){// y>0
50  if(ix()>xMiddle) // A y
51  return 1; // |
52  else // Q2 | Q1
53  return 2; // |
54  } else{// y<0 // ----------o---------> x
55  if(ix()>xMiddle) // |
56  return 4; // Q3 | Q4
57  else // |
58  return 3;
59  }
60  //Should never be reached
61  return -1;
62 }
int ix() const
Definition: EcalScDetId.h:71
static const int IY_MAX
Definition: EcalScDetId.h:160
int iy() const
Definition: EcalScDetId.h:77
static const int IX_MAX
Definition: EcalScDetId.h:156
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 38 of file EcalScDetId.cc.

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

38  {
39  if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalEndcap )) {
40  throw cms::Exception("InvalidDetId");
41  }
42  id_=gen.rawId();
43  return *this;
44 }
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
uint32_t id_
Definition: DetId.h:55
EcalSubdetector EcalScDetId::subdet ( ) const
inline

Gets the subdetector

Returns
subdetectot ID, that is EcalEndcap

Definition at line 60 of file EcalScDetId.h.

References DetId::subdetId().

60 { 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:37
EcalSubdetector
static EcalScDetId EcalScDetId::unhashIndex ( int  hi)
inlinestatic
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 133 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 64 of file EcalScDetId.cc.

References funct::abs().

Referenced by checkHashedIndexMap(), EcalScDetId(), popcon::EcalDAQHandler::getNewObjects(), popcon::EcalDCSHandler::getNewObjects(), hashedIndex(), popcon::EcalDCSHandler::insertHVDataSetToOffline(), popcon::EcalDCSHandler::insertLVDataSetToOffline(), ecaldqm::binning::isValidIdBin(), EcalSelectiveReadout::printDccChMap(), EcalSelectiveReadout::printEndcap(), EcalTrivialConditionRetriever::produceEcalDAQTowerStatus(), EcalTrivialConditionRetriever::produceEcalDCSTowerStatus(), EcalTrivialConditionRetriever::produceEcalDQMTowerStatus(), and EcalSelectiveReadoutSuppressor::run().

64  {
65  static const char endcapMap[401] = {
66  " XXXXXX "
67  " XXXXXXXXXXXX "
68  " XXXXXXXXXXXXXX "
69  " XXXXXXXXXXXXXXXX "
70  " XXXXXXXXXXXXXXXXXX "
71  " XXXXXXXXXXXXXXXXXX " // Z
72  " XXXXXXXXXXXXXXXXXX " // x-----> X
73  "XXXXXXXXXXXXXXXXXXXX" // |
74  "XXXXXXXXX XXXXXXXXX" // |
75  "XXXXXXXX XXXXXXXX"//_ // |
76  "XXXXXXXX XXXXXXXX" // V Y
77  "XXXXXXXXX XXXXXXXXX"
78  "XXXXXXXXXXXXXXXXXXXX"
79  " XXXXXXXXXXXXXXXXXX "
80  " XXXXXXXXXXXXXXXXXX "
81  " XXXXXXXXXXXXXXXXXX "
82  " XXXXXXXXXXXXXXXX "
83  " XXXXXXXXXXXXXX "
84  " XXXXXXXXXXXX "
85  " XXXXXX "};
86 
87  return abs(iZ)==1 && endcapMap[iX-1+(iY-1)*20]!=' ';
88 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 140 of file EcalScDetId.h.

References validDenseIndex().

Referenced by EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::plot(), and EcalDAQTowerStatusXMLTranslator::plot().

140 { return validDenseIndex(hi) ; }
static bool validDenseIndex(uint32_t din)
Definition: EcalScDetId.h:133
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 202 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 168 of file EcalScDetId.h.

const int EcalScDetId::IHASHED_MIN = 0
static

Lower bound for hashed/dense index

Definition at line 164 of file EcalScDetId.h.

const int EcalScDetId::IX_MAX =20
static

Upper bound of EE crystal y-index

Definition at line 156 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 148 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 160 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 152 of file EcalScDetId.h.

Referenced by checkHashedIndexMap(), and hashedIndex().

const int EcalScDetId::nEndcaps = 2
staticprivate

Definition at line 194 of file EcalScDetId.h.

const int EcalScDetId::SC_PER_EE_CNT = 312
static

Number of supercrystals per endcap

Definition at line 144 of file EcalScDetId.h.

short EcalScDetId::xyz2HashedIndex
staticprivate

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

Definition at line 198 of file EcalScDetId.h.

Referenced by checkHashedIndexMap(), and hashedIndex().