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(HBHEHFEntries,HTEntries,LinearIndex2Entry,HbHash2Entry,HeHash2Entry,HfHash2Entry,HtHash2Entry);
77 buildHOXMap(HOHXEntries,LinearIndex2Entry,HoHash2Entry,HxCalibHash2Entry);
78 buildCALIBMap(CALIBEntries,LinearIndex2Entry,HxCalibHash2Entry);
79 buildZDCMap(ZDCEntries,LinearIndex2Entry,ZdcHash2Entry);
81 return HcalLogicalMap(HBHEHFEntries,HOHXEntries,CALIBEntries,ZDCEntries,HTEntries,
82 LinearIndex2Entry,HbHash2Entry,HeHash2Entry,HfHash2Entry,HtHash2Entry,
83 HoHash2Entry,HxCalibHash2Entry,ZdcHash2Entry);
87 std::vector <HTLogicalMapEntry>& HTEntries,
88 std::vector <uint32_t>& LinearIndex2Entry,
89 std::vector <uint32_t>& HbHash2Entry,
90 std::vector <uint32_t>& HeHash2Entry,
91 std::vector <uint32_t>& HfHash2Entry,
92 std::vector <uint32_t>& HtHash2Entry) {
96 int hbhecrate_loc[NHBHECR]={0,1,4,5,10,11,14,15,17};
97 memcpy( hbhecrate, hbhecrate_loc,
sizeof(
int)*NHBHECR );
99 int fedhbhenum_loc[NHBHECR][2]={{702,703},{704,705},{700,701},
100 {706,707},{716,717},{708,709},
101 {714,715},{710,711},{712,713}};
102 memcpy( fedhbhenum, fedhbhenum_loc,
sizeof(
int)*NHBHECR*2 );
104 int ihslot_loc[NHSETS]={2,5,13,16};
105 memcpy( ihslot, ihslot_loc,
sizeof(
int)*NHSETS );
107 int ihbhephis_loc[NHBHECR]={11,19,3,27,67,35,59,43,51};
108 memcpy( ihbhephis, ihbhephis_loc,
sizeof(
int)*NHBHECR );
110 int ihbheetadepth_loc[NHTRS][NTOPBOT][NFBR][NFCH][2]={
111 {{{{11,1},{ 7,1},{ 3,1}},
112 {{ 5,1},{ 1,1},{ 9,1}},
113 {{11,1},{ 7,1},{ 3,1}},
114 {{ 5,1},{ 1,1},{ 9,1}},
115 {{10,1},{ 6,1},{ 2,1}},
116 {{ 8,1},{ 4,1},{12,1}},
117 {{10,1},{ 6,1},{ 2,1}},
118 {{ 8,1},{ 4,1},{12,1}}},
119 {{{11,1},{ 7,1},{ 3,1}},
120 {{ 5,1},{ 1,1},{ 9,1}},
121 {{11,1},{ 7,1},{ 3,1}},
122 {{ 5,1},{ 1,1},{ 9,1}},
123 {{10,1},{ 6,1},{ 2,1}},
124 {{ 8,1},{ 4,1},{12,1}},
125 {{10,1},{ 6,1},{ 2,1}},
126 {{ 8,1},{ 4,1},{12,1}}}},
127 {{{{16,2},{15,2},{14,1}},
128 {{15,1},{13,1},{16,1}},
129 {{16,2},{15,2},{14,1}},
130 {{15,1},{13,1},{16,1}},
131 {{17,1},{16,3},{26,1}},
132 {{18,1},{18,2},{26,2}},
133 {{17,1},{16,3},{25,1}},
134 {{18,1},{18,2},{25,2}}},
135 {{{16,2},{15,2},{14,1}},
136 {{15,1},{13,1},{16,1}},
137 {{16,2},{15,2},{14,1}},
138 {{15,1},{13,1},{16,1}},
139 {{17,1},{16,3},{25,1}},
140 {{18,1},{18,2},{25,2}},
141 {{17,1},{16,3},{26,1}},
142 {{18,1},{18,2},{26,2}}}},
143 {{{{28,1},{28,2},{29,1}},
144 {{28,3},{24,2},{24,1}},
145 {{27,1},{27,2},{29,2}},
146 {{27,3},{23,2},{23,1}},
147 {{19,2},{20,1},{22,2}},
148 {{19,1},{20,2},{22,1}},
149 {{19,2},{20,1},{21,2}},
150 {{19,1},{20,2},{21,1}}},
151 {{{27,1},{27,2},{29,2}},
152 {{27,3},{23,2},{23,1}},
153 {{28,1},{28,2},{29,1}},
154 {{28,3},{24,2},{24,1}},
155 {{19,2},{20,1},{21,2}},
156 {{19,1},{20,2},{21,1}},
157 {{19,2},{20,1},{22,2}},
158 {{19,1},{20,2},{22,1}}}}
160 memcpy( ihbheetadepth, ihbheetadepth_loc,
sizeof(
int)*NHTRS*NTOPBOT*NFBR*NFCH*2 );
164 int irm_rmfiHBHE_loc[NHTRS][NTOPBOT][NFBR][2]={
165 {{{6,1},{7,1},{6,2},{7,2},{4,1},{5,1},{4,2},{5,2}},
166 {{6,3},{7,3},{6,4},{7,4},{4,3},{5,3},{4,4},{5,4}}},
167 {{{2,1},{3,1},{2,2},{3,2},{2,1},{3,1},{2,2},{3,2}},
168 {{2,3},{3,3},{2,4},{3,4},{2,3},{3,3},{2,4},{3,4}}},
169 {{{4,1},{5,1},{4,2},{5,2},{6,1},{7,1},{6,2},{7,2}},
170 {{4,3},{5,3},{4,4},{5,4},{6,3},{7,3},{6,4},{7,4}}}
172 memcpy( irm_rmfiHBHE, irm_rmfiHBHE_loc,
sizeof(
int)*NHTRS*NTOPBOT*NFBR*2 );
175 int ipixelHB_loc[NRMFIBR][NFCH][NRMSLOT] = {
176 {{18, 17, 3, 2 }, {13, 3, 17, 7 }, {14, 1, 19, 6 }},
177 {{19, 2, 18, 1 }, {15, 7, 13, 5 }, {17, 19, 1, 3 }},
178 {{9, 4, 16, 11}, {5, 8, 12, 15}, {2, 13, 7, 18}},
179 {{12, 11, 9, 8 }, {7, 15, 5, 13}, {16, 6, 14, 4 }},
180 {{8, 5, 15, 12}, {4, 9, 11, 16}, {1, 14, 6, 19}},
181 {{6, 16, 4, 14}, {3, 18, 2, 17}, {11, 12, 8, 9 }}
183 memcpy( ipixelHB, ipixelHB_loc,
sizeof(
int)*NRMFIBR*NFCH*NRMSLOT );
185 int ipixelHE_loc[NRMFIBR][NFCH][NRMSLOT] = {
186 {{12, 12, 12, 12}, {16, 7, 16, 7 }, {7, 16, 7, 16}},
187 {{11, 11, 11, 11}, {19, 3, 19, 3 }, {3, 19, 3, 19}},
188 {{15, 15, 6, 6 }, {2, 18, 2, 18}, {6, 6, 15, 15}},
189 {{5, 14, 5, 14}, {14, 5, 14, 5 }, {18, 2, 18, 2 }},
190 {{17, 1, 17, 1 }, {9, 9, 9, 9 }, {1, 17, 1, 17}},
191 {{13, 4, 13, 4 }, {8, 8, 8, 8 }, {4, 13, 4, 13}}
193 memcpy( ipixelHE, ipixelHE_loc,
sizeof(
int)*NRMFIBR*NFCH*NRMSLOT );
199 const char* S_slbin_odd_loc[] ={
"A1",
"B0",
"B1",
"A0",
"A1",
"B0",
"B1",
"A0"};
200 for (
int gg = 0; gg < 8; gg++) {
201 S_slbin_odd[gg] = S_slbin_odd_loc[gg];
203 const char* S_slbin_even_loc[]={
"C1",
"D0",
"D1",
"C0",
"C1",
"D0",
"D1",
"C0"};
204 for (
int gg = 0; gg < 8; gg++) {
205 S_slbin_even[gg] = S_slbin_even_loc[gg];
207 const char* rct_rackHBHE_loc[]={
"S2E01-RH",
"S2E03-RH",
"S2E05-RH",
"S2E07-RH",
"S2E09-RH",
"S2E08-RL",
"S2E06-RL",
"S2E04-RL",
"S2E02-RL",
208 "S2E02-RH",
"S2E04-RH",
"S2E06-RH",
"S2E08-RH",
"S2E09-RL",
"S2E07-RL",
"S2E05-RL",
"S2E03-RL",
"S2E01-RL"};
209 for (
int gg = 0; gg < 18; gg++) {
210 rct_rackHBHE[gg] = rct_rackHBHE_loc[gg];
213 int slb_table_loc[29] = {1,1,2,2,3,3,4,4,5,5,6,6,
216 memcpy( slb_table, slb_table_loc,
sizeof(
int)*29 );
220 stringstream mystream;
223 for(ic=0; ic<NHBHECR; ic++){
225 for(is=0; is<NHSETS; is++){
227 for(ih=0; ih<NHTRS; ih++){
229 for(itb=0; itb<NTOPBOT; itb++){
231 for(ifb=0; ifb<NFBR; ifb++){
233 for(ifc=0; ifc<NFCH; ifc++){
234 icrate=hbhecrate[ic];
235 iside=is<NHSETS/2?-1:1;
236 ifwtb=(is/2+itb+1)%2;
237 ieta=ihbheetadepth[ih][ifwtb][ifb][ifc][0];
238 idepth=ihbheetadepth[ih][ifwtb][ifb][ifc][1];
240 (ieta>16||idepth>2) ? det =
"HE": det =
"HB";
241 (itb%2)==1 ? fpga =
"bot" : fpga =
"top";
244 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;
245 ispigot=(is%2)*6+ih*2+itb;
246 idcc=is<NHSETS/2?1:2;
247 idcc_sl=idcc==1?10:20;
248 ifed=fedhbhenum[ic][idcc-1];
256 irm = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][1];
257 irm_fi = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][0];
260 if (ieta >= 21 && (irm == 1 || irm == 3)) iwedge = (iphi + 1 + irm + 1) / 4;
261 else iwedge = (iphi + irm + 1) / 4;
264 if (iwedge > 18) iwedge -= 18;
269 irm = irm_rmfiHBHE[ih][itb][ifb][1];
270 irm_fi = irm_rmfiHBHE[ih][itb][ifb][0];
273 if (ieta >= 21 && (irm == 4 || irm == 2)) iwedge = (iphi + 1 - irm + 6) / 4;
274 else iwedge = (iphi - irm + 6) / 4;
277 if (iwedge > 18) iwedge -= 18;
280 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
282 rbx = mystream.str();
289 if (ieta > 16 || idepth > 2) ipixel = ipixelHE[irm_fi - 2][ifc][irm - 1];
290 else ipixel = ipixelHB[irm_fi - 2][ifc][irm - 1];
292 iqie = iadcquiHBHE[irm_fi - 2][ifc][0];
293 iadc = iadcquiHBHE[irm_fi - 2][ifc][1];
296 if (phideg < 0) phideg = phideg + 72;
297 phideg = (phideg / 4) * 20 + 10;
298 irctcra = (( 89 - phideg + 720)%360)/20;
299 oddcard = irctcra % 2;
301 if (iside > 0) irctcra = irctcra + 9;
303 etaslb = ((ieta - 1) / 2) * 2 + 1;
304 if (etaslb > 27) etaslb = 27;
307 sprintf(tempbuff,
"SLB_H_%3.3d%c%2.2d%c",phideg,S_side,etaslb,
'\0');
309 slnam = mystream.str();
312 islb = slb_table[ieta - 1];
316 irctcar = 2 * ((ieta - 1)/8) + oddcard;
317 irctcon = 2 * (((ieta - 1)/2)%4);
322 if (eta2 > 28) eta2 = 28;
323 if (oddcard == 0) eta3 = eta2;
324 else eta3 = 57 - eta2;
325 irctcon = 2 * (((eta3 - 1) / 2) % 4);
327 irctcon = 11 * irctcon + 1;
329 sprintf(tempbuff,
"%s-%1d-HD%2.2d",rct_rackHBHE[irctcra],irctcar,irctcon);
331 rctnam = mystream.str();
338 for (
i = 0;
i < 18;
i++) {
339 if (iphi <
i * 4 + 3) {
346 if (ieta == 29) ietamod = 0;
347 else ietamod = ieta % 2;
349 if (ietamod == 1) mystream<<S_slbin_odd[phimod8];
350 else mystream<<S_slbin_even[phimod8];
352 else if (crazy == 0) {
353 if (ietamod == 1) mystream<<S_slbin_odd[phimod8];
354 else mystream<<S_slbin_even[phimod8];
357 if (ietamod == 1) mystream<<S_slbin_even[phimod8];
358 else mystream<<S_slbin_odd[phimod8];
361 slbin = mystream.str();
375 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
376 det, iside, ieta, iphi, idepth,
377 idphi, iwedge, irm, irm_fi, ipixel, iqie, iadc,
378 islb, irctcra, irctcar, irctcon,
379 rbx, slbin, slbin2, slnam, rctnam
381 HBHEHFEntries.push_back(hbeflmapentry);
385 const int hashedId=hgdi.
hashedId(
false);
390 ConstructTriggerTower(
392 iside, ieta, iphi, idphi, idepth, det, iwedge, irm,
393 ipixel, iqie, iadc, irm_fi, ifi_ch, icrate, ihtr, fpga,
394 ihtr_fi, ispigot, islb, slbin, slbin2,
395 slnam, irctcra, irctcar, irctcon, rctnam, ifed
406 int hfcrate_loc[NHFCR]={2,9,12};
407 memcpy( hfcrate, hfcrate_loc,
sizeof(
int)*NHFCR );
409 int fedhfnum_loc[NHFCR][2]={{718,719},{720,721},{722,723}};
410 memcpy( fedhfnum, fedhfnum_loc,
sizeof(
int)*NHFCR*2 );
412 int ihfphis_loc[NHFCR]={3,27,51};
413 memcpy( ihfphis, ihfphis_loc,
sizeof(
int)*NHFCR );
415 int ihfetadepth_loc[NTOPBOT][NFBR][NFCH][2]={
416 {{{33,1},{31,1},{29,1}},
417 {{32,1},{30,1},{34,1}},
418 {{33,2},{31,2},{29,2}},
419 {{32,2},{30,2},{34,2}},
420 {{34,2},{32,2},{30,2}},
421 {{31,2},{29,2},{33,2}},
422 {{34,1},{32,1},{30,1}},
423 {{31,1},{29,1},{33,1}}},
424 {{{41,1},{37,1},{35,1}},
425 {{38,1},{36,1},{39,1}},
426 {{41,2},{37,2},{35,2}},
427 {{38,2},{36,2},{39,2}},
428 {{40,2},{38,2},{36,2}},
429 {{37,2},{35,2},{39,2}},
430 {{40,1},{38,1},{36,1}},
431 {{37,1},{35,1},{39,1}}}
433 memcpy( ihfetadepth, ihfetadepth_loc,
sizeof(
int)*NTOPBOT*NFBR*NFCH*2 );
436 int irm_rmfiHF_loc[NHTRS][NTOPBOT][NFBR][2]={
437 {{{1,2},{2,2},{3,2},{4,2},{1,3},{2,3},{3,3},{4,3}},
438 {{5,2},{6,2},{7,2},{8,2},{5,3},{6,3},{7,3},{8,3}}},
439 {{{1,1},{2,1},{3,1},{4,1},{1,2},{2,2},{3,2},{4,2}},
440 {{5,1},{6,1},{7,1},{8,1},{5,2},{6,2},{7,2},{8,2}}},
441 {{{1,3},{2,3},{3,3},{4,3},{1,1},{2,1},{3,1},{4,1}},
442 {{5,3},{6,3},{7,3},{8,3},{5,1},{6,1},{7,1},{8,1}}}
444 memcpy( irm_rmfiHF, irm_rmfiHF_loc,
sizeof(
int)*NHTRS*NTOPBOT*NFBR*2 );
447 const char* S_slbin_7_loc[] ={
"A0",
"A1",
"B0",
"B1"};
448 for (
int gg = 0; gg < 4; gg++) {
449 S_slbin_7[gg] = S_slbin_7_loc[gg];
451 const char* S_slbin_3_loc[] ={
"C0",
"C1",
"D0",
"D1"};
452 for (
int gg = 0; gg < 4; gg++) {
453 S_slbin_3[gg] = S_slbin_3_loc[gg];
455 const char* rct_rackHF_loc[]={
"S2E01-FH",
"S2E03-FH",
"S2E05-FH",
"S2E07-FH",
"S2E09-FH",
"S2E08-FL",
"S2E06-FL",
"S2E04-FL",
"S2E02-FL",
456 "S2E02-FH",
"S2E04-FH",
"S2E06-FH",
"S2E08-FH",
"S2E09-FL",
"S2E07-FL",
"S2E05-FL",
"S2E03-FL",
"S2E01-FL"};
457 for (
int gg = 0; gg < 18; gg++) {
458 rct_rackHF[gg] = rct_rackHF_loc[gg];
465 for(ic=0; ic<NHFCR; ic++){
467 for(is=0; is<NHSETS; is++){
469 for(ih=0; ih<NHTRS; ih++){
471 for(itb=0; itb<NTOPBOT; itb++){
473 for(ifb=0; ifb<NFBR; ifb++){
475 for(ifc=0; ifc<NFCH; ifc++){
477 iside=is<NHSETS/2?-1:1;
478 ieta=ihfetadepth[itb][ifb][ifc][0];
479 idepth=ihfetadepth[itb][ifb][ifc][1];
482 (itb%2)== 1 ? fpga =
"bot" : fpga =
"top";
485 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;
486 ispigot=(is%2)*6+ih*2+itb;
487 idcc=is<NHSETS/2?1:2;
488 idcc_sl=idcc==1?10:20;
489 ifed=fedhfnum[ic][idcc-1];
491 irm_fi = irm_rmfiHF[ih][itb][ifb][0];
499 if (iphi == 1) iphi = 71;
500 else if (iphi == 71) iphi = 1;
501 else if (iphi % 4 == 1) iphi -= 2;
502 else if (iphi % 4 == 3) iphi += 2;
503 else edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Even iphi in HFM"<<endl;
512 if ((iside == 1 && ieta == 40) || (iside == -1 && ieta == 41)){
513 irm = ((iphi + 1) / 2) % 36 + 1;
514 hfphi = ((iphi + 1) / 6) % 12 + 1;
517 irm = ( iphi + 1) / 2;
518 hfphi = (iphi - 1) / 6 + 1;
520 irm = (irm - 1) % 3 + 1;
523 if (iphi >= 71) iwedge = 1;
524 else iwedge = (iphi + 1) / 4 + 1;
527 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, hfphi,
'\0');
529 rbx = mystream.str();
536 iqie = (irm_fi - 1) / 2 + 1;
538 if (irm_fi % 2 != 0) iadc = ifi_ch;
539 else iadc = NFCH + (ifi_ch + 1) % 3;
544 if (phideg < 0) phideg = phideg + 72;
545 phideg = (phideg / 4) * 20 + 10;
546 irctcra = (( 89 - phideg + 720)%360)/40;
547 if (iside > 0) irctcra = irctcra + 9;
555 sprintf(tempbuff,
"SLB_H_%3.3d%c%2.2d",phideg,S_side,etaslb);
557 slnam = mystream.str();
560 sprintf(tempbuff,
"%s-JSC-HF_IN",rct_rackHF[irctcra]);
562 rctnam = mystream.str();
567 int phibin = (iphi + 1) % 8 ;
568 int etabin = (ieta - 29) / 3;
569 if (etabin < 0) etabin = 0;
570 if (etabin > 3) etabin = 3;
571 if (phibin < 4) mystream<<S_slbin_7[etabin];
572 else mystream<<S_slbin_3[etabin];
574 slbin = mystream.str();
579 if (ieta < 40) idphi = 2;
583 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
584 det, iside, ieta, iphi, idepth,
585 idphi, iwedge, irm, irm_fi, ipixel, iqie, iadc,
586 islb, irctcra, irctcar, irctcon,
587 rbx, slbin, slbin2, slnam, rctnam
589 HBHEHFEntries.push_back(hbeflmapentry);
593 const int hashedId=hgdi.
hashedId(
false);
598 ConstructTriggerTower(
600 iside, ieta, iphi, idphi, idepth, det, iwedge, irm,
601 ipixel, iqie, iadc, irm_fi, ifi_ch, icrate, ihtr, fpga,
602 ihtr_fi, ispigot, islb, slbin, slbin2,
603 slnam, irctcra, irctcar, irctcon, rctnam, ifed
614 std::vector <uint32_t>& LinearIndex2Entry,
615 std::vector <uint32_t>& HoHash2Entry,
616 std::vector <uint32_t>& HxCalibHash2Entry) {
619 int hocrate_loc[NHOCR]={3,7,6,13};
620 memcpy( hocrate, hocrate_loc,
sizeof(
int)*NHOCR );
622 int fedhonum_loc[NHOCR][2]={{724,725},{726,727},{728,729},{730,731}};
623 memcpy( fedhonum, fedhonum_loc,
sizeof(
int)*NHOCR*2 );
625 int ihslotho_loc[NHSETSHO][NHTRSHO]={{2,3,4,5},{6,7,13,14},{15,16,17,18}};
626 memcpy( ihslotho, ihslotho_loc,
sizeof(
int)*NHSETSHO*NHTRSHO );
628 int ihophis_loc[NHOCR]={71,17,35,53};
629 memcpy( ihophis, ihophis_loc,
sizeof(
int)*NHOCR );
633 int HO_RM_table_loc[24][16][2] =
635 {{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}},
636 {{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}},
637 {{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}},
638 {{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}},
639 {{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}},
640 {{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}},
641 {{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}},
642 {{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}},
643 {{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}},
644 {{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}},
645 {{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}},
646 {{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}},
647 {{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}},
648 {{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}},
649 {{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}},
650 {{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}},
651 {{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}},
652 {{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}},
653 {{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}},
654 {{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}},
655 {{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}},
656 {{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}},
657 {{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}},
658 {{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}}
660 memcpy( HO_RM_table, HO_RM_table_loc,
sizeof(
int)*24*16*2 );
663 int HO_RM_fi_eta5to15_loc[11] = {3, 2, 5, 4, 7, 6, 3, 2, 5, 4, 7};
664 memcpy( HO_RM_fi_eta5to15, HO_RM_fi_eta5to15_loc,
sizeof(
int)*11 );
671 int HO_htr_fi_450eta5to15_loc[2][11] = {{2, 2, 4, 6, 8, 2, 4, 6, 8, 4, 6},
672 {2, 8, 6, 4, 2, 8, 6, 4, 2, 4, 2}};
673 memcpy( HO_htr_fi_450eta5to15, HO_htr_fi_450eta5to15_loc,
sizeof(
int)*2*11 );
676 int HO_htr_fi_450eta16M_loc[4] = {7, 7, 8, 8};
677 memcpy( HO_htr_fi_450eta16M, HO_htr_fi_450eta16M_loc,
sizeof(
int)*4 );
680 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} };
681 memcpy( HO_htr_fi_450eta16P, HO_htr_fi_450eta16P_loc,
sizeof(
int)*4*6 );
684 int HO_htr_fi_eta4_loc[2][6] = {{6, 6, 8, 8, 7, 7},
686 memcpy( HO_htr_fi_eta4, HO_htr_fi_eta4_loc,
sizeof(
int)*2*6 );
688 int HO_htr_fi_eta123_loc[2][6] = {{6, 5, 4, 3, 8, 7},
690 memcpy( HO_htr_fi_eta123, HO_htr_fi_eta123_loc,
sizeof(
int)*2*6 );
696 int HO_RM_fi_eta1to4_loc[72][2][2] =
698 {{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}},
699 {{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}},
700 {{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}},
701 {{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}},
702 {{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}},
703 {{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}},
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)*72*2*2 );
714 int ipixelHO_loc[NRMFIBR][NFCH][2] = {{{12,12},{ 7, 7},{ 6, 3}}, {{ 4, 4},{ 8, 8},{ 5, 1}}, {{19,11},{18, 6},{17, 2}},
715 {{ 2, 9},{ 1,13},{ 3, 5}}, {{11,19},{16,18},{15,17}}, {{13,15},{ 9,14},{14,16}}};
716 memcpy( ipixelHO, ipixelHO_loc,
sizeof(
int)*NRMFIBR*NFCH*2 );
718 std::string letterHO_loc[NRMFIBR][NFCH][2] = {{{
"E",
"E"},{
"G",
"L"},{
"F",
"S"}}, {{
"Q",
"M"},{
"N",
"T"},{
"P",
"F"}}, {{
"A",
"C"},{
"X",
"J"},{
"J",
"Q"}},
719 {{
"X",
"K"},{
"R",
"R"},{
"H",
"D"}}, {{
"D",
"A"},{
"C",
"G"},{
"B",
"N"}}, {{
"L",
"H"},{
"M",
"P"},{
"K",
"B"}}};
721 for (
int jj = 0; jj < NRMFIBR; jj++) {
722 for (
int kk = 0; kk < NFCH; kk++) {
723 for (
int ll = 0; ll < 2; ll++) {
724 letterHO[jj][kk][ll] = letterHO_loc[jj][kk][ll];
742 int rmspecialeta_loc[6][6] = {
743 { 14, 15, 14, 13, 12, 11 },
744 { 14, 15, 14, 13, 12, 11 },
745 { 10, 9, 8, 7, 6, 5 },
746 { 10, 9, 8, 7, 6, 5 },
747 { 14, 15, 14, 13, 12, 11 },
748 { 14, 15, 14, 13, 12, 11 }
751 std::string rmspeciallet_code_loc[6][6] = {
752 {
"X",
"B",
"C",
"D",
"E",
"F" },
753 {
"X",
"P",
"Q",
"R",
"S",
"T" },
754 {
"G",
"H",
"J",
"K",
"L",
"M" },
755 {
"A",
"B",
"C",
"D",
"E",
"F" },
756 {
"X",
"B",
"C",
"D",
"E",
"F" },
757 {
"X",
"P",
"Q",
"R",
"S",
"T" }
760 std::string rmspecialdet_loc[6][6] = {
761 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
762 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
763 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
764 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
765 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
766 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" }
769 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
772 for (
int jj = 0; jj < 6; jj++) {
773 for (
int kk = 0; kk < 6; kk++) {
774 rmspeciallet_code[jj][kk] = rmspeciallet_code_loc[jj][kk];}}
776 for (
int jj = 0; jj < 6; jj++) {
777 for (
int kk = 0; kk < 6; kk++) {
778 rmspecialdet[jj][kk] = rmspecialdet_loc[jj][kk];}}
781 else if (mapIOV_==2) {
782 int rmspecialeta_loc[6][6] = {
783 { 11, 12, 13, 14, 15, 15 },
784 { 11, 12, 13, 14, 15, 15 },
785 { 5, 6, 7, 8, 9, 10 },
786 { 5, 6, 7, 8, 9, 10 },
787 { 14, 15, 14, 13, 12, 11 },
788 { 11, 12, 13, 14, 15, 15 }
791 std::string rmspeciallet_code_loc[6][6] = {
792 {
"F",
"E",
"D",
"C",
"B",
"X" },
793 {
"T",
"S",
"R",
"Q",
"P",
"X" },
794 {
"M",
"L",
"K",
"J",
"H",
"G" },
795 {
"F",
"E",
"D",
"C",
"B",
"A" },
796 {
"X",
"B",
"C",
"D",
"E",
"F" },
797 {
"T",
"S",
"R",
"Q",
"P",
"X" }
800 std::string rmspecialdet_loc[6][6] = {
801 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
802 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
803 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
804 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
805 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
806 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" }
809 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
812 for (
int jj = 0; jj < 6; jj++) {
813 for (
int kk = 0; kk < 6; kk++) {
814 rmspeciallet_code[jj][kk] = rmspeciallet_code_loc[jj][kk];}}
816 for (
int jj = 0; jj < 6; jj++) {
817 for (
int kk = 0; kk < 6; kk++) {
818 rmspecialdet[jj][kk] = rmspecialdet_loc[jj][kk];}}
822 int rmspecialeta_loc[6][6] = {
823 { 11, 12, 13, 14, 15, 15 },
824 { 11, 12, 13, 14, 15, 15 },
825 { 5, 6, 7, 8, 9, 10 },
826 { 5, 6, 7, 8, 9, 10 },
827 { 11, 12, 13, 14, 15, 15 },
828 { 11, 12, 13, 14, 15, 15 }
831 std::string rmspeciallet_code_loc[6][6] = {
832 {
"F",
"E",
"D",
"C",
"B",
"X" },
833 {
"T",
"S",
"R",
"Q",
"P",
"X" },
834 {
"M",
"L",
"K",
"J",
"H",
"G" },
835 {
"F",
"E",
"D",
"C",
"B",
"A" },
836 {
"F",
"E",
"D",
"C",
"B",
"X" },
837 {
"T",
"S",
"R",
"Q",
"P",
"X" }
840 std::string rmspecialdet_loc[6][6] = {
841 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
842 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
843 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
844 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
845 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
846 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" }
849 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
852 for (
int jj = 0; jj < 6; jj++) {
853 for (
int kk = 0; kk < 6; kk++) {
854 rmspeciallet_code[jj][kk] = rmspeciallet_code_loc[jj][kk];}}
856 for (
int jj = 0; jj < 6; jj++) {
857 for (
int kk = 0; kk < 6; kk++) {
858 rmspecialdet[jj][kk] = rmspecialdet_loc[jj][kk];}}
864 stringstream mystream;
867 for(isid = -1; isid < 2; isid+=2){
868 for (iph = 0; iph < NHOPHI; iph++){
869 for (iet = 0; iet < NHOETA; iet++){
875 if (iphi >= 71 || iphi < 17) ic = 0;
876 else if (iphi >= 17 && iphi < 35) ic = 1;
877 else if (iphi >= 35 && iphi < 53) ic = 2;
889 phmod6e450 = (phmod6 == 4 || phmod6 == 5 || phmod6 == 0);
890 phmod6e123 = (phmod6 == 1 || phmod6 == 2 || phmod6 == 3);
893 if (ieta <= 3 && (iside < 0 || phmod6 >= 4)) fpga =
"bot";
894 else if (ieta <= 3 && iside > 0 && phmod6 < 4) fpga =
"top";
896 else if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6)) fpga =
"top";
897 else if ((ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13)) fpga =
"bot";
899 else if (ieta >= 10 && iside > 0) fpga =
"top";
900 else if (ieta < 10 && ieta >= 6 && iside > 0) fpga =
"bot";
902 else if ((ieta == 5 && iside > 0) || ieta == 4) fpga =
"top";
903 else if ((ieta == 5 || ieta >= 10) && iside < 0) fpga =
"bot";
904 else if ((ieta < 10 && ieta >= 6) && iside < 0) fpga =
"top";
905 else edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Bad fpga code"<<endl;
908 if (ieta <= 20) idphi = 1;
912 if (iside == 1) sidear = 1;
915 if (fpga ==
"bot") itb = 1;
922 irm = HO_RM_table[phmod24][iet][sidear];
926 if (ieta==16) irm_fi = HO_RM_fi_eta16;
927 else if (ieta >= 5) irm_fi = HO_RM_fi_eta5to15[ieta - 5];
928 else if (ieta <= 3) irm_fi = HO_RM_fi_eta1to4[iph][0][sidear];
929 else if (ieta == 4) irm_fi = HO_RM_fi_eta1to4[iph][1][sidear];
936 if (ieta <= 3 || (ieta >= 14 && iside == 1)) ih = 0;
937 else if (ieta <= 13 && ieta >= 6 && iside == 1) ih = 1;
938 else if (ieta <= 13 && ieta >= 6 && iside == -1) ih = 3;
944 if (iphi % 18 == 17 || iphi % 18 <= 4) is = 0;
945 else if (iphi % 18 >= 5 && iphi % 18 <= 10) is = 1;
948 if ( ieta == 16 && iside > 0 ) ihtr=21;
949 else ihtr=ihslotho[is][ih];
951 if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6)) ispigot = 12;
952 else if ((ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13)) ispigot = 13;
953 else ispigot=ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
955 idcc_sl = idcc == 1 ?10:20;
957 ifed=fedhonum[ic][idcc-1];
962 if (ieta >= 5 && phmod6e450) ihtr_fi = HO_htr_fi_450eta5to15[sidear][ieta - 5];
963 else if (ieta >= 5 && phmod6e123) ihtr_fi = HO_htr_fi_450eta5to15[sidear][ieta - 5] - 1;
964 else if (ieta == 4) ihtr_fi = HO_htr_fi_eta4[sidear][phmod6];
965 else if (ieta <= 3) ihtr_fi = HO_htr_fi_eta123[sidear][phmod6];
966 else ihtr_fi = -1000;
970 phi1458 = (iphi % 12 == 1 || iphi % 12 == 4 || iphi % 12 == 5 || iphi % 12 == 8);
971 phi271011 = (iphi % 12 == 2 || iphi % 12 == 7 || iphi % 12 == 10 || iphi % 12 == 11);
974 phir0v1 = (iphi % 24 == 0 || iphi % 24 == 2 || iphi % 24 == 4 || iphi % 24 == 18 || iphi % 24 == 20 || iphi % 24 == 22);
975 phir0v2 = (iphi % 24 == 1 || iphi % 24 == 3 || iphi % 24 == 17 || iphi % 24 == 19 || iphi % 24 == 21 || iphi % 24 == 23);
977 phir0v3 = (iphi % 24 == 5 || iphi % 24 == 7 || iphi % 24 == 9 || iphi % 24 == 11 || iphi % 24 == 13 || iphi % 24 == 15);
978 phir0v4 = (iphi % 24 == 6 || iphi % 24 == 8 || iphi % 24 == 10 || iphi % 24 == 12 || iphi % 24 == 14 || iphi % 24 == 16);
981 if (ieta % 2 == 0 && phi1458) ifi_ch = 0;
982 else if (ieta % 2 == 0 && iphi % 3 == 0) ifi_ch = 1;
983 else if (ieta % 2 == 0 && phi271011) ifi_ch = 2;
984 else if (ieta % 2 == 1 && iphi % 3 == 0) ifi_ch = 0;
985 else if (ieta % 2 == 1 && phi271011) ifi_ch = 1;
986 else if (ieta % 2 == 1 && phi1458) ifi_ch = 2;
990 if (phir0v1) ifi_ch = 0;
991 else if (phir0v4) ifi_ch = 1;
992 else if (iphi % 2 == 1) ifi_ch = 2;
995 if (phir0v3) ifi_ch = 0;
996 else if (phir0v2) ifi_ch = 1;
997 else if (iphi % 2 == 0) ifi_ch = 2;
1001 else if ((ieta == 3 && iside == -1) || (ieta == 2 && iside == 1)){
1002 if (phir0v4) ifi_ch = 0;
1003 else if (phir0v3) ifi_ch = 1;
1004 else if (phir0v1 || phir0v2) ifi_ch = 2;
1007 else if ((ieta == 3 && iside == 1) || (ieta == 2 && iside == -1)){
1008 if (phir0v2) ifi_ch = 0;
1009 else if (phir0v1) ifi_ch = 1;
1010 else if (phir0v3 || phir0v4) ifi_ch = 2;
1013 else if (ieta == 1){
1014 if (phir0v1 || phir0v3) ifi_ch = 0;
1015 else if (phir0v2 || phir0v4) ifi_ch = 1;
1020 iqie = (irm_fi - 2) / 2 + 1;
1022 if (irm_fi % 2 == 0) iadc = ifi_ch;
1023 else iadc = NFCH + (ifi_ch + 1) % 3;
1027 ipixel = ipixelHO[irm_fi - 2][ifi_ch][0];
1028 letter = letterHO[irm_fi - 2][ifi_ch][0];
1031 ipixel = ipixelHO[irm_fi - 2][ifi_ch][1];
1032 letter = letterHO[irm_fi - 2][ifi_ch][1];
1037 if (iside == -1) sidesign =
'M';
1038 else sidesign =
'P';
1040 if (ieta <= 4)
ring = 0;
1041 else if (ieta >= 5 && ieta <= 10)
ring = 1;
1046 for (
i = -2;
i < iphi;
i+=6){
1049 if (sector > 12) sector = 1;
1054 if (
ring != 0 && sector % 2 != 0) sector++;
1056 if (
ring == 0) sprintf (tempbuff,
"%s%i%2.2d", det.c_str(),
ring, sector);
1057 else sprintf (tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign, sector);
1059 rbx = mystream.str();
1067 if (ieta==16 && isid<0) ihtr_fi = HO_htr_fi_450eta16M[irm - 1];
1068 else if (ieta==16 && isid>0) ihtr_fi = HO_htr_fi_450eta16P[irm - 1][sector/2-1];
1070 if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 7)) {
1074 else if ((ieta > 15 && iside > 0) && (icrate == 6 || icrate == 13)) {
1079 if ( ieta == 16 ) ieta = 15;
1081 if ( iside == 1 &&
ring == 2 ) {
1083 ieta = rmspecialeta[0][iet - 10];
1084 letter = rmspeciallet_code[0][iet - 10];
1085 det = rmspecialdet[0][iet - 10];
1087 else if ( iphi == 67 ) {
1088 ieta = rmspecialeta[1][iet - 10];
1089 letter = rmspeciallet_code[1][iet - 10];
1090 det = rmspecialdet[1][iet - 10];
1093 else if ( iside == -1) {
1096 ieta = rmspecialeta[2][iet - 4];
1097 letter = rmspeciallet_code[2][iet - 4];
1098 det = rmspecialdet[2][iet - 4];
1100 else if ( iphi == 65 ) {
1101 ieta = rmspecialeta[3][iet - 4];
1102 letter = rmspeciallet_code[3][iet - 4];
1103 det = rmspecialdet[3][iet - 4];
1106 else if (
ring == 2 ) {
1108 ieta = rmspecialeta[4][iet - 10];
1109 letter = rmspeciallet_code[4][iet - 10];
1110 det = rmspecialdet[4][iet - 10];
1112 else if ( iphi == 31 ) {
1113 ieta = rmspecialeta[5][iet - 10];
1114 letter = rmspeciallet_code[5][iet - 10];
1115 det = rmspecialdet[5][iet - 10];
1121 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1122 det, iside, ieta, iphi, idepth,
1123 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1126 HOHXEntries.push_back(hoxlmapentry);
1130 const int hashedId=hgdi.
hashedId(
false);
1142 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1143 det, iside, ieta, iphi, idepth,
1144 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1147 HOHXEntries.push_back(hoxlmapentry);
1151 const int hashedId=hgdi.
hashedId(
false);
1156 else if (ipixel==17){
1163 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1164 det, iside, ieta, iphi, idepth,
1165 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1168 HOHXEntries.push_back(hoxlmapentry);
1172 const int hashedId=hgdi.
hashedId(
false);
1184 std::vector <uint32_t>& LinearIndex2Entry,
1185 std::vector <uint32_t>& HxCalibHash2Entry) {
1189 int calibcrate_loc[NCALIBCR]={4,0,1,5,11,15,17,14,10,9,7,6,13};
1190 memcpy( calibcrate, calibcrate_loc,
sizeof(
int)*NCALIBCR );
1192 int fedcalibnum_loc[NCALIBCR][2]={{700,701},{702,703},{704,705},{706,707},{708,709},{710,711},{712,713},{714,715},{716,717},
1194 {726,727},{728,729},{730,731}};
1195 memcpy( fedcalibnum, fedcalibnum_loc,
sizeof(
int)*NCALIBCR*2 );
1197 int icalibphis_loc[NCALIBCR]={3,11,19,27,35,43,51,59,67,27,17,35,53};
1198 memcpy( icalibphis, icalibphis_loc,
sizeof(
int)*NCALIBCR );
1200 int icalibsector_min_loc[NCALIBCR]={2,4,6,8,10,12,14,16,18,1,4,7,10};
1201 memcpy( icalibsector_min, icalibsector_min_loc,
sizeof(
int)*NCALIBCR );
1203 int icalibsector_max_loc[NCALIBCR]={3,5,7,9,11,13,15,17,1,4,6,9,12};
1204 memcpy( icalibsector_max, icalibsector_max_loc,
sizeof(
int)*NCALIBCR );
1206 std::string detIDCALIB_loc[NCALIBCR][NTOPBOT] = {{
"HB",
"HE"},
1219 for (
int jj = 0; jj < NCALIBCR; jj++) {
1220 for (
int kk = 0; kk < NTOPBOT; kk++) {
1221 detIDCALIB[jj][kk] = detIDCALIB_loc[jj][kk];
1225 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}};
1226 memcpy( nfbr_max, nfbr_max_loc,
sizeof(
int)*NCALIBCR*NTOPBOT );
1228 int calibHOinfo_loc[NHOCR][NTOPBOT][NFBR][2]={
1229 {{{4,0},{5,0},{6,0},{},{6,-2},{6,-1},{6,1},{6,2}},
1230 {{4,-2},{4,-1},{4,1},{4,2},{},{},{},{}}},
1232 {{{7,0},{8,0},{9,0},{},{8,-2},{8,-1},{8,1},{8,2}},
1233 {{1,0},{2,0},{3,0},{},{2,-2},{2,-1},{2,1},{2,2}}},
1235 {{{10,0},{11,0},{12,0},{},{10,-2},{10,-1},{10,1},{10,2}},
1236 {{12,-2},{12,-1},{12,1},{12,2},{},{},{},{}}}
1238 memcpy( calibHOinfo, calibHOinfo_loc,
sizeof(
int)*NHOCR*NTOPBOT*NFBR*2 );
1244 stringstream mystream;
1254 for(ic=0; ic<NHBHECR; ic++){
1255 icrate=calibcrate[ic];
1256 ifed=fedcalibnum[ic][idcc-1];
1258 for(itb=0; itb<NTOPBOT; itb++){
1260 for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1261 det = detIDCALIB[ic][itb];
1265 if (itb==1)
if(ihtr_fi%2==0) irm_fi = 2;
1269 if (ihtr_fi==1||ihtr_fi==2||ihtr_fi==5||ihtr_fi==6) {
1270 iwedge = icalibsector_min[ic];
1272 else if (ihtr_fi==3||ihtr_fi==4||ihtr_fi==7||ihtr_fi==8) {
1273 iwedge = icalibsector_max[ic];
1288 else if (det==
"HB"){
1291 (ihtr_fi%2==1) ? iwedge = icalibsector_min[ic] : iwedge = icalibsector_max[ic];
1305 iphi = ((iwedge*idphi) + 71 - idphi)%72;
1306 subdet =
"CALIB_"+det;
1307 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
1309 rbx = mystream.str();
1312 for(ifc=0; ifc<NFCH; ifc++){
1315 if (ifc==0) ich_type=0;
1316 else if (ifc==1) ich_type=1;
1318 if (det==
"HB") ich_type=2;
1319 else if(det==
"HE") ich_type=3;
1322 else if (irm_fi==2){
1323 if (ifc==0) ich_type=4;
1324 else if (ifc==1) ich_type=5;
1325 else if (ifc==2) ich_type=6;
1328 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1329 det, ieta, iphi, ich_type,
1330 iside, idphi, rbx, iwedge, irm_fi,
1333 CALIBEntries.push_back(caliblmapentry);
1337 const int hashedId=hgdi.
hashedId(
false);
1346 for(itb=0; itb<NTOPBOT; itb++){
1348 for(ifb=0; ifb<4; ifb++){
1350 for(ifc=0; ifc<NFCH; ifc++){
1351 icrate=calibcrate[ic];
1355 (ihtr_fi==1)?iphi=1:((ihtr_fi==2)?iphi=19:((ihtr_fi==3)?iphi=37:iphi=55));
1357 ifed=fedcalibnum[ic][idcc-1];
1358 (ifc==0)?ich_type=8:(ifc==1?ich_type=0:ich_type=1);
1378 subdet =
"CALIB_"+det;
1379 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
1381 rbx = mystream.str();
1384 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1385 det, ieta, iphi, ich_type,
1386 iside, idphi, rbx, iwedge, irm_fi,
1389 CALIBEntries.push_back(caliblmapentry);
1393 const int hashedId=hgdi.
hashedId(
false);
1401 for(ic=ic; ic<NCALIBCR; ic++){
1402 icrate=calibcrate[ic];
1404 ifed=fedcalibnum[ic][idcc-1];
1406 for(itb=0; itb<NTOPBOT; itb++){
1407 det=detIDCALIB[ic][itb];
1409 for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1419 iwedge=calibHOinfo[ic-10][itb][ifb][0];
1420 ieta=calibHOinfo[ic-10][itb][ifb][1];
1433 if (ieta==-2) S_side=
'2';
1434 else if (ieta==-1) S_side=
'1';
1435 else if (ieta==1) S_side=
'1';
1436 else if (ieta==2) S_side=
'2';
1438 subdet =
"CALIB_"+det;
1439 if (ieta==0) sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
1440 else sprintf (tempbuff,
"%s%c%c%2.2i%c", det.c_str(), S_side, sidesign, iwedge,
'\0');
1442 rbx = mystream.str();
1450 ( ieta == -2 ) ? ( iwedge == 12 ? NFCH_HO = 3 : NFCH_HO = 2 ) : ( iwedge == 10) ? NFCH_HO = 3 : NFCH_HO = 2;
1451 for(ifc=0; ifc<NFCH_HO; ifc++){
1453 (ifi_ch == 2) ? ich_type = 7 : ich_type = ifi_ch;
1454 (ieta==0) ? idphi = 6 : idphi = 12;
1456 (ieta==0) ? iphi=((iwedge*idphi)+71-idphi)%72 : iphi=(((iwedge/2)*idphi)+71-idphi)%72;
1459 if (iside==0&&ifb==3)
break;
1461 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1462 det, ieta, iphi, ich_type,
1463 iside, idphi, rbx, iwedge, irm_fi,
1466 CALIBEntries.push_back(caliblmapentry);
1470 const int hashedId=hgdi.
hashedId(
false);
1480 std::vector <uint32_t>& LinearIndex2Entry,
1481 std::vector <uint32_t>& ZdcHash2Entry) {
1485 stringstream mystream;
1495 for(itb=0; itb<NTOPBOT; itb++){
1512 for(icab=1; icab<NZDCCAB+1; icab++){
1518 else if (icab < 7) {
1532 if (mapIOV_<4) ihtr_fi = irm_fi + 3;
1533 else ihtr_fi = irm_fi;
1549 if (icab==6) iqie = 1;
1553 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1555 ix, iy, idx, idet_ch, icab, irm, iqie,
1558 ZDCEntries.push_back(zdclmapentry);
1567 std::vector <HTLogicalMapEntry>& HTEntries,
1568 int iside,
int ieta,
int iphi,
int idphi,
int idepth, std::string det,
int iwedge,
int irm,
1569 int ipixel,
int iqie,
int iadc,
int irm_fi,
int ifi_ch,
int icrate,
int ihtr, std::string fpga,
1570 int ihtr_fi,
int ispigot,
int islb, std::string slbin, std::string slbin2,
1571 std::string slnam,
int irctcra,
int irctcar,
int irctcon, std::string rctnam,
int ifed
1575 string t_chDet,t_fpga;
1576 string t_slnam,t_rctnam,t_slbin,t_slbin2;
1579 int t_side,t_iEta,t_iPhi,t_jPhi,t_iDep,t_topbot;
1580 int t_wedge,t_rm,t_pixel,t_qie,t_adc,t_rm_fi,t_fi_ch,t_crate,t_htr;
1581 int t_htr_fi,t_spigo,t_slb,t_rctcra,t_rctcar,t_rctcon,t_fedid;
1584 (fpga==
"bot") ? t_topbot = 1 : t_topbot = 0;
1614 if(t_iDep!=1)
break;
1615 if(t_chDet==
"HE"&&t_iEta==29)
break;
1619 if(t_iEta==30||t_iEta==31||t_iEta==33||
1620 t_iEta==34||t_iEta==36||t_iEta==37||
1621 t_iEta==39||t_iEta==40||t_iEta==41)
break;
1623 else if(t_iEta==32)t_iEta=30;
1624 else if(t_iEta==35)t_iEta=31;
1625 else if(t_iEta==38)t_iEta=32;
1627 if(t_iPhi==3||t_iPhi==7||t_iPhi==11||t_iPhi==15||t_iPhi==19||
1628 t_iPhi==23||t_iPhi==27||t_iPhi==31||t_iPhi==35||t_iPhi==39||
1629 t_iPhi==43||t_iPhi==47||t_iPhi==51||t_iPhi==55||t_iPhi==59||
1630 t_iPhi==63||t_iPhi==67||t_iPhi==71)
break;
1633 if(t_side<0) t_iEta=-t_iEta;
1637 if(t_slbin2!=
"NA") t_jPhi=1;
1638 if(t_slbin==
"A0"||t_slbin==
"B0") t_nDat=0;
1639 else if(t_slbin==
"A1"||t_slbin==
"B1") t_nDat=1;
1640 else if(t_slbin==
"C0"||t_slbin==
"D0") t_nDat=2;
1641 else if(t_slbin==
"C1"||t_slbin==
"D1") t_nDat=3;
1645 t_side, t_jPhi, t_iDep, t_chDet, t_wedge, t_crate, t_htr, t_topbot,
1646 t_spigo, t_slb, t_slbin, t_slbin2, t_nDat,
1647 t_slnam, t_rctcra, t_rctcar, t_rctcon, t_rctnam, t_fedid
1649 HTEntries.push_back(htlmapentry);
1651 if(t_slbin2!=
"NA") {
1652 if(t_slbin2==
"A0"||t_slbin2==
"B0") t_nDat=0;
1653 else if(t_slbin2==
"A1"||t_slbin2==
"B1") t_nDat=1;
1654 else if(t_slbin2==
"C0"||t_slbin2==
"D0") t_nDat=2;
1655 else if(t_slbin2==
"C1"||t_slbin2==
"D1") t_nDat=3;
1661 t_side, t_jPhi, t_iDep, t_chDet, t_wedge, t_crate, t_htr, t_topbot,
1662 t_spigo, t_slb, t_slbin, t_slbin2, t_nDat,
1663 t_slnam, t_rctcra, t_rctcar, t_rctcon, t_rctnam, t_fedid
1665 HTEntries.push_back(htlmapentry);
HcalLogicalMapGenerator()
void buildCALIBMap(std::vector< CALIBLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
int hashedId(bool h2mode_=false) const
static uint32_t makeEntryNumber(bool, int, int)
void buildZDCMap(std::vector< ZDCLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
const uint32_t getLinearIndex() const
uint32_t getLinearIndex() const
const DetId getDetId() const
HcalLogicalMap createMap(unsigned int mapIOV=4)
const DetId getDetId() const
void buildHOXMap(std::vector< HOHXLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
const uint32_t getLinearIndex() const
const uint32_t getLinearIndex() const
static const int maxLinearIndex
void ConstructTriggerTower(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)
const DetId getDetId() const
void buildHBEFTMap(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 > &)
~HcalLogicalMapGenerator()