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 );
654 int HO_RM_table_loc[24][16][2] =
656 {{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}},
657 {{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}},
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 {{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}},
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 {{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}},
662 {{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}},
663 {{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}},
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 {{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}},
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 {{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}},
668 {{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}},
669 {{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}},
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 {{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}},
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 {{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}},
674 {{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}},
675 {{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}},
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 {{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}},
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}},
679 {{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 memcpy( HO_RM_table, HO_RM_table_loc,
sizeof(
int)*24*16*2 );
684 int HO_RM_fi_eta5to15_loc[11] = {3, 2, 5, 4, 7, 6, 3, 2, 5, 4, 7};
685 memcpy( HO_RM_fi_eta5to15, HO_RM_fi_eta5to15_loc,
sizeof(
int)*11 );
700 int HO_RM_fi_eta1to4_loc[24][2][2] =
702 {{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}},
703 {{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}},
704 {{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}}
706 memcpy( HO_RM_fi_eta1to4, HO_RM_fi_eta1to4_loc,
sizeof(
int)*24*2*2 );
717 int HO_RM_fi_eta1to4_sipm_loc[24][4][2] =
719 {{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}},
720 {{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}},
721 {{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}},
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 {{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}},
724 {{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 memcpy( HO_RM_fi_eta1to4_sipm, HO_RM_fi_eta1to4_sipm_loc,
sizeof(
int)*24*4*2 );
729 int HO_htr_fi_450eta5to15_loc[2][11] = {{2, 2, 4, 6, 8, 2, 4, 6, 8, 4, 6},
730 {2, 8, 6, 4, 2, 8, 6, 4, 2, 4, 2}};
731 memcpy( HO_htr_fi_450eta5to15, HO_htr_fi_450eta5to15_loc,
sizeof(
int)*2*11 );
734 int HO_htr_fi_450eta16M_loc[4] = {7, 7, 8, 8};
735 memcpy( HO_htr_fi_450eta16M, HO_htr_fi_450eta16M_loc,
sizeof(
int)*4 );
738 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} };
739 memcpy( HO_htr_fi_450eta16P, HO_htr_fi_450eta16P_loc,
sizeof(
int)*4*6 );
742 int HO_htr_fi_eta4_loc[2][6] = {{6, 6, 8, 8, 7, 7},
745 memcpy( HO_htr_fi_eta4, HO_htr_fi_eta4_loc,
sizeof(
int)*2*6 );
747 int HO_htr_fi_eta123_loc[2][6] = {{6, 5, 4, 3, 8, 7},
750 memcpy( HO_htr_fi_eta123, HO_htr_fi_eta123_loc,
sizeof(
int)*2*6 );
760 int HO_htr_fi_eta1234_sipm[6][5][2][2] = {
762 {{4,8},{6,4}}, {{4,4},{4,7}}, {{6,8},{6,7}}, {{5,8},{6,8}}, {{5,6},{-1,-1}} },
764 {{6,7},{5,6}}, {{6,6},{6,6}}, {{6,7},{5,7}}, {{5,7},{5,8}}, {{-1,-1},{4,8}} },
766 {{4,5},{5,6}}, {{5,5},{5,5}}, {{4,5},{4,6}}, {{4,6},{3,6}}, {{-1,-1},{3,8}} },
768 {{3,8},{8,5}}, {{8,8},{4,8}}, {{3,5},{4,5}}, {{3,6},{3,5}}, {{5,6},{-1,-1}} },
770 {{3,2},{8,3}}, {{3,3},{3,1}}, {{8,2},{8,1}}, {{7,2},{8,2}}, {{7,7},{-1,-1}} },
772 {{7,1},{7,7}}, {{8,7},{7,7}}, {{8,1},{7,1}}, {{7,1},{7,2}}, {{-1,-1},{3,2}} },
780 int ipixelHO_loc[NRMFIBR][NFCH][2] = {{{12,12},{ 7, 7},{ 6, 3}},
781 {{ 4, 4},{ 8, 8},{ 5, 1}},
782 {{19,11},{18, 6},{17, 2}},
783 {{ 2, 9},{ 1,13},{ 3, 5}},
784 {{11,19},{16,18},{15,17}},
785 {{13,15},{ 9,14},{14,16}}};
787 int ipixelHO_sipm[NRMFIBR][NFCH][2] = {{{12,12},{ 7, 7},{ 3, 3}},
788 {{ 4, 4},{ 8, 8},{ 1, 1}},
789 {{11,11},{ 6, 6},{ 2, 2}},
790 {{ 9, 9},{13,13},{ 5, 5}},
791 {{19,19},{18,18},{17,17}},
792 {{15,15},{14,14},{16,16}}};
794 memcpy( ipixelHO, ipixelHO_loc,
sizeof(
int)*NRMFIBR*NFCH*2 );
796 memcpy( ipixelHO, ipixelHO_sipm,
sizeof(
int)*NRMFIBR*NFCH*2 );
799 std::string letterHO_loc[NRMFIBR][NFCH][2] = {{{
"E",
"E"},{
"G",
"L"},{
"F",
"S"}},
800 {{
"Q",
"M"},{
"N",
"T"},{
"P",
"F"}},
801 {{
"A",
"C"},{
"X",
"J"},{
"J",
"Q"}},
802 {{
"X",
"K"},{
"R",
"R"},{
"H",
"D"}},
803 {{
"D",
"A"},{
"C",
"G"},{
"B",
"N"}},
804 {{
"L",
"H"},{
"M",
"P"},{
"K",
"B"}}};
806 std::string letterHO_sipm[NRMFIBR][NFCH][2] = {{{
"E",
"E"},{
"G",
"L"},{
"H",
"S"}},
807 {{
"Q",
"M"},{
"N",
"T"},{
"R",
"F"}},
808 {{
"D",
"C"},{
"F",
"J"},{
"X",
"Q"}},
809 {{
"M",
"K"},{
"L",
"R"},{
"P",
"D"}},
810 {{
"A",
"A"},{
"X",
"G"},{
"J",
"N"}},
811 {{
"B",
"H"},{
"K",
"P"},{
"C",
"B"}}};
813 for (
int jj = 0;
jj < NRMFIBR;
jj++) {
814 for (
int kk = 0;
kk < NFCH;
kk++) {
815 for (
int ll = 0; ll < 2; ll++) {
817 letterHO[
jj][
kk][ll] = letterHO_loc[
jj][
kk][ll];
819 letterHO[
jj][
kk][ll] = letterHO_sipm[
jj][
kk][ll];
839 int rmspecialeta_loc[6][6] = {
840 { 14, 15, 14, 13, 12, 11 },
841 { 14, 15, 14, 13, 12, 11 },
842 { 10, 9, 8, 7, 6, 5 },
843 { 10, 9, 8, 7, 6, 5 },
844 { 14, 15, 14, 13, 12, 11 },
845 { 14, 15, 14, 13, 12, 11 }
849 {
"X",
"B",
"C",
"D",
"E",
"F" },
850 {
"X",
"P",
"Q",
"R",
"S",
"T" },
851 {
"G",
"H",
"J",
"K",
"L",
"M" },
852 {
"A",
"B",
"C",
"D",
"E",
"F" },
853 {
"X",
"B",
"C",
"D",
"E",
"F" },
854 {
"X",
"P",
"Q",
"R",
"S",
"T" }
858 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
859 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
860 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
861 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
862 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
863 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" }
866 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
869 for (
int jj = 0;
jj < 6;
jj++) {
870 for (
int kk = 0;
kk < 6;
kk++) {
871 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];}}
873 for (
int jj = 0;
jj < 6;
jj++) {
874 for (
int kk = 0;
kk < 6;
kk++) {
875 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];}}
878 else if (mapIOV_==2) {
879 int rmspecialeta_loc[6][6] = {
880 { 11, 12, 13, 14, 15, 15 },
881 { 11, 12, 13, 14, 15, 15 },
882 { 5, 6, 7, 8, 9, 10 },
883 { 5, 6, 7, 8, 9, 10 },
884 { 14, 15, 14, 13, 12, 11 },
885 { 11, 12, 13, 14, 15, 15 }
889 {
"F",
"E",
"D",
"C",
"B",
"X" },
890 {
"T",
"S",
"R",
"Q",
"P",
"X" },
891 {
"M",
"L",
"K",
"J",
"H",
"G" },
892 {
"F",
"E",
"D",
"C",
"B",
"A" },
893 {
"X",
"B",
"C",
"D",
"E",
"F" },
894 {
"T",
"S",
"R",
"Q",
"P",
"X" }
898 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
899 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
900 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
901 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
902 {
"HOX",
"HO",
"HO",
"HO",
"HO",
"HO" },
903 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" }
906 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
909 for (
int jj = 0;
jj < 6;
jj++) {
910 for (
int kk = 0;
kk < 6;
kk++) {
911 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];}}
913 for (
int jj = 0;
jj < 6;
jj++) {
914 for (
int kk = 0;
kk < 6;
kk++) {
915 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];}}
919 int rmspecialeta_loc[6][6] = {
920 { 11, 12, 13, 14, 15, 15 },
921 { 11, 12, 13, 14, 15, 15 },
922 { 5, 6, 7, 8, 9, 10 },
923 { 5, 6, 7, 8, 9, 10 },
924 { 11, 12, 13, 14, 15, 15 },
925 { 11, 12, 13, 14, 15, 15 }
929 {
"F",
"E",
"D",
"C",
"B",
"X" },
930 {
"T",
"S",
"R",
"Q",
"P",
"X" },
931 {
"M",
"L",
"K",
"J",
"H",
"G" },
932 {
"F",
"E",
"D",
"C",
"B",
"A" },
933 {
"F",
"E",
"D",
"C",
"B",
"X" },
934 {
"T",
"S",
"R",
"Q",
"P",
"X" }
938 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
939 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
940 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
941 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HO" },
942 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" },
943 {
"HO",
"HO",
"HO",
"HO",
"HO",
"HOX" }
946 memcpy( rmspecialeta, rmspecialeta_loc,
sizeof(
int)*6*6 );
949 for (
int jj = 0;
jj < 6;
jj++) {
950 for (
int kk = 0;
kk < 6;
kk++) {
951 rmspeciallet_code[
jj][
kk] = rmspeciallet_code_loc[
jj][
kk];}}
953 for (
int jj = 0;
jj < 6;
jj++) {
954 for (
int kk = 0;
kk < 6;
kk++) {
955 rmspecialdet[
jj][
kk] = rmspecialdet_loc[
jj][
kk];}}
961 stringstream mystream;
964 for(isid = -1; isid < 2; isid+=2){
965 for (iph = 0; iph < NHOPHI; iph++){
966 for (iet = 0; iet < NHOETA; iet++){
972 if (iphi >= 71 || iphi < 17) ic = 0;
973 else if (iphi >= 17 && iphi < 35) ic = 1;
974 else if (iphi >= 35 && iphi < 53) ic = 2;
986 phmod6e450 = (phmod6 == 4 || phmod6 == 5 || phmod6 == 0);
987 phmod6e123 = (phmod6 == 1 || phmod6 == 2 || phmod6 == 3);
990 if (ieta <= 3 && (iside < 0 || phmod6 >= 4)) fpga =
"bot";
991 else if (ieta <= 3 && iside > 0 && phmod6 < 4) fpga =
"top";
993 else if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6)) fpga =
"top";
994 else if ((ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13)) fpga =
"bot";
996 else if (ieta >= 10 && iside > 0) fpga =
"top";
997 else if (ieta < 10 && ieta >= 6 && iside > 0) fpga =
"bot";
999 else if ((ieta == 5 && iside > 0) || ieta == 4) fpga =
"top";
1000 else if ((ieta == 5 || ieta >= 10) && iside < 0) fpga =
"bot";
1001 else if ((ieta < 10 && ieta >= 6) && iside < 0) fpga =
"top";
1002 else edm::LogInfo(
"HcalLogicalMapGenerator") <<
"Bad fpga code"<<endl;
1005 if (ieta <= 20) idphi = 1;
1009 if (iside == 1) sidear = 1;
1015 irm = HO_RM_table[phmod24][iet][sidear];
1019 if (ieta==16) irm_fi = HO_RM_fi_eta16;
1020 else if (ieta >= 5) irm_fi = HO_RM_fi_eta5to15[ieta - 5];
1023 if (ieta <= 3) irm_fi = HO_RM_fi_eta1to4[phmod24][0][sidear];
1024 else if (ieta == 4) irm_fi = HO_RM_fi_eta1to4[phmod24][1][sidear];
1025 else irm_fi = -1000;
1027 else if (mapIOV_ >= 5) {
1028 irm_fi = HO_RM_fi_eta1to4_sipm[phmod24][ieta-1][sidear];
1035 if (ieta >= 5 && phmod6e450) ihtr_fi = HO_htr_fi_450eta5to15[sidear][ieta - 5];
1036 else if (ieta >= 5 && phmod6e123) ihtr_fi = HO_htr_fi_450eta5to15[sidear][ieta - 5] - 1;
1037 else if (ieta <= 4) {
1039 if (ieta == 4) ihtr_fi = HO_htr_fi_eta4[sidear][phmod6];
1040 else if (ieta <= 3) ihtr_fi = HO_htr_fi_eta123[sidear][phmod6];
1042 else if (mapIOV_ >= 5) {
1043 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][ieta-1][(irm-1)/2][sidear];
1046 else ihtr_fi = -1000;
1050 phi1458 = (iphi % 12 == 1 || iphi % 12 == 4 || iphi % 12 == 5 || iphi % 12 == 8);
1051 phi271011 = (iphi % 12 == 2 || iphi % 12 == 7 || iphi % 12 == 10 || iphi % 12 == 11);
1054 phir0v1 = (iphi % 24 == 0 || iphi % 24 == 2 || iphi % 24 == 4 || iphi % 24 == 18 || iphi % 24 == 20 || iphi % 24 == 22);
1055 phir0v2 = (iphi % 24 == 1 || iphi % 24 == 3 || iphi % 24 == 17 || iphi % 24 == 19 || iphi % 24 == 21 || iphi % 24 == 23);
1057 phir0v3 = (iphi % 24 == 5 || iphi % 24 == 7 || iphi % 24 == 9 || iphi % 24 == 11 || iphi % 24 == 13 || iphi % 24 == 15);
1058 phir0v4 = (iphi % 24 == 6 || iphi % 24 == 8 || iphi % 24 == 10 || iphi % 24 == 12 || iphi % 24 == 14 || iphi % 24 == 16);
1061 if (ieta % 2 == 0 && phi1458) ifi_ch = 0;
1062 else if (ieta % 2 == 0 && iphi % 3 == 0) ifi_ch = 1;
1063 else if (ieta % 2 == 0 && phi271011) ifi_ch = 2;
1064 else if (ieta % 2 == 1 && iphi % 3 == 0) ifi_ch = 0;
1065 else if (ieta % 2 == 1 && phi271011) ifi_ch = 1;
1066 else if (ieta % 2 == 1 && phi1458) ifi_ch = 2;
1072 if (phir0v1) ifi_ch = 0;
1073 else if (phir0v4) ifi_ch = 1;
1074 else if (iphi % 2 == 1) ifi_ch = 2;
1077 if (phir0v3) ifi_ch = 0;
1078 else if (phir0v2) ifi_ch = 1;
1079 else if (iphi % 2 == 0) ifi_ch = 2;
1083 else if ((ieta == 3 && iside == -1) || (ieta == 2 && iside == 1)){
1084 if (phir0v4) ifi_ch = 0;
1085 else if (phir0v3) ifi_ch = 1;
1086 else if (phir0v1 || phir0v2) ifi_ch = 2;
1089 else if ((ieta == 3 && iside == 1) || (ieta == 2 && iside == -1)){
1090 if (phir0v2) ifi_ch = 0;
1091 else if (phir0v1) ifi_ch = 1;
1092 else if (phir0v3 || phir0v4) ifi_ch = 2;
1095 else if (ieta == 1){
1096 if (phir0v1 || phir0v3) ifi_ch = 0;
1097 else if (phir0v2 || phir0v4) ifi_ch = 1;
1105 if (phir0v1) ifi_ch = 0;
1106 else if (phir0v4) ifi_ch = 2;
1107 else if (iphi % 2 == 1) ifi_ch = 2;
1110 if (phir0v3) ifi_ch = 0;
1111 else if (phir0v2) ifi_ch = 2;
1112 else if (iphi % 2 == 0) ifi_ch = 2;
1117 if (iphi % 2 == 0) ifi_ch = 2;
1118 else if (iphi % 2 == 1) ifi_ch = 1;
1121 if (iphi % 2 == 0) ifi_ch = 1;
1122 else if (iphi % 2 == 1) ifi_ch = 2;
1127 if (iphi % 2 == 0) ifi_ch = 0;
1128 else if (iphi % 2 == 1) ifi_ch = 1;
1131 if (iphi % 2 == 1) ifi_ch = 0;
1132 else if (iphi % 2 == 0) ifi_ch = 1;
1137 if (phir0v1) ifi_ch = 0;
1138 else if (phir0v4) ifi_ch = 1;
1139 else if (iphi % 2 == 1) ifi_ch = 0;
1142 if (phir0v3) ifi_ch = 0;
1143 else if (phir0v2) ifi_ch = 1;
1144 else if (iphi % 2 == 0) ifi_ch = 0;
1152 iqie = (irm_fi - 2) / 2 + 1;
1154 if (irm_fi % 2 == 0) iadc = ifi_ch;
1155 else iadc = NFCH + (ifi_ch + 1) % 3;
1159 ipixel = ipixelHO[irm_fi - 2][ifi_ch][0];
1160 letter = letterHO[irm_fi - 2][ifi_ch][0];
1163 ipixel = ipixelHO[irm_fi - 2][ifi_ch][1];
1164 letter = letterHO[irm_fi - 2][ifi_ch][1];
1169 if (ieta <= 4 && mapIOV_ >= 5) {
1170 if (ipixel==3 || ipixel==7 || ipixel==12 || ipixel==14 || ipixel==17 || ipixel==18) {
1172 if (phmod6==1 || phmod6==3)
1177 else if (ipixel==1 || ipixel==4 || ipixel==8 || ipixel==15 || ipixel==16 || ipixel==19) {
1179 if (phmod6==0 || phmod6==2)
1184 else if (ipixel==2 || ipixel==5 || ipixel==6 || ipixel==9 || ipixel==11 || ipixel==13) {
1190 if (fpga ==
"bot") itb = 1;
1196 if (ieta <= 3 || (ieta >= 14 && iside == 1)) ih = 0;
1197 else if (ieta <= 13 && ieta >= 6 && iside == 1) ih = 1;
1198 else if (ieta <= 13 && ieta >= 6 && iside == -1) ih = 3;
1205 int php2mod18 = (iph+2)%18;
1206 int php2mod18ov6 = php2mod18/6;
1211 if (iphi % 18 == 17 || iphi % 18 <= 4) is = 0;
1212 else if (iphi % 18 >= 5 && iphi % 18 <= 10) is = 1;
1215 if ( ieta == 16 && iside > 0 ) ihtr=21;
1217 ihtr=ihslotho[is][ih];
1221 ihtr=ihslotho[is][ih];
1223 if (mytype == 1 || mytype == 2)
1227 ihtr=ihslotho[php2mod18ov6][ih];
1231 if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 6)) ispigot = 12;
1232 else if ((ieta > 15 && iside > 0) && (icrate == 7 || icrate == 13)) ispigot = 13;
1233 else ispigot=ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
1235 idcc_sl = idcc == 1 ?10:20;
1237 ifed=fedhonum[ic][idcc-1];
1241 if (iside == -1) sidesign =
'M';
1242 else sidesign =
'P';
1244 if (ieta <= 4)
ring = 0;
1245 else if (ieta >= 5 && ieta <= 10)
ring = 1;
1250 for (
i = -2;
i < iphi;
i+=6){
1253 if (sector > 12) sector = 1;
1258 if (
ring != 0 && sector % 2 != 0) sector++;
1260 if (
ring == 0) sprintf (tempbuff,
"%s%i%2.2d", det.c_str(),
ring, sector);
1261 else sprintf (tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign, sector);
1263 rbx = mystream.str();
1271 if (ieta==16 && isid<0) ihtr_fi = HO_htr_fi_450eta16M[irm - 1];
1272 else if (ieta==16 && isid>0) ihtr_fi = HO_htr_fi_450eta16P[irm - 1][sector/2-1];
1274 if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 7)) {
1278 else if ((ieta > 15 && iside > 0) && (icrate == 6 || icrate == 13)) {
1283 if ( ieta == 16 ) ieta = 15;
1285 if ( iside == 1 &&
ring == 2 ) {
1287 ieta = rmspecialeta[0][iet - 10];
1288 letter = rmspeciallet_code[0][iet - 10];
1289 det = rmspecialdet[0][iet - 10];
1291 else if ( iphi == 67 ) {
1292 ieta = rmspecialeta[1][iet - 10];
1293 letter = rmspeciallet_code[1][iet - 10];
1294 det = rmspecialdet[1][iet - 10];
1297 else if ( iside == -1) {
1300 ieta = rmspecialeta[2][iet - 4];
1301 letter = rmspeciallet_code[2][iet - 4];
1302 det = rmspecialdet[2][iet - 4];
1304 else if ( iphi == 65 ) {
1305 ieta = rmspecialeta[3][iet - 4];
1306 letter = rmspeciallet_code[3][iet - 4];
1307 det = rmspecialdet[3][iet - 4];
1310 else if (
ring == 2 ) {
1312 ieta = rmspecialeta[4][iet - 10];
1313 letter = rmspeciallet_code[4][iet - 10];
1314 det = rmspecialdet[4][iet - 10];
1316 else if ( iphi == 31 ) {
1317 ieta = rmspecialeta[5][iet - 10];
1318 letter = rmspeciallet_code[5][iet - 10];
1319 det = rmspecialdet[5][iet - 10];
1325 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1326 det, iside, ieta, iphi, idepth,
1327 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1330 HOHXEntries.push_back(hoxlmapentry);
1334 unsigned int denseId;
1337 HoHash2Entry.at(denseId)=HOHXEntries.size();
1340 HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1352 if (irm_fi % 2 == 0) iadc = ifi_ch;
1353 else iadc = NFCH + (ifi_ch + 1) % 3;
1354 iqie = (irm_fi - 2) / 2 + 1;
1355 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][4][(irm-1)/2][sidear];
1360 ihtr=ihslotho[php2mod18ov6][ih];
1361 ispigot = ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
1363 idcc_sl = idcc == 1 ?10:20;
1364 ifed=fedhonum[ic][idcc-1];
1369 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1370 det, iside, ieta, iphi, idepth,
1371 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1374 HOHXEntries.push_back(hoxlmapentry);
1378 unsigned int denseId;
1381 HoHash2Entry.at(denseId)=HOHXEntries.size();
1384 HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1387 else if (ipixel==17){
1395 if (irm_fi % 2 == 0) iadc = ifi_ch;
1396 else iadc = NFCH + (ifi_ch + 1) % 3;
1397 iqie = (irm_fi - 2) / 2 + 1;
1398 ihtr_fi = HO_htr_fi_eta1234_sipm[phmod6][4][(irm-1)/2][sidear];
1399 if (phmod6==1 || phmod6==3) {
1407 ispigot = ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
1409 idcc_sl = idcc == 1 ?10:20;
1410 ifed=fedhonum[ic][idcc-1];
1415 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1416 det, iside, ieta, iphi, idepth,
1417 idphi, isector, irm, irm_fi, ipixel, iqie, iadc,
1420 HOHXEntries.push_back(hoxlmapentry);
1424 unsigned int denseId;
1427 HoHash2Entry.at(denseId)=HOHXEntries.size();
1430 HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1440 std::vector <CALIBLogicalMapEntry>& CALIBEntries,
1441 std::vector <uint32_t>& LinearIndex2Entry,
1442 std::vector <uint32_t>& HxCalibHash2Entry) {
1446 int calibcrate_loc[NCALIBCR]={4,0,1,5,11,15,17,14,10,9,7,6,13};
1447 memcpy( calibcrate, calibcrate_loc,
sizeof(
int)*NCALIBCR );
1449 int fedcalibnum_loc[NCALIBCR][2]={{700,701},{702,703},{704,705},{706,707},{708,709},{710,711},{712,713},{714,715},{716,717},
1451 {726,727},{728,729},{730,731}};
1452 memcpy( fedcalibnum, fedcalibnum_loc,
sizeof(
int)*NCALIBCR*2 );
1454 int icalibphis_loc[NCALIBCR]={3,11,19,27,35,43,51,59,67,27,17,35,53};
1455 memcpy( icalibphis, icalibphis_loc,
sizeof(
int)*NCALIBCR );
1457 int icalibsector_min_loc[NCALIBCR]={2,4,6,8,10,12,14,16,18,1,4,7,10};
1458 memcpy( icalibsector_min, icalibsector_min_loc,
sizeof(
int)*NCALIBCR );
1460 int icalibsector_max_loc[NCALIBCR]={3,5,7,9,11,13,15,17,1,4,6,9,12};
1461 memcpy( icalibsector_max, icalibsector_max_loc,
sizeof(
int)*NCALIBCR );
1463 std::string detIDCALIB_loc[NCALIBCR][NTOPBOT] = {{
"HB",
"HE"},
1476 for (
int jj = 0;
jj < NCALIBCR;
jj++) {
1477 for (
int kk = 0;
kk < NTOPBOT;
kk++) {
1478 detIDCALIB[
jj][
kk] = detIDCALIB_loc[
jj][
kk];
1482 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}};
1483 memcpy( nfbr_max, nfbr_max_loc,
sizeof(
int)*NCALIBCR*NTOPBOT );
1485 int calibHOinfo_loc[NHOCR][NTOPBOT][NFBR][2]={
1486 {{{4,0},{5,0},{6,0},{},{6,-2},{6,-1},{6,1},{6,2}},
1487 {{4,-2},{4,-1},{4,1},{4,2},{},{},{},{}}},
1489 {{{7,0},{8,0},{9,0},{},{8,-2},{8,-1},{8,1},{8,2}},
1490 {{1,0},{2,0},{3,0},{},{2,-2},{2,-1},{2,1},{2,2}}},
1492 {{{10,0},{11,0},{12,0},{},{10,-2},{10,-1},{10,1},{10,2}},
1493 {{12,-2},{12,-1},{12,1},{12,2},{},{},{},{}}}
1495 memcpy( calibHOinfo, calibHOinfo_loc,
sizeof(
int)*NHOCR*NTOPBOT*NFBR*2 );
1501 stringstream mystream;
1511 for(ic=0; ic<NHBHECR; ic++){
1512 icrate=calibcrate[ic];
1513 ifed=fedcalibnum[ic][idcc-1];
1515 for(itb=0; itb<NTOPBOT; itb++){
1517 for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1518 det = detIDCALIB[ic][itb];
1522 if (itb==1)
if(ihtr_fi%2==0) irm_fi = 2;
1526 if (ihtr_fi==1||ihtr_fi==2||ihtr_fi==5||ihtr_fi==6) {
1527 iwedge = icalibsector_min[ic];
1529 else if (ihtr_fi==3||ihtr_fi==4||ihtr_fi==7||ihtr_fi==8) {
1530 iwedge = icalibsector_max[ic];
1545 else if (det==
"HB"){
1548 (ihtr_fi%2==1) ? iwedge = icalibsector_min[ic] : iwedge = icalibsector_max[ic];
1562 iphi = ((iwedge*idphi) + 71 - idphi)%72;
1563 subdet =
"CALIB_"+det;
1564 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
1566 rbx = mystream.str();
1569 for(ifc=0; ifc<NFCH; ifc++){
1572 if (ifc==0) ich_type=0;
1573 else if (ifc==1) ich_type=1;
1575 if (det==
"HB") ich_type=2;
1576 else if(det==
"HE") ich_type=3;
1579 else if (irm_fi==2){
1580 if (ifc==0) ich_type=4;
1581 else if (ifc==1) ich_type=5;
1582 else if (ifc==2) ich_type=6;
1585 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1586 det, ieta, iphi, ich_type,
1587 iside, idphi, rbx, iwedge, irm_fi,
1590 CALIBEntries.push_back(caliblmapentry);
1603 for(itb=0; itb<NTOPBOT; itb++){
1605 for(ifb=0; ifb<4; ifb++){
1607 for(ifc=0; ifc<NFCH; ifc++){
1608 icrate=calibcrate[ic];
1612 (ihtr_fi==1)?iphi=1:((ihtr_fi==2)?iphi=19:((ihtr_fi==3)?iphi=37:iphi=55));
1614 ifed=fedcalibnum[ic][idcc-1];
1615 (ifc==0)?ich_type=8:(ifc==1?ich_type=0:ich_type=1);
1635 subdet =
"CALIB_"+det;
1636 sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
1638 rbx = mystream.str();
1641 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1642 det, ieta, iphi, ich_type,
1643 iside, idphi, rbx, iwedge, irm_fi,
1646 CALIBEntries.push_back(caliblmapentry);
1659 for(ic=ic; ic<NCALIBCR; ic++){
1660 icrate=calibcrate[ic];
1662 ifed=fedcalibnum[ic][idcc-1];
1664 for(itb=0; itb<NTOPBOT; itb++){
1665 det=detIDCALIB[ic][itb];
1667 for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1677 iwedge=calibHOinfo[ic-10][itb][ifb][0];
1678 ieta=calibHOinfo[ic-10][itb][ifb][1];
1691 if (ieta==-2) S_side=
'2';
1692 else if (ieta==-1) S_side=
'1';
1693 else if (ieta==1) S_side=
'1';
1694 else if (ieta==2) S_side=
'2';
1696 subdet =
"CALIB_"+det;
1697 if (ieta==0) sprintf (tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
1698 else sprintf (tempbuff,
"%s%c%c%2.2i%c", det.c_str(), S_side, sidesign, iwedge,
'\0');
1700 rbx = mystream.str();
1708 ( ieta == -2 ) ? ( iwedge == 12 ? NFCH_HO = 3 : NFCH_HO = 2 ) : ( iwedge == 10) ? NFCH_HO = 3 : NFCH_HO = 2;
1709 for(ifc=0; ifc<NFCH_HO; ifc++){
1711 (ifi_ch == 2) ? ich_type = 7 : ich_type = ifi_ch;
1712 (ieta==0) ? idphi = 6 : idphi = 12;
1714 (ieta==0) ? iphi=((iwedge*idphi)+71-idphi)%72 : iphi=(((iwedge/2)*idphi)+71-idphi)%72;
1717 if (iside==0&&ifb==3)
break;
1719 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1720 det, ieta, iphi, ich_type,
1721 iside, idphi, rbx, iwedge, irm_fi,
1724 CALIBEntries.push_back(caliblmapentry);
1738 std::vector <uint32_t>& LinearIndex2Entry,
1739 std::vector <uint32_t>& ZdcHash2Entry) {
1743 stringstream mystream;
1753 for(itb=0; itb<NTOPBOT; itb++){
1770 for(icab=1; icab<NZDCCAB+1; icab++){
1776 else if (icab < 7) {
1790 if (mapIOV_<4) ihtr_fi = irm_fi + 3;
1791 else ihtr_fi = irm_fi;
1807 if (icab==6) iqie = 1;
1811 ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1813 ix, iy,
idx, idet_ch, icab, irm, iqie,
1816 ZDCEntries.push_back(zdclmapentry);
1825 std::vector <HTLogicalMapEntry>& HTEntries,
1826 int iside,
int ieta,
int iphi,
int idphi,
int idepth,
std::string det,
int iwedge,
int irm,
1827 int ipixel,
int iqie,
int iadc,
int irm_fi,
int ifi_ch,
int icrate,
int ihtr,
std::string fpga,
1833 string t_chDet,t_fpga;
1834 string t_slnam,t_rctnam,t_slbin,t_slbin2;
1837 int t_side,t_iEta,t_iPhi,t_jPhi,t_iDep,t_topbot;
1838 int t_wedge,t_crate,t_htr;
1840 int t_spigo,t_slb,t_rctcra,t_rctcar,t_rctcon,t_fedid;
1843 (fpga==
"bot") ? t_topbot = 1 : t_topbot = 0;
1873 if(t_iDep!=1)
break;
1874 if(t_chDet==
"HE"&&t_iEta==29)
break;
1878 if(t_iEta==30||t_iEta==31||t_iEta==33||
1879 t_iEta==34||t_iEta==36||t_iEta==37||
1880 t_iEta==39||t_iEta==40||t_iEta==41)
break;
1882 else if(t_iEta==32)t_iEta=30;
1883 else if(t_iEta==35)t_iEta=31;
1884 else if(t_iEta==38)t_iEta=32;
1886 if(t_iPhi==3||t_iPhi==7||t_iPhi==11||t_iPhi==15||t_iPhi==19||
1887 t_iPhi==23||t_iPhi==27||t_iPhi==31||t_iPhi==35||t_iPhi==39||
1888 t_iPhi==43||t_iPhi==47||t_iPhi==51||t_iPhi==55||t_iPhi==59||
1889 t_iPhi==63||t_iPhi==67||t_iPhi==71)
break;
1892 if(t_side<0) t_iEta=-t_iEta;
1896 if(t_slbin2!=
"NA") t_jPhi=1;
1897 if(t_slbin==
"A0"||t_slbin==
"B0") t_nDat=0;
1898 else if(t_slbin==
"A1"||t_slbin==
"B1") t_nDat=1;
1899 else if(t_slbin==
"C0"||t_slbin==
"D0") t_nDat=2;
1900 else if(t_slbin==
"C1"||t_slbin==
"D1") t_nDat=3;
1904 t_side, t_jPhi, t_iDep, t_chDet, t_wedge, t_crate, t_htr, t_topbot,
1905 t_spigo, t_slb, t_slbin, t_slbin2, t_nDat,
1906 t_slnam, t_rctcra, t_rctcar, t_rctcon, t_rctnam, t_fedid
1908 HTEntries.push_back(htlmapentry);
1910 if(t_slbin2!=
"NA") {
1911 if(t_slbin2==
"A0"||t_slbin2==
"B0") t_nDat=0;
1912 else if(t_slbin2==
"A1"||t_slbin2==
"B1") t_nDat=1;
1913 else if(t_slbin2==
"C0"||t_slbin2==
"D0") t_nDat=2;
1914 else if(t_slbin2==
"C1"||t_slbin2==
"D1") t_nDat=3;
1920 t_side, t_jPhi, t_iDep, t_chDet, t_wedge, t_crate, t_htr, t_topbot,
1921 t_spigo, t_slb, t_slbin, t_slbin2, t_nDat,
1922 t_slnam, t_rctcra, t_rctcar, t_rctcon, t_rctnam, t_fedid
1924 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()