6 const int EEDetId::QuadColLimits[
EEDetId::nCols+1] = { 0, 8,17,27,36,45,54,62,70,76,79 };
8 const int EEDetId::iYoffset[
EEDetId::nCols+1] = { 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
11 41, 51, 41, 51, 41, 51, 36, 51, 36, 51,
12 26, 51, 26, 51, 26, 51, 21, 51, 21, 51,
13 21, 51, 21, 51, 21, 51, 16, 51, 16, 51,
14 14, 51, 14, 51, 14, 51, 14, 51, 14, 51,
15 9, 51, 9, 51, 9, 51, 9, 51, 9, 51,
16 6, 51, 6, 51, 6, 51, 6, 51, 6, 51,
17 6, 51, 6, 51, 6, 51, 6, 51, 6, 51,
18 4, 51, 4, 51, 4, 51, 4, 51, 4, 56,
19 1, 58, 1, 59, 1, 60, 1, 61, 1, 61,
20 1, 62, 1, 62, 1, 62, 1, 62, 1, 62,
21 1, 62, 1, 62, 1, 62, 1, 62, 1, 62,
22 1, 61, 1, 61, 1, 60, 1, 59, 1, 58,
23 4, 56, 4, 51, 4, 51, 4, 51, 4, 51,
24 6, 51, 6, 51, 6, 51, 6, 51, 6, 51,
25 6, 51, 6, 51, 6, 51, 6, 51, 6, 51,
26 9, 51, 9, 51, 9, 51, 9, 51, 9, 51,
27 14, 51, 14, 51, 14, 51, 14, 51, 14, 51,
28 16, 51, 16, 51, 21, 51, 21, 51, 21, 51,
29 21, 51, 21, 51, 26, 51, 26, 51, 26, 51,
30 36, 51, 36, 51, 41, 51, 41, 51, 41, 51
34 0, 10, 20, 30, 40, 50, 60, 75, 90, 105,
35 120, 145, 170, 195, 220, 245, 270, 300, 330, 360,
36 390, 420, 450, 480, 510, 540, 570, 605, 640, 675,
37 710, 747, 784, 821, 858, 895, 932, 969, 1006, 1043,
38 1080, 1122, 1164, 1206, 1248, 1290, 1332, 1374, 1416, 1458,
39 1500, 1545, 1590, 1635, 1680, 1725, 1770, 1815, 1860, 1905,
40 1950, 1995, 2040, 2085, 2130, 2175, 2220, 2265, 2310, 2355,
41 2400, 2447, 2494, 2541, 2588, 2635, 2682, 2729, 2776, 2818,
42 2860, 2903, 2946, 2988, 3030, 3071, 3112, 3152, 3192, 3232,
43 3272, 3311, 3350, 3389, 3428, 3467, 3506, 3545, 3584, 3623,
44 3662, 3701, 3740, 3779, 3818, 3857, 3896, 3935, 3974, 4013,
45 4052, 4092, 4132, 4172, 4212, 4253, 4294, 4336, 4378, 4421,
46 4464, 4506, 4548, 4595, 4642, 4689, 4736, 4783, 4830, 4877,
47 4924, 4969, 5014, 5059, 5104, 5149, 5194, 5239, 5284, 5329,
48 5374, 5419, 5464, 5509, 5554, 5599, 5644, 5689, 5734, 5779,
49 5824, 5866, 5908, 5950, 5992, 6034, 6076, 6118, 6160, 6202,
50 6244, 6281, 6318, 6355, 6392, 6429, 6466, 6503, 6540, 6577,
51 6614, 6649, 6684, 6719, 6754, 6784, 6814, 6844, 6874, 6904,
52 6934, 6964, 6994, 7024, 7054, 7079, 7104, 7129, 7154, 7179,
53 7204, 7219, 7234, 7249, 7264, 7274, 7284, 7294, 7304, 7314
71 crystal_ix=iz*
ix(SC,crystal);
75 crystal_iy=
iy(SC,crystal);
83 throw cms::Exception(
"InvalidDetId") <<
"EEDetId: Cannot create object. Unknown mode for (int, int, int) constructor.";
88 throw cms::Exception(
"InvalidDetId") <<
"EEDetId: Cannot create object. Indexes out of bounds \n"
89 <<
"x = " << crystal_ix <<
" y = " << crystal_iy <<
" z = " << iz;
92 id_|=(crystal_iy&0x7f)|((crystal_ix&0x7f)<<7)|((iz>0)?(0x4000):(0));
103 const int iz ( hi<
kEEhalf ? -1 : 1 ) ;
104 const uint32_t di ( hi%
kEEhalf ) ;
106 const int iy ( 1 + ii/2 ) ;
107 const int ix (
kxf[ii] + di -
kdi[ii] ) ;
133 if (iSC > 4*nSCinQuadrant || iSC < 1)
140 if (iSC > 3*nSCinQuadrant)
142 iSCmap = iSC - 3*nSCinQuadrant;
146 else if (iSC > 2*nSCinQuadrant)
148 iSCmap = iSC - 2*nSCinQuadrant;
152 else if (iSC > nSCinQuadrant)
154 iSCmap = iSC - nSCinQuadrant;
171 if (iq == 1 || iq == 3)
172 ixCrys = iqx*(5*(iCol-1) + (
int)(iCrys+4)/5);
173 else if (iq == 2 || iq == 4)
174 ixCrys = iqx*(5*(iCol-1) + (iCrys-1)%5 + 1);
195 if (iSC > 4*nSCinQuadrant || iSC < 1)
202 if (iSC > 3*nSCinQuadrant)
204 iSCmap = iSC - 3*nSCinQuadrant;
208 else if (iSC > 2*nSCinQuadrant)
210 iSCmap = iSC - 2*nSCinQuadrant;
214 else if (iSC > nSCinQuadrant)
216 iSCmap = iSC - nSCinQuadrant;
234 if (iq == 1 || iq == 3)
235 iyCrys = iqy*(5*(iSCy-1) + (iCrys-1)%5 + 1);
236 else if (iq == 2 || iq == 4)
237 iyCrys = iqy*(5*(iSCy-1) + (
int)(iCrys+4)/5 );
244 if ( iQuadrant == 1 || iQuadrant == 4)
246 else if ( iQuadrant == 2 || iQuadrant == 3)
255 if ( iQuadrant == 1 || iQuadrant == 2)
257 else if ( iQuadrant == 3 || iQuadrant == 4)
299 const int iquad ( ( 10<jx && 10<jy ? 1 :
300 ( 11>jx && 10<jy ? 2 :
301 ( 11>jx && 11>jy ? 3 : 4 ) ) ) ) ;
303 const int iCol = ( 1 == iquad || 4 == iquad ? jx - 10 : 11 - jx ) ;
304 const int iRow = ( 1 == iquad || 2 == iquad ? jy - 10 : 11 - jy ) ;
306 static const int nSCinQuadrant =
ISC_MAX/4;
310 const int qOff ( nSCinQuadrant*( iquad - 1 ) ) ;
314 return ( yOff >= iRow ? -1 :
342 if (iQuadrant == 1 || iQuadrant == 3)
348 else if (iQuadrant == 2 || iQuadrant == 4)
354 int icrys = 5*icrCol + icrRow + 1;
370 return id.ix() == 50 ||
id.ix() == 51 ;
377 for (
int i = -1;
i <= 1; ++
i) {
378 for (
int j = -1;
j <= 1; ++
j) {
390 int returnValue ( 0 ) ;
395 returnValue = ax + 50 - ay ;
396 if( ay <= 47 ) --returnValue ;
397 if( ay <= 45 ) --returnValue ;
398 if( ay <= 42 ) --returnValue ;
399 if( ay <= 37 ) --returnValue ;
400 if( ay <= 35 ) --returnValue ;
401 if( ay <= 30 ) --returnValue ;
402 if( ay <= 25 ) --returnValue ;
403 if( ay <= 15 ) --returnValue ;
404 if( ay <= 10 ) --returnValue ;
408 returnValue = 91 - returnValue ;
420 returnValue = 271 - returnValue ;
428 returnValue = 1 + ( 360 + returnValue - 10 -1 )%360 ;
438 while( iPhi < 1 ) iPhi+=360 ;
439 while( iPhi > 360 ) iPhi-=360 ;
441 const int index1 ( iPhi - 1 ) ;
442 const int quad ( index1/90 ) ;
443 int indexq ( index1 - quad*90 + 1 ) ;
444 if( 0==quad || 2==quad ) indexq = 91 - indexq ;
445 const int indexh ( indexq > 45 ? 91 - indexq : indexq ) ;
446 const int axh ( indexh<=10 ? indexh :
448 ( indexh<=17 ? indexh - 2 :
450 ( indexh<=28 ? indexh - 3 :
452 ( indexh<=35 ? indexh - 5 :
454 ( indexh<=44 ? indexh - 9 : 35 ))))))))) ;
455 const int ayh ( indexh<=10 ? 50 :
456 ( indexh<=12 ? 60 - indexh :
458 ( indexh<=18 ? 64 - indexh :
460 ( indexh<=30 ? 73 - indexh :
462 ( indexh<=39 ? 77 - indexh :
463 ( indexh<=44 ? 37 : 36 ))))))))) ;
464 const int bxh ( indexq>45 ? ayh : axh ) ;
465 const int byh ( indexq>45 ? axh : ayh ) ;
466 const int cx ( ( quad==0 || quad==3 ? bxh : -bxh+1 ) +
IX_MAX/2 ) ;
467 const int cy ( ( quad==0 || quad==1 ? byh : -byh+1 ) +
IY_MAX/2 ) ;
469 return EEDetId( cx, cy, ( zEnd > 0 ? 1 : -1 ) ) ;
476 int newX =
ix() + nrStepsX;
477 int newY =
iy() + nrStepsY;
489 int newZSide = -1 *
zside();
522 const int kx (
ix() ) ;
523 const int ky (
iy() ) ;
533 return ( ( ax<=10 && ay==50 ) ||
534 ( ax==10 && ay>=48 ) ||
535 ( ax<=15 && ax>=11 && ay==47 ) ||
536 ( ax==15 && ay==46 ) ||
537 ( ax<=25 && ax>=16 && ay==45 ) ||
538 ( ax==25 && ay<=44 && ay>=43 ) ||
539 ( ax<=30 && ax>=26 && ay==42 ) ||
540 ( ax==30 && ay<=41 && ay>=38 ) ||
541 ( ax<=35 && ax>=31 && ay==37 ) ||
542 ( ax==35 && ay==36 ) ) ;
550 (crystal_ix >= 1 && crystal_ix <= 3 && (crystal_iy <= 40 || crystal_iy > 60) ) ||
551 (crystal_ix >= 4 && crystal_ix <= 5 && (crystal_iy <= 35 || crystal_iy > 65) ) ||
552 (crystal_ix >= 6 && crystal_ix <= 8 && (crystal_iy <= 25 || crystal_iy > 75) ) ||
553 (crystal_ix >= 9 && crystal_ix <= 13 && (crystal_iy <= 20 || crystal_iy > 80) ) ||
554 (crystal_ix >= 14 && crystal_ix <= 15 && (crystal_iy <= 15 || crystal_iy > 85) ) ||
555 (crystal_ix >= 16 && crystal_ix <= 20 && (crystal_iy <= 13 || crystal_iy > 87) ) ||
556 (crystal_ix >= 21 && crystal_ix <= 25 && (crystal_iy <= 8 || crystal_iy > 92) ) ||
557 (crystal_ix >= 26 && crystal_ix <= 35 && (crystal_iy <= 5 || crystal_iy > 95) ) ||
558 (crystal_ix >= 36 && crystal_ix <= 39 && (crystal_iy <= 3 || crystal_iy > 97) ) ||
559 (crystal_ix >= 98 && crystal_ix <= 100 && (crystal_iy <= 40 || crystal_iy > 60) ) ||
560 (crystal_ix >= 96 && crystal_ix <= 97 && (crystal_iy <= 35 || crystal_iy > 65) ) ||
561 (crystal_ix >= 93 && crystal_ix <= 95 && (crystal_iy <= 25 || crystal_iy > 75) ) ||
562 (crystal_ix >= 88 && crystal_ix <= 92 && (crystal_iy <= 20 || crystal_iy > 80) ) ||
563 (crystal_ix >= 86 && crystal_ix <= 87 && (crystal_iy <= 15 || crystal_iy > 85) ) ||
564 (crystal_ix >= 81 && crystal_ix <= 85 && (crystal_iy <= 13 || crystal_iy > 87) ) ||
565 (crystal_ix >= 76 && crystal_ix <= 80 && (crystal_iy <= 8 || crystal_iy > 92) ) ||
566 (crystal_ix >= 66 && crystal_ix <= 75 && (crystal_iy <= 5 || crystal_iy > 95) ) ||
567 (crystal_ix >= 62 && crystal_ix <= 65 && (crystal_iy <= 3 || crystal_iy > 97) ) ||
568 ( (crystal_ix == 40 || crystal_ix == 61) && ( (crystal_iy >= 46 && crystal_iy <= 55 ) || crystal_iy <= 3 || crystal_iy > 97 )) ||
569 ( (crystal_ix == 41 || crystal_ix == 60) && crystal_iy >= 44 && crystal_iy <= 57 ) ||
570 ( (crystal_ix == 42 || crystal_ix == 59) && crystal_iy >= 43 && crystal_iy <= 58 ) ||
571 ( (crystal_ix == 43 || crystal_ix == 58) && crystal_iy >= 42 && crystal_iy <= 59 ) ||
572 ( (crystal_ix == 44 || crystal_ix == 45 || crystal_ix == 57 || crystal_ix == 56) && crystal_iy >= 41 && crystal_iy <= 60 ) ||
573 ( crystal_ix >= 46 && crystal_ix <= 55 && crystal_iy >= 40 && crystal_iy <= 61 )
590 return s <<
"(EE iz " << ((
id.zside()>0)?(
"+ "):(
"- "))
591 <<
" ix " <<
id.ix() <<
" , iy " <<
id.iy() <<
')';
static bool isNextToBoundary(EEDetId id)
static int distanceX(const EEDetId &a, const EEDetId &b)
EEDetId offsetBy(int nrStepsX, int nrStepsY) const
DetId()
Create an empty or null id (also for persistence)
int ixQuadrantOne() const
static EEDetId unhashIndex(int hi)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
static const int SCCRYSTALMODE
static bool validHashIndex(int i)
static const int iYoffset[nCols+1]
uint32_t rawId() const
get the raw id
static bool isOuterRingXY(int ax, int ay)
static bool slowValidDetId(int crystal_ix, int crystal_iy)
int iPhiOuterRing() const
Abs< T >::type abs(const T &t)
static bool isNextToRingBoundary(EEDetId id)
static int distanceY(const EEDetId &a, const EEDetId &b)
static bool isNextToDBoundary(EEDetId id)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
EEDetId switchZSide() const
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int QuadColLimits[nCols+1]
static const unsigned short kxf[2 *IY_MAX]
static EEDetId idOuterRing(int iPhi, int zEnd)
int iyQuadrantOne() const
static const unsigned short kdi[2 *IY_MAX]
Detector det() const
get the detector field from this detid