CMS 3D CMS Logo

L1RCTORCAMap.cc
Go to the documentation of this file.
2 
3 #include <vector>
4 using std::vector;
5 
7  rawEMET = std::vector<unsigned short>(56 * 72);
8  rawHDET = std::vector<unsigned short>(56 * 72);
9  rawEMFG = std::vector<unsigned short>(56 * 72);
10  rawHDFG = std::vector<unsigned short>(56 * 72);
11  rawHFET = std::vector<unsigned short>(8 * 18);
12  combEM = std::vector<unsigned short>(56 * 72);
13  combHD = std::vector<unsigned short>(56 * 72);
14 
15  barrelData = std::vector<std::vector<std::vector<unsigned short>>>(
16  18, std::vector<std::vector<unsigned short>>(
17  7, std::vector<unsigned short>(64)));
18  hfData = std::vector<std::vector<unsigned short>>(
19  18, std::vector<unsigned short>(8));
20 }
21 vector<std::vector<std::vector<unsigned short>>> L1RCTORCAMap::giveBarrel() {
22  return barrelData;
23 }
24 
25 vector<std::vector<unsigned short>> L1RCTORCAMap::giveHF() { return hfData; }
27  std::vector<unsigned short> crate(16);
28  for (int i = 0; i < 9; i++) {
29  for (int j = 0; j < 16; j++) {
30  crate.at(j) = rawHFET.at(16 * i + j);
31  }
32  hfData.at(i) = crate;
33  }
34 }
35 
37  std::vector<int> indices;
38  for (int phi = 0; phi < 72; phi++) {
39  for (int eta = 0; eta < 56; eta++) {
40  indices = orcamap(eta, phi);
41  (barrelData.at(indices.at(0))).at(indices.at(1)).at(indices.at(2)) =
42  combEM.at(phi * 56 + eta);
43  (barrelData.at(indices.at(0))).at(indices.at(1)).at(indices.at(2) + 32) =
44  combHD.at(phi * 56 + eta);
45  }
46  }
47 }
48 
49 void L1RCTORCAMap::readData(const std::vector<unsigned> &emet,
50  const std::vector<unsigned> &hdet,
51  const std::vector<bool> &emfg,
52  const std::vector<bool> &hdfg,
53  const std::vector<unsigned> &hfet) {
54  for (int i = 0; i < 4032; i++) {
55  rawEMET.at(i) = emet.at(i);
56  rawHDET.at(i) = hdet.at(i);
57  rawEMFG.at(i) = emfg.at(i);
58  rawHDFG.at(i) = hdfg.at(i);
59  }
60  for (int i = 0; i < 144; i++)
61  rawHFET.at(i) = hfet.at(i);
62 
65 
67  makeHFData();
68 }
69 
70 unsigned short L1RCTORCAMap::combine(unsigned short et, unsigned short fg) {
71  unsigned short newfg = fg << 8;
72  return newfg + et;
73 }
74 
75 vector<unsigned short>
76 L1RCTORCAMap::combVec(const std::vector<unsigned short> &et,
77  const std::vector<unsigned short> &fg) {
78  std::vector<unsigned short> comb(56 * 72);
79  for (int i = 0; i < (int)et.size(); i++)
80  comb.at(i) = combine(et.at(i), fg.at(i));
81  return comb;
82 }
83 
84 vector<int> L1RCTORCAMap::orcamap(int eta, int phi) {
85  int crateNum(20);
86  std::vector<int> cardTower(2, 0);
87  std::vector<int> returnVec(3, 0);
88  int modEta = eta % 28;
89  int modPhi = phi % 8;
90  if (phi < 8)
91  crateNum = 0;
92  else if (phi < 16)
93  crateNum = 1;
94  else if (phi < 24)
95  crateNum = 2;
96  else if (phi < 32)
97  crateNum = 3;
98  else if (phi < 40)
99  crateNum = 4;
100  else if (phi < 48)
101  crateNum = 5;
102  else if (phi < 56)
103  crateNum = 6;
104  else if (phi < 64)
105  crateNum = 7;
106  else if (phi < 72)
107  crateNum = 8;
108 
109  if (eta < 28)
110  cardTower = lowEtaMap(modEta, modPhi);
111  else {
112  cardTower = highEtaMap(modEta, modPhi);
113  crateNum = crateNum + 9;
114  }
115 
116  returnVec.at(0) = crateNum;
117  for (int i = 0; i < 2; i++) {
118  returnVec.at(i + 1) = cardTower.at(i);
119  }
120  return returnVec;
121 }
122 
123 vector<int> L1RCTORCAMap::lowEtaMap(int eta, int phi) {
124  int cardnum = 0;
125  int towernum = 0;
126  std::vector<int> returnVec(2);
127  if (eta < 4) {
128  cardnum = 6;
129  if (phi < 4)
130  towernum = (3 - eta) * 4 + phi;
131  else
132  towernum = eta * 4 + phi + 12;
133  } else if (eta < 12) {
134  if (phi < 4) {
135  cardnum = 4;
136  if (eta < 8)
137  towernum = (7 - eta) * 4 + phi + 16;
138  else
139  towernum = (11 - eta) * 4 + phi;
140  } else {
141  cardnum = 5;
142  if (eta < 8)
143  towernum = (7 - eta) * 4 + (phi - 4) + 16;
144  else
145  towernum = (11 - eta) * 4 + (phi - 4);
146  }
147  } else if (eta < 20) {
148  if (phi < 4) {
149  cardnum = 2;
150  if (eta < 16)
151  towernum = (15 - eta) * 4 + phi + 16;
152  else
153  towernum = (19 - eta) * 4 + phi;
154  } else {
155  cardnum = 3;
156  if (eta < 16)
157  towernum = (15 - eta) * 4 + (phi - 4) + 16;
158  else
159  towernum = (19 - eta) * 4 + (phi - 4);
160  }
161  } else if (eta < 28) {
162  if (phi < 4) {
163  cardnum = 0;
164  if (eta < 24)
165  towernum = (23 - eta) * 4 + phi + 16;
166  else
167  towernum = (27 - eta) * 4 + phi;
168  } else {
169  cardnum = 1;
170  if (eta < 24)
171  towernum = (23 - eta) * 4 + (phi - 4) + 16;
172  else
173  towernum = (27 - eta) * 4 + (phi - 4);
174  }
175  }
176 
177  returnVec.at(0) = cardnum;
178  returnVec.at(1) = towernum;
179  return returnVec;
180 }
181 
182 vector<int> L1RCTORCAMap::highEtaMap(int eta, int phi) {
183  int cardnum;
184  int towernum;
185  std::vector<int> returnVec(2);
186  if (eta < 8) {
187  if (phi < 4) {
188  cardnum = 0;
189  towernum = eta * 4 + phi;
190  } else {
191  cardnum = 1;
192  towernum = eta * 4 + (phi - 4);
193  }
194  } else if (eta < 16) {
195  if (phi < 4) {
196  cardnum = 2;
197  towernum = (eta - 8) * 4 + phi;
198  } else {
199  cardnum = 3;
200  towernum = (eta - 8) * 4 + (phi - 4);
201  }
202  } else if (eta < 24) {
203  if (phi < 4) {
204  cardnum = 4;
205  towernum = (eta - 16) * 4 + phi;
206  } else {
207  cardnum = 5;
208  towernum = (eta - 16) * 4 + (phi - 4);
209  }
210  } else {
211  cardnum = 6;
212  if (phi < 4)
213  towernum = (27 - eta) * 4 + phi;
214  else
215  towernum = (27 - eta) * 4 + phi + 12;
216  }
217 
218  returnVec.at(0) = cardnum;
219  returnVec.at(1) = towernum;
220  return returnVec;
221 }
std::vector< std::vector< std::vector< unsigned short > > > barrelData
Definition: L1RCTORCAMap.h:29
std::vector< std::vector< unsigned short > > giveHF()
Definition: L1RCTORCAMap.cc:25
std::vector< unsigned short > combHD
Definition: L1RCTORCAMap.h:46
std::vector< int > highEtaMap(int eta, int phi)
unsigned short combine(unsigned short et, unsigned short fg)
Definition: L1RCTORCAMap.cc:70
void makeBarrelData()
Definition: L1RCTORCAMap.cc:36
std::vector< unsigned short > rawHDFG
Definition: L1RCTORCAMap.h:43
std::vector< std::vector< unsigned short > > hfData
Definition: L1RCTORCAMap.h:30
std::vector< int > orcamap(int eta, int phi)
Definition: L1RCTORCAMap.cc:84
std::vector< unsigned short > combEM
Definition: L1RCTORCAMap.h:45
et
define resolution functions of each parameter
std::vector< int > lowEtaMap(int eta, int phi)
std::vector< unsigned short > rawEMFG
Definition: L1RCTORCAMap.h:41
std::vector< unsigned short > combVec(const std::vector< unsigned short > &et, const std::vector< unsigned short > &fg)
Definition: L1RCTORCAMap.cc:76
std::vector< unsigned short > rawHFET
Definition: L1RCTORCAMap.h:44
std::vector< unsigned short > rawEMET
Definition: L1RCTORCAMap.h:40
std::vector< unsigned short > rawHDET
Definition: L1RCTORCAMap.h:42
std::vector< std::vector< std::vector< unsigned short > > > giveBarrel()
Definition: L1RCTORCAMap.cc:21
void makeHFData()
Definition: L1RCTORCAMap.cc:26
void readData(const std::vector< unsigned > &emet, const std::vector< unsigned > &hdet, const std::vector< bool > &emfg, const std::vector< bool > &hdfg, const std::vector< unsigned > &hfet)
Definition: L1RCTORCAMap.cc:49