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 //$Id: EcalScDetId.h,v 1.7 2010/02/09 17:31:15 pgras Exp $
3 //
4 // \author Philippe Gras (CEA/Saclay). Code adapted from EEDetId.
5 //
6 #ifndef EcalDetId_EcalScDetId_h
7 #define EcalDetId_EcalScDetId_h
8 
9 #include <ostream>
12 
13 
25 class EcalScDetId : public DetId {
26  public:
27 
30  EcalScDetId();
31 
36  EcalScDetId(uint32_t rawid);
37 
46  EcalScDetId(int ix, int iy, int iz);
47 
51  EcalScDetId(const DetId& id);
52 
56  EcalScDetId& operator=(const DetId& id);
57 
62 
66  int zside() const { return (id_&0x4000)?(1):(-1); }
67 
72  int ix() const { return (id_>>7)&0x7F; }
73 
78  int iy() const { return id_&0x7F; }
79 
102  int iquadrant() const ;
103 
104 
109  int hashedIndex() const{
111  if(!validDetId(ix(),iy(),zside())) return -1;
112  return xyz2HashedIndex[ix()-IX_MIN][iy()-IY_MIN][zside()>0?1:0];
113  }
114 
119  static EcalScDetId unhashIndex(int hi){
121  if(hi < 0 || hi >= kSizeForDenseIndexing) return EcalScDetId();
122  return hashedIndex2DetId[hi];
123  }
124 
128  uint32_t denseIndex() const { return hashedIndex() ; }
129 
134  static bool validDenseIndex(uint32_t din) { return din < kSizeForDenseIndexing; }
135 
136 
141  static bool validHashIndex(int hi) { return validDenseIndex(hi) ; }
142 
145  static const int SC_PER_EE_CNT = 312;
146 
149  static const int IX_MIN=1;
150 
153  static const int IY_MIN=1;
154 
157  static const int IX_MAX=20;
158 
161  static const int IY_MAX=20;
162 
165  static const int IHASHED_MIN = 0;
166 
169  static const int IHASHED_MAX = SC_PER_EE_CNT*2 - 1;
170 
178  static bool validDetId(int ix, int iy, int iz) ;
179 
180 private:
183  static void checkHashedIndexMap();
184 
185 
186  //fields
187 public:
188  enum {
192  };
193 
194 private:
195  static const int nEndcaps = 2;
196 
200 
204 };
205 
206 
207 std::ostream& operator<<(std::ostream& s,const EcalScDetId& id);
208 
209 
210 #endif //EcalDetId_EcalScDetId_h not defined
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:63
EcalSubdetector subdet() const
Definition: EcalScDetId.h:61
EcalScDetId & operator=(const DetId &id)
Definition: EcalScDetId.cc:37
static const int SC_PER_EE_CNT
Definition: EcalScDetId.h:145
static const int IHASHED_MAX
Definition: EcalScDetId.h:169
static EcalScDetId unhashIndex(int hi)
Definition: EcalScDetId.h:119
static EcalScDetId hashedIndex2DetId[kSizeForDenseIndexing]
Definition: EcalScDetId.h:203
static const int IY_MIN
Definition: EcalScDetId.h:153
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
uint32_t denseIndex() const
Definition: EcalScDetId.h:128
static const int IX_MIN
Definition: EcalScDetId.h:149
int ix() const
Definition: EcalScDetId.h:72
static const int IY_MAX
Definition: EcalScDetId.h:161
static const int nEndcaps
Definition: EcalScDetId.h:195
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
int hashedIndex() const
Definition: EcalScDetId.h:109
int iy() const
Definition: EcalScDetId.h:78
Definition: DetId.h:20
static void checkHashedIndexMap()
Definition: EcalScDetId.cc:93
uint32_t id_
Definition: DetId.h:57
static const int IX_MAX
Definition: EcalScDetId.h:157
int zside() const
Definition: EcalScDetId.h:66
static bool validHashIndex(int hi)
Definition: EcalScDetId.h:141
static bool validDenseIndex(uint32_t din)
Definition: EcalScDetId.h:134
static const int IHASHED_MIN
Definition: EcalScDetId.h:165
EcalSubdetector
int iquadrant() const
Definition: EcalScDetId.cc:45
static short xyz2HashedIndex[IX_MAX][IY_MAX][nEndcaps]
Definition: EcalScDetId.h:199