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 {
188  kSizeForDenseIndexing = SC_PER_EE_CNT * 2
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
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:59
EcalSubdetector subdet() const
Definition: EcalScDetId.h:59
EcalScDetId & operator=(const DetId &id)
Definition: EcalScDetId.cc:33
static const int SC_PER_EE_CNT
Definition: EcalScDetId.h:143
static const int IHASHED_MAX
Definition: EcalScDetId.h:167
static EcalScDetId unhashIndex(int hi)
Definition: EcalScDetId.h:117
static EcalScDetId hashedIndex2DetId[kSizeForDenseIndexing]
Definition: EcalScDetId.h:200
static const int IY_MIN
Definition: EcalScDetId.h:151
uint32_t denseIndex() const
Definition: EcalScDetId.h:127
static const int IX_MIN
Definition: EcalScDetId.h:147
int ix() const
Definition: EcalScDetId.h:70
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
#define CMS_THREAD_SAFE
static const int IY_MAX
Definition: EcalScDetId.h:159
static const int nEndcaps
Definition: EcalScDetId.h:192
int hashedIndex() const
Definition: EcalScDetId.h:106
int iy() const
Definition: EcalScDetId.h:76
std::ostream & operator<<(std::ostream &s, const EcalScDetId &id)
Definition: EcalScDetId.cc:85
Definition: DetId.h:18
static void checkHashedIndexMap()
Definition: EcalScDetId.cc:91
uint32_t id_
Definition: DetId.h:62
static const int IX_MAX
Definition: EcalScDetId.h:155
int zside() const
Definition: EcalScDetId.h:64
static bool validHashIndex(int hi)
Definition: EcalScDetId.h:139
static bool validDenseIndex(uint32_t din)
Definition: EcalScDetId.h:133
static const int IHASHED_MIN
Definition: EcalScDetId.h:163
EcalSubdetector
int iquadrant() const
Definition: EcalScDetId.cc:41
static short xyz2HashedIndex[IX_MAX][IY_MAX][nEndcaps]
Definition: EcalScDetId.h:196