CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ecalDccMap.h
Go to the documentation of this file.
1 #include <iostream>
2 
3 template<class T>
4 T mod(const T& a, const T& b){
5  T c = a%b;
6  return c<0?c+b:c;
7 }
8 
9 static const char endcapDccMap[401] = {
10  " 777777 "
11  " 666777777888 "
12  " 66667777778888 "
13  " 6666667777888888 "
14  " 666666677778888888 "
15  " 566666677778888880 " // Z
16  " 555666667788888000 " // x-----> X
17  "55555566677888000000" // |
18  "555555566 880000000" // |
19  "55555555 00000000"//_ // |
20  "55555554 10000000" // V Y
21  "554444444 111111100"
22  "44444444332211111111"
23  " 444444333222111111 "
24  " 444443333222211111 "
25  " 444433333222221111 "
26  " 4443333322222111 "
27  " 43333332222221 "
28  " 333333222222 "
29  " 333222 "};
30 
38 inline int dccPhiIndexOfRU(int iDet, int i, int j){
39  if(iDet==1){//barrel
40  //iEta=i, iPhi=j
41  //phi edge of a SM is 4 TT
42  return (j+2)/4;
43  }
44  char flag=endcapDccMap[i+j*20];
45  return (flag==' ')?-1:(flag-'0');
46 }
47 
48 
56 inline int dccPhiIndex(int iDet, int i, int j){
57  return dccPhiIndexOfRU(iDet, i/5, j/5);
58 }
59 
66 inline int dccIndex(int iDet, int i, int j){
67  if(iDet==1){//barrel
68  //a SM is 85 crystal long:
69  int iEtaSM = i/85;
70  //a SM is 20 crystal wide:
71  int iPhiSM = (j+10)/20;
72  //DCC numbers start at 9 in the barrel and there 18 DCC/SM
73  return 9+18*iEtaSM+iPhiSM;
74  }
75  int iPhi = dccPhiIndex(iDet, i, j);
76  if(iPhi<0) return -1;
77  //34 DCCs in barrel and 8 in EE-=>in EE+ DCC numbering starts at 45,
78  //iDet/2 is 0 for EE- and 1 for EE+:
79  return iPhi+iDet/2*45;
80 }
81 
88 inline int dccIndexOfRU(int iDet, int i, int j){
89  if(iDet==1){//barrel
90  //a SM is 17 RU long:
91  int iEtaSM = i/17;
92  //a SM is 4 RU wide:
93  int iPhiSM = (j+2)/4;
94  //DCC numbers start at 9 in the barrel and there 18 DCC/SM
95  return 9+18*iEtaSM+iPhiSM;
96  }
97  int iPhi = dccPhiIndexOfRU(iDet, i, j);
98  if(iPhi<0) return -1;
99  //34 DCCs in barrel and 8 in EE-=>in EE+ DCC numbering starts at 45,
100  //iDet/2 is 0 for EE- and 1 for EE+:
101  return iPhi+iDet/2*45;
102 }
103 
104 inline int abOfDcc(int iDCC){
105  if(iDCC<0||iDCC>54) return -1;
106  if(iDCC<9){//EE-
107  return iDCC/3;
108  } else if(iDCC<27){//EB-
109  //an EB AB is made of 6 DCCs,
110  //first EB- AB is numbered 3
111  //and "1st" DCC of AB 3 is DCC 26
112  //(AB 3 made of DCCs 26,9,10,11,12,13):
113  return 3+mod(iDCC-26,18)/6;
114  } else if(iDCC<45){//EB+
115  //an EB AB is made of 6 DCCs,
116  //first EB+ AB is numbered 6
117  //and "1st" DCC of AB6 is DCC 44
118  //(AB 6 made of DCCs 44,27,28,29,30,31):
119  return 6+mod(iDCC-44,18)/6;
120  } else{//EE+
121  //AB numbering starts at DCC=45 and runs along phi in increasing phi
122  //first EE+ AB is numbered 9:
123  return 9+(iDCC-45)/3;
124  }
125 }
int dccPhiIndex(int iDet, int i, int j)
Definition: ecalDccMap.h:56
int i
Definition: DBlmapReader.cc:9
long int flag
Definition: mlp_lapack.h:47
int dccIndex(int iDet, int i, int j)
Definition: ecalDccMap.h:66
int abOfDcc(int iDCC)
Definition: ecalDccMap.h:104
int j
Definition: DBlmapReader.cc:9
int dccIndexOfRU(int iDet, int i, int j)
Definition: ecalDccMap.h:88
list mod
Load physics model.
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
long double T
int dccPhiIndexOfRU(int iDet, int i, int j)
Definition: ecalDccMap.h:38
static const char endcapDccMap[401]
Definition: ecalDccMap.h:9