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 );
221 stringstream mystream;
224 for(ic=0; ic<NHBHECR; ic++){
226 for(is=0; is<NHSETS; is++){
228 for(ih=0; ih<NHTRS; ih++){
230 for(itb=0; itb<NTOPBOT; itb++){
232 for(ifb=0; ifb<NFBR; ifb++){
234 for(ifc=0; ifc<NFCH; ifc++){
235 icrate=hbhecrate[ic];
236 iside=is<NHSETS/2?-1:1;
237 ifwtb=(is/2+itb+1)%2;
238 ieta=ihbheetadepth[ih][ifwtb][ifb][ifc][0];
239 idepth=ihbheetadepth[ih][ifwtb][ifb][ifc][1];
241 (ieta>16||idepth>2) ? det =
"HE": det =
"HB";
242 (itb%2)==1 ? fpga =
"bot" : fpga =
"top";
245 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;
246 ispigot=(is%2)*6+ih*2+itb;
247 idcc=is<NHSETS/2?1:2;
248 idcc_sl=idcc==1?10:20;
249 ifed=fedhbhenum[ic][idcc-1];
257 irm = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][1];
258 irm_fi = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][0];
261 if (ieta >= 21 && (irm == 1 || irm == 3)) iwedge = (iphi + 1 + irm + 1) / 4;
262 else iwedge = (iphi + irm + 1) / 4;
265 if (iwedge > 18) iwedge -= 18;
270 irm = irm_rmfiHBHE[ih][itb][ifb][1];
271 irm_fi = irm_rmfiHBHE[ih][itb][ifb][0];
274 if (ieta >= 21 && (irm == 4 || irm == 2)) iwedge = (iphi + 1 - irm + 6) / 4;
275 else iwedge = (iphi - irm + 6) / 4;
278 if (iwedge > 18) iwedge -= 18;
281 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
283 rbx = mystream.str();
290 if (ieta > 16 || idepth > 2) ipixel = ipixelHE[irm_fi - 2][ifc][irm - 1];
291 else ipixel = ipixelHB[irm_fi - 2][ifc][irm - 1];
293 iqie = iadcquiHBHE[irm_fi - 2][ifc][0];
294 iadc = iadcquiHBHE[irm_fi - 2][ifc][1];
297 if (phideg < 0) phideg = phideg + 72;
298 phideg = (phideg / 4) * 20 + 10;
299 irctcra = (( 89 - phideg + 720)%360)/20;
300 oddcard = irctcra % 2;
302 if (iside > 0) irctcra = irctcra + 9;
304 etaslb = ((ieta - 1) / 2) * 2 + 1;
305 if (etaslb > 27) etaslb = 27;
308 sprintf(tempbuff,
"SLB_H_%3.3d%c%2.2d%c",phideg,S_side,etaslb,
'\0');
310 slnam = mystream.str();
313 islb = slb_table[ieta - 1];
317 irctcar = 2 * ((ieta - 1)/8) + oddcard;
318 irctcon = 2 * (((ieta - 1)/2)%4);
323 if (eta2 > 28) eta2 = 28;
324 if (oddcard == 0) eta3 = eta2;
325 else eta3 = 57 - eta2;
326 irctcon = 2 * (((eta3 - 1) / 2) % 4);
328 irctcon = 11 * irctcon + 1;
330 sprintf(tempbuff,
"%s-%1d-HD%2.2d",rct_rackHBHE[irctcra],irctcar,irctcon);
332 rctnam = mystream.str();
339 for (
i = 0;
i < 18;
i++) {
340 if (iphi <
i * 4 + 3) {
347 if (ieta == 29) ietamod = 0;
348 else ietamod = ieta % 2;
350 if (ietamod == 1) mystream<<S_slbin_odd[phimod8];
351 else mystream<<S_slbin_even[phimod8];
353 else if (crazy == 0) {
354 if (ietamod == 1) mystream<<S_slbin_odd[phimod8];
355 else mystream<<S_slbin_even[phimod8];
358 if (ietamod == 1) mystream<<S_slbin_even[phimod8];
359 else mystream<<S_slbin_odd[phimod8];
362 slbin = mystream.str();
376 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
377 det, iside, ieta, iphi, idepth,
378 idphi, iwedge, irm, irm_fi, ipixel, iqie, iadc,
379 islb, irctcra, irctcar, irctcon,
380 rbx, slbin, slbin2, slnam, rctnam
382 HBHEHFEntries.push_back(hbeflmapentry);
386 unsigned int denseId;
389 HbHash2Entry.at(denseId)=HBHEHFEntries.size();
393 HeHash2Entry.at(denseId)=HBHEHFEntries.size();
397 HfHash2Entry.at(denseId)=HBHEHFEntries.size();
400 ConstructTriggerTower(topo,
402 iside, ieta, iphi, idphi, idepth, det, iwedge, irm,
403 ipixel, iqie, iadc, irm_fi, ifi_ch, icrate, ihtr, fpga,
404 ihtr_fi, ispigot, islb, slbin, slbin2,
405 slnam, irctcra, irctcar, irctcon, rctnam, ifed
416 int hfcrate_loc[NHFCR]={2,9,12};
417 memcpy( hfcrate, hfcrate_loc,
sizeof(
int)*NHFCR );
419 int fedhfnum_loc[NHFCR][2]={{718,719},{720,721},{722,723}};
420 memcpy( fedhfnum, fedhfnum_loc,
sizeof(
int)*NHFCR*2 );
422 int ihfphis_loc[NHFCR]={3,27,51};
423 memcpy( ihfphis, ihfphis_loc,
sizeof(
int)*NHFCR );
425 int ihfetadepth_loc[NTOPBOT][NFBR][NFCH][2]={
426 {{{33,1},{31,1},{29,1}},
427 {{32,1},{30,1},{34,1}},
428 {{33,2},{31,2},{29,2}},
429 {{32,2},{30,2},{34,2}},
430 {{34,2},{32,2},{30,2}},
431 {{31,2},{29,2},{33,2}},
432 {{34,1},{32,1},{30,1}},
433 {{31,1},{29,1},{33,1}}},
434 {{{41,1},{37,1},{35,1}},
435 {{38,1},{36,1},{39,1}},
436 {{41,2},{37,2},{35,2}},
437 {{38,2},{36,2},{39,2}},
438 {{40,2},{38,2},{36,2}},
439 {{37,2},{35,2},{39,2}},
440 {{40,1},{38,1},{36,1}},
441 {{37,1},{35,1},{39,1}}}
443 memcpy( ihfetadepth, ihfetadepth_loc,
sizeof(
int)*NTOPBOT*NFBR*NFCH*2 );
446 int irm_rmfiHF_loc[NHTRS][NTOPBOT][NFBR][2]={
447 {{{1,2},{2,2},{3,2},{4,2},{1,3},{2,3},{3,3},{4,3}},
448 {{5,2},{6,2},{7,2},{8,2},{5,3},{6,3},{7,3},{8,3}}},
449 {{{1,1},{2,1},{3,1},{4,1},{1,2},{2,2},{3,2},{4,2}},
450 {{5,1},{6,1},{7,1},{8,1},{5,2},{6,2},{7,2},{8,2}}},
451 {{{1,3},{2,3},{3,3},{4,3},{1,1},{2,1},{3,1},{4,1}},
452 {{5,3},{6,3},{7,3},{8,3},{5,1},{6,1},{7,1},{8,1}}}
454 memcpy( irm_rmfiHF, irm_rmfiHF_loc,
sizeof(
int)*NHTRS*NTOPBOT*NFBR*2 );
457 const char* S_slbin_7_loc[] ={
"A0",
"A1",
"B0",
"B1"};
458 for (
int gg = 0; gg < 4; gg++) {
459 S_slbin_7[gg] = S_slbin_7_loc[gg];
461 const char* S_slbin_3_loc[] ={
"C0",
"C1",
"D0",
"D1"};
462 for (
int gg = 0; gg < 4; gg++) {
463 S_slbin_3[gg] = S_slbin_3_loc[gg];
465 const char* rct_rackHF_loc[]={
"S2E01-FH",
"S2E03-FH",
"S2E05-FH",
"S2E07-FH",
"S2E09-FH",
"S2E08-FL",
"S2E06-FL",
"S2E04-FL",
"S2E02-FL",
466 "S2E02-FH",
"S2E04-FH",
"S2E06-FH",
"S2E08-FH",
"S2E09-FL",
"S2E07-FL",
"S2E05-FL",
"S2E03-FL",
"S2E01-FL"};
467 for (
int gg = 0; gg < 18; gg++) {
468 rct_rackHF[gg] = rct_rackHF_loc[gg];
475 for(ic=0; ic<NHFCR; ic++){
477 for(is=0; is<NHSETS; is++){
479 for(ih=0; ih<NHTRS; ih++){
481 for(itb=0; itb<NTOPBOT; itb++){
483 for(ifb=0; ifb<NFBR; ifb++){
485 for(ifc=0; ifc<NFCH; ifc++){
487 iside=is<NHSETS/2?-1:1;
488 ieta=ihfetadepth[itb][ifb][ifc][0];
489 idepth=ihfetadepth[itb][ifb][ifc][1];
492 (itb%2)== 1 ? fpga =
"bot" : fpga =
"top";
495 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;
496 ispigot=(is%2)*6+ih*2+itb;
497 idcc=is<NHSETS/2?1:2;
498 idcc_sl=idcc==1?10:20;
499 ifed=fedhfnum[ic][idcc-1];
501 irm_fi = irm_rmfiHF[ih][itb][ifb][0];
509 if (iphi == 1) iphi = 71;
510 else if (iphi == 71) iphi = 1;
511 else if (iphi % 4 == 1) iphi -= 2;
512 else if (iphi % 4 == 3) iphi += 2;
513 else edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Even iphi in HFM"<<endl;
522 if ((iside == 1 && ieta == 40) || (iside == -1 && ieta == 41)){
523 irm = ((iphi + 1) / 2) % 36 + 1;
524 hfphi = ((iphi + 1) / 6) % 12 + 1;
527 irm = ( iphi + 1) / 2;
528 hfphi = (iphi - 1) / 6 + 1;
530 irm = (irm - 1) % 3 + 1;
533 if (iphi >= 71) iwedge = 1;
534 else iwedge = (iphi + 1) / 4 + 1;
537 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, hfphi,
'\0');
539 rbx = mystream.str();
546 iqie = (irm_fi - 1) / 2 + 1;
548 if (irm_fi % 2 != 0) iadc = ifi_ch;
549 else iadc = NFCH + (ifi_ch + 1) % 3;
554 if (phideg < 0) phideg = phideg + 72;
555 phideg = (phideg / 4) * 20 + 10;
556 irctcra = (( 89 - phideg + 720)%360)/40;
557 if (iside > 0) irctcra = irctcra + 9;
565 sprintf(tempbuff,
"SLB_H_%3.3d%c%2.2d",phideg,S_side,etaslb);
567 slnam = mystream.str();
570 sprintf(tempbuff,
"%s-JSC-HF_IN",rct_rackHF[irctcra]);
572 rctnam = mystream.str();
577 int phibin = (iphi + 1) % 8 ;
578 int etabin = (ieta - 29) / 3;
579 if (etabin < 0) etabin = 0;
580 if (etabin > 3) etabin = 3;
581 if (phibin < 4) mystream<<S_slbin_7[etabin];
582 else mystream<<S_slbin_3[etabin];
584 slbin = mystream.str();
589 if (ieta < 40) idphi = 2;
593 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
594 det, iside, ieta, iphi, idepth,
595 idphi, iwedge, irm, irm_fi, ipixel, iqie, iadc,
596 islb, irctcra, irctcar, irctcon,
597 rbx, slbin, slbin2, slnam, rctnam
599 HBHEHFEntries.push_back(hbeflmapentry);
603 unsigned int denseId;
606 HbHash2Entry.at(denseId)=HBHEHFEntries.size();
610 HeHash2Entry.at(denseId)=HBHEHFEntries.size();
614 HfHash2Entry.at(denseId)=HBHEHFEntries.size();
617 ConstructTriggerTower(topo,
619 iside, ieta, iphi, idphi, idepth, det, iwedge, irm,
620 ipixel, iqie, iadc, irm_fi, ifi_ch, icrate, ihtr, fpga,
621 ihtr_fi, ispigot, islb, slbin, slbin2,
622 slnam, irctcra, irctcar, irctcon, rctnam, ifed
633 std::vector <HOHXLogicalMapEntry>& HOHXEntries,
634 std::vector <uint32_t>& LinearIndex2Entry,
635 std::vector <uint32_t>& HoHash2Entry,
636 std::vector <uint32_t>& HxCalibHash2Entry) {
639 int hocrate_loc[NHOCR]={3,7,6,13};
640 memcpy( hocrate, hocrate_loc,
sizeof(
int)*NHOCR );
642 int fedhonum_loc[NHOCR][2]={{724,725},{726,727},{728,729},{730,731}};
643 memcpy( fedhonum, fedhonum_loc,
sizeof(
int)*NHOCR*2 );
645 int ihslotho_loc[NHSETSHO][NHTRSHO]={{2,3,4,5},{6,7,13,14},{15,16,17,18}};
646 memcpy( ihslotho, ihslotho_loc,
sizeof(
int)*NHSETSHO*NHTRSHO );
648 int ihophis_loc[NHOCR]={71,17,35,53};
649 memcpy( ihophis, ihophis_loc,
sizeof(
int)*NHOCR );
653 int HO_RM_table_loc[24][16][2] =
655 {{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}},
656 {{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}},
657 {{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}},
658 {{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}},
659 {{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}},
660 {{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}},
661 {{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}},
662 {{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}},
663 {{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}},
664 {{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}},
665 {{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}},
666 {{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}},
667 {{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}},
668 {{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}},
669 {{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}},
670 {{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}},
671 {{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}},
672 {{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}},
673 {{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}},
674 {{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}},
675 {{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}},
676 {{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}},
677 {{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}},
678 {{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}}
680 memcpy( HO_RM_table, HO_RM_table_loc,
sizeof(
int)*24*16*2 );
683 int HO_RM_fi_eta5to15_loc[11] = {3, 2, 5, 4, 7, 6, 3, 2, 5, 4, 7};
684 memcpy( HO_RM_fi_eta5to15, HO_RM_fi_eta5to15_loc,
sizeof(
int)*11 );
691 int HO_htr_fi_450eta5to15_loc[2][11] = {{2, 2, 4, 6, 8, 2, 4, 6, 8, 4, 6},
692 {2, 8, 6, 4, 2, 8, 6, 4, 2, 4, 2}};
693 memcpy( HO_htr_fi_450eta5to15, HO_htr_fi_450eta5to15_loc,
sizeof(
int)*2*11 );
696 int HO_htr_fi_450eta16M_loc[4] = {7, 7, 8, 8};
697 memcpy( HO_htr_fi_450eta16M, HO_htr_fi_450eta16M_loc,
sizeof(
int)*4 );
700 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} };
701 memcpy( HO_htr_fi_450eta16P, HO_htr_fi_450eta16P_loc,
sizeof(
int)*4*6 );
704 int HO_htr_fi_eta4_loc[2][6] = {{6, 6, 8, 8, 7, 7},
706 memcpy( HO_htr_fi_eta4, HO_htr_fi_eta4_loc,
sizeof(
int)*2*6 );
708 int HO_htr_fi_eta123_loc[2][6] = {{6, 5, 4, 3, 8, 7},
710 memcpy( HO_htr_fi_eta123, HO_htr_fi_eta123_loc,
sizeof(
int)*2*6 );
716 int HO_RM_fi_eta1to4_loc[72][2][2] =
718 {{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}},
719 {{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}},
720 {{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}},
721 {{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}},
722 {{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}},
723 {{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}},
724 {{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}},
725 {{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}},
726 {{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}}
728 memcpy( HO_RM_fi_eta1to4, HO_RM_fi_eta1to4_loc,
sizeof(
int)*72*2*2 );
734 int ipixelHO_loc[NRMFIBR][NFCH][2] = {{{12,12},{ 7, 7},{ 6, 3}}, {{ 4, 4},{ 8, 8},{ 5, 1}}, {{19,11},{18, 6},{17, 2}},
735 {{ 2, 9},{ 1,13},{ 3, 5}}, {{11,19},{16,18},{15,17}}, {{13,15},{ 9,14},{14,16}}};
736 memcpy( ipixelHO, ipixelHO_loc,
sizeof(
int)*NRMFIBR*NFCH*2 );
738 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"}},
739 {{
"X",
"K"},{
"R",
"R"},{
"H",
"D"}}, {{
"D",
"A"},{
"C",
"G"},{
"B",
"N"}}, {{
"L",
"H"},{
"M",
"P"},{
"K",
"B"}}};
741 for (
int jj = 0;
jj < NRMFIBR;
jj++) {
742 for (
int kk = 0; kk < NFCH; kk++) {
743 for (
int ll = 0; ll < 2; ll++) {
744 letterHO[
jj][kk][ll] = letterHO_loc[
jj][kk][ll];
762 int rmspecialeta_loc[6][6] = {
763 { 14, 15, 14, 13, 12, 11 },
764 { 14, 15, 14, 13, 12, 11 },
765 { 10, 9, 8, 7, 6, 5 },
766 { 10, 9, 8, 7, 6, 5 },
767 { 14, 15, 14, 13, 12, 11 },
768 { 14, 15, 14, 13, 12, 11 }
772 {
"X",
"B",
"C",
"D",
"E",
"F" },
773 {
"X",
"P",
"Q",
"R",
"S",
"T" },
774 {
"G",
"H",
"J",
"K",
"L",
"M" },
775 {
"A",
"B",
"C",
"D",
"E",
"F" },
776 {
"X",
"B",
"C",
"D",
"E",
"F" },
777 {
"X",
"P",
"Q",
"R",
"S",
"T" }
781 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
782 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
783 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
784 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
785 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
786 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" }
789 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
792 for (
int jj = 0;
jj < 6;
jj++) {
793 for (
int kk = 0; kk < 6; kk++) {
794 rmspeciallet_code[
jj][kk] = rmspeciallet_code_loc[
jj][kk];}}
796 for (
int jj = 0;
jj < 6;
jj++) {
797 for (
int kk = 0; kk < 6; kk++) {
798 rmspecialdet[
jj][kk] = rmspecialdet_loc[
jj][kk];}}
801 else if (mapIOV_==2) {
802 int rmspecialeta_loc[6][6] = {
803 { 11, 12, 13, 14, 15, 15 },
804 { 11, 12, 13, 14, 15, 15 },
805 { 5, 6, 7, 8, 9, 10 },
806 { 5, 6, 7, 8, 9, 10 },
807 { 14, 15, 14, 13, 12, 11 },
808 { 11, 12, 13, 14, 15, 15 }
812 {
"F",
"E",
"D",
"C",
"B",
"X" },
813 {
"T",
"S",
"R",
"Q",
"P",
"X" },
814 {
"M",
"L",
"K",
"J",
"H",
"G" },
815 {
"F",
"E",
"D",
"C",
"B",
"A" },
816 {
"X",
"B",
"C",
"D",
"E",
"F" },
817 {
"T",
"S",
"R",
"Q",
"P",
"X" }
821 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
822 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
823 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
824 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
825 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
826 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" }
829 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
832 for (
int jj = 0;
jj < 6;
jj++) {
833 for (
int kk = 0; kk < 6; kk++) {
834 rmspeciallet_code[
jj][kk] = rmspeciallet_code_loc[
jj][kk];}}
836 for (
int jj = 0;
jj < 6;
jj++) {
837 for (
int kk = 0; kk < 6; kk++) {
838 rmspecialdet[
jj][kk] = rmspecialdet_loc[
jj][kk];}}
842 int rmspecialeta_loc[6][6] = {
843 { 11, 12, 13, 14, 15, 15 },
844 { 11, 12, 13, 14, 15, 15 },
845 { 5, 6, 7, 8, 9, 10 },
846 { 5, 6, 7, 8, 9, 10 },
847 { 11, 12, 13, 14, 15, 15 },
848 { 11, 12, 13, 14, 15, 15 }
852 {
"F",
"E",
"D",
"C",
"B",
"X" },
853 {
"T",
"S",
"R",
"Q",
"P",
"X" },
854 {
"M",
"L",
"K",
"J",
"H",
"G" },
855 {
"F",
"E",
"D",
"C",
"B",
"A" },
856 {
"F",
"E",
"D",
"C",
"B",
"X" },
857 {
"T",
"S",
"R",
"Q",
"P",
"X" }
861 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
862 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
863 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
864 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
865 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
866 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" }
869 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
872 for (
int jj = 0;
jj < 6;
jj++) {
873 for (
int kk = 0; kk < 6; kk++) {
874 rmspeciallet_code[
jj][kk] = rmspeciallet_code_loc[
jj][kk];}}
876 for (
int jj = 0;
jj < 6;
jj++) {
877 for (
int kk = 0; kk < 6; kk++) {
878 rmspecialdet[
jj][kk] = rmspecialdet_loc[
jj][kk];}}
884 stringstream mystream;
887 for(isid = -1; isid < 2; isid+=2){
888 for (iph = 0; iph < NHOPHI; iph++){
889 for (iet = 0; iet < NHOETA; iet++){
895 if (iphi >= 71 || iphi < 17) ic = 0;
896 else if (iphi >= 17 && iphi < 35) ic = 1;
897 else if (iphi >= 35 && iphi < 53) ic = 2;
909 phmod6e450 = (phmod6 == 4 || phmod6 == 5 || phmod6 == 0);
910 phmod6e123 = (phmod6 == 1 || phmod6 == 2 || phmod6 == 3);
913 if (ieta <= 3 && (iside < 0 || phmod6 >= 4)) fpga =
"bot";
914 else if (ieta <= 3 && iside > 0 && phmod6 < 4) fpga =
"top";
916 else if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6)) fpga =
"top";
917 else if ((ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13)) fpga =
"bot";
919 else if (ieta >= 10 && iside > 0) fpga =
"top";
920 else if (ieta < 10 && ieta >= 6 && iside > 0) fpga =
"bot";
922 else if ((ieta == 5 && iside > 0) || ieta == 4) fpga =
"top";
923 else if ((ieta == 5 || ieta >= 10) && iside < 0) fpga =
"bot";
924 else if ((ieta < 10 && ieta >= 6) && iside < 0) fpga =
"top";
925 else edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Bad fpga code"<<endl;
928 if (ieta <= 20) idphi = 1;
932 if (iside == 1) sidear = 1;
935 if (fpga ==
"bot") itb = 1;
942 irm = HO_RM_table[phmod24][iet][sidear];
946 if (ieta==16) irm_fi = HO_RM_fi_eta16;
947 else if (ieta >= 5) irm_fi = HO_RM_fi_eta5to15[ieta - 5];
948 else if (ieta <= 3) irm_fi = HO_RM_fi_eta1to4[iph][0][sidear];
949 else if (ieta == 4) irm_fi = HO_RM_fi_eta1to4[iph][1][sidear];
956 if (ieta <= 3 || (ieta >= 14 && iside == 1)) ih = 0;
957 else if (ieta <= 13 && ieta >= 6 && iside == 1) ih = 1;
958 else if (ieta <= 13 && ieta >= 6 && iside == -1) ih = 3;
964 if (iphi % 18 == 17 || iphi % 18 <= 4) is = 0;
965 else if (iphi % 18 >= 5 && iphi % 18 <= 10) is = 1;
968 if ( ieta == 16 && iside > 0 ) ihtr=21;
969 else ihtr=ihslotho[is][ih];
971 if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6)) ispigot = 12;
972 else if ((ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13)) ispigot = 13;
973 else ispigot=ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
975 idcc_sl = idcc == 1 ?10:20;
977 ifed=fedhonum[ic][idcc-1];
982 if (ieta >= 5 && phmod6e450) ihtr_fi = HO_htr_fi_450eta5to15[sidear][ieta - 5];
983 else if (ieta >= 5 && phmod6e123) ihtr_fi = HO_htr_fi_450eta5to15[sidear][ieta - 5] - 1;
984 else if (ieta == 4) ihtr_fi = HO_htr_fi_eta4[sidear][phmod6];
985 else if (ieta <= 3) ihtr_fi = HO_htr_fi_eta123[sidear][phmod6];
986 else ihtr_fi = -1000;
990 phi1458 = (iphi % 12 == 1 || iphi % 12 == 4 || iphi % 12 == 5 || iphi % 12 == 8);
991 phi271011 = (iphi % 12 == 2 || iphi % 12 == 7 || iphi % 12 == 10 || iphi % 12 == 11);
994 phir0v1 = (iphi % 24 == 0 || iphi % 24 == 2 || iphi % 24 == 4 || iphi % 24 == 18 || iphi % 24 == 20 || iphi % 24 == 22);
995 phir0v2 = (iphi % 24 == 1 || iphi % 24 == 3 || iphi % 24 == 17 || iphi % 24 == 19 || iphi % 24 == 21 || iphi % 24 == 23);
997 phir0v3 = (iphi % 24 == 5 || iphi % 24 == 7 || iphi % 24 == 9 || iphi % 24 == 11 || iphi % 24 == 13 || iphi % 24 == 15);
998 phir0v4 = (iphi % 24 == 6 || iphi % 24 == 8 || iphi % 24 == 10 || iphi % 24 == 12 || iphi % 24 == 14 || iphi % 24 == 16);
1001 if (ieta % 2 == 0 && phi1458) ifi_ch = 0;
1002 else if (ieta % 2 == 0 && iphi % 3 == 0) ifi_ch = 1;
1003 else if (ieta % 2 == 0 && phi271011) ifi_ch = 2;
1004 else if (ieta % 2 == 1 && iphi % 3 == 0) ifi_ch = 0;
1005 else if (ieta % 2 == 1 && phi271011) ifi_ch = 1;
1006 else if (ieta % 2 == 1 && phi1458) ifi_ch = 2;
1008 else if (ieta == 4){
1010 if (phir0v1) ifi_ch = 0;
1011 else if (phir0v4) ifi_ch = 1;
1012 else if (iphi % 2 == 1) ifi_ch = 2;
1015 if (phir0v3) ifi_ch = 0;
1016 else if (phir0v2) ifi_ch = 1;
1017 else if (iphi % 2 == 0) ifi_ch = 2;
1021 else if ((ieta == 3 && iside == -1) || (ieta == 2 && iside == 1)){
1022 if (phir0v4) ifi_ch = 0;
1023 else if (phir0v3) ifi_ch = 1;
1024 else if (phir0v1 || phir0v2) ifi_ch = 2;
1027 else if ((ieta == 3 && iside == 1) || (ieta == 2 && iside == -1)){
1028 if (phir0v2) ifi_ch = 0;
1029 else if (phir0v1) ifi_ch = 1;
1030 else if (phir0v3 || phir0v4) ifi_ch = 2;
1033 else if (ieta == 1){
1034 if (phir0v1 || phir0v3) ifi_ch = 0;
1035 else if (phir0v2 || phir0v4) ifi_ch = 1;
1040 iqie = (irm_fi - 2) / 2 + 1;
1042 if (irm_fi % 2 == 0) iadc = ifi_ch;
1043 else iadc = NFCH + (ifi_ch + 1) % 3;
1047 ipixel = ipixelHO[irm_fi - 2][ifi_ch][0];
1048 letter = letterHO[irm_fi - 2][ifi_ch][0];
1051 ipixel = ipixelHO[irm_fi - 2][ifi_ch][1];
1052 letter = letterHO[irm_fi - 2][ifi_ch][1];
1057 if (iside == -1) sidesign =
'M';
1058 else sidesign =
'P';
1060 if (ieta <= 4)
ring = 0;
1061 else if (ieta >= 5 && ieta <= 10)
ring = 1;
1066 for (
i = -2;
i < iphi;
i+=6){
1069 if (sector > 12) sector = 1;
1074 if (
ring != 0 && sector % 2 != 0) sector++;
1076 if (
ring == 0) sprintf (tempbuff,
"%s%i%2.2d", det.c_str(),
ring, sector);
1077 else sprintf (tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign, sector);
1079 rbx = mystream.str();
1087 if (ieta==16 && isid<0) ihtr_fi = HO_htr_fi_450eta16M[irm - 1];
1088 else if (ieta==16 && isid>0) ihtr_fi = HO_htr_fi_450eta16P[irm - 1][sector/2-1];
1090 if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 7)) {
1094 else if ((ieta > 15 && iside > 0) && (icrate == 6 || icrate == 13)) {
1099 if ( ieta == 16 ) ieta = 15;
1101 if ( iside == 1 &&
ring == 2 ) {
1103 ieta = rmspecialeta[0][iet - 10];
1104 letter = rmspeciallet_code[0][iet - 10];
1105 det = rmspecialdet[0][iet - 10];
1107 else if ( iphi == 67 ) {
1108 ieta = rmspecialeta[1][iet - 10];
1109 letter = rmspeciallet_code[1][iet - 10];
1110 det = rmspecialdet[1][iet - 10];
1113 else if ( iside == -1) {
1116 ieta = rmspecialeta[2][iet - 4];
1117 letter = rmspeciallet_code[2][iet - 4];
1118 det = rmspecialdet[2][iet - 4];
1120 else if ( iphi == 65 ) {
1121 ieta = rmspecialeta[3][iet - 4];
1122 letter = rmspeciallet_code[3][iet - 4];
1123 det = rmspecialdet[3][iet - 4];
1126 else if (
ring == 2 ) {
1128 ieta = rmspecialeta[4][iet - 10];
1129 letter = rmspeciallet_code[4][iet - 10];
1130 det = rmspecialdet[4][iet - 10];
1132 else if ( iphi == 31 ) {
1133 ieta = rmspecialeta[5][iet - 10];
1134 letter = rmspeciallet_code[5][iet - 10];
1135 det = rmspecialdet[5][iet - 10];
1141 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1142 det, iside, ieta, iphi, idepth,
1143 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1146 HOHXEntries.push_back(hoxlmapentry);
1150 unsigned int denseId;
1153 HoHash2Entry.at(denseId)=HOHXEntries.size();
1156 HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1167 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1168 det, iside, ieta, iphi, idepth,
1169 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1172 HOHXEntries.push_back(hoxlmapentry);
1176 unsigned int denseId;
1179 HoHash2Entry.at(denseId)=HOHXEntries.size();
1182 HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1185 else if (ipixel==17){
1192 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1193 det, iside, ieta, iphi, idepth,
1194 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1197 HOHXEntries.push_back(hoxlmapentry);
1201 unsigned int denseId;
1204 HoHash2Entry.at(denseId)=HOHXEntries.size();
1207 HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1217 std::vector <CALIBLogicalMapEntry>& CALIBEntries,
1218 std::vector <uint32_t>& LinearIndex2Entry,
1219 std::vector <uint32_t>& HxCalibHash2Entry) {
1223 int calibcrate_loc[NCALIBCR]={4,0,1,5,11,15,17,14,10,9,7,6,13};
1224 memcpy( calibcrate, calibcrate_loc,
sizeof(
int)*NCALIBCR );
1226 int fedcalibnum_loc[NCALIBCR][2]={{700,701},{702,703},{704,705},{706,707},{708,709},{710,711},{712,713},{714,715},{716,717},
1228 {726,727},{728,729},{730,731}};
1229 memcpy( fedcalibnum, fedcalibnum_loc,
sizeof(
int)*NCALIBCR*2 );
1231 int icalibphis_loc[NCALIBCR]={3,11,19,27,35,43,51,59,67,27,17,35,53};
1232 memcpy( icalibphis, icalibphis_loc,
sizeof(
int)*NCALIBCR );
1234 int icalibsector_min_loc[NCALIBCR]={2,4,6,8,10,12,14,16,18,1,4,7,10};
1235 memcpy( icalibsector_min, icalibsector_min_loc,
sizeof(
int)*NCALIBCR );
1237 int icalibsector_max_loc[NCALIBCR]={3,5,7,9,11,13,15,17,1,4,6,9,12};
1238 memcpy( icalibsector_max, icalibsector_max_loc,
sizeof(
int)*NCALIBCR );
1240 std::string detIDCALIB_loc[NCALIBCR][NTOPBOT] = {{
"HB",
"HE"},
1253 for (
int jj = 0;
jj < NCALIBCR;
jj++) {
1254 for (
int kk = 0; kk < NTOPBOT; kk++) {
1255 detIDCALIB[
jj][kk] = detIDCALIB_loc[
jj][kk];
1259 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}};
1260 memcpy( nfbr_max, nfbr_max_loc,
sizeof(
int)*NCALIBCR*NTOPBOT );
1262 int calibHOinfo_loc[NHOCR][NTOPBOT][NFBR][2]={
1263 {{{4,0},{5,0},{6,0},{},{6,-2},{6,-1},{6,1},{6,2}},
1264 {{4,-2},{4,-1},{4,1},{4,2},{},{},{},{}}},
1266 {{{7,0},{8,0},{9,0},{},{8,-2},{8,-1},{8,1},{8,2}},
1267 {{1,0},{2,0},{3,0},{},{2,-2},{2,-1},{2,1},{2,2}}},
1269 {{{10,0},{11,0},{12,0},{},{10,-2},{10,-1},{10,1},{10,2}},
1270 {{12,-2},{12,-1},{12,1},{12,2},{},{},{},{}}}
1272 memcpy( calibHOinfo, calibHOinfo_loc,
sizeof(
int)*NHOCR*NTOPBOT*NFBR*2 );
1278 stringstream mystream;
1288 for(ic=0; ic<NHBHECR; ic++){
1289 icrate=calibcrate[ic];
1290 ifed=fedcalibnum[ic][idcc-1];
1292 for(itb=0; itb<NTOPBOT; itb++){
1294 for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1295 det = detIDCALIB[ic][itb];
1299 if (itb==1)
if(ihtr_fi%2==0) irm_fi = 2;
1303 if (ihtr_fi==1||ihtr_fi==2||ihtr_fi==5||ihtr_fi==6) {
1304 iwedge = icalibsector_min[ic];
1306 else if (ihtr_fi==3||ihtr_fi==4||ihtr_fi==7||ihtr_fi==8) {
1307 iwedge = icalibsector_max[ic];
1322 else if (det==
"HB"){
1325 (ihtr_fi%2==1) ? iwedge = icalibsector_min[ic] : iwedge = icalibsector_max[ic];
1339 iphi = ((iwedge*idphi) + 71 - idphi)%72;
1340 subdet =
"CALIB_"+det;
1341 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
1343 rbx = mystream.str();
1346 for(ifc=0; ifc<NFCH; ifc++){
1349 if (ifc==0) ich_type=0;
1350 else if (ifc==1) ich_type=1;
1352 if (det==
"HB") ich_type=2;
1353 else if(det==
"HE") ich_type=3;
1356 else if (irm_fi==2){
1357 if (ifc==0) ich_type=4;
1358 else if (ifc==1) ich_type=5;
1359 else if (ifc==2) ich_type=6;
1362 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1363 det, ieta, iphi, ich_type,
1364 iside, idphi, rbx, iwedge, irm_fi,
1367 CALIBEntries.push_back(caliblmapentry);
1380 for(itb=0; itb<NTOPBOT; itb++){
1382 for(ifb=0; ifb<4; ifb++){
1384 for(ifc=0; ifc<NFCH; ifc++){
1385 icrate=calibcrate[ic];
1389 (ihtr_fi==1)?iphi=1:((ihtr_fi==2)?iphi=19:((ihtr_fi==3)?iphi=37:iphi=55));
1391 ifed=fedcalibnum[ic][idcc-1];
1392 (ifc==0)?ich_type=8:(ifc==1?ich_type=0:ich_type=1);
1412 subdet =
"CALIB_"+det;
1413 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
1415 rbx = mystream.str();
1418 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1419 det, ieta, iphi, ich_type,
1420 iside, idphi, rbx, iwedge, irm_fi,
1423 CALIBEntries.push_back(caliblmapentry);
1436 for(ic=ic; ic<NCALIBCR; ic++){
1437 icrate=calibcrate[ic];
1439 ifed=fedcalibnum[ic][idcc-1];
1441 for(itb=0; itb<NTOPBOT; itb++){
1442 det=detIDCALIB[ic][itb];
1444 for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1454 iwedge=calibHOinfo[ic-10][itb][ifb][0];
1455 ieta=calibHOinfo[ic-10][itb][ifb][1];
1468 if (ieta==-2) S_side=
'2';
1469 else if (ieta==-1) S_side=
'1';
1470 else if (ieta==1) S_side=
'1';
1471 else if (ieta==2) S_side=
'2';
1473 subdet =
"CALIB_"+det;
1474 if (ieta==0) sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
1475 else sprintf (tempbuff,
"%s%c%c%2.2i%c", det.c_str(), S_side, sidesign, iwedge,
'\0');
1477 rbx = mystream.str();
1485 ( ieta == -2 ) ? ( iwedge == 12 ? NFCH_HO = 3 : NFCH_HO = 2 ) : ( iwedge == 10) ? NFCH_HO = 3 : NFCH_HO = 2;
1486 for(ifc=0; ifc<NFCH_HO; ifc++){
1488 (ifi_ch == 2) ? ich_type = 7 : ich_type = ifi_ch;
1489 (ieta==0) ? idphi = 6 : idphi = 12;
1491 (ieta==0) ? iphi=((iwedge*idphi)+71-idphi)%72 : iphi=(((iwedge/2)*idphi)+71-idphi)%72;
1494 if (iside==0&&ifb==3)
break;
1496 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1497 det, ieta, iphi, ich_type,
1498 iside, idphi, rbx, iwedge, irm_fi,
1501 CALIBEntries.push_back(caliblmapentry);
1515 std::vector <uint32_t>& LinearIndex2Entry,
1516 std::vector <uint32_t>& ZdcHash2Entry) {
1520 stringstream mystream;
1530 for(itb=0; itb<NTOPBOT; itb++){
1547 for(icab=1; icab<NZDCCAB+1; icab++){
1553 else if (icab < 7) {
1567 if (mapIOV_<4) ihtr_fi = irm_fi + 3;
1568 else ihtr_fi = irm_fi;
1584 if (icab==6) iqie = 1;
1588 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1590 ix, iy,
idx, idet_ch, icab, irm, iqie,
1593 ZDCEntries.push_back(zdclmapentry);
1602 std::vector <HTLogicalMapEntry>& HTEntries,
1603 int iside,
int ieta,
int iphi,
int idphi,
int idepth,
std::string det,
int iwedge,
int irm,
1604 int ipixel,
int iqie,
int iadc,
int irm_fi,
int ifi_ch,
int icrate,
int ihtr,
std::string fpga,
1610 string t_chDet,t_fpga;
1611 string t_slnam,t_rctnam,t_slbin,t_slbin2;
1614 int t_side,t_iEta,t_iPhi,t_jPhi,t_iDep,t_topbot;
1615 int t_wedge,t_crate,t_htr;
1617 int t_spigo,t_slb,t_rctcra,t_rctcar,t_rctcon,t_fedid;
1620 (fpga==
"bot") ? t_topbot = 1 : t_topbot = 0;
1650 if(t_iDep!=1)
break;
1651 if(t_chDet==
"HE"&&t_iEta==29)
break;
1655 if(t_iEta==30||t_iEta==31||t_iEta==33||
1656 t_iEta==34||t_iEta==36||t_iEta==37||
1657 t_iEta==39||t_iEta==40||t_iEta==41)
break;
1659 else if(t_iEta==32)t_iEta=30;
1660 else if(t_iEta==35)t_iEta=31;
1661 else if(t_iEta==38)t_iEta=32;
1663 if(t_iPhi==3||t_iPhi==7||t_iPhi==11||t_iPhi==15||t_iPhi==19||
1664 t_iPhi==23||t_iPhi==27||t_iPhi==31||t_iPhi==35||t_iPhi==39||
1665 t_iPhi==43||t_iPhi==47||t_iPhi==51||t_iPhi==55||t_iPhi==59||
1666 t_iPhi==63||t_iPhi==67||t_iPhi==71)
break;
1669 if(t_side<0) t_iEta=-t_iEta;
1673 if(t_slbin2!=
"NA") t_jPhi=1;
1674 if(t_slbin==
"A0"||t_slbin==
"B0") t_nDat=0;
1675 else if(t_slbin==
"A1"||t_slbin==
"B1") t_nDat=1;
1676 else if(t_slbin==
"C0"||t_slbin==
"D0") t_nDat=2;
1677 else if(t_slbin==
"C1"||t_slbin==
"D1") t_nDat=3;
1681 t_side, t_jPhi, t_iDep, t_chDet, t_wedge, t_crate, t_htr, t_topbot,
1682 t_spigo, t_slb, t_slbin, t_slbin2, t_nDat,
1683 t_slnam, t_rctcra, t_rctcar, t_rctcon, t_rctnam, t_fedid
1685 HTEntries.push_back(htlmapentry);
1687 if(t_slbin2!=
"NA") {
1688 if(t_slbin2==
"A0"||t_slbin2==
"B0") t_nDat=0;
1689 else if(t_slbin2==
"A1"||t_slbin2==
"B1") t_nDat=1;
1690 else if(t_slbin2==
"C0"||t_slbin2==
"D0") t_nDat=2;
1691 else if(t_slbin2==
"C1"||t_slbin2==
"D1") t_nDat=3;
1697 t_side, t_jPhi, t_iDep, t_chDet, t_wedge, t_crate, t_htr, t_topbot,
1698 t_spigo, t_slb, t_slbin, t_slbin2, t_nDat,
1699 t_slnam, t_rctcra, t_rctcar, t_rctcon, t_rctnam, t_fedid
1701 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
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
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()