CMS 3D CMS Logo

EcalScDetId.h
Go to the documentation of this file.
1 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 8; -*-
2 //
3 // \author Philippe Gras (CEA/Saclay). Code adapted from EEDetId.
4 //
5 #ifndef EcalDetId_EcalScDetId_h
6 #define EcalDetId_EcalScDetId_h
7 
8 #include <iosfwd>
12 
24 class EcalScDetId : public DetId {
25 public:
28  EcalScDetId();
29 
34  EcalScDetId(uint32_t rawid);
35 
44  EcalScDetId(int ix, int iy, int iz);
45 
49  EcalScDetId(const DetId& id);
50 
54  EcalScDetId& operator=(const DetId& id);
55 
60 
64  int zside() const { return (id_ & 0x4000) ? (1) : (-1); }
65 
70  int ix() const { return (id_ >> 7) & 0x7F; }
71 
76  int iy() const { return id_ & 0x7F; }
77 
100  int iquadrant() const;
101 
106  int hashedIndex() const {
108  if (!validDetId(ix(), iy(), zside()))
109  return -1;
110  return xyz2HashedIndex[ix() - IX_MIN][iy() - IY_MIN][zside() > 0 ? 1 : 0];
111  }
112 
117  static EcalScDetId unhashIndex(int hi) {
119  if (hi < 0 || hi >= kSizeForDenseIndexing)
120  return EcalScDetId();
121  return hashedIndex2DetId[hi];
122  }
123 
127  uint32_t denseIndex() const { return hashedIndex(); }
128 
133  static bool validDenseIndex(uint32_t din) { return din < kSizeForDenseIndexing; }
134 
139  static bool validHashIndex(int hi) { return validDenseIndex(hi); }
140 
143  static const int SC_PER_EE_CNT = 312;
144 
147  static const int IX_MIN = 1;
148 
151  static const int IY_MIN = 1;
152 
155  static const int IX_MAX = 20;
156 
159  static const int IY_MAX = 20;
160 
163  static const int IHASHED_MIN = 0;
164 
167  static const int IHASHED_MAX = SC_PER_EE_CNT * 2 - 1;
168 
176  static bool validDetId(int ix, int iy, int iz);
177 
178 private:
181  static void checkHashedIndexMap();
182 
183  //fields
184 public:
185  enum {
189  };
190 
191 private:
192  static const int nEndcaps = 2;
193 
197 
201 
202  /*The two arrays are thread safe since they are filled safely using std::call_once and
203  then only read and never modified.
204  */
205 };
206 
207 std::ostream& operator<<(std::ostream& s, const EcalScDetId& id);
208 
209 #endif //EcalDetId_EcalScDetId_h not defined
EcalScDetId::EcalScDetId
EcalScDetId()
Definition: EcalScDetId.cc:12
EcalScDetId::xyz2HashedIndex
static short xyz2HashedIndex[IX_MAX][IY_MAX][nEndcaps]
Definition: EcalScDetId.h:196
EcalScDetId::denseIndex
uint32_t denseIndex() const
Definition: EcalScDetId.h:127
EcalScDetId::operator=
EcalScDetId & operator=(const DetId &id)
Definition: EcalScDetId.cc:33
EcalScDetId::zside
int zside() const
Definition: EcalScDetId.h:64
EcalScDetId::IHASHED_MAX
static const int IHASHED_MAX
Definition: EcalScDetId.h:167
EcalScDetId::validDetId
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:59
EcalScDetId::unhashIndex
static EcalScDetId unhashIndex(int hi)
Definition: EcalScDetId.h:117
EcalScDetId::SC_PER_EE_CNT
static const int SC_PER_EE_CNT
Definition: EcalScDetId.h:143
EcalSubdetector
EcalSubdetector
Definition: EcalSubdetector.h:10
EcalScDetId::subdet
EcalSubdetector subdet() const
Definition: EcalScDetId.h:59
EcalScDetId::hashedIndex2DetId
static EcalScDetId hashedIndex2DetId[kSizeForDenseIndexing]
Definition: EcalScDetId.h:200
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
EcalScDetId::nEndcaps
static const int nEndcaps
Definition: EcalScDetId.h:192
EcalScDetId
Definition: EcalScDetId.h:24
EcalScDetId::IY_MIN
static const int IY_MIN
Definition: EcalScDetId.h:151
CMS_THREAD_SAFE
#define CMS_THREAD_SAFE
Definition: thread_safety_macros.h:4
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EcalSubdetector.h
EcalScDetId::hashedIndex
int hashedIndex() const
Definition: EcalScDetId.h:106
EcalScDetId::IX_MIN
static const int IX_MIN
Definition: EcalScDetId.h:147
cropTnPTrees.din
din
Definition: cropTnPTrees.py:30
DetId::id_
uint32_t id_
Definition: DetId.h:69
EcalScDetId::IX_MAX
static const int IX_MAX
Definition: EcalScDetId.h:155
thread_safety_macros.h
EcalScDetId::validHashIndex
static bool validHashIndex(int hi)
Definition: EcalScDetId.h:139
EcalScDetId::iy
int iy() const
Definition: EcalScDetId.h:76
EcalScDetId::checkHashedIndexMap
static void checkHashedIndexMap()
Definition: EcalScDetId.cc:91
hi
Definition: EPCuts.h:4
EcalScDetId::IY_MAX
static const int IY_MAX
Definition: EcalScDetId.h:159
EcalScDetId::validDenseIndex
static bool validDenseIndex(uint32_t din)
Definition: EcalScDetId.h:133
DetId.h
EcalScDetId::IHASHED_MIN
static const int IHASHED_MIN
Definition: EcalScDetId.h:163
operator<<
std::ostream & operator<<(std::ostream &s, const EcalScDetId &id)
Definition: EcalScDetId.cc:85
EcalScDetId::iquadrant
int iquadrant() const
Definition: EcalScDetId.cc:41
EcalScDetId::ix
int ix() const
Definition: EcalScDetId.h:70
EcalScDetId::kSizeForDenseIndexing
Definition: EcalScDetId.h:188