22 for (
i = 0;
i < NRMFIBR;
i++) {
23 for (
j = 0;
j < NFCH;
j++) {
25 iadcquiHBHE[
i][
j][0] =
i / 2 + 1;
28 iadcquiHBHE[
i][
j][1] =
j;
30 iadcquiHBHE[
i][
j][1] = NFCH + (
j + 1) % 3;
40 std::vector<HBHEHFLogicalMapEntry> HBHEHFEntries;
41 std::vector<HOHXLogicalMapEntry> HOHXEntries;
42 std::vector<CALIBLogicalMapEntry> CALIBEntries;
43 std::vector<ZDCLogicalMapEntry> ZDCEntries;
44 std::vector<HTLogicalMapEntry> HTEntries;
45 std::vector<uint32_t> LinearIndex2Entry;
46 std::vector<uint32_t> HbHash2Entry;
47 std::vector<uint32_t> HeHash2Entry;
48 std::vector<uint32_t> HfHash2Entry;
49 std::vector<uint32_t> HtHash2Entry;
50 std::vector<uint32_t> HoHash2Entry;
51 std::vector<uint32_t> HxCalibHash2Entry;
53 std::vector<uint32_t> ZdcHash2Entry;
62 int CalibFull = 216 + 425 + 8;
64 uint32_t illegal_value = 0;
66 LinearIndex2Entry.push_back(illegal_value);
67 for (
int iHb = 0; iHb < 2 * HbHalf; iHb++)
68 HbHash2Entry.push_back(illegal_value);
69 for (
int iHe = 0; iHe < 2 * HeHalf; iHe++)
70 HeHash2Entry.push_back(illegal_value);
71 for (
int iHf = 0; iHf < 2 * HfHalf; iHf++)
72 HfHash2Entry.push_back(illegal_value);
73 for (
int iHt = 0; iHt < 2 * HtHalf; iHt++)
74 HtHash2Entry.push_back(illegal_value);
75 for (
int iHo = 0; iHo < 2 * HoHalf; iHo++)
76 HoHash2Entry.push_back(illegal_value);
77 for (
int iHcalib = 0; iHcalib < CalibFull; iHcalib++)
78 HxCalibHash2Entry.push_back(illegal_value);
79 for (
int iZdc = 0; iZdc < 2 * ZdcHalf; iZdc++)
80 ZdcHash2Entry.push_back(illegal_value);
83 topo, HBHEHFEntries, HTEntries, LinearIndex2Entry, HbHash2Entry, HeHash2Entry, HfHash2Entry, HtHash2Entry);
84 buildHOXMap(topo, HOHXEntries, LinearIndex2Entry, HoHash2Entry, HxCalibHash2Entry);
85 buildCALIBMap(topo, CALIBEntries, LinearIndex2Entry, HxCalibHash2Entry);
86 buildZDCMap(topo, ZDCEntries, LinearIndex2Entry, ZdcHash2Entry);
105 std::vector<HBHEHFLogicalMapEntry>& HBHEHFEntries,
106 std::vector<HTLogicalMapEntry>& HTEntries,
107 std::vector<uint32_t>& LinearIndex2Entry,
108 std::vector<uint32_t>& HbHash2Entry,
109 std::vector<uint32_t>& HeHash2Entry,
110 std::vector<uint32_t>& HfHash2Entry,
111 std::vector<uint32_t>& HtHash2Entry) {
114 int hbhecrate_loc[NHBHECR] = {0, 1, 4, 5, 10, 11, 14, 15, 17};
115 memcpy(hbhecrate, hbhecrate_loc,
sizeof(
int) * NHBHECR);
117 int fedhbhenum_loc[NHBHECR][2] = {
118 {702, 703}, {704, 705}, {700, 701}, {706, 707}, {716, 717}, {708, 709}, {714, 715}, {710, 711}, {712, 713}};
119 memcpy(fedhbhenum, fedhbhenum_loc,
sizeof(
int) * NHBHECR * 2);
121 int ihslot_loc[NHSETS] = {2, 5, 13, 16};
122 memcpy(ihslot, ihslot_loc,
sizeof(
int) * NHSETS);
124 int ihbhephis_loc[NHBHECR] = {11, 19, 3, 27, 67, 35, 59, 43, 51};
125 memcpy(ihbhephis, ihbhephis_loc,
sizeof(
int) * NHBHECR);
127 int ihbheetadepth_loc[NHTRS][NTOPBOT][NFBR][NFCH][2] = {{{{{11, 1}, {7, 1}, {3, 1}},
128 {{5, 1}, {1, 1}, {9, 1}},
129 {{11, 1}, {7, 1}, {3, 1}},
130 {{5, 1}, {1, 1}, {9, 1}},
131 {{10, 1}, {6, 1}, {2, 1}},
132 {{8, 1}, {4, 1}, {12, 1}},
133 {{10, 1}, {6, 1}, {2, 1}},
134 {{8, 1}, {4, 1}, {12, 1}}},
135 {{{11, 1}, {7, 1}, {3, 1}},
136 {{5, 1}, {1, 1}, {9, 1}},
137 {{11, 1}, {7, 1}, {3, 1}},
138 {{5, 1}, {1, 1}, {9, 1}},
139 {{10, 1}, {6, 1}, {2, 1}},
140 {{8, 1}, {4, 1}, {12, 1}},
141 {{10, 1}, {6, 1}, {2, 1}},
142 {{8, 1}, {4, 1}, {12, 1}}}},
143 {{{{16, 2}, {15, 2}, {14, 1}},
144 {{15, 1}, {13, 1}, {16, 1}},
145 {{16, 2}, {15, 2}, {14, 1}},
146 {{15, 1}, {13, 1}, {16, 1}},
147 {{17, 1}, {16, 3}, {26, 1}},
148 {{18, 1}, {18, 2}, {26, 2}},
149 {{17, 1}, {16, 3}, {25, 1}},
150 {{18, 1}, {18, 2}, {25, 2}}},
151 {{{16, 2}, {15, 2}, {14, 1}},
152 {{15, 1}, {13, 1}, {16, 1}},
153 {{16, 2}, {15, 2}, {14, 1}},
154 {{15, 1}, {13, 1}, {16, 1}},
155 {{17, 1}, {16, 3}, {25, 1}},
156 {{18, 1}, {18, 2}, {25, 2}},
157 {{17, 1}, {16, 3}, {26, 1}},
158 {{18, 1}, {18, 2}, {26, 2}}}},
159 {{{{28, 1}, {28, 2}, {29, 1}},
160 {{28, 3}, {24, 2}, {24, 1}},
161 {{27, 1}, {27, 2}, {29, 2}},
162 {{27, 3}, {23, 2}, {23, 1}},
163 {{19, 2}, {20, 1}, {22, 2}},
164 {{19, 1}, {20, 2}, {22, 1}},
165 {{19, 2}, {20, 1}, {21, 2}},
166 {{19, 1}, {20, 2}, {21, 1}}},
167 {{{27, 1}, {27, 2}, {29, 2}},
168 {{27, 3}, {23, 2}, {23, 1}},
169 {{28, 1}, {28, 2}, {29, 1}},
170 {{28, 3}, {24, 2}, {24, 1}},
171 {{19, 2}, {20, 1}, {21, 2}},
172 {{19, 1}, {20, 2}, {21, 1}},
173 {{19, 2}, {20, 1}, {22, 2}},
174 {{19, 1}, {20, 2}, {22, 1}}}}};
175 memcpy(ihbheetadepth, ihbheetadepth_loc,
sizeof(
int) * NHTRS * NTOPBOT * NFBR * NFCH * 2);
179 int irm_rmfiHBHE_loc[NHTRS][NTOPBOT][NFBR][2] = {
180 {{{6, 1}, {7, 1}, {6, 2}, {7, 2}, {4, 1}, {5, 1}, {4, 2}, {5, 2}},
181 {{6, 3}, {7, 3}, {6, 4}, {7, 4}, {4, 3}, {5, 3}, {4, 4}, {5, 4}}},
182 {{{2, 1}, {3, 1}, {2, 2}, {3, 2}, {2, 1}, {3, 1}, {2, 2}, {3, 2}},
183 {{2, 3}, {3, 3}, {2, 4}, {3, 4}, {2, 3}, {3, 3}, {2, 4}, {3, 4}}},
184 {{{4, 1}, {5, 1}, {4, 2}, {5, 2}, {6, 1}, {7, 1}, {6, 2}, {7, 2}},
185 {{4, 3}, {5, 3}, {4, 4}, {5, 4}, {6, 3}, {7, 3}, {6, 4}, {7, 4}}}
187 memcpy(irm_rmfiHBHE, irm_rmfiHBHE_loc,
sizeof(
int) * NHTRS * NTOPBOT * NFBR * 2);
190 int ipixelHB_loc[NRMFIBR][NFCH][NRMSLOT] = {
192 {{18, 17, 3, 2}, {13, 3, 17, 7}, {14, 1, 19, 6}},
193 {{19, 2, 18, 1}, {15, 7, 13, 5}, {17, 19, 1, 3}},
194 {{9, 4, 16, 11}, {5, 8, 12, 15}, {2, 13, 7, 18}},
195 {{12, 11, 9, 8}, {7, 15, 5, 13}, {16, 6, 14, 4}},
196 {{8, 5, 15, 12}, {4, 9, 11, 16}, {1, 14, 6, 19}},
197 {{6, 16, 4, 14}, {3, 18, 2, 17}, {11, 12, 8, 9}}
199 memcpy(ipixelHB, ipixelHB_loc,
sizeof(
int) * NRMFIBR * NFCH * NRMSLOT);
201 int ipixelHE_loc[NRMFIBR][NFCH][NRMSLOT] = {
203 {{12, 12, 12, 12}, {16, 7, 16, 7}, {7, 16, 7, 16}},
204 {{11, 11, 11, 11}, {19, 3, 19, 3}, {3, 19, 3, 19}},
205 {{15, 15, 6, 6}, {2, 18, 2, 18}, {6, 6, 15, 15}},
206 {{5, 14, 5, 14}, {14, 5, 14, 5}, {18, 2, 18, 2}},
207 {{17, 1, 17, 1}, {9, 9, 9, 9}, {1, 17, 1, 17}},
208 {{13, 4, 13, 4}, {8, 8, 8, 8}, {4, 13, 4, 13}}
210 memcpy(ipixelHE, ipixelHE_loc,
sizeof(
int) * NRMFIBR * NFCH * NRMSLOT);
216 const char* S_slbin_odd_loc[] = {
"A1",
"B0",
"B1",
"A0",
"A1",
"B0",
"B1",
"A0"};
217 for (
int gg = 0; gg < 8; gg++) {
218 S_slbin_odd[gg] = S_slbin_odd_loc[gg];
220 const char* S_slbin_even_loc[] = {
"C1",
"D0",
"D1",
"C0",
"C1",
"D0",
"D1",
"C0"};
221 for (
int gg = 0; gg < 8; gg++) {
222 S_slbin_even[gg] = S_slbin_even_loc[gg];
224 const char* rct_rackHBHE_loc[] = {
"S2E01-RH",
242 for (
int gg = 0; gg < 18; gg++) {
243 rct_rackHBHE[gg] = rct_rackHBHE_loc[gg];
246 int slb_table_loc[29] = {1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
247 1, 1, 2, 2, 3, 3, 1, 1,
248 2, 2, 3, 3, 4, 4, 4, 4, 4};
249 memcpy(slb_table, slb_table_loc,
sizeof(
int) * 29);
252 char tempbuff[30]{0};
255 stringstream mystream;
258 for (ic = 0; ic < NHBHECR; ic++) {
260 for (is = 0; is < NHSETS; is++) {
262 for (ih = 0; ih < NHTRS; ih++) {
264 for (itb = 0; itb < NTOPBOT; itb++) {
266 for (ifb = 0; ifb < NFBR; ifb++) {
268 for (ifc = 0; ifc < NFCH; ifc++) {
269 icrate = hbhecrate[ic];
270 iside = is < NHSETS / 2 ? -1 : 1;
271 ifwtb = (is / 2 + itb + 1) % 2;
272 ieta = ihbheetadepth[ih][ifwtb][ifb][ifc][0];
273 idepth = ihbheetadepth[ih][ifwtb][ifb][ifc][1];
274 ihtr = ihslot[is] + ih;
275 (
ieta > 16 || idepth > 2) ? det =
"HE" : det =
"HB";
276 (itb % 2) == 1 ? fpga =
"bot" : fpga =
"top";
279 iphi = (
ieta > 20) ? (ihbhephis[ic] + (is % 2) * 4 + itb * 2 - 1) % 72 + 1
280 : (ihbhephis[ic] + (is % 2) * 4 + itb * 2 + (ifb / 2 + is / 2 + 1) % 2 - 1) % 72 + 1;
281 ispigot = (is % 2) * 6 + ih * 2 + itb;
282 idcc = is < NHSETS / 2 ? 1 : 2;
283 idcc_sl = idcc == 1 ? 10 : 20;
284 ifed = fedhbhenum[ic][idcc - 1];
292 irm = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][1];
293 irm_fi = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][0];
296 if (
ieta >= 21 && (irm == 1 || irm == 3))
297 iwedge = (
iphi + 1 + irm + 1) / 4;
299 iwedge = (
iphi + irm + 1) / 4;
307 irm = irm_rmfiHBHE[ih][itb][ifb][1];
308 irm_fi = irm_rmfiHBHE[ih][itb][ifb][0];
311 if (
ieta >= 21 && (irm == 4 || irm == 2))
312 iwedge = (
iphi + 1 - irm + 6) / 4;
314 iwedge = (
iphi - irm + 6) / 4;
321 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
322 mystream << tempbuff;
323 rbx = mystream.str();
330 if (
ieta > 16 || idepth > 2)
331 ipixel = ipixelHE[irm_fi - 2][ifc][irm - 1];
333 ipixel = ipixelHB[irm_fi - 2][ifc][irm - 1];
335 iqie = iadcquiHBHE[irm_fi - 2][ifc][0];
336 iadc = iadcquiHBHE[irm_fi - 2][ifc][1];
340 phideg = phideg + 72;
341 phideg = (phideg / 4) * 20 + 10;
342 irctcra = ((89 - phideg + 720) % 360) / 20;
343 oddcard = irctcra % 2;
346 irctcra = irctcra + 9;
348 etaslb = ((
ieta - 1) / 2) * 2 + 1;
352 snprintf(tempbuff,
sizeof tempbuff,
"SLB_H_%3.3d%c%2.2d", phideg, S_side, etaslb);
353 mystream << tempbuff;
354 slnam = mystream.str();
357 islb = slb_table[
ieta - 1];
361 irctcar = 2 * ((
ieta - 1) / 8) + oddcard;
362 irctcon = 2 * (((
ieta - 1) / 2) % 4);
372 irctcon = 2 * (((
eta3 - 1) / 2) % 4);
374 irctcon = 11 * irctcon + 1;
376 snprintf(tempbuff,
sizeof tempbuff,
"%s-%1d-HD%2.2d", rct_rackHBHE[irctcra], irctcar, irctcon);
377 mystream << tempbuff;
378 rctnam = mystream.str();
385 for (
i = 0;
i < 18;
i++) {
386 if (
iphi <
i * 4 + 3) {
399 mystream << S_slbin_odd[phimod8];
401 mystream << S_slbin_even[phimod8];
402 }
else if (crazy == 0) {
404 mystream << S_slbin_odd[phimod8];
406 mystream << S_slbin_even[phimod8];
409 mystream << S_slbin_even[phimod8];
411 mystream << S_slbin_odd[phimod8];
414 slbin = mystream.str();
454 HBHEHFEntries.push_back(hbeflmapentry);
459 unsigned int denseId;
462 HbHash2Entry.at(denseId) = HBHEHFEntries.size();
466 HeHash2Entry.at(denseId) = HBHEHFEntries.size();
470 HfHash2Entry.at(denseId) = HBHEHFEntries.size();
473 ConstructTriggerTower(topo,
511 int hfcrate_loc[NHFCR] = {2, 9, 12};
512 memcpy(hfcrate, hfcrate_loc,
sizeof(
int) * NHFCR);
514 int fedhfnum_loc[NHFCR][2] = {{718, 719}, {720, 721}, {722, 723}};
515 memcpy(fedhfnum, fedhfnum_loc,
sizeof(
int) * NHFCR * 2);
517 int ihfphis_loc[NHFCR] = {3, 27, 51};
518 memcpy(ihfphis, ihfphis_loc,
sizeof(
int) * NHFCR);
520 int ihfetadepth_loc[NTOPBOT][NFBR][NFCH][2] = {{{{33, 1}, {31, 1}, {29, 1}},
521 {{32, 1}, {30, 1}, {34, 1}},
522 {{33, 2}, {31, 2}, {29, 2}},
523 {{32, 2}, {30, 2}, {34, 2}},
524 {{34, 2}, {32, 2}, {30, 2}},
525 {{31, 2}, {29, 2}, {33, 2}},
526 {{34, 1}, {32, 1}, {30, 1}},
527 {{31, 1}, {29, 1}, {33, 1}}},
528 {{{41, 1}, {37, 1}, {35, 1}},
529 {{38, 1}, {36, 1}, {39, 1}},
530 {{41, 2}, {37, 2}, {35, 2}},
531 {{38, 2}, {36, 2}, {39, 2}},
532 {{40, 2}, {38, 2}, {36, 2}},
533 {{37, 2}, {35, 2}, {39, 2}},
534 {{40, 1}, {38, 1}, {36, 1}},
535 {{37, 1}, {35, 1}, {39, 1}}}};
536 memcpy(ihfetadepth, ihfetadepth_loc,
sizeof(
int) * NTOPBOT * NFBR * NFCH * 2);
538 int irm_rmfiHF_loc[NHTRS][NTOPBOT][NFBR][2] = {
539 {{{1, 2}, {2, 2}, {3, 2}, {4, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}},
540 {{5, 2}, {6, 2}, {7, 2}, {8, 2}, {5, 3}, {6, 3}, {7, 3}, {8, 3}}},
541 {{{1, 1}, {2, 1}, {3, 1}, {4, 1}, {1, 2}, {2, 2}, {3, 2}, {4, 2}},
542 {{5, 1}, {6, 1}, {7, 1}, {8, 1}, {5, 2}, {6, 2}, {7, 2}, {8, 2}}},
543 {{{1, 3}, {2, 3}, {3, 3}, {4, 3}, {1, 1}, {2, 1}, {3, 1}, {4, 1}},
544 {{5, 3}, {6, 3}, {7, 3}, {8, 3}, {5, 1}, {6, 1}, {7, 1}, {8, 1}}}
546 memcpy(irm_rmfiHF, irm_rmfiHF_loc,
sizeof(
int) * NHTRS * NTOPBOT * NFBR * 2);
549 const char* S_slbin_7_loc[] = {
"A0",
"A1",
"B0",
"B1"};
550 for (
int gg = 0; gg < 4; gg++) {
551 S_slbin_7[gg] = S_slbin_7_loc[gg];
553 const char* S_slbin_3_loc[] = {
"C0",
"C1",
"D0",
"D1"};
554 for (
int gg = 0; gg < 4; gg++) {
555 S_slbin_3[gg] = S_slbin_3_loc[gg];
557 const char* rct_rackHF_loc[] = {
"S2E01-FH",
575 for (
int gg = 0; gg < 18; gg++) {
576 rct_rackHF[gg] = rct_rackHF_loc[gg];
582 for (ic = 0; ic < NHFCR; ic++) {
584 for (is = 0; is < NHSETS; is++) {
586 for (ih = 0; ih < NHTRS; ih++) {
588 for (itb = 0; itb < NTOPBOT; itb++) {
590 for (ifb = 0; ifb < NFBR; ifb++) {
592 for (ifc = 0; ifc < NFCH; ifc++) {
593 icrate = hfcrate[ic];
594 iside = is < NHSETS / 2 ? -1 : 1;
595 ieta = ihfetadepth[itb][ifb][ifc][0];
596 idepth = ihfetadepth[itb][ifb][ifc][1];
597 ihtr = ihslot[is] + ih;
599 (itb % 2) == 1 ? fpga =
"bot" : fpga =
"top";
602 iphi = (
ieta > 39) ? (ihfphis[ic] + (is % 2) * 12 + ih * 4 - 1) % 72 + 1
603 : (ihfphis[ic] + (is % 2) * 12 + ih * 4 + (ifb / 4) * 2 - 1) % 72 + 1;
604 ispigot = (is % 2) * 6 + ih * 2 + itb;
605 idcc = is < NHSETS / 2 ? 1 : 2;
606 idcc_sl = idcc == 1 ? 10 : 20;
607 ifed = fedhfnum[ic][idcc - 1];
609 irm_fi = irm_rmfiHF[ih][itb][ifb][0];
621 else if (
iphi % 4 == 1)
623 else if (
iphi % 4 == 3)
626 edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Even iphi in HFM" << endl;
634 if ((iside == 1 &&
ieta == 40) || (iside == -1 &&
ieta == 41)) {
635 irm = ((
iphi + 1) / 2) % 36 + 1;
636 hfphi = ((
iphi + 1) / 6) % 12 + 1;
638 irm = (
iphi + 1) / 2;
639 hfphi = (
iphi - 1) / 6 + 1;
641 irm = (irm - 1) % 3 + 1;
647 iwedge = (
iphi + 1) / 4 + 1;
650 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, hfphi);
651 mystream << tempbuff;
652 rbx = mystream.str();
659 iqie = (irm_fi - 1) / 2 + 1;
664 iadc = NFCH + (ifi_ch + 1) % 3;
670 phideg = phideg + 72;
671 phideg = (phideg / 4) * 20 + 10;
672 irctcra = ((89 - phideg + 720) % 360) / 40;
674 irctcra = irctcra + 9;
682 snprintf(tempbuff,
sizeof tempbuff,
"SLB_H_%3.3d%c%2.2d", phideg, S_side, etaslb);
683 mystream << tempbuff;
684 slnam = mystream.str();
687 snprintf(tempbuff,
sizeof tempbuff,
"%s-JSC-HF_IN", rct_rackHF[irctcra]);
688 mystream << tempbuff;
689 rctnam = mystream.str();
694 int phibin = (
iphi + 1) % 8;
695 int etabin = (
ieta - 29) / 3;
701 mystream << S_slbin_7[etabin];
703 mystream << S_slbin_3[etabin];
705 slbin = mystream.str();
743 HBHEHFEntries.push_back(hbeflmapentry);
748 unsigned int denseId;
751 HbHash2Entry.at(denseId) = HBHEHFEntries.size();
755 HeHash2Entry.at(denseId) = HBHEHFEntries.size();
759 HfHash2Entry.at(denseId) = HBHEHFEntries.size();
762 ConstructTriggerTower(topo,
800 std::vector<HOHXLogicalMapEntry>& HOHXEntries,
801 std::vector<uint32_t>& LinearIndex2Entry,
802 std::vector<uint32_t>& HoHash2Entry,
803 std::vector<uint32_t>& HxCalibHash2Entry) {
806 int hocrate_loc[NHOCR] = {3, 7, 6, 13};
807 memcpy(hocrate, hocrate_loc,
sizeof(
int) * NHOCR);
809 int fedhonum_loc[NHOCR][2] = {{724, 725}, {726, 727}, {728, 729}, {730, 731}};
810 memcpy(fedhonum, fedhonum_loc,
sizeof(
int) * NHOCR * 2);
812 int ihslotho_loc[NHSETSHO][NHTRSHO] = {{2, 3, 4, 5}, {6, 7, 13, 14}, {15, 16, 17, 18}};
813 memcpy(ihslotho, ihslotho_loc,
sizeof(
int) * NHSETSHO * NHTRSHO);
815 int ihophis_loc[NHOCR] = {71, 17, 35, 53};
816 memcpy(ihophis, ihophis_loc,
sizeof(
int) * NHOCR);
821 int HO_RM_table_loc[24][16][2] = {{{2, 2},
1205 memcpy(HO_RM_table, HO_RM_table_loc,
sizeof(
int) * 24 * 16 * 2);
1208 int HO_RM_fi_eta5to15_loc[11] = {3, 2, 5, 4, 7, 6, 3, 2, 5, 4, 7};
1209 memcpy(HO_RM_fi_eta5to15, HO_RM_fi_eta5to15_loc,
sizeof(
int) * 11);
1224 int HO_RM_fi_eta1to4_loc[24][2][2] = {
1226 {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}, {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}, {{2, 6}, {5, 4}},
1227 {{3, 7}, {5, 4}}, {{2, 6}, {5, 4}}, {{3, 7}, {5, 4}},
1228 {{2, 6}, {5, 4}}, {{3, 7}, {5, 4}}, {{2, 6}, {5, 4}}, {{3, 7}, {5, 4}}, {{2, 6}, {5, 4}},
1229 {{3, 7}, {5, 4}}, {{2, 6}, {5, 4}}, {{3, 7}, {5, 4}},
1230 {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}, {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}, {{7, 3}, {4, 5}},
1231 {{6, 2}, {4, 5}}, {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}
1233 memcpy(HO_RM_fi_eta1to4, HO_RM_fi_eta1to4_loc,
sizeof(
int) * 24 * 2 * 2);
1244 int HO_RM_fi_eta1to4_sipm_loc[24][4][2] = {
1246 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1247 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1248 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1249 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1250 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1251 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1252 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1253 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1254 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1255 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1256 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1257 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1259 memcpy(HO_RM_fi_eta1to4_sipm, HO_RM_fi_eta1to4_sipm_loc,
sizeof(
int) * 24 * 4 * 2);
1262 int HO_htr_fi_450eta5to15_loc[2][11] = {{2, 2, 4, 6, 8, 2, 4, 6, 8, 4, 6},
1263 {2, 8, 6, 4, 2, 8, 6, 4, 2, 4, 2}};
1264 memcpy(HO_htr_fi_450eta5to15, HO_htr_fi_450eta5to15_loc,
sizeof(
int) * 2 * 11);
1267 int HO_htr_fi_450eta16M_loc[4] = {7, 7, 8, 8};
1268 memcpy(HO_htr_fi_450eta16M, HO_htr_fi_450eta16M_loc,
sizeof(
int) * 4);
1271 int HO_htr_fi_450eta16P_loc[4][6] = {
1272 {4, 2, 4, 4, 2, 6}, {2, 6, 6, 2, 6, 4}, {5, 3, 5, 5, 3, 7}, {3, 7, 7, 3, 7, 5}};
1273 memcpy(HO_htr_fi_450eta16P, HO_htr_fi_450eta16P_loc,
sizeof(
int) * 4 * 6);
1276 int HO_htr_fi_eta4_loc[2][6] = {{6, 6, 8, 8, 7, 7},
1277 {4, 4, 5, 5, 3, 3}};
1279 memcpy(HO_htr_fi_eta4, HO_htr_fi_eta4_loc,
sizeof(
int) * 2 * 6);
1281 int HO_htr_fi_eta123_loc[2][6] = {{6, 5, 4, 3, 8, 7},
1282 {8, 7, 6, 5, 2, 1}};
1284 memcpy(HO_htr_fi_eta123, HO_htr_fi_eta123_loc,
sizeof(
int) * 2 * 6);
1294 int HO_htr_fi_eta1234_sipm[6][5][2][2] = {
1300 {{5, 6}, {-1, -1}}},
1301 {{{6, 7}, {5, 6}}, {{6, 6}, {6, 6}}, {{6, 7}, {5, 7}}, {{5, 7}, {5, 8}}, {{-1, -1}, {4, 8}}},
1302 {{{4, 5}, {5, 6}}, {{5, 5}, {5, 5}}, {{4, 5}, {4, 6}}, {{4, 6}, {3, 6}}, {{-1, -1}, {3, 8}}},
1303 {{{3, 8}, {8, 5}}, {{8, 8}, {4, 8}}, {{3, 5}, {4, 5}}, {{3, 6}, {3, 5}}, {{5, 6}, {-1, -1}}},
1309 {{7, 7}, {-1, -1}}},
1310 {{{7, 1}, {7, 7}}, {{8, 7}, {7, 7}}, {{8, 1}, {7, 1}}, {{7, 1}, {7, 2}}, {{-1, -1}, {3, 2}}},
1318 int ipixelHO_loc[NRMFIBR][NFCH][2] = {{{12, 12}, {7, 7}, {6, 3}},
1319 {{4, 4}, {8, 8}, {5, 1}},
1320 {{19, 11}, {18, 6}, {17, 2}},
1321 {{2, 9}, {1, 13}, {3, 5}},
1322 {{11, 19}, {16, 18}, {15, 17}},
1323 {{13, 15}, {9, 14}, {14, 16}}};
1325 int ipixelHO_sipm[NRMFIBR][NFCH][2] = {{{12, 12}, {7, 7}, {3, 3}},
1326 {{4, 4}, {8, 8}, {1, 1}},
1327 {{11, 11}, {6, 6}, {2, 2}},
1328 {{9, 9}, {13, 13}, {5, 5}},
1329 {{19, 19}, {18, 18}, {17, 17}},
1330 {{15, 15}, {14, 14}, {16, 16}}};
1332 memcpy(ipixelHO, ipixelHO_loc,
sizeof(
int) * NRMFIBR * NFCH * 2);
1334 memcpy(ipixelHO, ipixelHO_sipm,
sizeof(
int) * NRMFIBR * NFCH * 2);
1337 std::string letterHO_loc[NRMFIBR][NFCH][2] = {{{
"E",
"E"}, {
"G",
"L"}, {
"F",
"S"}},
1338 {{
"Q",
"M"}, {
"N",
"T"}, {
"P",
"F"}},
1339 {{
"A",
"C"}, {
"X",
"J"}, {
"J",
"Q"}},
1340 {{
"X",
"K"}, {
"R",
"R"}, {
"H",
"D"}},
1341 {{
"D",
"A"}, {
"C",
"G"}, {
"B",
"N"}},
1342 {{
"L",
"H"}, {
"M",
"P"}, {
"K",
"B"}}};
1344 std::string letterHO_sipm[NRMFIBR][NFCH][2] = {{{
"E",
"E"}, {
"G",
"L"}, {
"H",
"S"}},
1345 {{
"Q",
"M"}, {
"N",
"T"}, {
"R",
"F"}},
1346 {{
"D",
"C"}, {
"F",
"J"}, {
"X",
"Q"}},
1347 {{
"M",
"K"}, {
"L",
"R"}, {
"P",
"D"}},
1348 {{
"A",
"A"}, {
"X",
"G"}, {
"J",
"N"}},
1349 {{
"B",
"H"}, {
"K",
"P"}, {
"C",
"B"}}};
1351 for (
int jj = 0;
jj < NRMFIBR;
jj++) {
1352 for (
int kk = 0;
kk < NFCH;
kk++) {
1353 for (
int ll = 0; ll < 2; ll++) {
1355 letterHO[
jj][
kk][ll] = letterHO_loc[
jj][
kk][ll];
1357 letterHO[
jj][
kk][ll] = letterHO_sipm[
jj][
kk][ll];
1377 int rmspecialeta_loc[6][6] = {
1379 {14, 15, 14, 13, 12, 11},
1380 {14, 15, 14, 13, 12, 11},
1381 {10, 9, 8, 7, 6, 5},
1382 {10, 9, 8, 7, 6, 5},
1383 {14, 15, 14, 13, 12, 11},
1384 {14, 15, 14, 13, 12, 11}
1389 {
"X",
"B",
"C",
"D",
"E",
"F"},
1390 {
"X",
"P",
"Q",
"R",
"S",
"T"},
1391 {
"G",
"H",
"J",
"K",
"L",
"M"},
1392 {
"A",
"B",
"C",
"D",
"E",
"F"},
1393 {
"X",
"B",
"C",
"D",
"E",
"F"},
1394 {
"X",
"P",
"Q",
"R",
"S",
"T"}
1399 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"},
1400 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"},
1401 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1402 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1403 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"},
1404 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"}
1407 memcpy(rmspecialeta, rmspecialeta_loc,
sizeof(
int) * 6 * 6);
1410 for (
int jj = 0;
jj < 6;
jj++) {
1411 for (
int kk = 0;
kk < 6;
kk++) {
1412 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];
1416 for (
int jj = 0;
jj < 6;
jj++) {
1417 for (
int kk = 0;
kk < 6;
kk++) {
1418 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];
1423 else if (mapIOV_ == 2) {
1424 int rmspecialeta_loc[6][6] = {
1426 {11, 12, 13, 14, 15, 15},
1427 {11, 12, 13, 14, 15, 15},
1428 {5, 6, 7, 8, 9, 10},
1429 {5, 6, 7, 8, 9, 10},
1430 {14, 15, 14, 13, 12, 11},
1431 {11, 12, 13, 14, 15, 15}
1436 {
"F",
"E",
"D",
"C",
"B",
"X"},
1437 {
"T",
"S",
"R",
"Q",
"P",
"X"},
1438 {
"M",
"L",
"K",
"J",
"H",
"G"},
1439 {
"F",
"E",
"D",
"C",
"B",
"A"},
1440 {
"X",
"B",
"C",
"D",
"E",
"F"},
1441 {
"T",
"S",
"R",
"Q",
"P",
"X"}
1446 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1447 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1448 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1449 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1450 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"},
1451 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"}
1454 memcpy(rmspecialeta, rmspecialeta_loc,
sizeof(
int) * 6 * 6);
1457 for (
int jj = 0;
jj < 6;
jj++) {
1458 for (
int kk = 0;
kk < 6;
kk++) {
1459 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];
1463 for (
int jj = 0;
jj < 6;
jj++) {
1464 for (
int kk = 0;
kk < 6;
kk++) {
1465 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];
1471 int rmspecialeta_loc[6][6] = {
1473 {11, 12, 13, 14, 15, 15},
1474 {11, 12, 13, 14, 15, 15},
1475 {5, 6, 7, 8, 9, 10},
1476 {5, 6, 7, 8, 9, 10},
1477 {11, 12, 13, 14, 15, 15},
1478 {11, 12, 13, 14, 15, 15}
1483 {
"F",
"E",
"D",
"C",
"B",
"X"},
1484 {
"T",
"S",
"R",
"Q",
"P",
"X"},
1485 {
"M",
"L",
"K",
"J",
"H",
"G"},
1486 {
"F",
"E",
"D",
"C",
"B",
"A"},
1487 {
"F",
"E",
"D",
"C",
"B",
"X"},
1488 {
"T",
"S",
"R",
"Q",
"P",
"X"}
1493 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1494 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1495 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1496 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1497 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1498 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"}
1501 memcpy(rmspecialeta, rmspecialeta_loc,
sizeof(
int) * 6 * 6);
1504 for (
int jj = 0;
jj < 6;
jj++) {
1505 for (
int kk = 0;
kk < 6;
kk++) {
1506 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];
1510 for (
int jj = 0;
jj < 6;
jj++) {
1511 for (
int kk = 0;
kk < 6;
kk++) {
1512 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];
1519 char tempbuff[30]{0};
1522 stringstream mystream;
1525 for (isid = -1; isid < 2; isid += 2) {
1526 for (iph = 0; iph < NHOPHI; iph++) {
1527 for (iet = 0; iet < NHOETA; iet++) {
1541 icrate = hocrate[ic];
1550 phmod6e450 = (phmod6 == 4 || phmod6 == 5 || phmod6 == 0);
1551 phmod6e123 = (phmod6 == 1 || phmod6 == 2 || phmod6 == 3);
1554 if (
ieta <= 3 && (iside < 0 || phmod6 >= 4))
1556 else if (ieta <= 3 && iside > 0 && phmod6 < 4)
1559 else if ((
ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6))
1561 else if ((
ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13))
1564 else if (
ieta >= 10 && iside > 0)
1566 else if (ieta < 10 && ieta >= 6 && iside > 0)
1569 else if ((
ieta == 5 && iside > 0) ||
ieta == 4)
1571 else if ((
ieta == 5 ||
ieta >= 10) && iside < 0)
1573 else if ((ieta < 10 && ieta >= 6) && iside < 0)
1576 edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Bad fpga code" << endl;
1593 irm = HO_RM_table[phmod24][iet][sidear];
1598 irm_fi = HO_RM_fi_eta16;
1600 irm_fi = HO_RM_fi_eta5to15[
ieta - 5];
1604 irm_fi = HO_RM_fi_eta1to4[phmod24][0][sidear];
1606 irm_fi = HO_RM_fi_eta1to4[phmod24][1][sidear];
1609 }
else if (mapIOV_ >= 5) {
1610 irm_fi = HO_RM_fi_eta1to4_sipm[phmod24][
ieta - 1][sidear];
1617 if (
ieta >= 5 && phmod6e450)
1618 ihtr_fi = HO_htr_fi_450eta5to15[sidear][
ieta - 5];
1619 else if (
ieta >= 5 && phmod6e123)
1620 ihtr_fi = HO_htr_fi_450eta5to15[sidear][
ieta - 5] - 1;
1621 else if (
ieta <= 4) {
1624 ihtr_fi = HO_htr_fi_eta4[sidear][phmod6];
1626 ihtr_fi = HO_htr_fi_eta123[sidear][phmod6];
1627 }
else if (mapIOV_ >= 5) {
1628 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][
ieta - 1][(irm - 1) / 2][sidear];
1635 phi1458 = (
iphi % 12 == 1 ||
iphi % 12 == 4 ||
iphi % 12 == 5 ||
iphi % 12 == 8);
1636 phi271011 = (
iphi % 12 == 2 ||
iphi % 12 == 7 ||
iphi % 12 == 10 ||
iphi % 12 == 11);
1639 phir0v1 = (
iphi % 24 == 0 ||
iphi % 24 == 2 ||
iphi % 24 == 4 ||
iphi % 24 == 18 ||
iphi % 24 == 20 ||
1641 phir0v2 = (
iphi % 24 == 1 ||
iphi % 24 == 3 ||
iphi % 24 == 17 ||
iphi % 24 == 19 ||
iphi % 24 == 21 ||
1644 phir0v3 = (
iphi % 24 == 5 ||
iphi % 24 == 7 ||
iphi % 24 == 9 ||
iphi % 24 == 11 ||
iphi % 24 == 13 ||
1646 phir0v4 = (
iphi % 24 == 6 ||
iphi % 24 == 8 ||
iphi % 24 == 10 ||
iphi % 24 == 12 ||
iphi % 24 == 14 ||
1650 if (
ieta % 2 == 0 && phi1458)
1652 else if (
ieta % 2 == 0 &&
iphi % 3 == 0)
1654 else if (
ieta % 2 == 0 && phi271011)
1656 else if (
ieta % 2 == 1 &&
iphi % 3 == 0)
1658 else if (
ieta % 2 == 1 && phi271011)
1660 else if (
ieta % 2 == 1 && phi1458)
1670 else if (
iphi % 2 == 1)
1677 else if (
iphi % 2 == 0)
1682 else if ((
ieta == 3 && iside == -1) || (
ieta == 2 && iside == 1)) {
1687 else if (phir0v1 || phir0v2)
1691 else if ((
ieta == 3 && iside == 1) || (
ieta == 2 && iside == -1)) {
1696 else if (phir0v3 || phir0v4)
1700 else if (
ieta == 1) {
1701 if (phir0v1 || phir0v3)
1703 else if (phir0v2 || phir0v4)
1715 else if (
iphi % 2 == 1)
1722 else if (
iphi % 2 == 0)
1730 else if (
iphi % 2 == 1)
1735 else if (
iphi % 2 == 1)
1743 else if (
iphi % 2 == 1)
1748 else if (
iphi % 2 == 0)
1758 else if (
iphi % 2 == 1)
1765 else if (
iphi % 2 == 0)
1774 iqie = (irm_fi - 2) / 2 + 1;
1776 if (irm_fi % 2 == 0)
1779 iadc = NFCH + (ifi_ch + 1) % 3;
1783 ipixel = ipixelHO[irm_fi - 2][ifi_ch][0];
1784 letter = letterHO[irm_fi - 2][ifi_ch][0];
1786 ipixel = ipixelHO[irm_fi - 2][ifi_ch][1];
1787 letter = letterHO[irm_fi - 2][ifi_ch][1];
1792 if (ieta <= 4 && mapIOV_ >= 5) {
1793 if (ipixel == 3 || ipixel == 7 || ipixel == 12 || ipixel == 14 || ipixel == 17 || ipixel == 18) {
1795 if (phmod6 == 1 || phmod6 == 3)
1799 }
else if (ipixel == 1 || ipixel == 4 || ipixel == 8 || ipixel == 15 || ipixel == 16 || ipixel == 19) {
1801 if (phmod6 == 0 || phmod6 == 2)
1805 }
else if (ipixel == 2 || ipixel == 5 || ipixel == 6 || ipixel == 9 || ipixel == 11 || ipixel == 13) {
1819 if (
ieta <= 3 || (
ieta >= 14 && iside == 1))
1821 else if (ieta <= 13 && ieta >= 6 && iside == 1)
1823 else if (ieta <= 13 && ieta >= 6 && iside == -1)
1832 int php2mod18 = (iph + 2) % 18;
1833 int php2mod18ov6 = php2mod18 / 6;
1838 if (
iphi % 18 == 17 ||
iphi % 18 <= 4)
1840 else if (
iphi % 18 >= 5 &&
iphi % 18 <= 10)
1845 if (
ieta == 16 && iside > 0)
1848 ihtr = ihslotho[is][ih];
1852 ihtr = ihslotho[is][ih];
1854 if (mytype == 1 || mytype == 2)
1858 ihtr = ihslotho[php2mod18ov6][ih];
1862 if ((
ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6))
1864 else if ((
ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13))
1867 ispigot = ihtr < 9 ? (ihtr - 2) * 2 + itb : (ihtr - 13) * 2 + itb;
1868 idcc = ihtr < 9 ? 1 : 2;
1869 idcc_sl = idcc == 1 ? 10 : 20;
1871 ifed = fedhonum[ic][idcc - 1];
1889 for (
i = -2;
i <
iphi;
i += 6) {
1898 if (
ring != 0 && sector % 2 != 0)
1902 snprintf(tempbuff,
sizeof tempbuff,
"%s%i%2.2d", det.c_str(),
ring, sector);
1904 snprintf(tempbuff,
sizeof tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign, sector);
1905 mystream << tempbuff;
1906 rbx = mystream.str();
1915 if (
ieta == 16 && isid < 0)
1916 ihtr_fi = HO_htr_fi_450eta16M[irm - 1];
1917 else if (
ieta == 16 && isid > 0)
1918 ihtr_fi = HO_htr_fi_450eta16P[irm - 1][sector / 2 - 1];
1920 if ((
ieta > 15 && iside > 0) && (icrate == 3 || icrate == 7)) {
1923 }
else if ((
ieta > 15 && iside > 0) && (icrate == 6 || icrate == 13)) {
1931 if (iside == 1 &&
ring == 2) {
1933 ieta = rmspecialeta[0][iet - 10];
1934 letter = rmspeciallet_code[0][iet - 10];
1935 det = rmspecialdet[0][iet - 10];
1936 }
else if (iphi == 67) {
1937 ieta = rmspecialeta[1][iet - 10];
1938 letter = rmspeciallet_code[1][iet - 10];
1939 det = rmspecialdet[1][iet - 10];
1941 }
else if (iside == -1) {
1944 ieta = rmspecialeta[2][iet - 4];
1945 letter = rmspeciallet_code[2][iet - 4];
1946 det = rmspecialdet[2][iet - 4];
1947 }
else if (iphi == 65) {
1948 ieta = rmspecialeta[3][iet - 4];
1949 letter = rmspeciallet_code[3][iet - 4];
1950 det = rmspecialdet[3][iet - 4];
1952 }
else if (
ring == 2) {
1954 ieta = rmspecialeta[4][iet - 10];
1955 letter = rmspeciallet_code[4][iet - 10];
1956 det = rmspecialdet[4][iet - 10];
1957 }
else if (iphi == 31) {
1958 ieta = rmspecialeta[5][iet - 10];
1959 letter = rmspeciallet_code[5][iet - 10];
1960 det = rmspecialdet[5][iet - 10];
1986 HOHXEntries.push_back(hoxlmapentry);
1991 unsigned int denseId;
1994 HoHash2Entry.at(denseId) = HOHXEntries.size();
1997 HxCalibHash2Entry.at(denseId) = HOHXEntries.size();
2009 if (irm_fi % 2 == 0)
2012 iadc = NFCH + (ifi_ch + 1) % 3;
2013 iqie = (irm_fi - 2) / 2 + 1;
2014 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][4][(irm - 1) / 2][sidear];
2019 ihtr = ihslotho[php2mod18ov6][ih];
2020 ispigot = ihtr < 9 ? (ihtr - 2) * 2 + itb : (ihtr - 13) * 2 + itb;
2021 idcc = ihtr < 9 ? 1 : 2;
2022 idcc_sl = idcc == 1 ? 10 : 20;
2023 ifed = fedhonum[ic][idcc - 1];
2048 HOHXEntries.push_back(hoxlmapentry);
2053 unsigned int denseId;
2056 HoHash2Entry.at(denseId) = HOHXEntries.size();
2059 HxCalibHash2Entry.at(denseId) = HOHXEntries.size();
2061 }
else if (ipixel == 17) {
2069 if (irm_fi % 2 == 0)
2072 iadc = NFCH + (ifi_ch + 1) % 3;
2073 iqie = (irm_fi - 2) / 2 + 1;
2074 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][4][(irm - 1) / 2][sidear];
2075 if (phmod6 == 1 || phmod6 == 3) {
2082 ispigot = ihtr < 9 ? (ihtr - 2) * 2 + itb : (ihtr - 13) * 2 + itb;
2083 idcc = ihtr < 9 ? 1 : 2;
2084 idcc_sl = idcc == 1 ? 10 : 20;
2085 ifed = fedhonum[ic][idcc - 1];
2110 HOHXEntries.push_back(hoxlmapentry);
2115 unsigned int denseId;
2118 HoHash2Entry.at(denseId) = HOHXEntries.size();
2121 HxCalibHash2Entry.at(denseId) = HOHXEntries.size();
2131 std::vector<CALIBLogicalMapEntry>& CALIBEntries,
2132 std::vector<uint32_t>& LinearIndex2Entry,
2133 std::vector<uint32_t>& HxCalibHash2Entry) {
2136 int calibcrate_loc[NCALIBCR] = {4, 0, 1, 5, 11, 15, 17, 14, 10, 9, 7, 6, 13};
2137 memcpy(calibcrate, calibcrate_loc,
sizeof(
int) * NCALIBCR);
2139 int fedcalibnum_loc[NCALIBCR][2] = {{700, 701},
2152 memcpy(fedcalibnum, fedcalibnum_loc,
sizeof(
int) * NCALIBCR * 2);
2154 int icalibphis_loc[NCALIBCR] = {3, 11, 19, 27, 35, 43, 51, 59, 67, 27, 17, 35, 53};
2155 memcpy(icalibphis, icalibphis_loc,
sizeof(
int) * NCALIBCR);
2157 int icalibsector_min_loc[NCALIBCR] = {2, 4, 6, 8, 10, 12, 14, 16, 18, 1, 4, 7, 10};
2158 memcpy(icalibsector_min, icalibsector_min_loc,
sizeof(
int) * NCALIBCR);
2160 int icalibsector_max_loc[NCALIBCR] = {3, 5, 7, 9, 11, 13, 15, 17, 1, 4, 6, 9, 12};
2161 memcpy(icalibsector_max, icalibsector_max_loc,
sizeof(
int) * NCALIBCR);
2163 std::string detIDCALIB_loc[NCALIBCR][NTOPBOT] = {{
"HB",
"HE"},
2176 for (
int jj = 0;
jj < NCALIBCR;
jj++) {
2177 for (
int kk = 0;
kk < NTOPBOT;
kk++) {
2178 detIDCALIB[
jj][
kk] = detIDCALIB_loc[
jj][
kk];
2182 int nfbr_max_loc[NCALIBCR][NTOPBOT] = {
2183 {4, 8}, {4, 8}, {4, 8}, {4, 8}, {4, 8}, {4, 8}, {4, 8}, {4, 8}, {4, 8}, {4, 4}, {8, 4}, {8, 8}, {8, 4}};
2184 memcpy(nfbr_max, nfbr_max_loc,
sizeof(
int) * NCALIBCR * NTOPBOT);
2186 int calibHOinfo_loc[NHOCR][NTOPBOT][NFBR][2] = {
2188 {{{4, 0}, {5, 0}, {6, 0}, {}, {6, -2}, {6, -1}, {6, 1}, {6, 2}},
2189 {{4, -2}, {4, -1}, {4, 1}, {4, 2}, {}, {}, {}, {}}},
2191 {{{7, 0}, {8, 0}, {9, 0}, {}, {8, -2}, {8, -1}, {8, 1}, {8, 2}},
2192 {{1, 0}, {2, 0}, {3, 0}, {}, {2, -2}, {2, -1}, {2, 1}, {2, 2}}},
2194 {{{10, 0}, {11, 0}, {12, 0}, {}, {10, -2}, {10, -1}, {10, 1}, {10, 2}},
2195 {{12, -2}, {12, -1}, {12, 1}, {12, 2}, {}, {}, {}, {}}}
2197 memcpy(calibHOinfo, calibHOinfo_loc,
sizeof(
int) * NHOCR * NTOPBOT * NFBR * 2);
2201 char tempbuff[30]{0};
2205 stringstream mystream;
2215 for (ic = 0; ic < NHBHECR; ic++) {
2216 icrate = calibcrate[ic];
2217 ifed = fedcalibnum[ic][idcc - 1];
2219 for (itb = 0; itb < NTOPBOT; itb++) {
2221 for (ifb = 0; ifb < nfbr_max[ic][itb]; ifb++) {
2222 det = detIDCALIB[ic][itb];
2227 if (ihtr_fi % 2 == 0)
2232 if (ihtr_fi == 1 || ihtr_fi == 2 || ihtr_fi == 5 || ihtr_fi == 6) {
2233 iwedge = icalibsector_min[ic];
2234 }
else if (ihtr_fi == 3 || ihtr_fi == 4 || ihtr_fi == 7 || ihtr_fi == 8) {
2235 iwedge = icalibsector_max[ic];
2248 }
else if (det ==
"HB") {
2251 (ihtr_fi % 2 == 1) ? iwedge = icalibsector_min[ic] : iwedge = icalibsector_max[ic];
2264 iphi = ((iwedge * idphi) + 71 - idphi) % 72;
2265 subdet =
"CALIB_" + det;
2266 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
2267 mystream << tempbuff;
2268 rbx = mystream.str();
2271 for (ifc = 0; ifc < NFCH; ifc++) {
2278 else if (ifc == 2) {
2281 else if (det ==
"HE")
2284 }
else if (irm_fi == 2) {
2309 CALIBEntries.push_back(caliblmapentry);
2316 HxCalibHash2Entry.at(hashedId) = CALIBEntries.size();
2324 for (itb = 0; itb < NTOPBOT; itb++) {
2326 for (ifb = 0; ifb < 4; ifb++) {
2328 for (ifc = 0; ifc < NFCH; ifc++) {
2329 icrate = calibcrate[ic];
2333 (ihtr_fi == 1) ?
iphi = 1 : ((ihtr_fi == 2) ?
iphi = 19 : ((ihtr_fi == 3) ?
iphi = 37 :
iphi = 55));
2335 ifed = fedcalibnum[ic][idcc - 1];
2336 (ifc == 0) ? ich_type = 8 : (ifc == 1 ? ich_type = 0 : ich_type = 1);
2341 iwedge = 2 + (ifb * 3);
2355 subdet =
"CALIB_" + det;
2356 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
2357 mystream << tempbuff;
2358 rbx = mystream.str();
2377 CALIBEntries.push_back(caliblmapentry);
2384 HxCalibHash2Entry.at(hashedId) = CALIBEntries.size();
2390 for (ic = ic + 1; ic < NCALIBCR; ic++) {
2391 icrate = calibcrate[ic];
2393 ifed = fedcalibnum[ic][idcc - 1];
2395 for (itb = 0; itb < NTOPBOT; itb++) {
2396 det = detIDCALIB[ic][itb];
2398 for (ifb = 0; ifb < nfbr_max[ic][itb]; ifb++) {
2407 iwedge = calibHOinfo[ic - 10][itb][ifb][0];
2408 ieta = calibHOinfo[ic - 10][itb][ifb][1];
2412 }
else if (
ieta > 0) {
2421 else if (
ieta == -1)
2428 subdet =
"CALIB_" + det;
2430 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
2432 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%c%2.2i", det.c_str(), S_side, sidesign, iwedge);
2433 mystream << tempbuff;
2434 rbx = mystream.str();
2442 (
ieta == -2) ? (iwedge == 12 ? NFCH_HO = 3 : NFCH_HO = 2) : (iwedge == 10) ? NFCH_HO = 3 : NFCH_HO = 2;
2443 for (ifc = 0; ifc < NFCH_HO; ifc++) {
2445 (ifi_ch == 2) ? ich_type = 7 : ich_type = ifi_ch;
2446 (
ieta == 0) ? idphi = 6 : idphi = 12;
2448 (
ieta == 0) ?
iphi = ((iwedge * idphi) + 71 - idphi) % 72 :
iphi = (((iwedge / 2) * idphi) + 71 - idphi) % 72;
2451 if (iside == 0 && ifb == 3)
2470 CALIBEntries.push_back(caliblmapentry);
2477 HxCalibHash2Entry.at(hashedId) = CALIBEntries.size();
2486 std::vector<ZDCLogicalMapEntry>& ZDCEntries,
2487 std::vector<uint32_t>& LinearIndex2Entry,
2488 std::vector<uint32_t>& ZdcHash2Entry) {
2492 stringstream mystream;
2502 for (itb = 0; itb < NTOPBOT; itb++) {
2519 for (icab = 1; icab < NZDCCAB + 1; icab++) {
2524 }
else if (icab < 7) {
2537 ihtr_fi = irm_fi + 3;
2578 ZDCEntries.push_back(zdclmapentry);
2587 std::vector<HTLogicalMapEntry>& HTEntries,
2615 string t_chDet, t_fpga;
2616 string t_slnam, t_rctnam, t_slbin, t_slbin2;
2619 int t_side, t_iEta, t_iPhi, t_jPhi, t_iDep, t_topbot;
2620 int t_wedge, t_crate, t_htr;
2622 int t_spigo, t_slb, t_rctcra, t_rctcar, t_rctcon, t_fedid;
2625 (fpga ==
"bot") ? t_topbot = 1 : t_topbot = 0;
2657 if (t_chDet ==
"HE" && t_iEta == 29)
2660 if (t_chDet ==
"HF") {
2662 if (t_iEta == 30 || t_iEta == 31 || t_iEta == 33 || t_iEta == 34 || t_iEta == 36 || t_iEta == 37 ||
2663 t_iEta == 39 || t_iEta == 40 || t_iEta == 41)
2666 else if (t_iEta == 32)
2668 else if (t_iEta == 35)
2670 else if (t_iEta == 38)
2673 if (t_iPhi == 3 || t_iPhi == 7 || t_iPhi == 11 || t_iPhi == 15 || t_iPhi == 19 || t_iPhi == 23 || t_iPhi == 27 ||
2674 t_iPhi == 31 || t_iPhi == 35 || t_iPhi == 39 || t_iPhi == 43 || t_iPhi == 47 || t_iPhi == 51 ||
2675 t_iPhi == 55 || t_iPhi == 59 || t_iPhi == 63 || t_iPhi == 67 || t_iPhi == 71)
2683 if (t_slbin !=
"NA") {
2684 if (t_slbin2 !=
"NA")
2686 if (t_slbin ==
"A0" || t_slbin ==
"B0")
2688 else if (t_slbin ==
"A1" || t_slbin ==
"B1")
2690 else if (t_slbin ==
"C0" || t_slbin ==
"D0")
2692 else if (t_slbin ==
"C1" || t_slbin ==
"D1")
2716 HTEntries.push_back(htlmapentry);
2718 if (t_slbin2 !=
"NA") {
2719 if (t_slbin2 ==
"A0" || t_slbin2 ==
"B0")
2721 else if (t_slbin2 ==
"A1" || t_slbin2 ==
"B1")
2723 else if (t_slbin2 ==
"C0" || t_slbin2 ==
"D0")
2725 else if (t_slbin2 ==
"C1" || t_slbin2 ==
"D1")
2751 HTEntries.push_back(htlmapentry);
HcalLogicalMapGenerator()
static uint32_t makeEntryNumber(bool, int, int)
unsigned int detId2denseIdHF(const DetId &id) const
return a linear packed id from HF
unsigned int detId2denseIdHB(const DetId &id) const
return a linear packed id from HB
void buildZDCMap(const HcalTopology *topo, std::vector< ZDCLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
const uint32_t getLinearIndex() const
uint32_t getLinearIndex() const
const DetId getDetId() const
const DetId getDetId() const
HcalLogicalMap createMap(const HcalTopology *topo, unsigned int mapIOV=4)
const uint32_t getLinearIndex() const
void buildCALIBMap(const HcalTopology *topo, std::vector< CALIBLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
const uint32_t getLinearIndex() const
static const int maxLinearIndex
void buildHOXMap(const HcalTopology *topo, std::vector< HOHXLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
unsigned int detId2denseIdHO(const DetId &id) const
return a linear packed id from HO
unsigned int detId2denseIdHE(const DetId &id) const
return a linear packed id from HE
const DetId getDetId() const
void ConstructTriggerTower(const HcalTopology *topo, std::vector< HTLogicalMapEntry > &, int i_side, int i_eta, int i_phi, int i_dphi, int i_depth, std::string i_det, int i_wedge, int i_rm, int i_pixel, int i_qie, int i_adc, int i_rm_fi, int i_fi_ch, int i_crate, int i_htr, std::string i_fpga, int i_htr_fi, int i_spigot, int i_slb, std::string i_slbin, std::string i_slbin2, std::string i_slnam, int i_rctcra, int i_rctcar, int i_rctcon, std::string i_rctnam, int i_fed)
void buildHBEFTMap(const HcalTopology *topo, std::vector< HBHEHFLogicalMapEntry > &, std::vector< HTLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
unsigned int detId2denseIdCALIB(const DetId &id) const
return a linear packed id from CALIB
~HcalLogicalMapGenerator()