test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
26 
29  EcalScDetId();
30 
35  EcalScDetId(uint32_t rawid);
36 
45  EcalScDetId(int ix, int iy, int iz);
46 
50  EcalScDetId(const DetId& id);
51 
55  EcalScDetId& operator=(const DetId& id);
56 
61 
65  int zside() const { return (id_&0x4000)?(1):(-1); }
66 
71  int ix() const { return (id_>>7)&0x7F; }
72 
77  int iy() const { return id_&0x7F; }
78 
101  int iquadrant() const ;
102 
103 
108  int hashedIndex() const{
110  if(!validDetId(ix(),iy(),zside())) return -1;
111  return xyz2HashedIndex[ix()-IX_MIN][iy()-IY_MIN][zside()>0?1:0];
112  }
113 
118  static EcalScDetId unhashIndex(int hi){
120  if(hi < 0 || hi >= kSizeForDenseIndexing) 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 
135 
140  static bool validHashIndex(int hi) { return validDenseIndex(hi) ; }
141 
144  static const int SC_PER_EE_CNT = 312;
145 
148  static const int IX_MIN=1;
149 
152  static const int IY_MIN=1;
153 
156  static const int IX_MAX=20;
157 
160  static const int IY_MAX=20;
161 
164  static const int IHASHED_MIN = 0;
165 
168  static const int IHASHED_MAX = SC_PER_EE_CNT*2 - 1;
169 
177  static bool validDetId(int ix, int iy, int iz) ;
178 
179 private:
182  static void checkHashedIndexMap();
183 
184 
185  //fields
186 public:
187  enum {
191  };
192 
193 private:
194  static const int nEndcaps = 2;
195 
199 
203 
204  /*The two arrays are thread safe since they are filled safely using std::call_once and
205  then only read and never modified.
206  */
207 };
208 
209 
210 std::ostream& operator<<(std::ostream& s,const EcalScDetId& id);
211 
212 
213 #endif //EcalDetId_EcalScDetId_h not defined
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:64
EcalSubdetector subdet() const
Definition: EcalScDetId.h:60
EcalScDetId & operator=(const DetId &id)
Definition: EcalScDetId.cc:38
static const int SC_PER_EE_CNT
Definition: EcalScDetId.h:144
static const int IHASHED_MAX
Definition: EcalScDetId.h:168
static EcalScDetId unhashIndex(int hi)
Definition: EcalScDetId.h:118
static EcalScDetId hashedIndex2DetId[kSizeForDenseIndexing]
Definition: EcalScDetId.h:202
static const int IY_MIN
Definition: EcalScDetId.h:152
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
uint32_t denseIndex() const
Definition: EcalScDetId.h:127
static const int IX_MIN
Definition: EcalScDetId.h:148
int ix() const
Definition: EcalScDetId.h:71
#define CMS_THREAD_SAFE
static const int IY_MAX
Definition: EcalScDetId.h:160
static const int nEndcaps
Definition: EcalScDetId.h:194
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
int hashedIndex() const
Definition: EcalScDetId.h:108
int iy() const
Definition: EcalScDetId.h:77
Definition: DetId.h:18
static void checkHashedIndexMap()
Definition: EcalScDetId.cc:96
uint32_t id_
Definition: DetId.h:55
static const int IX_MAX
Definition: EcalScDetId.h:156
int zside() const
Definition: EcalScDetId.h:65
static bool validHashIndex(int hi)
Definition: EcalScDetId.h:140
static bool validDenseIndex(uint32_t din)
Definition: EcalScDetId.h:133
static const int IHASHED_MIN
Definition: EcalScDetId.h:164
EcalSubdetector
int iquadrant() const
Definition: EcalScDetId.cc:46
static short xyz2HashedIndex[IX_MAX][IY_MAX][nEndcaps]
Definition: EcalScDetId.h:198