23 for (
i = 0;
i < NRMFIBR;
i++){
24 for (j = 0; j < NFCH; j++){
26 iadcquiHBHE[
i][j][0] =
i / 2 + 1;
28 if (
i % 2 == 0) iadcquiHBHE[
i][j][1] = j;
29 else iadcquiHBHE[
i][j][1] = NFCH + (j + 1) % 3;
42 std::vector <HBHEHFLogicalMapEntry> HBHEHFEntries;
43 std::vector <HOHXLogicalMapEntry> HOHXEntries;
44 std::vector <CALIBLogicalMapEntry> CALIBEntries;
45 std::vector <ZDCLogicalMapEntry> ZDCEntries;
46 std::vector <HTLogicalMapEntry> HTEntries;
47 std::vector <uint32_t> LinearIndex2Entry;
48 std::vector <uint32_t> HbHash2Entry;
49 std::vector <uint32_t> HeHash2Entry;
50 std::vector <uint32_t> HfHash2Entry;
51 std::vector <uint32_t> HtHash2Entry;
52 std::vector <uint32_t> HoHash2Entry;
53 std::vector <uint32_t> HxCalibHash2Entry;
55 std::vector <uint32_t> ZdcHash2Entry;
64 int CalibFull=216+425+8;
66 uint32_t illegal_value=0;
68 for (
int iHb=0;iHb<2*HbHalf;iHb++) HbHash2Entry.push_back(illegal_value);
69 for (
int iHe=0;iHe<2*HeHalf;iHe++) HeHash2Entry.push_back(illegal_value);
70 for (
int iHf=0;iHf<2*HfHalf;iHf++) HfHash2Entry.push_back(illegal_value);
71 for (
int iHt=0;iHt<2*HtHalf;iHt++) HtHash2Entry.push_back(illegal_value);
72 for (
int iHo=0;iHo<2*HoHalf;iHo++) HoHash2Entry.push_back(illegal_value);
73 for (
int iHcalib=0;iHcalib<CalibFull;iHcalib++) HxCalibHash2Entry.push_back(illegal_value);
74 for (
int iZdc=0;iZdc<2*ZdcHalf;iZdc++) ZdcHash2Entry.push_back(illegal_value);
76 buildHBEFTMap(topo,HBHEHFEntries,HTEntries,LinearIndex2Entry,HbHash2Entry,HeHash2Entry,HfHash2Entry,HtHash2Entry);
77 buildHOXMap(topo,HOHXEntries,LinearIndex2Entry,HoHash2Entry,HxCalibHash2Entry);
78 buildCALIBMap(topo,CALIBEntries,LinearIndex2Entry,HxCalibHash2Entry);
79 buildZDCMap(topo,ZDCEntries,LinearIndex2Entry,ZdcHash2Entry);
81 return HcalLogicalMap(topo,HBHEHFEntries,HOHXEntries,CALIBEntries,ZDCEntries,HTEntries,
82 LinearIndex2Entry,HbHash2Entry,HeHash2Entry,HfHash2Entry,HtHash2Entry,
83 HoHash2Entry,HxCalibHash2Entry,ZdcHash2Entry);
87 std::vector <HBHEHFLogicalMapEntry>& HBHEHFEntries,
88 std::vector <HTLogicalMapEntry>& HTEntries,
89 std::vector <uint32_t>& LinearIndex2Entry,
90 std::vector <uint32_t>& HbHash2Entry,
91 std::vector <uint32_t>& HeHash2Entry,
92 std::vector <uint32_t>& HfHash2Entry,
93 std::vector <uint32_t>& HtHash2Entry) {
97 int hbhecrate_loc[NHBHECR]={0,1,4,5,10,11,14,15,17};
98 memcpy( hbhecrate, hbhecrate_loc,
sizeof(
int)*NHBHECR );
100 int fedhbhenum_loc[NHBHECR][2]={{702,703},{704,705},{700,701},
101 {706,707},{716,717},{708,709},
102 {714,715},{710,711},{712,713}};
103 memcpy( fedhbhenum, fedhbhenum_loc,
sizeof(
int)*NHBHECR*2 );
105 int ihslot_loc[NHSETS]={2,5,13,16};
106 memcpy( ihslot, ihslot_loc,
sizeof(
int)*NHSETS );
108 int ihbhephis_loc[NHBHECR]={11,19,3,27,67,35,59,43,51};
109 memcpy( ihbhephis, ihbhephis_loc,
sizeof(
int)*NHBHECR );
111 int ihbheetadepth_loc[NHTRS][NTOPBOT][NFBR][NFCH][2]={
112 {{{{11,1},{ 7,1},{ 3,1}},
113 {{ 5,1},{ 1,1},{ 9,1}},
114 {{11,1},{ 7,1},{ 3,1}},
115 {{ 5,1},{ 1,1},{ 9,1}},
116 {{10,1},{ 6,1},{ 2,1}},
117 {{ 8,1},{ 4,1},{12,1}},
118 {{10,1},{ 6,1},{ 2,1}},
119 {{ 8,1},{ 4,1},{12,1}}},
120 {{{11,1},{ 7,1},{ 3,1}},
121 {{ 5,1},{ 1,1},{ 9,1}},
122 {{11,1},{ 7,1},{ 3,1}},
123 {{ 5,1},{ 1,1},{ 9,1}},
124 {{10,1},{ 6,1},{ 2,1}},
125 {{ 8,1},{ 4,1},{12,1}},
126 {{10,1},{ 6,1},{ 2,1}},
127 {{ 8,1},{ 4,1},{12,1}}}},
128 {{{{16,2},{15,2},{14,1}},
129 {{15,1},{13,1},{16,1}},
130 {{16,2},{15,2},{14,1}},
131 {{15,1},{13,1},{16,1}},
132 {{17,1},{16,3},{26,1}},
133 {{18,1},{18,2},{26,2}},
134 {{17,1},{16,3},{25,1}},
135 {{18,1},{18,2},{25,2}}},
136 {{{16,2},{15,2},{14,1}},
137 {{15,1},{13,1},{16,1}},
138 {{16,2},{15,2},{14,1}},
139 {{15,1},{13,1},{16,1}},
140 {{17,1},{16,3},{25,1}},
141 {{18,1},{18,2},{25,2}},
142 {{17,1},{16,3},{26,1}},
143 {{18,1},{18,2},{26,2}}}},
144 {{{{28,1},{28,2},{29,1}},
145 {{28,3},{24,2},{24,1}},
146 {{27,1},{27,2},{29,2}},
147 {{27,3},{23,2},{23,1}},
148 {{19,2},{20,1},{22,2}},
149 {{19,1},{20,2},{22,1}},
150 {{19,2},{20,1},{21,2}},
151 {{19,1},{20,2},{21,1}}},
152 {{{27,1},{27,2},{29,2}},
153 {{27,3},{23,2},{23,1}},
154 {{28,1},{28,2},{29,1}},
155 {{28,3},{24,2},{24,1}},
156 {{19,2},{20,1},{21,2}},
157 {{19,1},{20,2},{21,1}},
158 {{19,2},{20,1},{22,2}},
159 {{19,1},{20,2},{22,1}}}}
161 memcpy( ihbheetadepth, ihbheetadepth_loc,
sizeof(
int)*NHTRS*NTOPBOT*NFBR*NFCH*2 );
165 int irm_rmfiHBHE_loc[NHTRS][NTOPBOT][NFBR][2]={
166 {{{6,1},{7,1},{6,2},{7,2},{4,1},{5,1},{4,2},{5,2}},
167 {{6,3},{7,3},{6,4},{7,4},{4,3},{5,3},{4,4},{5,4}}},
168 {{{2,1},{3,1},{2,2},{3,2},{2,1},{3,1},{2,2},{3,2}},
169 {{2,3},{3,3},{2,4},{3,4},{2,3},{3,3},{2,4},{3,4}}},
170 {{{4,1},{5,1},{4,2},{5,2},{6,1},{7,1},{6,2},{7,2}},
171 {{4,3},{5,3},{4,4},{5,4},{6,3},{7,3},{6,4},{7,4}}}
173 memcpy( irm_rmfiHBHE, irm_rmfiHBHE_loc,
sizeof(
int)*NHTRS*NTOPBOT*NFBR*2 );
176 int ipixelHB_loc[NRMFIBR][NFCH][NRMSLOT] = {
177 {{18, 17, 3, 2 }, {13, 3, 17, 7 }, {14, 1, 19, 6 }},
178 {{19, 2, 18, 1 }, {15, 7, 13, 5 }, {17, 19, 1, 3 }},
179 {{9, 4, 16, 11}, {5, 8, 12, 15}, {2, 13, 7, 18}},
180 {{12, 11, 9, 8 }, {7, 15, 5, 13}, {16, 6, 14, 4 }},
181 {{8, 5, 15, 12}, {4, 9, 11, 16}, {1, 14, 6, 19}},
182 {{6, 16, 4, 14}, {3, 18, 2, 17}, {11, 12, 8, 9 }}
184 memcpy( ipixelHB, ipixelHB_loc,
sizeof(
int)*NRMFIBR*NFCH*NRMSLOT );
186 int ipixelHE_loc[NRMFIBR][NFCH][NRMSLOT] = {
187 {{12, 12, 12, 12}, {16, 7, 16, 7 }, {7, 16, 7, 16}},
188 {{11, 11, 11, 11}, {19, 3, 19, 3 }, {3, 19, 3, 19}},
189 {{15, 15, 6, 6 }, {2, 18, 2, 18}, {6, 6, 15, 15}},
190 {{5, 14, 5, 14}, {14, 5, 14, 5 }, {18, 2, 18, 2 }},
191 {{17, 1, 17, 1 }, {9, 9, 9, 9 }, {1, 17, 1, 17}},
192 {{13, 4, 13, 4 }, {8, 8, 8, 8 }, {4, 13, 4, 13}}
194 memcpy( ipixelHE, ipixelHE_loc,
sizeof(
int)*NRMFIBR*NFCH*NRMSLOT );
200 const char* S_slbin_odd_loc[] ={
"A1",
"B0",
"B1",
"A0",
"A1",
"B0",
"B1",
"A0"};
201 for (
int gg = 0; gg < 8; gg++) {
202 S_slbin_odd[gg] = S_slbin_odd_loc[gg];
204 const char* S_slbin_even_loc[]={
"C1",
"D0",
"D1",
"C0",
"C1",
"D0",
"D1",
"C0"};
205 for (
int gg = 0; gg < 8; gg++) {
206 S_slbin_even[gg] = S_slbin_even_loc[gg];
208 const char* rct_rackHBHE_loc[]={
"S2E01-RH",
"S2E03-RH",
"S2E05-RH",
"S2E07-RH",
"S2E09-RH",
"S2E08-RL",
"S2E06-RL",
"S2E04-RL",
"S2E02-RL",
209 "S2E02-RH",
"S2E04-RH",
"S2E06-RH",
"S2E08-RH",
"S2E09-RL",
"S2E07-RL",
"S2E05-RL",
"S2E03-RL",
"S2E01-RL"};
210 for (
int gg = 0; gg < 18; gg++) {
211 rct_rackHBHE[gg] = rct_rackHBHE_loc[gg];
214 int slb_table_loc[29] = {1,1,2,2,3,3,4,4,5,5,6,6,
217 memcpy( slb_table, slb_table_loc,
sizeof(
int)*29 );
220 char tempbuff[30]{0};
223 stringstream mystream;
226 for(ic=0; ic<NHBHECR; ic++){
228 for(is=0; is<NHSETS; is++){
230 for(ih=0; ih<NHTRS; ih++){
232 for(itb=0; itb<NTOPBOT; itb++){
234 for(ifb=0; ifb<NFBR; ifb++){
236 for(ifc=0; ifc<NFCH; ifc++){
237 icrate=hbhecrate[ic];
238 iside=is<NHSETS/2?-1:1;
239 ifwtb=(is/2+itb+1)%2;
240 ieta=ihbheetadepth[ih][ifwtb][ifb][ifc][0];
241 idepth=ihbheetadepth[ih][ifwtb][ifb][ifc][1];
243 (ieta>16||idepth>2) ? det =
"HE": det =
"HB";
244 (itb%2)==1 ? fpga =
"bot" : fpga =
"top";
247 iphi=(ieta>20)?(ihbhephis[ic]+(is%2)*4+itb*2-1)%72+1:(ihbhephis[ic]+(is%2)*4+itb*2+(ifb/2+is/2+1)%2-1)%72+1;
248 ispigot=(is%2)*6+ih*2+itb;
249 idcc=is<NHSETS/2?1:2;
250 idcc_sl=idcc==1?10:20;
251 ifed=fedhbhenum[ic][idcc-1];
259 irm = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][1];
260 irm_fi = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][0];
263 if (ieta >= 21 && (irm == 1 || irm == 3)) iwedge = (iphi + 1 + irm + 1) / 4;
264 else iwedge = (iphi + irm + 1) / 4;
267 if (iwedge > 18) iwedge -= 18;
272 irm = irm_rmfiHBHE[ih][itb][ifb][1];
273 irm_fi = irm_rmfiHBHE[ih][itb][ifb][0];
276 if (ieta >= 21 && (irm == 4 || irm == 2)) iwedge = (iphi + 1 - irm + 6) / 4;
277 else iwedge = (iphi - irm + 6) / 4;
280 if (iwedge > 18) iwedge -= 18;
283 snprintf (tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
285 rbx = mystream.str();
292 if (ieta > 16 || idepth > 2) ipixel = ipixelHE[irm_fi - 2][ifc][irm - 1];
293 else ipixel = ipixelHB[irm_fi - 2][ifc][irm - 1];
295 iqie = iadcquiHBHE[irm_fi - 2][ifc][0];
296 iadc = iadcquiHBHE[irm_fi - 2][ifc][1];
299 if (phideg < 0) phideg = phideg + 72;
300 phideg = (phideg / 4) * 20 + 10;
301 irctcra = (( 89 - phideg + 720)%360)/20;
302 oddcard = irctcra % 2;
304 if (iside > 0) irctcra = irctcra + 9;
306 etaslb = ((ieta - 1) / 2) * 2 + 1;
307 if (etaslb > 27) etaslb = 27;
310 snprintf(tempbuff,
sizeof tempbuff,
"SLB_H_%3.3d%c%2.2d", phideg, S_side, etaslb);
312 slnam = mystream.str();
315 islb = slb_table[ieta - 1];
319 irctcar = 2 * ((ieta - 1)/8) + oddcard;
320 irctcon = 2 * (((ieta - 1)/2)%4);
325 if (eta2 > 28) eta2 = 28;
326 if (oddcard == 0) eta3 = eta2;
327 else eta3 = 57 - eta2;
328 irctcon = 2 * (((eta3 - 1) / 2) % 4);
330 irctcon = 11 * irctcon + 1;
332 snprintf(tempbuff,
sizeof tempbuff,
"%s-%1d-HD%2.2d", rct_rackHBHE[irctcra], irctcar, irctcon);
334 rctnam = mystream.str();
341 for (
i = 0;
i < 18;
i++) {
342 if (iphi <
i * 4 + 3) {
349 if (ieta == 29) ietamod = 0;
350 else ietamod = ieta % 2;
352 if (ietamod == 1) mystream<<S_slbin_odd[phimod8];
353 else mystream<<S_slbin_even[phimod8];
355 else if (crazy == 0) {
356 if (ietamod == 1) mystream<<S_slbin_odd[phimod8];
357 else mystream<<S_slbin_even[phimod8];
360 if (ietamod == 1) mystream<<S_slbin_even[phimod8];
361 else mystream<<S_slbin_odd[phimod8];
364 slbin = mystream.str();
378 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
379 det, iside, ieta, iphi, idepth,
380 idphi, iwedge, irm, irm_fi, ipixel, iqie, iadc,
381 islb, irctcra, irctcar, irctcon,
382 rbx, slbin, slbin2, slnam, rctnam
384 HBHEHFEntries.push_back(hbeflmapentry);
388 unsigned int denseId;
391 HbHash2Entry.at(denseId)=HBHEHFEntries.size();
395 HeHash2Entry.at(denseId)=HBHEHFEntries.size();
399 HfHash2Entry.at(denseId)=HBHEHFEntries.size();
402 ConstructTriggerTower(topo,
404 iside, ieta, iphi, idphi, idepth, det, iwedge, irm,
405 ipixel, iqie, iadc, irm_fi, ifi_ch, icrate, ihtr, fpga,
406 ihtr_fi, ispigot, islb, slbin, slbin2,
407 slnam, irctcra, irctcar, irctcon, rctnam, ifed
418 int hfcrate_loc[NHFCR]={2,9,12};
419 memcpy( hfcrate, hfcrate_loc,
sizeof(
int)*NHFCR );
421 int fedhfnum_loc[NHFCR][2]={{718,719},{720,721},{722,723}};
422 memcpy( fedhfnum, fedhfnum_loc,
sizeof(
int)*NHFCR*2 );
424 int ihfphis_loc[NHFCR]={3,27,51};
425 memcpy( ihfphis, ihfphis_loc,
sizeof(
int)*NHFCR );
427 int ihfetadepth_loc[NTOPBOT][NFBR][NFCH][2]={
428 {{{33,1},{31,1},{29,1}},
429 {{32,1},{30,1},{34,1}},
430 {{33,2},{31,2},{29,2}},
431 {{32,2},{30,2},{34,2}},
432 {{34,2},{32,2},{30,2}},
433 {{31,2},{29,2},{33,2}},
434 {{34,1},{32,1},{30,1}},
435 {{31,1},{29,1},{33,1}}},
436 {{{41,1},{37,1},{35,1}},
437 {{38,1},{36,1},{39,1}},
438 {{41,2},{37,2},{35,2}},
439 {{38,2},{36,2},{39,2}},
440 {{40,2},{38,2},{36,2}},
441 {{37,2},{35,2},{39,2}},
442 {{40,1},{38,1},{36,1}},
443 {{37,1},{35,1},{39,1}}}
445 memcpy( ihfetadepth, ihfetadepth_loc,
sizeof(
int)*NTOPBOT*NFBR*NFCH*2 );
448 int irm_rmfiHF_loc[NHTRS][NTOPBOT][NFBR][2]={
449 {{{1,2},{2,2},{3,2},{4,2},{1,3},{2,3},{3,3},{4,3}},
450 {{5,2},{6,2},{7,2},{8,2},{5,3},{6,3},{7,3},{8,3}}},
451 {{{1,1},{2,1},{3,1},{4,1},{1,2},{2,2},{3,2},{4,2}},
452 {{5,1},{6,1},{7,1},{8,1},{5,2},{6,2},{7,2},{8,2}}},
453 {{{1,3},{2,3},{3,3},{4,3},{1,1},{2,1},{3,1},{4,1}},
454 {{5,3},{6,3},{7,3},{8,3},{5,1},{6,1},{7,1},{8,1}}}
456 memcpy( irm_rmfiHF, irm_rmfiHF_loc,
sizeof(
int)*NHTRS*NTOPBOT*NFBR*2 );
459 const char* S_slbin_7_loc[] ={
"A0",
"A1",
"B0",
"B1"};
460 for (
int gg = 0; gg < 4; gg++) {
461 S_slbin_7[gg] = S_slbin_7_loc[gg];
463 const char* S_slbin_3_loc[] ={
"C0",
"C1",
"D0",
"D1"};
464 for (
int gg = 0; gg < 4; gg++) {
465 S_slbin_3[gg] = S_slbin_3_loc[gg];
467 const char* rct_rackHF_loc[]={
"S2E01-FH",
"S2E03-FH",
"S2E05-FH",
"S2E07-FH",
"S2E09-FH",
"S2E08-FL",
"S2E06-FL",
"S2E04-FL",
"S2E02-FL",
468 "S2E02-FH",
"S2E04-FH",
"S2E06-FH",
"S2E08-FH",
"S2E09-FL",
"S2E07-FL",
"S2E05-FL",
"S2E03-FL",
"S2E01-FL"};
469 for (
int gg = 0; gg < 18; gg++) {
470 rct_rackHF[gg] = rct_rackHF_loc[gg];
477 for(ic=0; ic<NHFCR; ic++){
479 for(is=0; is<NHSETS; is++){
481 for(ih=0; ih<NHTRS; ih++){
483 for(itb=0; itb<NTOPBOT; itb++){
485 for(ifb=0; ifb<NFBR; ifb++){
487 for(ifc=0; ifc<NFCH; ifc++){
489 iside=is<NHSETS/2?-1:1;
490 ieta=ihfetadepth[itb][ifb][ifc][0];
491 idepth=ihfetadepth[itb][ifb][ifc][1];
494 (itb%2)== 1 ? fpga =
"bot" : fpga =
"top";
497 iphi=(ieta>39)?(ihfphis[ic]+(is%2)*12+ih*4-1)%72+1:(ihfphis[ic]+(is%2)*12+ih*4+(ifb/4)*2-1)%72+1;
498 ispigot=(is%2)*6+ih*2+itb;
499 idcc=is<NHSETS/2?1:2;
500 idcc_sl=idcc==1?10:20;
501 ifed=fedhfnum[ic][idcc-1];
503 irm_fi = irm_rmfiHF[ih][itb][ifb][0];
511 if (iphi == 1) iphi = 71;
512 else if (iphi == 71) iphi = 1;
513 else if (iphi % 4 == 1) iphi -= 2;
514 else if (iphi % 4 == 3) iphi += 2;
515 else edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Even iphi in HFM"<<endl;
524 if ((iside == 1 && ieta == 40) || (iside == -1 && ieta == 41)){
525 irm = ((iphi + 1) / 2) % 36 + 1;
526 hfphi = ((iphi + 1) / 6) % 12 + 1;
529 irm = ( iphi + 1) / 2;
530 hfphi = (iphi - 1) / 6 + 1;
532 irm = (irm - 1) % 3 + 1;
535 if (iphi >= 71) iwedge = 1;
536 else iwedge = (iphi + 1) / 4 + 1;
539 snprintf (tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, hfphi);
541 rbx = mystream.str();
548 iqie = (irm_fi - 1) / 2 + 1;
550 if (irm_fi % 2 != 0) iadc = ifi_ch;
551 else iadc = NFCH + (ifi_ch + 1) % 3;
556 if (phideg < 0) phideg = phideg + 72;
557 phideg = (phideg / 4) * 20 + 10;
558 irctcra = (( 89 - phideg + 720)%360)/40;
559 if (iside > 0) irctcra = irctcra + 9;
567 snprintf(tempbuff,
sizeof tempbuff,
"SLB_H_%3.3d%c%2.2d", phideg, S_side, etaslb);
569 slnam = mystream.str();
572 snprintf(tempbuff,
sizeof tempbuff,
"%s-JSC-HF_IN", rct_rackHF[irctcra]);
574 rctnam = mystream.str();
579 int phibin = (iphi + 1) % 8 ;
580 int etabin = (ieta - 29) / 3;
581 if (etabin < 0) etabin = 0;
582 if (etabin > 3) etabin = 3;
583 if (phibin < 4) mystream<<S_slbin_7[etabin];
584 else mystream<<S_slbin_3[etabin];
586 slbin = mystream.str();
591 if (ieta < 40) idphi = 2;
595 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
596 det, iside, ieta, iphi, idepth,
597 idphi, iwedge, irm, irm_fi, ipixel, iqie, iadc,
598 islb, irctcra, irctcar, irctcon,
599 rbx, slbin, slbin2, slnam, rctnam
601 HBHEHFEntries.push_back(hbeflmapentry);
605 unsigned int denseId;
608 HbHash2Entry.at(denseId)=HBHEHFEntries.size();
612 HeHash2Entry.at(denseId)=HBHEHFEntries.size();
616 HfHash2Entry.at(denseId)=HBHEHFEntries.size();
619 ConstructTriggerTower(topo,
621 iside, ieta, iphi, idphi, idepth, det, iwedge, irm,
622 ipixel, iqie, iadc, irm_fi, ifi_ch, icrate, ihtr, fpga,
623 ihtr_fi, ispigot, islb, slbin, slbin2,
624 slnam, irctcra, irctcar, irctcon, rctnam, ifed
635 std::vector <HOHXLogicalMapEntry>& HOHXEntries,
636 std::vector <uint32_t>& LinearIndex2Entry,
637 std::vector <uint32_t>& HoHash2Entry,
638 std::vector <uint32_t>& HxCalibHash2Entry) {
641 int hocrate_loc[NHOCR]={3,7,6,13};
642 memcpy( hocrate, hocrate_loc,
sizeof(
int)*NHOCR );
644 int fedhonum_loc[NHOCR][2]={{724,725},{726,727},{728,729},{730,731}};
645 memcpy( fedhonum, fedhonum_loc,
sizeof(
int)*NHOCR*2 );
647 int ihslotho_loc[NHSETSHO][NHTRSHO]={{2,3,4,5},{6,7,13,14},{15,16,17,18}};
648 memcpy( ihslotho, ihslotho_loc,
sizeof(
int)*NHSETSHO*NHTRSHO );
650 int ihophis_loc[NHOCR]={71,17,35,53};
651 memcpy( ihophis, ihophis_loc,
sizeof(
int)*NHOCR );
656 int HO_RM_table_loc[24][16][2] =
658 {{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2}},
659 {{2,2},{2,2},{2,2},{2,2},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4},{2,4}},
660 {{3,3},{3,3},{3,3},{3,3},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4},{2,4}},
661 {{3,3},{3,3},{3,3},{3,3},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4},{2,4}},
662 {{4,4},{4,4},{4,4},{4,4},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3},{1,3}},
663 {{4,4},{4,4},{4,4},{4,4},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3},{1,3}},
664 {{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3},{1,3}},
665 {{3,3},{3,3},{3,3},{3,3},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1},{3,1}},
666 {{2,2},{2,2},{2,2},{2,2},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1},{3,1}},
667 {{2,2},{2,2},{2,2},{2,2},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1},{3,1}},
668 {{4,4},{4,4},{4,4},{4,4},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2}},
669 {{4,4},{4,4},{4,4},{4,4},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2}},
670 {{3,3},{3,3},{3,3},{3,3},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2}},
671 {{3,3},{3,3},{3,3},{3,3},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4},{2,4}},
672 {{2,2},{2,2},{2,2},{2,2},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4},{2,4}},
673 {{2,2},{2,2},{2,2},{2,2},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4},{2,4}},
674 {{1,1},{1,1},{1,1},{1,1},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3},{1,3}},
675 {{1,1},{1,1},{1,1},{1,1},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3},{1,3}},
676 {{2,2},{2,2},{2,2},{2,2},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3},{1,3}},
677 {{2,2},{2,2},{2,2},{2,2},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1},{3,1}},
678 {{3,3},{3,3},{3,3},{3,3},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1},{3,1}},
679 {{3,3},{3,3},{3,3},{3,3},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1},{3,1}},
680 {{1,1},{1,1},{1,1},{1,1},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2}},
681 {{1,1},{1,1},{1,1},{1,1},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2}}
683 memcpy( HO_RM_table, HO_RM_table_loc,
sizeof(
int)*24*16*2 );
686 int HO_RM_fi_eta5to15_loc[11] = {3, 2, 5, 4, 7, 6, 3, 2, 5, 4, 7};
687 memcpy( HO_RM_fi_eta5to15, HO_RM_fi_eta5to15_loc,
sizeof(
int)*11 );
702 int HO_RM_fi_eta1to4_loc[24][2][2] =
704 {{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},
705 {{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},
706 {{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}}
708 memcpy( HO_RM_fi_eta1to4, HO_RM_fi_eta1to4_loc,
sizeof(
int)*24*2*2 );
719 int HO_RM_fi_eta1to4_sipm_loc[24][4][2] =
721 {{5,3},{5,5},{7,3},{6,3}}, {{4,2},{7,4},{7,2},{6,2}}, {{5,3},{5,5},{7,3},{6,3}}, {{4,2},{7,4},{7,2},{6,2}},
722 {{2,4},{4,7},{2,7},{2,6}}, {{3,5},{5,5},{3,7},{3,6}}, {{2,4},{4,7},{2,7},{2,6}}, {{3,5},{5,5},{3,7},{3,6}},
723 {{2,4},{4,7},{2,7},{2,6}}, {{3,5},{5,5},{3,7},{3,6}}, {{2,4},{4,7},{2,7},{2,6}}, {{3,5},{5,5},{3,7},{3,6}},
724 {{2,4},{4,7},{2,7},{2,6}}, {{3,5},{5,5},{3,7},{3,6}}, {{2,4},{4,7},{2,7},{2,6}}, {{3,5},{5,5},{3,7},{3,6}},
725 {{5,3},{5,5},{7,3},{6,3}}, {{4,2},{7,4},{7,2},{6,2}}, {{5,3},{5,5},{7,3},{6,3}}, {{4,2},{7,4},{7,2},{6,2}},
726 {{5,3},{5,5},{7,3},{6,3}}, {{4,2},{7,4},{7,2},{6,2}}, {{5,3},{5,5},{7,3},{6,3}}, {{4,2},{7,4},{7,2},{6,2}},
728 memcpy( HO_RM_fi_eta1to4_sipm, HO_RM_fi_eta1to4_sipm_loc,
sizeof(
int)*24*4*2 );
731 int HO_htr_fi_450eta5to15_loc[2][11] = {{2, 2, 4, 6, 8, 2, 4, 6, 8, 4, 6},
732 {2, 8, 6, 4, 2, 8, 6, 4, 2, 4, 2}};
733 memcpy( HO_htr_fi_450eta5to15, HO_htr_fi_450eta5to15_loc,
sizeof(
int)*2*11 );
736 int HO_htr_fi_450eta16M_loc[4] = {7, 7, 8, 8};
737 memcpy( HO_htr_fi_450eta16M, HO_htr_fi_450eta16M_loc,
sizeof(
int)*4 );
740 int HO_htr_fi_450eta16P_loc[4][6] = { {4,2,4,4,2,6},{2,6,6,2,6,4},{5,3,5,5,3,7},{3,7,7,3,7,5} };
741 memcpy( HO_htr_fi_450eta16P, HO_htr_fi_450eta16P_loc,
sizeof(
int)*4*6 );
744 int HO_htr_fi_eta4_loc[2][6] = {{6, 6, 8, 8, 7, 7},
747 memcpy( HO_htr_fi_eta4, HO_htr_fi_eta4_loc,
sizeof(
int)*2*6 );
749 int HO_htr_fi_eta123_loc[2][6] = {{6, 5, 4, 3, 8, 7},
752 memcpy( HO_htr_fi_eta123, HO_htr_fi_eta123_loc,
sizeof(
int)*2*6 );
762 int HO_htr_fi_eta1234_sipm[6][5][2][2] = {
764 {{4,8},{6,4}}, {{4,4},{4,7}}, {{6,8},{6,7}}, {{5,8},{6,8}}, {{5,6},{-1,-1}} },
766 {{6,7},{5,6}}, {{6,6},{6,6}}, {{6,7},{5,7}}, {{5,7},{5,8}}, {{-1,-1},{4,8}} },
768 {{4,5},{5,6}}, {{5,5},{5,5}}, {{4,5},{4,6}}, {{4,6},{3,6}}, {{-1,-1},{3,8}} },
770 {{3,8},{8,5}}, {{8,8},{4,8}}, {{3,5},{4,5}}, {{3,6},{3,5}}, {{5,6},{-1,-1}} },
772 {{3,2},{8,3}}, {{3,3},{3,1}}, {{8,2},{8,1}}, {{7,2},{8,2}}, {{7,7},{-1,-1}} },
774 {{7,1},{7,7}}, {{8,7},{7,7}}, {{8,1},{7,1}}, {{7,1},{7,2}}, {{-1,-1},{3,2}} },
782 int ipixelHO_loc[NRMFIBR][NFCH][2] = {{{12,12},{ 7, 7},{ 6, 3}},
783 {{ 4, 4},{ 8, 8},{ 5, 1}},
784 {{19,11},{18, 6},{17, 2}},
785 {{ 2, 9},{ 1,13},{ 3, 5}},
786 {{11,19},{16,18},{15,17}},
787 {{13,15},{ 9,14},{14,16}}};
789 int ipixelHO_sipm[NRMFIBR][NFCH][2] = {{{12,12},{ 7, 7},{ 3, 3}},
790 {{ 4, 4},{ 8, 8},{ 1, 1}},
791 {{11,11},{ 6, 6},{ 2, 2}},
792 {{ 9, 9},{13,13},{ 5, 5}},
793 {{19,19},{18,18},{17,17}},
794 {{15,15},{14,14},{16,16}}};
796 memcpy( ipixelHO, ipixelHO_loc,
sizeof(
int)*NRMFIBR*NFCH*2 );
798 memcpy( ipixelHO, ipixelHO_sipm,
sizeof(
int)*NRMFIBR*NFCH*2 );
801 std::string letterHO_loc[NRMFIBR][NFCH][2] = {{{
"E",
"E"},{
"G",
"L"},{
"F",
"S"}},
802 {{
"Q",
"M"},{
"N",
"T"},{
"P",
"F"}},
803 {{
"A",
"C"},{
"X",
"J"},{
"J",
"Q"}},
804 {{
"X",
"K"},{
"R",
"R"},{
"H",
"D"}},
805 {{
"D",
"A"},{
"C",
"G"},{
"B",
"N"}},
806 {{
"L",
"H"},{
"M",
"P"},{
"K",
"B"}}};
808 std::string letterHO_sipm[NRMFIBR][NFCH][2] = {{{
"E",
"E"},{
"G",
"L"},{
"H",
"S"}},
809 {{
"Q",
"M"},{
"N",
"T"},{
"R",
"F"}},
810 {{
"D",
"C"},{
"F",
"J"},{
"X",
"Q"}},
811 {{
"M",
"K"},{
"L",
"R"},{
"P",
"D"}},
812 {{
"A",
"A"},{
"X",
"G"},{
"J",
"N"}},
813 {{
"B",
"H"},{
"K",
"P"},{
"C",
"B"}}};
815 for (
int jj = 0;
jj < NRMFIBR;
jj++) {
816 for (
int kk = 0;
kk < NFCH;
kk++) {
817 for (
int ll = 0; ll < 2; ll++) {
819 letterHO[
jj][
kk][ll] = letterHO_loc[
jj][
kk][ll];
821 letterHO[
jj][
kk][ll] = letterHO_sipm[
jj][
kk][ll];
841 int rmspecialeta_loc[6][6] = {
842 { 14, 15, 14, 13, 12, 11 },
843 { 14, 15, 14, 13, 12, 11 },
844 { 10, 9, 8, 7, 6, 5 },
845 { 10, 9, 8, 7, 6, 5 },
846 { 14, 15, 14, 13, 12, 11 },
847 { 14, 15, 14, 13, 12, 11 }
851 {
"X",
"B",
"C",
"D",
"E",
"F" },
852 {
"X",
"P",
"Q",
"R",
"S",
"T" },
853 {
"G",
"H",
"J",
"K",
"L",
"M" },
854 {
"A",
"B",
"C",
"D",
"E",
"F" },
855 {
"X",
"B",
"C",
"D",
"E",
"F" },
856 {
"X",
"P",
"Q",
"R",
"S",
"T" }
860 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
861 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
862 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
863 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
864 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
865 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" }
868 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
871 for (
int jj = 0;
jj < 6;
jj++) {
872 for (
int kk = 0;
kk < 6;
kk++) {
873 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];}}
875 for (
int jj = 0;
jj < 6;
jj++) {
876 for (
int kk = 0;
kk < 6;
kk++) {
877 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];}}
880 else if (mapIOV_==2) {
881 int rmspecialeta_loc[6][6] = {
882 { 11, 12, 13, 14, 15, 15 },
883 { 11, 12, 13, 14, 15, 15 },
884 { 5, 6, 7, 8, 9, 10 },
885 { 5, 6, 7, 8, 9, 10 },
886 { 14, 15, 14, 13, 12, 11 },
887 { 11, 12, 13, 14, 15, 15 }
891 {
"F",
"E",
"D",
"C",
"B",
"X" },
892 {
"T",
"S",
"R",
"Q",
"P",
"X" },
893 {
"M",
"L",
"K",
"J",
"H",
"G" },
894 {
"F",
"E",
"D",
"C",
"B",
"A" },
895 {
"X",
"B",
"C",
"D",
"E",
"F" },
896 {
"T",
"S",
"R",
"Q",
"P",
"X" }
900 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
901 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
902 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
903 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
904 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
905 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" }
908 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
911 for (
int jj = 0;
jj < 6;
jj++) {
912 for (
int kk = 0;
kk < 6;
kk++) {
913 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];}}
915 for (
int jj = 0;
jj < 6;
jj++) {
916 for (
int kk = 0;
kk < 6;
kk++) {
917 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];}}
921 int rmspecialeta_loc[6][6] = {
922 { 11, 12, 13, 14, 15, 15 },
923 { 11, 12, 13, 14, 15, 15 },
924 { 5, 6, 7, 8, 9, 10 },
925 { 5, 6, 7, 8, 9, 10 },
926 { 11, 12, 13, 14, 15, 15 },
927 { 11, 12, 13, 14, 15, 15 }
931 {
"F",
"E",
"D",
"C",
"B",
"X" },
932 {
"T",
"S",
"R",
"Q",
"P",
"X" },
933 {
"M",
"L",
"K",
"J",
"H",
"G" },
934 {
"F",
"E",
"D",
"C",
"B",
"A" },
935 {
"F",
"E",
"D",
"C",
"B",
"X" },
936 {
"T",
"S",
"R",
"Q",
"P",
"X" }
940 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
941 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
942 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
943 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
944 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
945 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" }
948 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
951 for (
int jj = 0;
jj < 6;
jj++) {
952 for (
int kk = 0;
kk < 6;
kk++) {
953 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];}}
955 for (
int jj = 0;
jj < 6;
jj++) {
956 for (
int kk = 0;
kk < 6;
kk++) {
957 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];}}
962 char tempbuff[30]{0};
965 stringstream mystream;
968 for(isid = -1; isid < 2; isid+=2){
969 for (iph = 0; iph < NHOPHI; iph++){
970 for (iet = 0; iet < NHOETA; iet++){
976 if (iphi >= 71 || iphi < 17) ic = 0;
977 else if (iphi >= 17 && iphi < 35) ic = 1;
978 else if (iphi >= 35 && iphi < 53) ic = 2;
990 phmod6e450 = (phmod6 == 4 || phmod6 == 5 || phmod6 == 0);
991 phmod6e123 = (phmod6 == 1 || phmod6 == 2 || phmod6 == 3);
994 if (ieta <= 3 && (iside < 0 || phmod6 >= 4)) fpga =
"bot";
995 else if (ieta <= 3 && iside > 0 && phmod6 < 4) fpga =
"top";
997 else if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6)) fpga =
"top";
998 else if ((ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13)) fpga =
"bot";
1000 else if (ieta >= 10 && iside > 0) fpga =
"top";
1001 else if (ieta < 10 && ieta >= 6 && iside > 0) fpga =
"bot";
1003 else if ((ieta == 5 && iside > 0) || ieta == 4) fpga =
"top";
1004 else if ((ieta == 5 || ieta >= 10) && iside < 0) fpga =
"bot";
1005 else if ((ieta < 10 && ieta >= 6) && iside < 0) fpga =
"top";
1006 else edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Bad fpga code"<<endl;
1009 if (ieta <= 20) idphi = 1;
1013 if (iside == 1) sidear = 1;
1019 irm = HO_RM_table[phmod24][iet][sidear];
1023 if (ieta==16) irm_fi = HO_RM_fi_eta16;
1024 else if (ieta >= 5) irm_fi = HO_RM_fi_eta5to15[ieta - 5];
1027 if (ieta <= 3) irm_fi = HO_RM_fi_eta1to4[phmod24][0][sidear];
1028 else if (ieta == 4) irm_fi = HO_RM_fi_eta1to4[phmod24][1][sidear];
1029 else irm_fi = -1000;
1031 else if (mapIOV_ >= 5) {
1032 irm_fi = HO_RM_fi_eta1to4_sipm[phmod24][ieta-1][sidear];
1039 if (ieta >= 5 && phmod6e450) ihtr_fi = HO_htr_fi_450eta5to15[sidear][ieta - 5];
1040 else if (ieta >= 5 && phmod6e123) ihtr_fi = HO_htr_fi_450eta5to15[sidear][ieta - 5] - 1;
1041 else if (ieta <= 4) {
1043 if (ieta == 4) ihtr_fi = HO_htr_fi_eta4[sidear][phmod6];
1044 else if (ieta <= 3) ihtr_fi = HO_htr_fi_eta123[sidear][phmod6];
1046 else if (mapIOV_ >= 5) {
1047 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][ieta-1][(irm-1)/2][sidear];
1050 else ihtr_fi = -1000;
1054 phi1458 = (iphi % 12 == 1 || iphi % 12 == 4 || iphi % 12 == 5 || iphi % 12 == 8);
1055 phi271011 = (iphi % 12 == 2 || iphi % 12 == 7 || iphi % 12 == 10 || iphi % 12 == 11);
1058 phir0v1 = (iphi % 24 == 0 || iphi % 24 == 2 || iphi % 24 == 4 || iphi % 24 == 18 || iphi % 24 == 20 || iphi % 24 == 22);
1059 phir0v2 = (iphi % 24 == 1 || iphi % 24 == 3 || iphi % 24 == 17 || iphi % 24 == 19 || iphi % 24 == 21 || iphi % 24 == 23);
1061 phir0v3 = (iphi % 24 == 5 || iphi % 24 == 7 || iphi % 24 == 9 || iphi % 24 == 11 || iphi % 24 == 13 || iphi % 24 == 15);
1062 phir0v4 = (iphi % 24 == 6 || iphi % 24 == 8 || iphi % 24 == 10 || iphi % 24 == 12 || iphi % 24 == 14 || iphi % 24 == 16);
1065 if (ieta % 2 == 0 && phi1458) ifi_ch = 0;
1066 else if (ieta % 2 == 0 && iphi % 3 == 0) ifi_ch = 1;
1067 else if (ieta % 2 == 0 && phi271011) ifi_ch = 2;
1068 else if (ieta % 2 == 1 && iphi % 3 == 0) ifi_ch = 0;
1069 else if (ieta % 2 == 1 && phi271011) ifi_ch = 1;
1070 else if (ieta % 2 == 1 && phi1458) ifi_ch = 2;
1076 if (phir0v1) ifi_ch = 0;
1077 else if (phir0v4) ifi_ch = 1;
1078 else if (iphi % 2 == 1) ifi_ch = 2;
1081 if (phir0v3) ifi_ch = 0;
1082 else if (phir0v2) ifi_ch = 1;
1083 else if (iphi % 2 == 0) ifi_ch = 2;
1087 else if ((ieta == 3 && iside == -1) || (ieta == 2 && iside == 1)){
1088 if (phir0v4) ifi_ch = 0;
1089 else if (phir0v3) ifi_ch = 1;
1090 else if (phir0v1 || phir0v2) ifi_ch = 2;
1093 else if ((ieta == 3 && iside == 1) || (ieta == 2 && iside == -1)){
1094 if (phir0v2) ifi_ch = 0;
1095 else if (phir0v1) ifi_ch = 1;
1096 else if (phir0v3 || phir0v4) ifi_ch = 2;
1099 else if (ieta == 1){
1100 if (phir0v1 || phir0v3) ifi_ch = 0;
1101 else if (phir0v2 || phir0v4) ifi_ch = 1;
1109 if (phir0v1) ifi_ch = 0;
1110 else if (phir0v4) ifi_ch = 2;
1111 else if (iphi % 2 == 1) ifi_ch = 2;
1114 if (phir0v3) ifi_ch = 0;
1115 else if (phir0v2) ifi_ch = 2;
1116 else if (iphi % 2 == 0) ifi_ch = 2;
1121 if (iphi % 2 == 0) ifi_ch = 2;
1122 else if (iphi % 2 == 1) ifi_ch = 1;
1125 if (iphi % 2 == 0) ifi_ch = 1;
1126 else if (iphi % 2 == 1) ifi_ch = 2;
1131 if (iphi % 2 == 0) ifi_ch = 0;
1132 else if (iphi % 2 == 1) ifi_ch = 1;
1135 if (iphi % 2 == 1) ifi_ch = 0;
1136 else if (iphi % 2 == 0) ifi_ch = 1;
1141 if (phir0v1) ifi_ch = 0;
1142 else if (phir0v4) ifi_ch = 1;
1143 else if (iphi % 2 == 1) ifi_ch = 0;
1146 if (phir0v3) ifi_ch = 0;
1147 else if (phir0v2) ifi_ch = 1;
1148 else if (iphi % 2 == 0) ifi_ch = 0;
1156 iqie = (irm_fi - 2) / 2 + 1;
1158 if (irm_fi % 2 == 0) iadc = ifi_ch;
1159 else iadc = NFCH + (ifi_ch + 1) % 3;
1163 ipixel = ipixelHO[irm_fi - 2][ifi_ch][0];
1164 letter = letterHO[irm_fi - 2][ifi_ch][0];
1167 ipixel = ipixelHO[irm_fi - 2][ifi_ch][1];
1168 letter = letterHO[irm_fi - 2][ifi_ch][1];
1173 if (ieta <= 4 && mapIOV_ >= 5) {
1174 if (ipixel==3 || ipixel==7 || ipixel==12 || ipixel==14 || ipixel==17 || ipixel==18) {
1176 if (phmod6==1 || phmod6==3)
1181 else if (ipixel==1 || ipixel==4 || ipixel==8 || ipixel==15 || ipixel==16 || ipixel==19) {
1183 if (phmod6==0 || phmod6==2)
1188 else if (ipixel==2 || ipixel==5 || ipixel==6 || ipixel==9 || ipixel==11 || ipixel==13) {
1194 if (fpga ==
"bot") itb = 1;
1200 if (ieta <= 3 || (ieta >= 14 && iside == 1)) ih = 0;
1201 else if (ieta <= 13 && ieta >= 6 && iside == 1) ih = 1;
1202 else if (ieta <= 13 && ieta >= 6 && iside == -1) ih = 3;
1209 int php2mod18 = (iph+2)%18;
1210 int php2mod18ov6 = php2mod18/6;
1215 if (iphi % 18 == 17 || iphi % 18 <= 4) is = 0;
1216 else if (iphi % 18 >= 5 && iphi % 18 <= 10) is = 1;
1219 if ( ieta == 16 && iside > 0 ) ihtr=21;
1221 ihtr=ihslotho[is][ih];
1225 ihtr=ihslotho[is][ih];
1227 if (mytype == 1 || mytype == 2)
1231 ihtr=ihslotho[php2mod18ov6][ih];
1235 if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6)) ispigot = 12;
1236 else if ((ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13)) ispigot = 13;
1237 else ispigot=ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
1239 idcc_sl = idcc == 1 ?10:20;
1241 ifed=fedhonum[ic][idcc-1];
1245 if (iside == -1) sidesign =
'M';
1246 else sidesign =
'P';
1248 if (ieta <= 4)
ring = 0;
1249 else if (ieta >= 5 && ieta <= 10)
ring = 1;
1254 for (
i = -2;
i < iphi;
i+=6){
1257 if (sector > 12) sector = 1;
1262 if (
ring != 0 && sector % 2 != 0) sector++;
1264 if (
ring == 0) snprintf (tempbuff,
sizeof tempbuff,
"%s%i%2.2d", det.c_str(),
ring, sector);
1265 else snprintf (tempbuff,
sizeof tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign, sector);
1267 rbx = mystream.str();
1275 if (ieta==16 && isid<0) ihtr_fi = HO_htr_fi_450eta16M[irm - 1];
1276 else if (ieta==16 && isid>0) ihtr_fi = HO_htr_fi_450eta16P[irm - 1][sector/2-1];
1278 if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 7)) {
1282 else if ((ieta > 15 && iside > 0) && (icrate == 6 || icrate == 13)) {
1287 if ( ieta == 16 ) ieta = 15;
1289 if ( iside == 1 &&
ring == 2 ) {
1291 ieta = rmspecialeta[0][iet - 10];
1292 letter = rmspeciallet_code[0][iet - 10];
1293 det = rmspecialdet[0][iet - 10];
1295 else if ( iphi == 67 ) {
1296 ieta = rmspecialeta[1][iet - 10];
1297 letter = rmspeciallet_code[1][iet - 10];
1298 det = rmspecialdet[1][iet - 10];
1301 else if ( iside == -1) {
1304 ieta = rmspecialeta[2][iet - 4];
1305 letter = rmspeciallet_code[2][iet - 4];
1306 det = rmspecialdet[2][iet - 4];
1308 else if ( iphi == 65 ) {
1309 ieta = rmspecialeta[3][iet - 4];
1310 letter = rmspeciallet_code[3][iet - 4];
1311 det = rmspecialdet[3][iet - 4];
1314 else if (
ring == 2 ) {
1316 ieta = rmspecialeta[4][iet - 10];
1317 letter = rmspeciallet_code[4][iet - 10];
1318 det = rmspecialdet[4][iet - 10];
1320 else if ( iphi == 31 ) {
1321 ieta = rmspecialeta[5][iet - 10];
1322 letter = rmspeciallet_code[5][iet - 10];
1323 det = rmspecialdet[5][iet - 10];
1329 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1330 det, iside, ieta, iphi, idepth,
1331 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1334 HOHXEntries.push_back(hoxlmapentry);
1338 unsigned int denseId;
1341 HoHash2Entry.at(denseId)=HOHXEntries.size();
1344 HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1356 if (irm_fi % 2 == 0) iadc = ifi_ch;
1357 else iadc = NFCH + (ifi_ch + 1) % 3;
1358 iqie = (irm_fi - 2) / 2 + 1;
1359 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][4][(irm-1)/2][sidear];
1364 ihtr=ihslotho[php2mod18ov6][ih];
1365 ispigot = ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
1367 idcc_sl = idcc == 1 ?10:20;
1368 ifed=fedhonum[ic][idcc-1];
1373 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1374 det, iside, ieta, iphi, idepth,
1375 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1378 HOHXEntries.push_back(hoxlmapentry);
1382 unsigned int denseId;
1385 HoHash2Entry.at(denseId)=HOHXEntries.size();
1388 HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1391 else if (ipixel==17){
1399 if (irm_fi % 2 == 0) iadc = ifi_ch;
1400 else iadc = NFCH + (ifi_ch + 1) % 3;
1401 iqie = (irm_fi - 2) / 2 + 1;
1402 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][4][(irm-1)/2][sidear];
1403 if (phmod6==1 || phmod6==3) {
1411 ispigot = ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
1413 idcc_sl = idcc == 1 ?10:20;
1414 ifed=fedhonum[ic][idcc-1];
1419 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1420 det, iside, ieta, iphi, idepth,
1421 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1424 HOHXEntries.push_back(hoxlmapentry);
1428 unsigned int denseId;
1431 HoHash2Entry.at(denseId)=HOHXEntries.size();
1434 HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1444 std::vector <CALIBLogicalMapEntry>& CALIBEntries,
1445 std::vector <uint32_t>& LinearIndex2Entry,
1446 std::vector <uint32_t>& HxCalibHash2Entry) {
1450 int calibcrate_loc[NCALIBCR]={4,0,1,5,11,15,17,14,10,9,7,6,13};
1451 memcpy( calibcrate, calibcrate_loc,
sizeof(
int)*NCALIBCR );
1453 int fedcalibnum_loc[NCALIBCR][2]={{700,701},{702,703},{704,705},{706,707},{708,709},{710,711},{712,713},{714,715},{716,717},
1455 {726,727},{728,729},{730,731}};
1456 memcpy( fedcalibnum, fedcalibnum_loc,
sizeof(
int)*NCALIBCR*2 );
1458 int icalibphis_loc[NCALIBCR]={3,11,19,27,35,43,51,59,67,27,17,35,53};
1459 memcpy( icalibphis, icalibphis_loc,
sizeof(
int)*NCALIBCR );
1461 int icalibsector_min_loc[NCALIBCR]={2,4,6,8,10,12,14,16,18,1,4,7,10};
1462 memcpy( icalibsector_min, icalibsector_min_loc,
sizeof(
int)*NCALIBCR );
1464 int icalibsector_max_loc[NCALIBCR]={3,5,7,9,11,13,15,17,1,4,6,9,12};
1465 memcpy( icalibsector_max, icalibsector_max_loc,
sizeof(
int)*NCALIBCR );
1467 std::string detIDCALIB_loc[NCALIBCR][NTOPBOT] = {{
"HB",
"HE"},
1480 for (
int jj = 0;
jj < NCALIBCR;
jj++) {
1481 for (
int kk = 0;
kk < NTOPBOT;
kk++) {
1482 detIDCALIB[
jj][
kk] = detIDCALIB_loc[
jj][
kk];
1486 int nfbr_max_loc[NCALIBCR][NTOPBOT] = {{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}};
1487 memcpy( nfbr_max, nfbr_max_loc,
sizeof(
int)*NCALIBCR*NTOPBOT );
1489 int calibHOinfo_loc[NHOCR][NTOPBOT][NFBR][2]={
1490 {{{4,0},{5,0},{6,0},{},{6,-2},{6,-1},{6,1},{6,2}},
1491 {{4,-2},{4,-1},{4,1},{4,2},{},{},{},{}}},
1493 {{{7,0},{8,0},{9,0},{},{8,-2},{8,-1},{8,1},{8,2}},
1494 {{1,0},{2,0},{3,0},{},{2,-2},{2,-1},{2,1},{2,2}}},
1496 {{{10,0},{11,0},{12,0},{},{10,-2},{10,-1},{10,1},{10,2}},
1497 {{12,-2},{12,-1},{12,1},{12,2},{},{},{},{}}}
1499 memcpy( calibHOinfo, calibHOinfo_loc,
sizeof(
int)*NHOCR*NTOPBOT*NFBR*2 );
1503 char tempbuff[30]{0};
1507 stringstream mystream;
1517 for(ic=0; ic<NHBHECR; ic++){
1518 icrate=calibcrate[ic];
1519 ifed=fedcalibnum[ic][idcc-1];
1521 for(itb=0; itb<NTOPBOT; itb++){
1523 for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1524 det = detIDCALIB[ic][itb];
1528 if (itb==1)
if(ihtr_fi%2==0) irm_fi = 2;
1532 if (ihtr_fi==1||ihtr_fi==2||ihtr_fi==5||ihtr_fi==6) {
1533 iwedge = icalibsector_min[ic];
1535 else if (ihtr_fi==3||ihtr_fi==4||ihtr_fi==7||ihtr_fi==8) {
1536 iwedge = icalibsector_max[ic];
1551 else if (det==
"HB"){
1554 (ihtr_fi%2==1) ? iwedge = icalibsector_min[ic] : iwedge = icalibsector_max[ic];
1568 iphi = ((iwedge*idphi) + 71 - idphi)%72;
1569 subdet =
"CALIB_"+det;
1570 snprintf (tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
1572 rbx = mystream.str();
1575 for(ifc=0; ifc<NFCH; ifc++){
1578 if (ifc==0) ich_type=0;
1579 else if (ifc==1) ich_type=1;
1581 if (det==
"HB") ich_type=2;
1582 else if(det==
"HE") ich_type=3;
1585 else if (irm_fi==2){
1586 if (ifc==0) ich_type=4;
1587 else if (ifc==1) ich_type=5;
1588 else if (ifc==2) ich_type=6;
1591 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1592 det, ieta, iphi, ich_type,
1593 iside, idphi, rbx, iwedge, irm_fi,
1596 CALIBEntries.push_back(caliblmapentry);
1609 for(itb=0; itb<NTOPBOT; itb++){
1611 for(ifb=0; ifb<4; ifb++){
1613 for(ifc=0; ifc<NFCH; ifc++){
1614 icrate=calibcrate[ic];
1618 (ihtr_fi==1)?iphi=1:((ihtr_fi==2)?iphi=19:((ihtr_fi==3)?iphi=37:iphi=55));
1620 ifed=fedcalibnum[ic][idcc-1];
1621 (ifc==0)?ich_type=8:(ifc==1?ich_type=0:ich_type=1);
1641 subdet =
"CALIB_"+det;
1642 snprintf (tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
1644 rbx = mystream.str();
1647 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1648 det, ieta, iphi, ich_type,
1649 iside, idphi, rbx, iwedge, irm_fi,
1652 CALIBEntries.push_back(caliblmapentry);
1664 for(ic=ic+1 ; ic<NCALIBCR; ic++){
1665 icrate=calibcrate[ic];
1667 ifed=fedcalibnum[ic][idcc-1];
1669 for(itb=0; itb<NTOPBOT; itb++){
1670 det=detIDCALIB[ic][itb];
1672 for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1682 iwedge=calibHOinfo[ic-10][itb][ifb][0];
1683 ieta=calibHOinfo[ic-10][itb][ifb][1];
1696 if (ieta==-2) S_side=
'2';
1697 else if (ieta==-1) S_side=
'1';
1698 else if (ieta==1) S_side=
'1';
1699 else if (ieta==2) S_side=
'2';
1701 subdet =
"CALIB_"+det;
1702 if (ieta==0) snprintf (tempbuff,
sizeof tempbuff,
"%s%c%2.2i", det.c_str(), sidesign, iwedge);
1703 else snprintf (tempbuff,
sizeof tempbuff,
"%s%c%c%2.2i", det.c_str(), S_side, sidesign, iwedge);
1705 rbx = mystream.str();
1713 ( ieta == -2 ) ? ( iwedge == 12 ? NFCH_HO = 3 : NFCH_HO = 2 ) : ( iwedge == 10) ? NFCH_HO = 3 : NFCH_HO = 2;
1714 for(ifc=0; ifc<NFCH_HO; ifc++){
1716 (ifi_ch == 2) ? ich_type = 7 : ich_type = ifi_ch;
1717 (ieta==0) ? idphi = 6 : idphi = 12;
1719 (ieta==0) ? iphi=((iwedge*idphi)+71-idphi)%72 : iphi=(((iwedge/2)*idphi)+71-idphi)%72;
1722 if (iside==0&&ifb==3)
continue;
1724 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1725 det, ieta, iphi, ich_type,
1726 iside, idphi, rbx, iwedge, irm_fi,
1729 CALIBEntries.push_back(caliblmapentry);
1743 std::vector <uint32_t>& LinearIndex2Entry,
1744 std::vector <uint32_t>& ZdcHash2Entry) {
1748 stringstream mystream;
1758 for(itb=0; itb<NTOPBOT; itb++){
1775 for(icab=1; icab<NZDCCAB+1; icab++){
1781 else if (icab < 7) {
1795 if (mapIOV_<4) ihtr_fi = irm_fi + 3;
1796 else ihtr_fi = irm_fi;
1812 if (icab==6) iqie = 1;
1816 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1818 ix, iy,
idx, idet_ch, icab, irm, iqie,
1821 ZDCEntries.push_back(zdclmapentry);
1830 std::vector <HTLogicalMapEntry>& HTEntries,
1831 int iside,
int ieta,
int iphi,
int idphi,
int idepth,
std::string det,
int iwedge,
int irm,
1832 int ipixel,
int iqie,
int iadc,
int irm_fi,
int ifi_ch,
int icrate,
int ihtr,
std::string fpga,
1838 string t_chDet,t_fpga;
1839 string t_slnam,t_rctnam,t_slbin,t_slbin2;
1842 int t_side,t_iEta,t_iPhi,t_jPhi,t_iDep,t_topbot;
1843 int t_wedge,t_crate,t_htr;
1845 int t_spigo,t_slb,t_rctcra,t_rctcar,t_rctcon,t_fedid;
1848 (fpga==
"bot") ? t_topbot = 1 : t_topbot = 0;
1878 if(t_iDep!=1)
break;
1879 if(t_chDet==
"HE"&&t_iEta==29)
break;
1883 if(t_iEta==30||t_iEta==31||t_iEta==33||
1884 t_iEta==34||t_iEta==36||t_iEta==37||
1885 t_iEta==39||t_iEta==40||t_iEta==41)
break;
1887 else if(t_iEta==32)t_iEta=30;
1888 else if(t_iEta==35)t_iEta=31;
1889 else if(t_iEta==38)t_iEta=32;
1891 if(t_iPhi==3||t_iPhi==7||t_iPhi==11||t_iPhi==15||t_iPhi==19||
1892 t_iPhi==23||t_iPhi==27||t_iPhi==31||t_iPhi==35||t_iPhi==39||
1893 t_iPhi==43||t_iPhi==47||t_iPhi==51||t_iPhi==55||t_iPhi==59||
1894 t_iPhi==63||t_iPhi==67||t_iPhi==71)
break;
1897 if(t_side<0) t_iEta=-t_iEta;
1901 if(t_slbin2!=
"NA") t_jPhi=1;
1902 if(t_slbin==
"A0"||t_slbin==
"B0") t_nDat=0;
1903 else if(t_slbin==
"A1"||t_slbin==
"B1") t_nDat=1;
1904 else if(t_slbin==
"C0"||t_slbin==
"D0") t_nDat=2;
1905 else if(t_slbin==
"C1"||t_slbin==
"D1") t_nDat=3;
1909 t_side, t_jPhi, t_iDep, t_chDet, t_wedge, t_crate, t_htr, t_topbot,
1910 t_spigo, t_slb, t_slbin, t_slbin2, t_nDat,
1911 t_slnam, t_rctcra, t_rctcar, t_rctcon, t_rctnam, t_fedid
1913 HTEntries.push_back(htlmapentry);
1915 if(t_slbin2!=
"NA") {
1916 if(t_slbin2==
"A0"||t_slbin2==
"B0") t_nDat=0;
1917 else if(t_slbin2==
"A1"||t_slbin2==
"B1") t_nDat=1;
1918 else if(t_slbin2==
"C0"||t_slbin2==
"D0") t_nDat=2;
1919 else if(t_slbin2==
"C1"||t_slbin2==
"D1") t_nDat=3;
1925 t_side, t_jPhi, t_iDep, t_chDet, t_wedge, t_crate, t_htr, t_topbot,
1926 t_spigo, t_slb, t_slbin, t_slbin2, t_nDat,
1927 t_slnam, t_rctcra, t_rctcar, t_rctcon, t_rctnam, t_fedid
1929 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()