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 HbHash2Entry.reserve(2 * HbHalf);
68 for (
int iHb = 0; iHb < 2 * HbHalf; iHb++)
69 HbHash2Entry.push_back(illegal_value);
70 HeHash2Entry.reserve(2 * HeHalf);
71 for (
int iHe = 0; iHe < 2 * HeHalf; iHe++)
72 HeHash2Entry.push_back(illegal_value);
73 HfHash2Entry.reserve(2 * HfHalf);
74 for (
int iHf = 0; iHf < 2 * HfHalf; iHf++)
75 HfHash2Entry.push_back(illegal_value);
76 HtHash2Entry.reserve(2 * HtHalf);
77 for (
int iHt = 0; iHt < 2 * HtHalf; iHt++)
78 HtHash2Entry.push_back(illegal_value);
79 HoHash2Entry.reserve(2 * HoHalf);
80 for (
int iHo = 0; iHo < 2 * HoHalf; iHo++)
81 HoHash2Entry.push_back(illegal_value);
82 HxCalibHash2Entry.reserve(CalibFull);
83 for (
int iHcalib = 0; iHcalib < CalibFull; iHcalib++)
84 HxCalibHash2Entry.push_back(illegal_value);
85 ZdcHash2Entry.reserve(2 * ZdcHalf);
86 for (
int iZdc = 0; iZdc < 2 * ZdcHalf; iZdc++)
87 ZdcHash2Entry.push_back(illegal_value);
90 topo, HBHEHFEntries, HTEntries, LinearIndex2Entry, HbHash2Entry, HeHash2Entry, HfHash2Entry, HtHash2Entry);
91 buildHOXMap(topo, HOHXEntries, LinearIndex2Entry, HoHash2Entry, HxCalibHash2Entry);
92 buildCALIBMap(topo, CALIBEntries, LinearIndex2Entry, HxCalibHash2Entry);
93 buildZDCMap(topo, ZDCEntries, LinearIndex2Entry, ZdcHash2Entry);
112 std::vector<HBHEHFLogicalMapEntry>& HBHEHFEntries,
113 std::vector<HTLogicalMapEntry>& HTEntries,
114 std::vector<uint32_t>& LinearIndex2Entry,
115 std::vector<uint32_t>& HbHash2Entry,
116 std::vector<uint32_t>& HeHash2Entry,
117 std::vector<uint32_t>& HfHash2Entry,
118 std::vector<uint32_t>& HtHash2Entry) {
121 int hbhecrate_loc[NHBHECR] = {0, 1, 4, 5, 10, 11, 14, 15, 17};
122 memcpy(hbhecrate, hbhecrate_loc,
sizeof(
int) * NHBHECR);
124 int fedhbhenum_loc[NHBHECR][2] = {
125 {702, 703}, {704, 705}, {700, 701}, {706, 707}, {716, 717}, {708, 709}, {714, 715}, {710, 711}, {712, 713}};
126 memcpy(fedhbhenum, fedhbhenum_loc,
sizeof(
int) * NHBHECR * 2);
128 int ihslot_loc[NHSETS] = {2, 5, 13, 16};
129 memcpy(ihslot, ihslot_loc,
sizeof(
int) * NHSETS);
131 int ihbhephis_loc[NHBHECR] = {11, 19, 3, 27, 67, 35, 59, 43, 51};
132 memcpy(ihbhephis, ihbhephis_loc,
sizeof(
int) * NHBHECR);
134 int ihbheetadepth_loc[NHTRS][NTOPBOT][NFBR][NFCH][2] = {{{{{11, 1}, {7, 1}, {3, 1}},
135 {{5, 1}, {1, 1}, {9, 1}},
136 {{11, 1}, {7, 1}, {3, 1}},
137 {{5, 1}, {1, 1}, {9, 1}},
138 {{10, 1}, {6, 1}, {2, 1}},
139 {{8, 1}, {4, 1}, {12, 1}},
140 {{10, 1}, {6, 1}, {2, 1}},
141 {{8, 1}, {4, 1}, {12, 1}}},
142 {{{11, 1}, {7, 1}, {3, 1}},
143 {{5, 1}, {1, 1}, {9, 1}},
144 {{11, 1}, {7, 1}, {3, 1}},
145 {{5, 1}, {1, 1}, {9, 1}},
146 {{10, 1}, {6, 1}, {2, 1}},
147 {{8, 1}, {4, 1}, {12, 1}},
148 {{10, 1}, {6, 1}, {2, 1}},
149 {{8, 1}, {4, 1}, {12, 1}}}},
150 {{{{16, 2}, {15, 2}, {14, 1}},
151 {{15, 1}, {13, 1}, {16, 1}},
152 {{16, 2}, {15, 2}, {14, 1}},
153 {{15, 1}, {13, 1}, {16, 1}},
154 {{17, 1}, {16, 3}, {26, 1}},
155 {{18, 1}, {18, 2}, {26, 2}},
156 {{17, 1}, {16, 3}, {25, 1}},
157 {{18, 1}, {18, 2}, {25, 2}}},
158 {{{16, 2}, {15, 2}, {14, 1}},
159 {{15, 1}, {13, 1}, {16, 1}},
160 {{16, 2}, {15, 2}, {14, 1}},
161 {{15, 1}, {13, 1}, {16, 1}},
162 {{17, 1}, {16, 3}, {25, 1}},
163 {{18, 1}, {18, 2}, {25, 2}},
164 {{17, 1}, {16, 3}, {26, 1}},
165 {{18, 1}, {18, 2}, {26, 2}}}},
166 {{{{28, 1}, {28, 2}, {29, 1}},
167 {{28, 3}, {24, 2}, {24, 1}},
168 {{27, 1}, {27, 2}, {29, 2}},
169 {{27, 3}, {23, 2}, {23, 1}},
170 {{19, 2}, {20, 1}, {22, 2}},
171 {{19, 1}, {20, 2}, {22, 1}},
172 {{19, 2}, {20, 1}, {21, 2}},
173 {{19, 1}, {20, 2}, {21, 1}}},
174 {{{27, 1}, {27, 2}, {29, 2}},
175 {{27, 3}, {23, 2}, {23, 1}},
176 {{28, 1}, {28, 2}, {29, 1}},
177 {{28, 3}, {24, 2}, {24, 1}},
178 {{19, 2}, {20, 1}, {21, 2}},
179 {{19, 1}, {20, 2}, {21, 1}},
180 {{19, 2}, {20, 1}, {22, 2}},
181 {{19, 1}, {20, 2}, {22, 1}}}}};
182 memcpy(ihbheetadepth, ihbheetadepth_loc,
sizeof(
int) * NHTRS * NTOPBOT * NFBR * NFCH * 2);
186 int irm_rmfiHBHE_loc[NHTRS][NTOPBOT][NFBR][2] = {
187 {{{6, 1}, {7, 1}, {6, 2}, {7, 2}, {4, 1}, {5, 1}, {4, 2}, {5, 2}},
188 {{6, 3}, {7, 3}, {6, 4}, {7, 4}, {4, 3}, {5, 3}, {4, 4}, {5, 4}}},
189 {{{2, 1}, {3, 1}, {2, 2}, {3, 2}, {2, 1}, {3, 1}, {2, 2}, {3, 2}},
190 {{2, 3}, {3, 3}, {2, 4}, {3, 4}, {2, 3}, {3, 3}, {2, 4}, {3, 4}}},
191 {{{4, 1}, {5, 1}, {4, 2}, {5, 2}, {6, 1}, {7, 1}, {6, 2}, {7, 2}},
192 {{4, 3}, {5, 3}, {4, 4}, {5, 4}, {6, 3}, {7, 3}, {6, 4}, {7, 4}}}
194 memcpy(irm_rmfiHBHE, irm_rmfiHBHE_loc,
sizeof(
int) * NHTRS * NTOPBOT * NFBR * 2);
197 int ipixelHB_loc[NRMFIBR][NFCH][NRMSLOT] = {
199 {{18, 17, 3, 2}, {13, 3, 17, 7}, {14, 1, 19, 6}},
200 {{19, 2, 18, 1}, {15, 7, 13, 5}, {17, 19, 1, 3}},
201 {{9, 4, 16, 11}, {5, 8, 12, 15}, {2, 13, 7, 18}},
202 {{12, 11, 9, 8}, {7, 15, 5, 13}, {16, 6, 14, 4}},
203 {{8, 5, 15, 12}, {4, 9, 11, 16}, {1, 14, 6, 19}},
204 {{6, 16, 4, 14}, {3, 18, 2, 17}, {11, 12, 8, 9}}
206 memcpy(ipixelHB, ipixelHB_loc,
sizeof(
int) * NRMFIBR * NFCH * NRMSLOT);
208 int ipixelHE_loc[NRMFIBR][NFCH][NRMSLOT] = {
210 {{12, 12, 12, 12}, {16, 7, 16, 7}, {7, 16, 7, 16}},
211 {{11, 11, 11, 11}, {19, 3, 19, 3}, {3, 19, 3, 19}},
212 {{15, 15, 6, 6}, {2, 18, 2, 18}, {6, 6, 15, 15}},
213 {{5, 14, 5, 14}, {14, 5, 14, 5}, {18, 2, 18, 2}},
214 {{17, 1, 17, 1}, {9, 9, 9, 9}, {1, 17, 1, 17}},
215 {{13, 4, 13, 4}, {8, 8, 8, 8}, {4, 13, 4, 13}}
217 memcpy(ipixelHE, ipixelHE_loc,
sizeof(
int) * NRMFIBR * NFCH * NRMSLOT);
223 const char* S_slbin_odd_loc[] = {
"A1",
"B0",
"B1",
"A0",
"A1",
"B0",
"B1",
"A0"};
224 for (
int gg = 0; gg < 8; gg++) {
225 S_slbin_odd[gg] = S_slbin_odd_loc[gg];
227 const char* S_slbin_even_loc[] = {
"C1",
"D0",
"D1",
"C0",
"C1",
"D0",
"D1",
"C0"};
228 for (
int gg = 0; gg < 8; gg++) {
229 S_slbin_even[gg] = S_slbin_even_loc[gg];
231 const char* rct_rackHBHE_loc[] = {
"S2E01-RH",
249 for (
int gg = 0; gg < 18; gg++) {
250 rct_rackHBHE[gg] = rct_rackHBHE_loc[gg];
253 int slb_table_loc[29] = {1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
254 1, 1, 2, 2, 3, 3, 1, 1,
255 2, 2, 3, 3, 4, 4, 4, 4, 4};
256 memcpy(slb_table, slb_table_loc,
sizeof(
int) * 29);
259 char tempbuff[30]{0};
262 stringstream mystream;
265 for (ic = 0; ic < NHBHECR; ic++) {
267 for (is = 0; is < NHSETS; is++) {
269 for (ih = 0; ih < NHTRS; ih++) {
271 for (itb = 0; itb < NTOPBOT; itb++) {
273 for (ifb = 0; ifb < NFBR; ifb++) {
275 for (ifc = 0; ifc < NFCH; ifc++) {
276 icrate = hbhecrate[ic];
277 iside = is < NHSETS / 2 ? -1 : 1;
278 ifwtb = (is / 2 + itb + 1) % 2;
279 ieta = ihbheetadepth[ih][ifwtb][ifb][ifc][0];
280 idepth = ihbheetadepth[ih][ifwtb][ifb][ifc][1];
281 ihtr = ihslot[is] + ih;
282 (
ieta > 16 || idepth > 2) ? det =
"HE" : det =
"HB";
283 (itb % 2) == 1 ? fpga =
"bot" : fpga =
"top";
286 iphi = (
ieta > 20) ? (ihbhephis[ic] + (is % 2) * 4 + itb * 2 - 1) % 72 + 1
287 : (ihbhephis[ic] + (is % 2) * 4 + itb * 2 + (ifb / 2 + is / 2 + 1) % 2 - 1) % 72 + 1;
288 ispigot = (is % 2) * 6 + ih * 2 + itb;
289 idcc = is < NHSETS / 2 ? 1 : 2;
290 idcc_sl = idcc == 1 ? 10 : 20;
291 ifed = fedhbhenum[ic][idcc - 1];
299 irm = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][1];
300 irm_fi = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][0];
303 if (
ieta >= 21 && (irm == 1 || irm == 3))
304 iwedge = (
iphi + 1 + irm + 1) / 4;
306 iwedge = (
iphi + irm + 1) / 4;
314 irm = irm_rmfiHBHE[ih][itb][ifb][1];
315 irm_fi = irm_rmfiHBHE[ih][itb][ifb][0];
318 if (
ieta >= 21 && (irm == 4 || irm == 2))
319 iwedge = (
iphi + 1 - irm + 6) / 4;
321 iwedge = (
iphi - irm + 6) / 4;
328 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
329 mystream << tempbuff;
330 rbx = mystream.str();
337 if (
ieta > 16 || idepth > 2)
338 ipixel = ipixelHE[irm_fi - 2][ifc][irm - 1];
340 ipixel = ipixelHB[irm_fi - 2][ifc][irm - 1];
342 iqie = iadcquiHBHE[irm_fi - 2][ifc][0];
343 iadc = iadcquiHBHE[irm_fi - 2][ifc][1];
347 phideg = phideg + 72;
348 phideg = (phideg / 4) * 20 + 10;
349 irctcra = ((89 - phideg + 720) % 360) / 20;
350 oddcard = irctcra % 2;
353 irctcra = irctcra + 9;
355 etaslb = ((
ieta - 1) / 2) * 2 + 1;
359 snprintf(tempbuff,
sizeof tempbuff,
"SLB_H_%3.3d%c%2.2d", phideg, S_side, etaslb);
360 mystream << tempbuff;
361 slnam = mystream.str();
364 islb = slb_table[
ieta - 1];
368 irctcar = 2 * ((
ieta - 1) / 8) + oddcard;
369 irctcon = 2 * (((
ieta - 1) / 2) % 4);
379 irctcon = 2 * (((
eta3 - 1) / 2) % 4);
381 irctcon = 11 * irctcon + 1;
383 snprintf(tempbuff,
sizeof tempbuff,
"%s-%1d-HD%2.2d", rct_rackHBHE[irctcra], irctcar, irctcon);
384 mystream << tempbuff;
385 rctnam = mystream.str();
392 for (
i = 0;
i < 18;
i++) {
393 if (
iphi <
i * 4 + 3) {
406 mystream << S_slbin_odd[phimod8];
408 mystream << S_slbin_even[phimod8];
409 }
else if (crazy == 0) {
411 mystream << S_slbin_odd[phimod8];
413 mystream << S_slbin_even[phimod8];
416 mystream << S_slbin_even[phimod8];
418 mystream << S_slbin_odd[phimod8];
421 slbin = mystream.str();
461 HBHEHFEntries.push_back(hbeflmapentry);
466 unsigned int denseId;
469 HbHash2Entry.at(denseId) = HBHEHFEntries.size();
473 HeHash2Entry.at(denseId) = HBHEHFEntries.size();
477 HfHash2Entry.at(denseId) = HBHEHFEntries.size();
480 ConstructTriggerTower(topo,
518 int hfcrate_loc[NHFCR] = {2, 9, 12};
519 memcpy(hfcrate, hfcrate_loc,
sizeof(
int) * NHFCR);
521 int fedhfnum_loc[NHFCR][2] = {{718, 719}, {720, 721}, {722, 723}};
522 memcpy(fedhfnum, fedhfnum_loc,
sizeof(
int) * NHFCR * 2);
524 int ihfphis_loc[NHFCR] = {3, 27, 51};
525 memcpy(ihfphis, ihfphis_loc,
sizeof(
int) * NHFCR);
527 int ihfetadepth_loc[NTOPBOT][NFBR][NFCH][2] = {{{{33, 1}, {31, 1}, {29, 1}},
528 {{32, 1}, {30, 1}, {34, 1}},
529 {{33, 2}, {31, 2}, {29, 2}},
530 {{32, 2}, {30, 2}, {34, 2}},
531 {{34, 2}, {32, 2}, {30, 2}},
532 {{31, 2}, {29, 2}, {33, 2}},
533 {{34, 1}, {32, 1}, {30, 1}},
534 {{31, 1}, {29, 1}, {33, 1}}},
535 {{{41, 1}, {37, 1}, {35, 1}},
536 {{38, 1}, {36, 1}, {39, 1}},
537 {{41, 2}, {37, 2}, {35, 2}},
538 {{38, 2}, {36, 2}, {39, 2}},
539 {{40, 2}, {38, 2}, {36, 2}},
540 {{37, 2}, {35, 2}, {39, 2}},
541 {{40, 1}, {38, 1}, {36, 1}},
542 {{37, 1}, {35, 1}, {39, 1}}}};
543 memcpy(ihfetadepth, ihfetadepth_loc,
sizeof(
int) * NTOPBOT * NFBR * NFCH * 2);
545 int irm_rmfiHF_loc[NHTRS][NTOPBOT][NFBR][2] = {
546 {{{1, 2}, {2, 2}, {3, 2}, {4, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}},
547 {{5, 2}, {6, 2}, {7, 2}, {8, 2}, {5, 3}, {6, 3}, {7, 3}, {8, 3}}},
548 {{{1, 1}, {2, 1}, {3, 1}, {4, 1}, {1, 2}, {2, 2}, {3, 2}, {4, 2}},
549 {{5, 1}, {6, 1}, {7, 1}, {8, 1}, {5, 2}, {6, 2}, {7, 2}, {8, 2}}},
550 {{{1, 3}, {2, 3}, {3, 3}, {4, 3}, {1, 1}, {2, 1}, {3, 1}, {4, 1}},
551 {{5, 3}, {6, 3}, {7, 3}, {8, 3}, {5, 1}, {6, 1}, {7, 1}, {8, 1}}}
553 memcpy(irm_rmfiHF, irm_rmfiHF_loc,
sizeof(
int) * NHTRS * NTOPBOT * NFBR * 2);
556 const char* S_slbin_7_loc[] = {
"A0",
"A1",
"B0",
"B1"};
557 for (
int gg = 0; gg < 4; gg++) {
558 S_slbin_7[gg] = S_slbin_7_loc[gg];
560 const char* S_slbin_3_loc[] = {
"C0",
"C1",
"D0",
"D1"};
561 for (
int gg = 0; gg < 4; gg++) {
562 S_slbin_3[gg] = S_slbin_3_loc[gg];
564 const char* rct_rackHF_loc[] = {
"S2E01-FH",
582 for (
int gg = 0; gg < 18; gg++) {
583 rct_rackHF[gg] = rct_rackHF_loc[gg];
589 for (ic = 0; ic < NHFCR; ic++) {
591 for (is = 0; is < NHSETS; is++) {
593 for (ih = 0; ih < NHTRS; ih++) {
595 for (itb = 0; itb < NTOPBOT; itb++) {
597 for (ifb = 0; ifb < NFBR; ifb++) {
599 for (ifc = 0; ifc < NFCH; ifc++) {
600 icrate = hfcrate[ic];
601 iside = is < NHSETS / 2 ? -1 : 1;
602 ieta = ihfetadepth[itb][ifb][ifc][0];
603 idepth = ihfetadepth[itb][ifb][ifc][1];
604 ihtr = ihslot[is] + ih;
606 (itb % 2) == 1 ? fpga =
"bot" : fpga =
"top";
609 iphi = (
ieta > 39) ? (ihfphis[ic] + (is % 2) * 12 + ih * 4 - 1) % 72 + 1
610 : (ihfphis[ic] + (is % 2) * 12 + ih * 4 + (ifb / 4) * 2 - 1) % 72 + 1;
611 ispigot = (is % 2) * 6 + ih * 2 + itb;
612 idcc = is < NHSETS / 2 ? 1 : 2;
613 idcc_sl = idcc == 1 ? 10 : 20;
614 ifed = fedhfnum[ic][idcc - 1];
616 irm_fi = irm_rmfiHF[ih][itb][ifb][0];
628 else if (
iphi % 4 == 1)
630 else if (
iphi % 4 == 3)
633 edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Even iphi in HFM" << endl;
641 if ((iside == 1 &&
ieta == 40) || (iside == -1 &&
ieta == 41)) {
642 irm = ((
iphi + 1) / 2) % 36 + 1;
643 hfphi = ((
iphi + 1) / 6) % 12 + 1;
645 irm = (
iphi + 1) / 2;
646 hfphi = (
iphi - 1) / 6 + 1;
648 irm = (irm - 1) % 3 + 1;
654 iwedge = (
iphi + 1) / 4 + 1;
657 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, hfphi);
658 mystream << tempbuff;
659 rbx = mystream.str();
666 iqie = (irm_fi - 1) / 2 + 1;
671 iadc = NFCH + (ifi_ch + 1) % 3;
677 phideg = phideg + 72;
678 phideg = (phideg / 4) * 20 + 10;
679 irctcra = ((89 - phideg + 720) % 360) / 40;
681 irctcra = irctcra + 9;
689 snprintf(tempbuff,
sizeof tempbuff,
"SLB_H_%3.3d%c%2.2d", phideg, S_side, etaslb);
690 mystream << tempbuff;
691 slnam = mystream.str();
694 snprintf(tempbuff,
sizeof tempbuff,
"%s-JSC-HF_IN", rct_rackHF[irctcra]);
695 mystream << tempbuff;
696 rctnam = mystream.str();
701 int phibin = (
iphi + 1) % 8;
702 int etabin = (
ieta - 29) / 3;
708 mystream << S_slbin_7[etabin];
710 mystream << S_slbin_3[etabin];
712 slbin = mystream.str();
750 HBHEHFEntries.push_back(hbeflmapentry);
755 unsigned int denseId;
758 HbHash2Entry.at(denseId) = HBHEHFEntries.size();
762 HeHash2Entry.at(denseId) = HBHEHFEntries.size();
766 HfHash2Entry.at(denseId) = HBHEHFEntries.size();
769 ConstructTriggerTower(topo,
807 std::vector<HOHXLogicalMapEntry>& HOHXEntries,
808 std::vector<uint32_t>& LinearIndex2Entry,
809 std::vector<uint32_t>& HoHash2Entry,
810 std::vector<uint32_t>& HxCalibHash2Entry) {
813 int hocrate_loc[NHOCR] = {3, 7, 6, 13};
814 memcpy(hocrate, hocrate_loc,
sizeof(
int) * NHOCR);
816 int fedhonum_loc[NHOCR][2] = {{724, 725}, {726, 727}, {728, 729}, {730, 731}};
817 memcpy(fedhonum, fedhonum_loc,
sizeof(
int) * NHOCR * 2);
819 int ihslotho_loc[NHSETSHO][NHTRSHO] = {{2, 3, 4, 5}, {6, 7, 13, 14}, {15, 16, 17, 18}};
820 memcpy(ihslotho, ihslotho_loc,
sizeof(
int) * NHSETSHO * NHTRSHO);
822 int ihophis_loc[NHOCR] = {71, 17, 35, 53};
823 memcpy(ihophis, ihophis_loc,
sizeof(
int) * NHOCR);
828 int HO_RM_table_loc[24][16][2] = {{{2, 2},
1212 memcpy(HO_RM_table, HO_RM_table_loc,
sizeof(
int) * 24 * 16 * 2);
1215 int HO_RM_fi_eta5to15_loc[11] = {3, 2, 5, 4, 7, 6, 3, 2, 5, 4, 7};
1216 memcpy(HO_RM_fi_eta5to15, HO_RM_fi_eta5to15_loc,
sizeof(
int) * 11);
1231 int HO_RM_fi_eta1to4_loc[24][2][2] = {
1233 {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}, {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}, {{2, 6}, {5, 4}},
1234 {{3, 7}, {5, 4}}, {{2, 6}, {5, 4}}, {{3, 7}, {5, 4}},
1235 {{2, 6}, {5, 4}}, {{3, 7}, {5, 4}}, {{2, 6}, {5, 4}}, {{3, 7}, {5, 4}}, {{2, 6}, {5, 4}},
1236 {{3, 7}, {5, 4}}, {{2, 6}, {5, 4}}, {{3, 7}, {5, 4}},
1237 {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}, {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}, {{7, 3}, {4, 5}},
1238 {{6, 2}, {4, 5}}, {{7, 3}, {4, 5}}, {{6, 2}, {4, 5}}
1240 memcpy(HO_RM_fi_eta1to4, HO_RM_fi_eta1to4_loc,
sizeof(
int) * 24 * 2 * 2);
1251 int HO_RM_fi_eta1to4_sipm_loc[24][4][2] = {
1253 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1254 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1255 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1256 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1257 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1258 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1259 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1260 {{2, 4}, {4, 7}, {2, 7}, {2, 6}}, {{3, 5}, {5, 5}, {3, 7}, {3, 6}},
1261 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1262 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1263 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1264 {{5, 3}, {5, 5}, {7, 3}, {6, 3}}, {{4, 2}, {7, 4}, {7, 2}, {6, 2}},
1266 memcpy(HO_RM_fi_eta1to4_sipm, HO_RM_fi_eta1to4_sipm_loc,
sizeof(
int) * 24 * 4 * 2);
1269 int HO_htr_fi_450eta5to15_loc[2][11] = {{2, 2, 4, 6, 8, 2, 4, 6, 8, 4, 6},
1270 {2, 8, 6, 4, 2, 8, 6, 4, 2, 4, 2}};
1271 memcpy(HO_htr_fi_450eta5to15, HO_htr_fi_450eta5to15_loc,
sizeof(
int) * 2 * 11);
1274 int HO_htr_fi_450eta16M_loc[4] = {7, 7, 8, 8};
1275 memcpy(HO_htr_fi_450eta16M, HO_htr_fi_450eta16M_loc,
sizeof(
int) * 4);
1278 int HO_htr_fi_450eta16P_loc[4][6] = {
1279 {4, 2, 4, 4, 2, 6}, {2, 6, 6, 2, 6, 4}, {5, 3, 5, 5, 3, 7}, {3, 7, 7, 3, 7, 5}};
1280 memcpy(HO_htr_fi_450eta16P, HO_htr_fi_450eta16P_loc,
sizeof(
int) * 4 * 6);
1283 int HO_htr_fi_eta4_loc[2][6] = {{6, 6, 8, 8, 7, 7},
1284 {4, 4, 5, 5, 3, 3}};
1286 memcpy(HO_htr_fi_eta4, HO_htr_fi_eta4_loc,
sizeof(
int) * 2 * 6);
1288 int HO_htr_fi_eta123_loc[2][6] = {{6, 5, 4, 3, 8, 7},
1289 {8, 7, 6, 5, 2, 1}};
1291 memcpy(HO_htr_fi_eta123, HO_htr_fi_eta123_loc,
sizeof(
int) * 2 * 6);
1301 int HO_htr_fi_eta1234_sipm[6][5][2][2] = {
1307 {{5, 6}, {-1, -1}}},
1308 {{{6, 7}, {5, 6}}, {{6, 6}, {6, 6}}, {{6, 7}, {5, 7}}, {{5, 7}, {5, 8}}, {{-1, -1}, {4, 8}}},
1309 {{{4, 5}, {5, 6}}, {{5, 5}, {5, 5}}, {{4, 5}, {4, 6}}, {{4, 6}, {3, 6}}, {{-1, -1}, {3, 8}}},
1310 {{{3, 8}, {8, 5}}, {{8, 8}, {4, 8}}, {{3, 5}, {4, 5}}, {{3, 6}, {3, 5}}, {{5, 6}, {-1, -1}}},
1316 {{7, 7}, {-1, -1}}},
1317 {{{7, 1}, {7, 7}}, {{8, 7}, {7, 7}}, {{8, 1}, {7, 1}}, {{7, 1}, {7, 2}}, {{-1, -1}, {3, 2}}},
1325 int ipixelHO_loc[NRMFIBR][NFCH][2] = {{{12, 12}, {7, 7}, {6, 3}},
1326 {{4, 4}, {8, 8}, {5, 1}},
1327 {{19, 11}, {18, 6}, {17, 2}},
1328 {{2, 9}, {1, 13}, {3, 5}},
1329 {{11, 19}, {16, 18}, {15, 17}},
1330 {{13, 15}, {9, 14}, {14, 16}}};
1332 int ipixelHO_sipm[NRMFIBR][NFCH][2] = {{{12, 12}, {7, 7}, {3, 3}},
1333 {{4, 4}, {8, 8}, {1, 1}},
1334 {{11, 11}, {6, 6}, {2, 2}},
1335 {{9, 9}, {13, 13}, {5, 5}},
1336 {{19, 19}, {18, 18}, {17, 17}},
1337 {{15, 15}, {14, 14}, {16, 16}}};
1339 memcpy(ipixelHO, ipixelHO_loc,
sizeof(
int) * NRMFIBR * NFCH * 2);
1341 memcpy(ipixelHO, ipixelHO_sipm,
sizeof(
int) * NRMFIBR * NFCH * 2);
1344 std::string letterHO_loc[NRMFIBR][NFCH][2] = {{{
"E",
"E"}, {
"G",
"L"}, {
"F",
"S"}},
1345 {{
"Q",
"M"}, {
"N",
"T"}, {
"P",
"F"}},
1346 {{
"A",
"C"}, {
"X",
"J"}, {
"J",
"Q"}},
1347 {{
"X",
"K"}, {
"R",
"R"}, {
"H",
"D"}},
1348 {{
"D",
"A"}, {
"C",
"G"}, {
"B",
"N"}},
1349 {{
"L",
"H"}, {
"M",
"P"}, {
"K",
"B"}}};
1351 std::string letterHO_sipm[NRMFIBR][NFCH][2] = {{{
"E",
"E"}, {
"G",
"L"}, {
"H",
"S"}},
1352 {{
"Q",
"M"}, {
"N",
"T"}, {
"R",
"F"}},
1353 {{
"D",
"C"}, {
"F",
"J"}, {
"X",
"Q"}},
1354 {{
"M",
"K"}, {
"L",
"R"}, {
"P",
"D"}},
1355 {{
"A",
"A"}, {
"X",
"G"}, {
"J",
"N"}},
1356 {{
"B",
"H"}, {
"K",
"P"}, {
"C",
"B"}}};
1358 for (
int jj = 0;
jj < NRMFIBR;
jj++) {
1359 for (
int kk = 0;
kk < NFCH;
kk++) {
1360 for (
int ll = 0; ll < 2; ll++) {
1362 letterHO[
jj][
kk][ll] = letterHO_loc[
jj][
kk][ll];
1364 letterHO[
jj][
kk][ll] = letterHO_sipm[
jj][
kk][ll];
1384 int rmspecialeta_loc[6][6] = {
1386 {14, 15, 14, 13, 12, 11},
1387 {14, 15, 14, 13, 12, 11},
1388 {10, 9, 8, 7, 6, 5},
1389 {10, 9, 8, 7, 6, 5},
1390 {14, 15, 14, 13, 12, 11},
1391 {14, 15, 14, 13, 12, 11}
1396 {
"X",
"B",
"C",
"D",
"E",
"F"},
1397 {
"X",
"P",
"Q",
"R",
"S",
"T"},
1398 {
"G",
"H",
"J",
"K",
"L",
"M"},
1399 {
"A",
"B",
"C",
"D",
"E",
"F"},
1400 {
"X",
"B",
"C",
"D",
"E",
"F"},
1401 {
"X",
"P",
"Q",
"R",
"S",
"T"}
1406 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"},
1407 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"},
1408 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1409 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1410 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"},
1411 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"}
1414 memcpy(rmspecialeta, rmspecialeta_loc,
sizeof(
int) * 6 * 6);
1417 for (
int jj = 0;
jj < 6;
jj++) {
1418 for (
int kk = 0;
kk < 6;
kk++) {
1419 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];
1423 for (
int jj = 0;
jj < 6;
jj++) {
1424 for (
int kk = 0;
kk < 6;
kk++) {
1425 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];
1430 else if (mapIOV_ == 2) {
1431 int rmspecialeta_loc[6][6] = {
1433 {11, 12, 13, 14, 15, 15},
1434 {11, 12, 13, 14, 15, 15},
1435 {5, 6, 7, 8, 9, 10},
1436 {5, 6, 7, 8, 9, 10},
1437 {14, 15, 14, 13, 12, 11},
1438 {11, 12, 13, 14, 15, 15}
1443 {
"F",
"E",
"D",
"C",
"B",
"X"},
1444 {
"T",
"S",
"R",
"Q",
"P",
"X"},
1445 {
"M",
"L",
"K",
"J",
"H",
"G"},
1446 {
"F",
"E",
"D",
"C",
"B",
"A"},
1447 {
"X",
"B",
"C",
"D",
"E",
"F"},
1448 {
"T",
"S",
"R",
"Q",
"P",
"X"}
1453 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1454 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1455 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1456 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1457 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO"},
1458 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"}
1461 memcpy(rmspecialeta, rmspecialeta_loc,
sizeof(
int) * 6 * 6);
1464 for (
int jj = 0;
jj < 6;
jj++) {
1465 for (
int kk = 0;
kk < 6;
kk++) {
1466 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];
1470 for (
int jj = 0;
jj < 6;
jj++) {
1471 for (
int kk = 0;
kk < 6;
kk++) {
1472 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];
1478 int rmspecialeta_loc[6][6] = {
1480 {11, 12, 13, 14, 15, 15},
1481 {11, 12, 13, 14, 15, 15},
1482 {5, 6, 7, 8, 9, 10},
1483 {5, 6, 7, 8, 9, 10},
1484 {11, 12, 13, 14, 15, 15},
1485 {11, 12, 13, 14, 15, 15}
1490 {
"F",
"E",
"D",
"C",
"B",
"X"},
1491 {
"T",
"S",
"R",
"Q",
"P",
"X"},
1492 {
"M",
"L",
"K",
"J",
"H",
"G"},
1493 {
"F",
"E",
"D",
"C",
"B",
"A"},
1494 {
"F",
"E",
"D",
"C",
"B",
"X"},
1495 {
"T",
"S",
"R",
"Q",
"P",
"X"}
1500 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1501 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1502 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1503 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO"},
1504 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"},
1505 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX"}
1508 memcpy(rmspecialeta, rmspecialeta_loc,
sizeof(
int) * 6 * 6);
1511 for (
int jj = 0;
jj < 6;
jj++) {
1512 for (
int kk = 0;
kk < 6;
kk++) {
1513 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];
1517 for (
int jj = 0;
jj < 6;
jj++) {
1518 for (
int kk = 0;
kk < 6;
kk++) {
1519 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];
1526 char tempbuff[30]{0};
1529 stringstream mystream;
1532 for (isid = -1; isid < 2; isid += 2) {
1533 for (iph = 0; iph < NHOPHI; iph++) {
1548 icrate = hocrate[ic];
1557 phmod6e450 = (phmod6 == 4 || phmod6 == 5 || phmod6 == 0);
1558 phmod6e123 = (phmod6 == 1 || phmod6 == 2 || phmod6 == 3);
1561 if (
ieta <= 3 && (iside < 0 || phmod6 >= 4))
1563 else if (ieta <= 3 && iside > 0 && phmod6 < 4)
1566 else if ((
ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6))
1568 else if ((
ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13))
1571 else if (
ieta >= 10 && iside > 0)
1573 else if (ieta < 10 && ieta >= 6 && iside > 0)
1576 else if ((
ieta == 5 && iside > 0) ||
ieta == 4)
1578 else if ((
ieta == 5 ||
ieta >= 10) && iside < 0)
1580 else if ((ieta < 10 && ieta >= 6) && iside < 0)
1583 edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Bad fpga code" << endl;
1600 irm = HO_RM_table[phmod24][
iet][sidear];
1605 irm_fi = HO_RM_fi_eta16;
1607 irm_fi = HO_RM_fi_eta5to15[
ieta - 5];
1611 irm_fi = HO_RM_fi_eta1to4[phmod24][0][sidear];
1613 irm_fi = HO_RM_fi_eta1to4[phmod24][1][sidear];
1616 }
else if (mapIOV_ >= 5) {
1617 irm_fi = HO_RM_fi_eta1to4_sipm[phmod24][
ieta - 1][sidear];
1624 if (
ieta >= 5 && phmod6e450)
1625 ihtr_fi = HO_htr_fi_450eta5to15[sidear][
ieta - 5];
1626 else if (
ieta >= 5 && phmod6e123)
1627 ihtr_fi = HO_htr_fi_450eta5to15[sidear][
ieta - 5] - 1;
1628 else if (
ieta <= 4) {
1631 ihtr_fi = HO_htr_fi_eta4[sidear][phmod6];
1633 ihtr_fi = HO_htr_fi_eta123[sidear][phmod6];
1634 }
else if (mapIOV_ >= 5) {
1635 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][
ieta - 1][(irm - 1) / 2][sidear];
1642 phi1458 = (
iphi % 12 == 1 ||
iphi % 12 == 4 ||
iphi % 12 == 5 ||
iphi % 12 == 8);
1643 phi271011 = (
iphi % 12 == 2 ||
iphi % 12 == 7 ||
iphi % 12 == 10 ||
iphi % 12 == 11);
1646 phir0v1 = (
iphi % 24 == 0 ||
iphi % 24 == 2 ||
iphi % 24 == 4 ||
iphi % 24 == 18 ||
iphi % 24 == 20 ||
1648 phir0v2 = (
iphi % 24 == 1 ||
iphi % 24 == 3 ||
iphi % 24 == 17 ||
iphi % 24 == 19 ||
iphi % 24 == 21 ||
1651 phir0v3 = (
iphi % 24 == 5 ||
iphi % 24 == 7 ||
iphi % 24 == 9 ||
iphi % 24 == 11 ||
iphi % 24 == 13 ||
1653 phir0v4 = (
iphi % 24 == 6 ||
iphi % 24 == 8 ||
iphi % 24 == 10 ||
iphi % 24 == 12 ||
iphi % 24 == 14 ||
1657 if (
ieta % 2 == 0 && phi1458)
1659 else if (
ieta % 2 == 0 &&
iphi % 3 == 0)
1661 else if (
ieta % 2 == 0 && phi271011)
1663 else if (
ieta % 2 == 1 &&
iphi % 3 == 0)
1665 else if (
ieta % 2 == 1 && phi271011)
1667 else if (
ieta % 2 == 1 && phi1458)
1677 else if (
iphi % 2 == 1)
1684 else if (
iphi % 2 == 0)
1689 else if ((
ieta == 3 && iside == -1) || (
ieta == 2 && iside == 1)) {
1694 else if (phir0v1 || phir0v2)
1698 else if ((
ieta == 3 && iside == 1) || (
ieta == 2 && iside == -1)) {
1703 else if (phir0v3 || phir0v4)
1707 else if (
ieta == 1) {
1708 if (phir0v1 || phir0v3)
1710 else if (phir0v2 || phir0v4)
1722 else if (
iphi % 2 == 1)
1729 else if (
iphi % 2 == 0)
1737 else if (
iphi % 2 == 1)
1742 else if (
iphi % 2 == 1)
1750 else if (
iphi % 2 == 1)
1755 else if (
iphi % 2 == 0)
1765 else if (
iphi % 2 == 1)
1772 else if (
iphi % 2 == 0)
1781 iqie = (irm_fi - 2) / 2 + 1;
1783 if (irm_fi % 2 == 0)
1786 iadc = NFCH + (ifi_ch + 1) % 3;
1790 ipixel = ipixelHO[irm_fi - 2][ifi_ch][0];
1791 letter = letterHO[irm_fi - 2][ifi_ch][0];
1793 ipixel = ipixelHO[irm_fi - 2][ifi_ch][1];
1794 letter = letterHO[irm_fi - 2][ifi_ch][1];
1799 if (ieta <= 4 && mapIOV_ >= 5) {
1800 if (ipixel == 3 || ipixel == 7 || ipixel == 12 || ipixel == 14 || ipixel == 17 || ipixel == 18) {
1802 if (phmod6 == 1 || phmod6 == 3)
1806 }
else if (ipixel == 1 || ipixel == 4 || ipixel == 8 || ipixel == 15 || ipixel == 16 || ipixel == 19) {
1808 if (phmod6 == 0 || phmod6 == 2)
1812 }
else if (ipixel == 2 || ipixel == 5 || ipixel == 6 || ipixel == 9 || ipixel == 11 || ipixel == 13) {
1826 if (
ieta <= 3 || (
ieta >= 14 && iside == 1))
1828 else if (ieta <= 13 && ieta >= 6 && iside == 1)
1830 else if (ieta <= 13 && ieta >= 6 && iside == -1)
1839 int php2mod18 = (iph + 2) % 18;
1840 int php2mod18ov6 = php2mod18 / 6;
1845 if (
iphi % 18 == 17 ||
iphi % 18 <= 4)
1847 else if (
iphi % 18 >= 5 &&
iphi % 18 <= 10)
1852 if (
ieta == 16 && iside > 0)
1855 ihtr = ihslotho[is][ih];
1859 ihtr = ihslotho[is][ih];
1861 if (mytype == 1 || mytype == 2)
1865 ihtr = ihslotho[php2mod18ov6][ih];
1869 if ((
ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6))
1871 else if ((
ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13))
1874 ispigot = ihtr < 9 ? (ihtr - 2) * 2 + itb : (ihtr - 13) * 2 + itb;
1875 idcc = ihtr < 9 ? 1 : 2;
1876 idcc_sl = idcc == 1 ? 10 : 20;
1878 ifed = fedhonum[ic][idcc - 1];
1896 for (
i = -2;
i <
iphi;
i += 6) {
1909 snprintf(tempbuff,
sizeof tempbuff,
"%s%i%2.2d", det.c_str(),
ring,
sector);
1911 snprintf(tempbuff,
sizeof tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign,
sector);
1912 mystream << tempbuff;
1913 rbx = mystream.str();
1922 if (
ieta == 16 && isid < 0)
1923 ihtr_fi = HO_htr_fi_450eta16M[irm - 1];
1924 else if (
ieta == 16 && isid > 0)
1925 ihtr_fi = HO_htr_fi_450eta16P[irm - 1][
sector / 2 - 1];
1927 if ((
ieta > 15 && iside > 0) && (icrate == 3 || icrate == 7)) {
1930 }
else if ((
ieta > 15 && iside > 0) && (icrate == 6 || icrate == 13)) {
1938 if (iside == 1 &&
ring == 2) {
1940 ieta = rmspecialeta[0][
iet - 10];
1941 letter = rmspeciallet_code[0][
iet - 10];
1942 det = rmspecialdet[0][
iet - 10];
1943 }
else if (
iphi == 67) {
1944 ieta = rmspecialeta[1][
iet - 10];
1945 letter = rmspeciallet_code[1][
iet - 10];
1946 det = rmspecialdet[1][
iet - 10];
1948 }
else if (iside == -1) {
1951 ieta = rmspecialeta[2][
iet - 4];
1952 letter = rmspeciallet_code[2][
iet - 4];
1953 det = rmspecialdet[2][
iet - 4];
1954 }
else if (
iphi == 65) {
1955 ieta = rmspecialeta[3][
iet - 4];
1956 letter = rmspeciallet_code[3][
iet - 4];
1957 det = rmspecialdet[3][
iet - 4];
1959 }
else if (
ring == 2) {
1961 ieta = rmspecialeta[4][
iet - 10];
1962 letter = rmspeciallet_code[4][
iet - 10];
1963 det = rmspecialdet[4][
iet - 10];
1964 }
else if (
iphi == 31) {
1965 ieta = rmspecialeta[5][
iet - 10];
1966 letter = rmspeciallet_code[5][
iet - 10];
1967 det = rmspecialdet[5][
iet - 10];
1993 HOHXEntries.push_back(hoxlmapentry);
1998 unsigned int denseId;
2001 HoHash2Entry.at(denseId) = HOHXEntries.size();
2004 HxCalibHash2Entry.at(denseId) = HOHXEntries.size();
2016 if (irm_fi % 2 == 0)
2019 iadc = NFCH + (ifi_ch + 1) % 3;
2020 iqie = (irm_fi - 2) / 2 + 1;
2021 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][4][(irm - 1) / 2][sidear];
2026 ihtr = ihslotho[php2mod18ov6][ih];
2027 ispigot = ihtr < 9 ? (ihtr - 2) * 2 + itb : (ihtr - 13) * 2 + itb;
2028 idcc = ihtr < 9 ? 1 : 2;
2029 idcc_sl = idcc == 1 ? 10 : 20;
2030 ifed = fedhonum[ic][idcc - 1];
2055 HOHXEntries.push_back(hoxlmapentry);
2060 unsigned int denseId;
2063 HoHash2Entry.at(denseId) = HOHXEntries.size();
2066 HxCalibHash2Entry.at(denseId) = HOHXEntries.size();
2068 }
else if (ipixel == 17) {
2076 if (irm_fi % 2 == 0)
2079 iadc = NFCH + (ifi_ch + 1) % 3;
2080 iqie = (irm_fi - 2) / 2 + 1;
2081 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][4][(irm - 1) / 2][sidear];
2082 if (phmod6 == 1 || phmod6 == 3) {
2089 ispigot = ihtr < 9 ? (ihtr - 2) * 2 + itb : (ihtr - 13) * 2 + itb;
2090 idcc = ihtr < 9 ? 1 : 2;
2091 idcc_sl = idcc == 1 ? 10 : 20;
2092 ifed = fedhonum[ic][idcc - 1];
2117 HOHXEntries.push_back(hoxlmapentry);
2122 unsigned int denseId;
2125 HoHash2Entry.at(denseId) = HOHXEntries.size();
2128 HxCalibHash2Entry.at(denseId) = HOHXEntries.size();
2138 std::vector<CALIBLogicalMapEntry>& CALIBEntries,
2139 std::vector<uint32_t>& LinearIndex2Entry,
2140 std::vector<uint32_t>& HxCalibHash2Entry) {
2143 int calibcrate_loc[NCALIBCR] = {4, 0, 1, 5, 11, 15, 17, 14, 10, 9, 7, 6, 13};
2144 memcpy(calibcrate, calibcrate_loc,
sizeof(
int) * NCALIBCR);
2146 int fedcalibnum_loc[NCALIBCR][2] = {{700, 701},
2159 memcpy(fedcalibnum, fedcalibnum_loc,
sizeof(
int) * NCALIBCR * 2);
2161 int icalibphis_loc[NCALIBCR] = {3, 11, 19, 27, 35, 43, 51, 59, 67, 27, 17, 35, 53};
2162 memcpy(icalibphis, icalibphis_loc,
sizeof(
int) * NCALIBCR);
2164 int icalibsector_min_loc[NCALIBCR] = {2, 4, 6, 8, 10, 12, 14, 16, 18, 1, 4, 7, 10};
2165 memcpy(icalibsector_min, icalibsector_min_loc,
sizeof(
int) * NCALIBCR);
2167 int icalibsector_max_loc[NCALIBCR] = {3, 5, 7, 9, 11, 13, 15, 17, 1, 4, 6, 9, 12};
2168 memcpy(icalibsector_max, icalibsector_max_loc,
sizeof(
int) * NCALIBCR);
2170 std::string detIDCALIB_loc[NCALIBCR][NTOPBOT] = {{
"HB",
"HE"},
2183 for (
int jj = 0;
jj < NCALIBCR;
jj++) {
2184 for (
int kk = 0;
kk < NTOPBOT;
kk++) {
2185 detIDCALIB[
jj][
kk] = detIDCALIB_loc[
jj][
kk];
2189 int nfbr_max_loc[NCALIBCR][NTOPBOT] = {
2190 {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}};
2191 memcpy(nfbr_max, nfbr_max_loc,
sizeof(
int) * NCALIBCR * NTOPBOT);
2193 int calibHOinfo_loc[NHOCR][NTOPBOT][NFBR][2] = {
2195 {{{4, 0}, {5, 0}, {6, 0}, {}, {6, -2}, {6, -1}, {6, 1}, {6, 2}},
2196 {{4, -2}, {4, -1}, {4, 1}, {4, 2}, {}, {}, {}, {}}},
2198 {{{7, 0}, {8, 0}, {9, 0}, {}, {8, -2}, {8, -1}, {8, 1}, {8, 2}},
2199 {{1, 0}, {2, 0}, {3, 0}, {}, {2, -2}, {2, -1}, {2, 1}, {2, 2}}},
2201 {{{10, 0}, {11, 0}, {12, 0}, {}, {10, -2}, {10, -1}, {10, 1}, {10, 2}},
2202 {{12, -2}, {12, -1}, {12, 1}, {12, 2}, {}, {}, {}, {}}}
2204 memcpy(calibHOinfo, calibHOinfo_loc,
sizeof(
int) * NHOCR * NTOPBOT * NFBR * 2);
2208 char tempbuff[30]{0};
2212 stringstream mystream;
2222 for (ic = 0; ic < NHBHECR; ic++) {
2223 icrate = calibcrate[ic];
2224 ifed = fedcalibnum[ic][idcc - 1];
2226 for (itb = 0; itb < NTOPBOT; itb++) {
2228 for (ifb = 0; ifb < nfbr_max[ic][itb]; ifb++) {
2229 det = detIDCALIB[ic][itb];
2234 if (ihtr_fi % 2 == 0)
2239 if (ihtr_fi == 1 || ihtr_fi == 2 || ihtr_fi == 5 || ihtr_fi == 6) {
2240 iwedge = icalibsector_min[ic];
2241 }
else if (ihtr_fi == 3 || ihtr_fi == 4 || ihtr_fi == 7 || ihtr_fi == 8) {
2242 iwedge = icalibsector_max[ic];
2255 }
else if (det ==
"HB") {
2258 (ihtr_fi % 2 == 1) ? iwedge = icalibsector_min[ic] : iwedge = icalibsector_max[ic];
2271 iphi = ((iwedge * idphi) + 71 - idphi) % 72;
2272 subdet =
"CALIB_" + det;
2273 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
2274 mystream << tempbuff;
2275 rbx = mystream.str();
2278 for (ifc = 0; ifc < NFCH; ifc++) {
2285 else if (ifc == 2) {
2288 else if (det ==
"HE")
2291 }
else if (irm_fi == 2) {
2316 CALIBEntries.push_back(caliblmapentry);
2323 HxCalibHash2Entry.at(hashedId) = CALIBEntries.size();
2331 for (itb = 0; itb < NTOPBOT; itb++) {
2333 for (ifb = 0; ifb < 4; ifb++) {
2335 for (ifc = 0; ifc < NFCH; ifc++) {
2336 icrate = calibcrate[ic];
2340 (ihtr_fi == 1) ?
iphi = 1 : ((ihtr_fi == 2) ?
iphi = 19 : ((ihtr_fi == 3) ?
iphi = 37 :
iphi = 55));
2342 ifed = fedcalibnum[ic][idcc - 1];
2343 (ifc == 0) ? ich_type = 8 : (ifc == 1 ? ich_type = 0 : ich_type = 1);
2348 iwedge = 2 + (ifb * 3);
2362 subdet =
"CALIB_" + det;
2363 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
2364 mystream << tempbuff;
2365 rbx = mystream.str();
2384 CALIBEntries.push_back(caliblmapentry);
2391 HxCalibHash2Entry.at(hashedId) = CALIBEntries.size();
2397 for (ic = ic + 1; ic < NCALIBCR; ic++) {
2398 icrate = calibcrate[ic];
2400 ifed = fedcalibnum[ic][idcc - 1];
2402 for (itb = 0; itb < NTOPBOT; itb++) {
2403 det = detIDCALIB[ic][itb];
2405 for (ifb = 0; ifb < nfbr_max[ic][itb]; ifb++) {
2414 iwedge = calibHOinfo[ic - 10][itb][ifb][0];
2415 ieta = calibHOinfo[ic - 10][itb][ifb][1];
2419 }
else if (
ieta > 0) {
2428 else if (
ieta == -1)
2435 subdet =
"CALIB_" + det;
2437 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
2439 snprintf(tempbuff,
sizeof tempbuff,
"%s%c%c%2.2i", det.c_str(), S_side, sidesign, iwedge);
2440 mystream << tempbuff;
2441 rbx = mystream.str();
2449 (
ieta == -2) ? (iwedge == 12 ? NFCH_HO = 3 : NFCH_HO = 2) : (iwedge == 10) ? NFCH_HO = 3 : NFCH_HO = 2;
2450 for (ifc = 0; ifc < NFCH_HO; ifc++) {
2452 (ifi_ch == 2) ? ich_type = 7 : ich_type = ifi_ch;
2453 (
ieta == 0) ? idphi = 6 : idphi = 12;
2455 (
ieta == 0) ?
iphi = ((iwedge * idphi) + 71 - idphi) % 72 :
iphi = (((iwedge / 2) * idphi) + 71 - idphi) % 72;
2458 if (iside == 0 && ifb == 3)
2477 CALIBEntries.push_back(caliblmapentry);
2484 HxCalibHash2Entry.at(hashedId) = CALIBEntries.size();
2493 std::vector<ZDCLogicalMapEntry>& ZDCEntries,
2494 std::vector<uint32_t>& LinearIndex2Entry,
2495 std::vector<uint32_t>& ZdcHash2Entry) {
2499 stringstream mystream;
2509 for (itb = 0; itb < NTOPBOT; itb++) {
2526 for (icab = 1; icab < NZDCCAB + 1; icab++) {
2531 }
else if (icab < 7) {
2544 ihtr_fi = irm_fi + 3;
2585 ZDCEntries.push_back(zdclmapentry);
2594 std::vector<HTLogicalMapEntry>& HTEntries,
2622 string t_chDet, t_fpga;
2623 string t_slnam, t_rctnam, t_slbin, t_slbin2;
2626 int t_side, t_iEta, t_iPhi, t_jPhi, t_iDep, t_topbot;
2627 int t_wedge, t_crate, t_htr;
2629 int t_spigo, t_slb, t_rctcra, t_rctcar, t_rctcon, t_fedid;
2632 (fpga ==
"bot") ? t_topbot = 1 : t_topbot = 0;
2664 if (t_chDet ==
"HE" && t_iEta == 29)
2667 if (t_chDet ==
"HF") {
2669 if (t_iEta == 30 || t_iEta == 31 || t_iEta == 33 || t_iEta == 34 || t_iEta == 36 || t_iEta == 37 ||
2670 t_iEta == 39 || t_iEta == 40 || t_iEta == 41)
2673 else if (t_iEta == 32)
2675 else if (t_iEta == 35)
2677 else if (t_iEta == 38)
2680 if (t_iPhi == 3 || t_iPhi == 7 || t_iPhi == 11 || t_iPhi == 15 || t_iPhi == 19 || t_iPhi == 23 || t_iPhi == 27 ||
2681 t_iPhi == 31 || t_iPhi == 35 || t_iPhi == 39 || t_iPhi == 43 || t_iPhi == 47 || t_iPhi == 51 ||
2682 t_iPhi == 55 || t_iPhi == 59 || t_iPhi == 63 || t_iPhi == 67 || t_iPhi == 71)
2690 if (t_slbin !=
"NA") {
2691 if (t_slbin2 !=
"NA")
2693 if (t_slbin ==
"A0" || t_slbin ==
"B0")
2695 else if (t_slbin ==
"A1" || t_slbin ==
"B1")
2697 else if (t_slbin ==
"C0" || t_slbin ==
"D0")
2699 else if (t_slbin ==
"C1" || t_slbin ==
"D1")
2723 HTEntries.push_back(htlmapentry);
2725 if (t_slbin2 !=
"NA") {
2726 if (t_slbin2 ==
"A0" || t_slbin2 ==
"B0")
2728 else if (t_slbin2 ==
"A1" || t_slbin2 ==
"B1")
2730 else if (t_slbin2 ==
"C0" || t_slbin2 ==
"D0")
2732 else if (t_slbin2 ==
"C1" || t_slbin2 ==
"D1")
2758 HTEntries.push_back(htlmapentry);
const DetId getDetId() const
uint32_t getLinearIndex() const
HcalLogicalMapGenerator()
const uint32_t getLinearIndex() const
static uint32_t makeEntryNumber(bool, int, int)
const DetId getDetId() const
unsigned int detId2denseIdHF(const DetId &id) const
return a linear packed id from HF
unsigned int detId2denseIdHO(const DetId &id) const
return a linear packed id from HO
void buildZDCMap(const HcalTopology *topo, std::vector< ZDCLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
unsigned int detId2denseIdHE(const DetId &id) const
return a linear packed id from HE
unsigned int detId2denseIdCALIB(const DetId &id) const
return a linear packed id from CALIB
unsigned int detId2denseIdHB(const DetId &id) const
return a linear packed id from HB
const uint32_t getLinearIndex() const
HcalLogicalMap createMap(const HcalTopology *topo, unsigned int mapIOV=4)
Log< level::Info, false > LogInfo
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
void buildCALIBMap(const HcalTopology *topo, std::vector< CALIBLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
static const int maxLinearIndex
void buildHOXMap(const HcalTopology *topo, std::vector< HOHXLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
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 > &)
const uint32_t getLinearIndex() const
~HcalLogicalMapGenerator()