CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EEDetId.h
Go to the documentation of this file.
1 #ifndef ECALDETID_EEDETID_H
2 #define ECALDETID_EEDETID_H
3 
4 #include <ostream>
8 
9 
16 class EEDetId : public DetId {
17  public:
18  enum {
22  };
23 
26  EEDetId() {}
27 
31  EEDetId(uint32_t rawid) : DetId(rawid) {}
32 
45  EEDetId(int i, int j, int iz, int mode = XYMODE);
46 
50  EEDetId(const DetId& id);
51 
55  EEDetId& operator=(const DetId& id);
56 
60  static EcalSubdetector subdet() { return EcalEndcap;}
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 
83  EcalScDetId sc() const {
84  const int scEdge = 5;
85  return EcalScDetId(1+(ix()-1)/scEdge, 1+(iy()-1)/scEdge, zside());
86  }
87 
120  int isc() const ;
121 
145  int ic() const;
146 
163  int iquadrant() const ;
164 
168  bool positiveZ() const { return id_&0x4000;}
169 
170  int iPhiOuterRing() const ; // 1-360 else==0 if not on outer ring!
171 
172  static EEDetId idOuterRing( int iPhi , int zEnd ) ;
173 
177  int hashedIndex() const
178  {
179  const uint32_t jx ( ix() ) ;
180  const uint32_t jd ( 2*( iy() - 1 ) + ( jx - 1 )/50 ) ;
181  return ( ( zside()<0 ? 0 : kEEhalf ) + kdi[jd] + jx - kxf[jd] ) ;
182  }
183 
187  uint32_t denseIndex() const { return hashedIndex() ; }
188 
191  EEDetId offsetBy( int nrStepsX, int nrStepsY ) const;
192 
195  EEDetId switchZSide() const;
196 
200  static DetId offsetBy( const DetId startId, int nrStepsX, int nrStepsY );
201  static DetId switchZSide( const DetId startId );
202 
208  static bool validDenseIndex( uint32_t din ) { return validHashIndex( din ) ; }
209 
215  static EEDetId detIdFromDenseIndex( uint32_t din ) { return unhashIndex( din ) ; }
216 
217  static bool isNextToBoundary( EEDetId id ) ;
218 
219  static bool isNextToDBoundary( EEDetId id ) ;
220 
221  static bool isNextToRingBoundary( EEDetId id ) ;
222 
227  static EEDetId unhashIndex( int hi ) ;
228 
234  static bool validHashIndex( int i ) { return ( i < kSizeForDenseIndexing ) ; }
235 
243  static bool validDetId(int crystal_ix, int crystal_iy, int iz);
244 
250  static int distanceX(const EEDetId& a,const EEDetId& b);
251 
257  static int distanceY(const EEDetId& a,const EEDetId& b);
258 
259 
266  static int isc( int iscCol, // output is 1-316
267  int iscRow ) ; //
268 
271  static const int IX_MIN =1;
272 
275  static const int IY_MIN =1;
276 
279  static const int IX_MAX =100;
280 
283  static const int IY_MAX =100;
284 
287  static const int ISC_MIN=1;
288 
291  static const int ICR_MIN=1;
292 
297  static const int ISC_MAX=316;
298 
301  static const int ICR_MAX=25;
302 
303  enum {
306  kEEhalf = 7324 ,
311  };
312 
316  static const int XYMODE = 0;
317  static const int SCCRYSTALMODE = 1;
320  private:
321 
322  bool isOuterRing() const ;
323 
324  static bool isOuterRingXY( int ax, int ay ) ;
325 
326  //Functions from B. Kennedy to retrieve ix and iy from SC and Crystal number
327 
328  static const int nCols = 10;
329  static const int nCrys = 5; /* Number of crystals per row in SC */
330  static const int QuadColLimits[nCols+1];
331  static const int iYoffset[nCols+1];
332 
333  static const unsigned short kxf[2*IY_MAX] ;
334  static const unsigned short kdi[2*IY_MAX] ;
335 
336  int ix( int iSC, int iCrys ) const;
337  int iy( int iSC, int iCrys ) const;
338  int ixQuadrantOne() const;
339  int iyQuadrantOne() const;
340 };
341 
342 
343 std::ostream& operator<<(std::ostream& s,const EEDetId& id);
344 
345 #endif
static EcalSubdetector subdet()
Definition: EEDetId.h:60
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:215
static bool isNextToBoundary(EEDetId id)
Definition: EEDetId.cc:377
int i
Definition: DBlmapReader.cc:9
static const int ISC_MAX
Definition: EEDetId.h:297
int ix() const
Definition: EEDetId.h:71
int ic() const
Definition: EEDetId.cc:340
static int distanceX(const EEDetId &a, const EEDetId &b)
Definition: EEDetId.cc:602
bool positiveZ() const
Definition: EEDetId.h:168
int isc() const
Definition: EEDetId.cc:301
static const int XYMODE
Definition: EEDetId.h:316
EEDetId(uint32_t rawid)
Definition: EEDetId.h:31
int iquadrant() const
Definition: EEDetId.cc:280
EEDetId offsetBy(int nrStepsX, int nrStepsY) const
Definition: EEDetId.cc:490
int ixQuadrantOne() const
Definition: EEDetId.cc:257
static const int ISC_MIN
Definition: EEDetId.h:287
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:115
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const int SCCRYSTALMODE
Definition: EEDetId.h:317
static const int IX_MIN
Definition: EEDetId.h:271
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.cc:562
static const int IY_MIN
Definition: EEDetId.h:275
static bool validHashIndex(int i)
Definition: EEDetId.h:234
static const int iYoffset[nCols+1]
Definition: EEDetId.h:331
bool isOuterRing() const
Definition: EEDetId.cc:536
static bool isOuterRingXY(int ax, int ay)
Definition: EEDetId.cc:547
static const int nCols
Definition: EEDetId.h:328
int zside() const
Definition: EEDetId.h:65
static const int ICR_MIN
Definition: EEDetId.h:291
int iPhiOuterRing() const
Definition: EEDetId.cc:404
int j
Definition: DBlmapReader.cc:9
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:391
int iy() const
Definition: EEDetId.h:77
static int distanceY(const EEDetId &a, const EEDetId &b)
Definition: EEDetId.cc:607
static bool isNextToDBoundary(EEDetId id)
Definition: EEDetId.cc:383
static const int IX_MAX
Definition: EEDetId.h:279
EEDetId switchZSide() const
Definition: EEDetId.cc:503
Definition: DetId.h:20
int hashedIndex() const
Definition: EEDetId.h:177
static const int nCrys
Definition: EEDetId.h:329
uint32_t id_
Definition: DetId.h:57
EcalScDetId sc() const
Definition: EEDetId.h:83
double b
Definition: hdecay.h:120
uint32_t denseIndex() const
Definition: EEDetId.h:187
static bool validDenseIndex(uint32_t din)
Definition: EEDetId.h:208
double a
Definition: hdecay.h:121
static const int QuadColLimits[nCols+1]
Definition: EEDetId.h:330
static const unsigned short kxf[2 *IY_MAX]
Definition: EEDetId.h:333
static EEDetId idOuterRing(int iPhi, int zEnd)
Definition: EEDetId.cc:451
int iyQuadrantOne() const
Definition: EEDetId.cc:268
static const int IY_MAX
Definition: EEDetId.h:283
static const unsigned short kdi[2 *IY_MAX]
Definition: EEDetId.h:334
EcalSubdetector
EEDetId & operator=(const DetId &id)
Definition: EEDetId.cc:104
static const int ICR_MAX
Definition: EEDetId.h:301
EEDetId()
Definition: EEDetId.h:26