CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalLogicalMapGenerator.cc
Go to the documentation of this file.
7 
8 #include <string>
9 #include <sstream>
10 #include <stdio.h>
11 #include <iostream>
12 #include <cstring>
13 
14 using namespace std;
15 
16 /***************************************/
17 
19 
20  //adc and qie table; qie is entry 0, adc is entry 1. Constant across HB, HE, HO
21  // int iadcquiHBHE[NRMFIBR][NFCH][2];
22 
23  for (i = 0; i < NRMFIBR; i++){
24  for (j = 0; j < NFCH; j++){
25  //Intentionally relying on integer truncation here
26  iadcquiHBHE[i][j][0] = i / 2 + 1;
27 
28  if (i % 2 == 0) iadcquiHBHE[i][j][1] = j;
29  else iadcquiHBHE[i][j][1] = NFCH + (j + 1) % 3;
30  }
31  }
32 }
33 
35 
36 }
37 
38 HcalLogicalMap HcalLogicalMapGenerator::createMap( const HcalTopology* topo, unsigned int mapIOV ) {
39 
40  mapIOV_ = mapIOV;
41 
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;
54  //std::vector <uint32_t> CalibHash2Entry;
55  std::vector <uint32_t> ZdcHash2Entry;
56 
57  int HbHalf = 1296;
58  int HeHalf = 1296;
59  //if (h2mode_) HeHalf = 4032;
60  int HoHalf = 1080;
61  int HfHalf = 864;
62  int HtHalf = 2088;
63  int ZdcHalf = 11;
64  int CalibFull=216+425+8;
65 
66  uint32_t illegal_value=0;
67  for (int i=0;i<=HcalElectronicsId::maxLinearIndex;i++) LinearIndex2Entry.push_back(illegal_value);
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);
75 
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);
80 
81  return HcalLogicalMap(topo,HBHEHFEntries,HOHXEntries,CALIBEntries,ZDCEntries,HTEntries,
82  LinearIndex2Entry,HbHash2Entry,HeHash2Entry,HfHash2Entry,HtHash2Entry,
83  HoHash2Entry,HxCalibHash2Entry,/*CalibHash2Entry,*/ZdcHash2Entry);
84 }
85 
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) {
94 
95  /******************************/
96  /* HBHE crate numbering */
97  int hbhecrate_loc[NHBHECR]={0,1,4,5,10,11,14,15,17};
98  memcpy( hbhecrate, hbhecrate_loc, sizeof(int)*NHBHECR );
99  /* HBHE FED numbering of DCCs */
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 );
104  /* HBHE/HF htr slot offsets for set of three htrs */
105  int ihslot_loc[NHSETS]={2,5,13,16};
106  memcpy( ihslot, ihslot_loc, sizeof(int)*NHSETS );
107  /* iphi (lower) starting index for each HBHE crate */
108  int ihbhephis_loc[NHBHECR]={11,19,3,27,67,35,59,43,51};
109  memcpy( ihbhephis, ihbhephis_loc, sizeof(int)*NHBHECR );
110  /* ihbheetadepth - unique HBHE {eta,depth} assignments per fiber and fiber channel */
111  int ihbheetadepth_loc[NHTRS][NTOPBOT][NFBR][NFCH][2]={
112  {{{{11,1},{ 7,1},{ 3,1}}, /* htr 0 (HB) -bot(+top) */
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}}, /* htr 0 (HB) +bot(-top) */
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}}, /* htr 1 (HBHE) -bot(+top) */
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}}, /* htr 1 (HBHE) +bot(-top) */
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}}, /* htr 2 (HE) -bot(+top) */
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}}, /* htr 2 (HE) +bot(-top) */
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}}}}
160  };
161  memcpy( ihbheetadepth, ihbheetadepth_loc, sizeof(int)*NHTRS*NTOPBOT*NFBR*NFCH*2 );
162 
163  //Aram's insert: I shall now define an array which contains the RM and the RM fiber for HB HE
164  //and variables associated with this table
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}}, // HTR 0 top
167  {{6,3},{7,3},{6,4},{7,4},{4,3},{5,3},{4,4},{5,4}}}, // HTR 0 bot
168  {{{2,1},{3,1},{2,2},{3,2},{2,1},{3,1},{2,2},{3,2}}, // HTR 1 top
169  {{2,3},{3,3},{2,4},{3,4},{2,3},{3,3},{2,4},{3,4}}}, // HTR 1 bot
170  {{{4,1},{5,1},{4,2},{5,2},{6,1},{7,1},{6,2},{7,2}}, // HTR 2 top
171  {{4,3},{5,3},{4,4},{5,4},{6,3},{7,3},{6,4},{7,4}}} // HTR 2 bot
172  };
173  memcpy( irm_rmfiHBHE, irm_rmfiHBHE_loc, sizeof(int)*NHTRS*NTOPBOT*NFBR*2 );
174  //Pixel tables as a function of rm, rm fiber and fiber channel
175 
176  int ipixelHB_loc[NRMFIBR][NFCH][NRMSLOT] = { // fch = 0 fch = 1 fch = 2
177  {{18, 17, 3, 2 }, {13, 3, 17, 7 }, {14, 1, 19, 6 }}, //rmfiber = 2
178  {{19, 2, 18, 1 }, {15, 7, 13, 5 }, {17, 19, 1, 3 }}, //rmfiber = 3
179  {{9, 4, 16, 11}, {5, 8, 12, 15}, {2, 13, 7, 18}}, //rmfiber = 4
180  {{12, 11, 9, 8 }, {7, 15, 5, 13}, {16, 6, 14, 4 }}, //rmfiber = 5
181  {{8, 5, 15, 12}, {4, 9, 11, 16}, {1, 14, 6, 19}}, //rmfiber = 6
182  {{6, 16, 4, 14}, {3, 18, 2, 17}, {11, 12, 8, 9 }} //rmfiber = 7
183  };
184  memcpy( ipixelHB, ipixelHB_loc, sizeof(int)*NRMFIBR*NFCH*NRMSLOT );
185 
186  int ipixelHE_loc[NRMFIBR][NFCH][NRMSLOT] = { // fch = 0 fch = 1 fch = 2
187  {{12, 12, 12, 12}, {16, 7, 16, 7 }, {7, 16, 7, 16}}, //rmfiber = 2
188  {{11, 11, 11, 11}, {19, 3, 19, 3 }, {3, 19, 3, 19}}, //rmfiber = 3
189  {{15, 15, 6, 6 }, {2, 18, 2, 18}, {6, 6, 15, 15}}, //rmfiber = 4
190  {{5, 14, 5, 14}, {14, 5, 14, 5 }, {18, 2, 18, 2 }}, //rmfiber = 5
191  {{17, 1, 17, 1 }, {9, 9, 9, 9 }, {1, 17, 1, 17}}, //rmfiber = 6
192  {{13, 4, 13, 4 }, {8, 8, 8, 8 }, {4, 13, 4, 13}} //rmfiber = 7
193  };
194  memcpy( ipixelHE, ipixelHE_loc, sizeof(int)*NRMFIBR*NFCH*NRMSLOT );
195 
196  //slb and rct tables
197 
198  //HB and HE
199 
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];
203  }
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];
207  }
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];
212  }
213 
214  int slb_table_loc[29] = {1,1,2,2,3,3,4,4,5,5,6,6, // 1<=eta<=12
215  1,1,2,2,3,3,1,1, // 13<=eta<=20
216  2,2,3,3,4,4,4,4,4}; // 21<=eta<=29
217  memcpy( slb_table, slb_table_loc, sizeof(int)*29 );
218  /********************/
219 
220  //Stream variable
221  stringstream mystream;
222 
223  /* all HBHE crates */
224  for(ic=0; ic<NHBHECR; ic++){
225  /* four sets of three htrs per crate */
226  for(is=0; is<NHSETS; is++){
227  /* three htrs per set */
228  for(ih=0; ih<NHTRS; ih++){
229  /* top and bottom */
230  for(itb=0; itb<NTOPBOT; itb++){
231  /* eight fibers per HTR FPGA */
232  for(ifb=0; ifb<NFBR; ifb++){
233  /* three channels per fiber */
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];
240  ihtr=ihslot[is]+ih;
241  (ieta>16||idepth>2) ? det = "HE": det = "HB";
242  (itb%2)==1 ? fpga = "bot" : fpga = "top";
243  ihtr_fi=ifb+1;
244  ifi_ch=ifc;
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];
250  //Aram's insert: rm variables, rbx, wedge
251  //Careful here: per Pawel's map, the rm fiber is the first entry an the rm itself is the second.
252 
253  //If iside == -1, switch top and bottom. Why?
254  if (iside == -1){
255  S_side = '-';
256  sidesign = 'M';
257  irm = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][1];
258  irm_fi = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][0];
259 
260  //For eta >=21, the phi's cover 10 degrees rather than 5 (see HCAL TDR)
261  if (ieta >= 21 && (irm == 1 || irm == 3)) iwedge = (iphi + 1 + irm + 1) / 4;
262  else iwedge = (iphi + irm + 1) / 4;
263 
264  //Roll over the wedge
265  if (iwedge > 18) iwedge -= 18;
266  }
267  else{
268  S_side = '+';
269  sidesign = 'P';
270  irm = irm_rmfiHBHE[ih][itb][ifb][1];
271  irm_fi = irm_rmfiHBHE[ih][itb][ifb][0];
272 
273  //For eta >=21, the phi's cover 10 degrees rather than 5 (see HCAL TDR)
274  if (ieta >= 21 && (irm == 4 || irm == 2)) iwedge = (iphi + 1 - irm + 6) / 4;
275  else iwedge = (iphi - irm + 6) / 4;
276 
277  //Roll over the wedge
278  if (iwedge > 18) iwedge -= 18;
279  }
280 
281  sprintf (tempbuff, "%s%c%2.2i%c", det.c_str(), sidesign, iwedge,'\0');
282  mystream<<tempbuff;
283  rbx = mystream.str();
284  mystream.str("");
285 
286  //Note that irm_fi ranges from 2 to 7 whereas arrays start at 0 so
287  //I use irm_fi - 2. Likewise, irm goes from 1 to 4 so use irm - 1
288 
289  //Pixel is split by HB and HE
290  if (ieta > 16 || idepth > 2) ipixel = ipixelHE[irm_fi - 2][ifc][irm - 1]; //HE
291  else ipixel = ipixelHB[irm_fi - 2][ifc][irm - 1]; //HB
292 
293  iqie = iadcquiHBHE[irm_fi - 2][ifc][0];
294  iadc = iadcquiHBHE[irm_fi - 2][ifc][1];
295 
296  phideg = iphi - 3;
297  if (phideg < 0) phideg = phideg + 72;
298  phideg = (phideg / 4) * 20 + 10;
299  irctcra = (( 89 - phideg + 720)%360)/20;
300  oddcard = irctcra % 2;
301  irctcra /= 2;
302  if (iside > 0) irctcra = irctcra + 9;
303 
304  etaslb = ((ieta - 1) / 2) * 2 + 1;
305  if (etaslb > 27) etaslb = 27;
306 
307 
308  sprintf(tempbuff,"SLB_H_%3.3d%c%2.2d%c",phideg,S_side,etaslb,'\0');
309  mystream<<tempbuff;
310  slnam = mystream.str();
311  mystream.str("");
312 
313  islb = slb_table[ieta - 1];
314 
315  // calculate RCT destination (that is, rctcon, rctcar and rctnam
316  if (ieta <= 24) { // these are the normal cards 0-5
317  irctcar = 2 * ((ieta - 1)/8) + oddcard;
318  irctcon = 2 * (((ieta - 1)/2)%4);
319  }
320  else { // these are on the special card 6 which folds back eta on the odd card half
321  irctcar = 6;
322  eta2 = ieta;
323  if (eta2 > 28) eta2 = 28;
324  if (oddcard == 0) eta3 = eta2;
325  else eta3 = 57 - eta2;
326  irctcon = 2 * (((eta3 - 1) / 2) % 4);
327  }
328  irctcon = 11 * irctcon + 1;
329 
330  sprintf(tempbuff,"%s-%1d-HD%2.2d",rct_rackHBHE[irctcra],irctcar,irctcon);
331  mystream<<tempbuff;
332  rctnam = mystream.str();
333  mystream.str("");
334 
335  //Finally, the slbin
336 
337  phimod8 = iphi % 8;
338 
339  for (i = 0; i < 18; i++) {
340  if (iphi < i * 4 + 3) {
341  crazy = i % 2;
342  break;
343  }
344  }
345 
346  int ietamod; // determine if eta is "odd" or "even".
347  if (ieta == 29) ietamod = 0;
348  else ietamod = ieta % 2;
349  if (ieta < 25) { // use the regular table
350  if (ietamod == 1) mystream<<S_slbin_odd[phimod8];
351  else mystream<<S_slbin_even[phimod8];
352  }
353  else if (crazy == 0) { // use the regular table
354  if (ietamod == 1) mystream<<S_slbin_odd[phimod8];
355  else mystream<<S_slbin_even[phimod8];
356  }
357  else { // swap odd/even!!!
358  if (ietamod == 1) mystream<<S_slbin_even[phimod8];
359  else mystream<<S_slbin_odd[phimod8];
360  }
361 
362  slbin = mystream.str();
363  mystream.str("");
364 
365  if (ieta > 20){
366  idphi = 2;
367  slbin2 = slbin;
368  slbin2[1] = '1';
369  }
370  else{
371  idphi = 1;
372  slbin2 = "NA";
373  }
374 
375  HBHEHFLogicalMapEntry hbeflmapentry(
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
381  );
382  HBHEHFEntries.push_back(hbeflmapentry);
383  LinearIndex2Entry.at(hbeflmapentry.getLinearIndex())=HcalLogicalMap::makeEntryNumber(1,0,HBHEHFEntries.size()-1);
384 
385  const HcalGenericDetId hgdi(hbeflmapentry.getDetId());
386  unsigned int denseId;
387  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenBarrel) {
388  denseId=topo->detId2denseIdHB(hgdi);
389  HbHash2Entry.at(denseId)=HBHEHFEntries.size();
390  }
391  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenEndcap) {
392  denseId=topo->detId2denseIdHE(hgdi);
393  HeHash2Entry.at(denseId)=HBHEHFEntries.size();
394  }
395  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenForward) {
396  denseId=topo->detId2denseIdHF(hgdi);
397  HfHash2Entry.at(denseId)=HBHEHFEntries.size();
398  }
399 
400  ConstructTriggerTower(topo,
401  HTEntries,
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
406  );
407  }
408  }
409  }
410  }
411  }
412  }
413 
414  /********************/
415  /* HF crate numbering */
416  int hfcrate_loc[NHFCR]={2,9,12};
417  memcpy( hfcrate, hfcrate_loc, sizeof(int)*NHFCR );
418  /* HF FED numbering of DCCs */
419  int fedhfnum_loc[NHFCR][2]={{718,719},{720,721},{722,723}};
420  memcpy( fedhfnum, fedhfnum_loc, sizeof(int)*NHFCR*2 );
421  /* iphi (lower) starting index for each HF crate */
422  int ihfphis_loc[NHFCR]={3,27,51};
423  memcpy( ihfphis, ihfphis_loc, sizeof(int)*NHFCR );
424  /* ihfetadepth - unique HF {eta,depth} assignments per fiber and fiber channel */
425  int ihfetadepth_loc[NTOPBOT][NFBR][NFCH][2]={
426  {{{33,1},{31,1},{29,1}}, /* top */
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}}, /* bot */
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}}}
442  };
443  memcpy( ihfetadepth, ihfetadepth_loc, sizeof(int)*NTOPBOT*NFBR*NFCH*2 );
444 
445 
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}}, // HTR 0 top
448  {{5,2},{6,2},{7,2},{8,2},{5,3},{6,3},{7,3},{8,3}}}, // HTR 0 bot
449  {{{1,1},{2,1},{3,1},{4,1},{1,2},{2,2},{3,2},{4,2}}, // HTR 1 top
450  {{5,1},{6,1},{7,1},{8,1},{5,2},{6,2},{7,2},{8,2}}}, // HTR 1 bot
451  {{{1,3},{2,3},{3,3},{4,3},{1,1},{2,1},{3,1},{4,1}}, // HTR 2 top
452  {{5,3},{6,3},{7,3},{8,3},{5,1},{6,1},{7,1},{8,1}}} // HTR 2 bot
453  };
454  memcpy( irm_rmfiHF, irm_rmfiHF_loc, sizeof(int)*NHTRS*NTOPBOT*NFBR*2 );
455 
456  //HF
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];
460  }
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];
464  }
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];
469  }
470 
471 
472  /***************/
473 
474  /* all HF crates */
475  for(ic=0; ic<NHFCR; ic++){
476  /* four sets of three htrs per crate */
477  for(is=0; is<NHSETS; is++){
478  /* three htrs per set */
479  for(ih=0; ih<NHTRS; ih++){
480  /* top and bottom */
481  for(itb=0; itb<NTOPBOT; itb++){
482  /* eight fibers per HTR FPGA */
483  for(ifb=0; ifb<NFBR; ifb++){
484  /* three channels per fiber */
485  for(ifc=0; ifc<NFCH; ifc++){
486  icrate=hfcrate[ic];
487  iside=is<NHSETS/2?-1:1;
488  ieta=ihfetadepth[itb][ifb][ifc][0];
489  idepth=ihfetadepth[itb][ifb][ifc][1];
490  ihtr=ihslot[is]+ih;
491  det = "HF";
492  (itb%2)== 1 ? fpga = "bot" : fpga = "top";
493  ihtr_fi=ifb+1;
494  ifi_ch=ifc;
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];
500 
501  irm_fi = irm_rmfiHF[ih][itb][ifb][0];
502 
503  //Don't switch in the HF. Why?
504  if (iside == -1){
505  S_side = '-';
506  sidesign = 'M';
507 
508  if (ieta < 40){
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;
514  }
515  }
516  else{
517  S_side = '+';
518  sidesign = 'P';
519  }
520 
521  //RM and RBX number
522  if ((iside == 1 && ieta == 40) || (iside == -1 && ieta == 41)){
523  irm = ((iphi + 1) / 2) % 36 + 1;
524  hfphi = ((iphi + 1) / 6) % 12 + 1;
525  }
526  else{
527  irm = ( iphi + 1) / 2;
528  hfphi = (iphi - 1) / 6 + 1;
529  }
530  irm = (irm - 1) % 3 + 1;
531 
532  //Wedge
533  if (iphi >= 71) iwedge = 1;
534  else iwedge = (iphi + 1) / 4 + 1;
535 
536  //RBX
537  sprintf (tempbuff, "%s%c%2.2i%c", det.c_str(), sidesign, hfphi,'\0');
538  mystream<<tempbuff;
539  rbx = mystream.str();
540  mystream.str("");
541 
542  //No pixel in HF, follow Fedor's convention
543  ipixel = 0;
544 
545  //Integer truncation again consistent with Fedor's map.
546  iqie = (irm_fi - 1) / 2 + 1;
547 
548  if (irm_fi % 2 != 0) iadc = ifi_ch;
549  else iadc = NFCH + (ifi_ch + 1) % 3;
550 
551  //slb and rct variables
552  //rctcrate
553  phideg = iphi - 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;
558 
559  //rct card and rct connector appear to be dummy here -- again, I follow Fedor's convention
560  irctcar = 99;
561  irctcon = 0;
562 
563  etaslb = 29;
564 
565  sprintf(tempbuff,"SLB_H_%3.3d%c%2.2d",phideg,S_side,etaslb);
566  mystream<<tempbuff;
567  slnam = mystream.str();
568  mystream.str("");
569 
570  sprintf(tempbuff,"%s-JSC-HF_IN",rct_rackHF[irctcra]);
571  mystream<<tempbuff;
572  rctnam = mystream.str();
573  mystream.str("");
574 
575  islb = 6;
576 
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];
583 
584  slbin = mystream.str();
585  mystream.str("");
586 
587  slbin2 = "NA";
588 
589  if (ieta < 40) idphi = 2;
590  else idphi = 4;
591 
592  HBHEHFLogicalMapEntry hbeflmapentry(
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
598  );
599  HBHEHFEntries.push_back(hbeflmapentry);
600  LinearIndex2Entry.at(hbeflmapentry.getLinearIndex())=HcalLogicalMap::makeEntryNumber(1,0,HBHEHFEntries.size()-1);
601 
602  const HcalGenericDetId hgdi(hbeflmapentry.getDetId());
603  unsigned int denseId;
604  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenBarrel) {
605  denseId=topo->detId2denseIdHB(hgdi);
606  HbHash2Entry.at(denseId)=HBHEHFEntries.size();
607  }
608  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenEndcap) {
609  denseId=topo->detId2denseIdHE(hgdi);
610  HeHash2Entry.at(denseId)=HBHEHFEntries.size();
611  }
612  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenForward) {
613  denseId=topo->detId2denseIdHF(hgdi);
614  HfHash2Entry.at(denseId)=HBHEHFEntries.size();
615  }
616 
617  ConstructTriggerTower(topo,
618  HTEntries,
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
623  );
624  }
625  }
626  }
627  }
628  }
629  }
630 }
631 
633  std::vector <HOHXLogicalMapEntry>& HOHXEntries,
634  std::vector <uint32_t>& LinearIndex2Entry,
635  std::vector <uint32_t>& HoHash2Entry,
636  std::vector <uint32_t>& HxCalibHash2Entry) {
637  /******************************/
638  /* HO crate numbering */
639  int hocrate_loc[NHOCR]={3,7,6,13};
640  memcpy( hocrate, hocrate_loc, sizeof(int)*NHOCR );
641  /* HO FED numbering of DCCs */
642  int fedhonum_loc[NHOCR][2]={{724,725},{726,727},{728,729},{730,731}};
643  memcpy( fedhonum, fedhonum_loc, sizeof(int)*NHOCR*2 );
644  /* HO htr slot offsets for three sets of four htrs */
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 );
647  /* iphi (lower) starting index for each HO crate */
648  int ihophis_loc[NHOCR]={71,17,35,53};
649  memcpy( ihophis, ihophis_loc, sizeof(int)*NHOCR );
650  //RM for the HO as a function of eta, phi and side as implemented in complete_ho_map.txt
651  //There are only 24 phi columns because after that it begins to repeat. The relevant variable is phi mod 24.
652  //HX as the 16th eta entry
653  int HO_RM_table_loc[24][16][2] =
654  {
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}}
679  };
680  memcpy( HO_RM_table, HO_RM_table_loc, sizeof(int)*24*16*2 );
681 
682  //For |eta| 5 to 15, rm_fi is a function of |eta| only while htr_fi is a function of side and |eta|
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 );
685  //For eta=16 it is 6, declared in the header
686  HO_RM_fi_eta16 = 6;
687  //For eta in the YB0 region, rm_fi is dependent on side, 4 for -1, and 5 for +1
688  //but the values won't be any different than when the regular loop is executed
689  //int HO_RM_fi_etaYB0[2] = {4, 5}
690 
691  int HO_htr_fi_450eta5to15_loc[2][11] = {{2, 2, 4, 6, 8, 2, 4, 6, 8, 4, 6}, //iside = -1
692  {2, 8, 6, 4, 2, 8, 6, 4, 2, 4, 2}}; //iside = +1
693  memcpy( HO_htr_fi_450eta5to15, HO_htr_fi_450eta5to15_loc, sizeof(int)*2*11 );
694  // for the minus side, htr_fi is determined by the RM, will have to shift up one since rm is
695  //numbered 1-4 not 0-3
696  int HO_htr_fi_450eta16M_loc[4] = {7, 7, 8, 8};//iside = -1
697  memcpy( HO_htr_fi_450eta16M, HO_htr_fi_450eta16M_loc, sizeof(int)*4 );
698  //For the plus side, there is a new htr so all values can be used, but only 6 are used
699  //Depend on phi, but also on rm and sector (2,4,6,8,10,12)
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} }; //iside = +1
701  memcpy( HO_htr_fi_450eta16P, HO_htr_fi_450eta16P_loc, sizeof(int)*4*6 );
702 
703  //for |eta| <= 4, htr_fi is a function of side and phmod6
704  int HO_htr_fi_eta4_loc[2][6] = {{6, 6, 8, 8, 7, 7}, //iside = -1
705  {4, 4, 5, 5, 3, 3}}; //iside = +1
706  memcpy( HO_htr_fi_eta4, HO_htr_fi_eta4_loc, sizeof(int)*2*6 );
707 
708  int HO_htr_fi_eta123_loc[2][6] = {{6, 5, 4, 3, 8, 7}, //iside = -1
709  {8, 7, 6, 5, 2, 1}}; //iside = +1
710  memcpy( HO_htr_fi_eta123, HO_htr_fi_eta123_loc, sizeof(int)*2*6 );
711 
712  //HO_htr_fi_123eta5to15[2][11] is unnecessary because HO_htr_fi_123eta5to15[i][j] == int HO_htr_fi_450eta5to15[i][j] - 1
713 
714  //For |eta| 1 to 4, it is a function of phi, eta and side. eta 1-3 always have the same value given a side, eta 4 is separate
715  //and thus gets its own box
716  int HO_RM_fi_eta1to4_loc[72][2][2] =
717  { //side = -1 side = 1
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}}, //Phi 1 to 8
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}}, //Phi 9 to 16
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}}, //Phi 17 to 24
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}}, //Phi 25 to 32
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}}, //Phi 33 to 40
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}}, //Phi 41 to 48
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}}, //Phi 49 to 56
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}}, //Phi 57 to 64
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}} //Phi 65 to 72
727  };
728  memcpy( HO_RM_fi_eta1to4, HO_RM_fi_eta1to4_loc, sizeof(int)*72*2*2 );
729 
730  //Pixel and letter code for the HO. Ring 0 is separate and goes into entry 0, Rings +/- 1,2 are all the same and go to entry 1.
731  //Pixel and let_code for HO ring 0 on the crosstalk channels: on rm_fi 4, pixel = 18, let_code = X
732  //Pixel and let_code for HO ring 0 on the crosstalk channels: on rm_fi 5, pixel = 2, let_code = X
733  // Fiber Channel 0 1 2 0 1 2 0 1 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}}, //RM fibers 2,3,4
735  {{ 2, 9},{ 1,13},{ 3, 5}}, {{11,19},{16,18},{15,17}}, {{13,15},{ 9,14},{14,16}}}; //RM fibers 5,6,7
736  memcpy( ipixelHO, ipixelHO_loc, sizeof(int)*NRMFIBR*NFCH*2 );
737  // Fiber Channel 0 1 2 0 1 2 0 Y 1 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"}}};
740 
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];
745  }
746  }
747  }
748 
749  /******************************************************************************************/
750  // Here is the section that deals with the miscabled HO RBXs.
751  // To modify the code between IOVs, just note that inverted corresponds to -infinity to end of 2008
752  // and otherwise, to 2009 to infinity.
753  // Except for some small but major caveats:
754  // HO2M04 (phi=16) was not able to be corrected, thus it is still inverted
755  // HO2M06 (phi=31) has not been active in 2009, and the cables have not been switched officially
756  // HO2P12 (phi=67) has not been active in 2009, and the cables have not been switched officially
757  // In the map, the inactive RBXs have been switched since the changes will be effected when the HO SiPMs
758  // are installed, also at that time, if it is possible, HO2M04 will be corrected as well.
759 
760  // switched HO RM's need reversed eta values
761  if(mapIOV_==1) {
762  int rmspecialeta_loc[6][6] = { //there are 6 special cases, corresponding to 6 values of phi
763  { 14, 15, 14, 13, 12, 11 }, // ring +2 phi = 5, inverted
764  { 14, 15, 14, 13, 12, 11 }, // ring +2 phi = 67, inverted
765  { 10, 9, 8, 7, 6, 5 }, // ring -1 phi = 57, inverted
766  { 10, 9, 8, 7, 6, 5 }, // ring -1 phi = 65, inverted
767  { 14, 15, 14, 13, 12, 11 }, // ring -2 phi = 16, inverted
768  { 14, 15, 14, 13, 12, 11 } // ring -2 phi = 31, inverted
769  };
770 
771  std::string rmspeciallet_code_loc[6][6] = { //there are 6 special cases, corresponding to 6 values of phi
772  { "X", "B", "C", "D", "E", "F" }, // ring +2 phi = 5, inverted
773  { "X", "P", "Q", "R", "S", "T" }, // ring +2 phi = 67, inverted
774  { "G", "H", "J", "K", "L", "M" }, // ring -1 phi = 57, inverted
775  { "A", "B", "C", "D", "E", "F" }, // ring -1 phi = 65, inverted
776  { "X", "B", "C", "D", "E", "F" }, // ring -2 phi = 16, inverted
777  { "X", "P", "Q", "R", "S", "T" } // ring -2 phi = 31, inverted
778  };
779 
780  std::string rmspecialdet_loc[6][6] = { //there are 6 special cases, corresponding to 6 values of phi
781  { "HOX", "HO", "HO", "HO", "HO", "HO" }, // ring +2 phi = 5, inverted
782  { "HOX", "HO", "HO", "HO", "HO", "HO" }, // ring +2 phi = 67, inverted
783  { "HO", "HO", "HO", "HO", "HO", "HO" }, // ring -1 phi = 57, inverted
784  { "HO", "HO", "HO", "HO", "HO", "HO" }, // ring -1 phi = 65, inverted
785  { "HOX", "HO", "HO", "HO", "HO", "HO" }, // ring -2 phi = 16, inverted
786  { "HOX", "HO", "HO", "HO", "HO", "HO" } // ring -2 phi = 31, inverted
787  };
788 
789  memcpy( rmspecialeta, rmspecialeta_loc, sizeof(int)*6*6 );
790  // switched HO RM's need revised letter codes
791 
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];}}
795 
796  for (int jj = 0; jj < 6; jj++) {
797  for (int kk = 0; kk < 6; kk++) {
798  rmspecialdet[jj][kk] = rmspecialdet_loc[jj][kk];}}
799  }
800 
801  else if (mapIOV_==2) {
802  int rmspecialeta_loc[6][6] = { //there are 6 special cases, corresponding to 6 values of phi
803  { 11, 12, 13, 14, 15, 15 }, // ring +2 phi = 5
804  { 11, 12, 13, 14, 15, 15 }, // ring +2 phi = 67
805  { 5, 6, 7, 8, 9, 10 }, // ring -1 phi = 57
806  { 5, 6, 7, 8, 9, 10 }, // ring -1 phi = 65
807  { 14, 15, 14, 13, 12, 11 }, // ring -2 phi = 16, still inverted
808  { 11, 12, 13, 14, 15, 15 } // ring -2 phi = 31
809  };
810 
811  std::string rmspeciallet_code_loc[6][6] = { //there are 6 special cases, corresponding to 6 values of phi
812  { "F", "E", "D", "C", "B", "X" }, // ring +2 phi = 5
813  { "T", "S", "R", "Q", "P", "X" }, // ring +2 phi = 67
814  { "M", "L", "K", "J", "H", "G" }, // ring -1 phi = 57
815  { "F", "E", "D", "C", "B", "A" }, // ring -1 phi = 65
816  { "X", "B", "C", "D", "E", "F" }, // ring -2 phi = 16,still inverted
817  { "T", "S", "R", "Q", "P", "X" } // ring -2 phi = 31
818  };
819 
820  std::string rmspecialdet_loc[6][6] = { //there are 6 special cases, corresponding to 6 values of phi
821  { "HO", "HO", "HO", "HO", "HO", "HOX" }, // ring +2 phi = 5
822  { "HO", "HO", "HO", "HO", "HO", "HOX" }, // ring +2 phi = 67
823  { "HO", "HO", "HO", "HO", "HO", "HO" }, // ring -1 phi = 57
824  { "HO", "HO", "HO", "HO", "HO", "HO" }, // ring -1 phi = 65
825  { "HOX", "HO", "HO", "HO", "HO", "HO" }, // ring -2 phi = 16, still inverted
826  { "HO", "HO", "HO", "HO", "HO", "HOX" } // ring -2 phi = 31
827  };
828 
829  memcpy( rmspecialeta, rmspecialeta_loc, sizeof(int)*6*6 );
830  // switched HO RM's need revised letter codes
831 
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];}}
835 
836  for (int jj = 0; jj < 6; jj++) {
837  for (int kk = 0; kk < 6; kk++) {
838  rmspecialdet[jj][kk] = rmspecialdet_loc[jj][kk];}}
839  }
840 
841  else {
842  int rmspecialeta_loc[6][6] = { //there are 6 special cases, corresponding to 6 values of phi
843  { 11, 12, 13, 14, 15, 15 }, // ring +2 phi = 5
844  { 11, 12, 13, 14, 15, 15 }, // ring +2 phi = 67
845  { 5, 6, 7, 8, 9, 10 }, // ring -1 phi = 57
846  { 5, 6, 7, 8, 9, 10 }, // ring -1 phi = 65
847  { 11, 12, 13, 14, 15, 15 }, // ring -2 phi = 16
848  { 11, 12, 13, 14, 15, 15 } // ring -2 phi = 31
849  };
850 
851  std::string rmspeciallet_code_loc[6][6] = { //there are 6 special cases, corresponding to 6 values of phi
852  { "F", "E", "D", "C", "B", "X" }, // ring +2 phi = 5
853  { "T", "S", "R", "Q", "P", "X" }, // ring +2 phi = 67
854  { "M", "L", "K", "J", "H", "G" }, // ring -1 phi = 57
855  { "F", "E", "D", "C", "B", "A" }, // ring -1 phi = 65
856  { "F", "E", "D", "C", "B", "X" }, // ring -2 phi = 16
857  { "T", "S", "R", "Q", "P", "X" } // ring -2 phi = 31
858  };
859 
860  std::string rmspecialdet_loc[6][6] = { //there are 6 special cases, corresponding to 6 values of phi
861  { "HO", "HO", "HO", "HO", "HO", "HOX" }, // ring +2 phi = 5
862  { "HO", "HO", "HO", "HO", "HO", "HOX" }, // ring +2 phi = 67
863  { "HO", "HO", "HO", "HO", "HO", "HO" }, // ring -1 phi = 57
864  { "HO", "HO", "HO", "HO", "HO", "HO" }, // ring -1 phi = 65
865  { "HO", "HO", "HO", "HO", "HO", "HOX" }, // ring -2 phi = 16
866  { "HO", "HO", "HO", "HO", "HO", "HOX" } // ring -2 phi = 31
867  };
868 
869  memcpy( rmspecialeta, rmspecialeta_loc, sizeof(int)*6*6 );
870  // switched HO RM's need revised letter codes
871 
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];}}
875 
876  for (int jj = 0; jj < 6; jj++) {
877  for (int kk = 0; kk < 6; kk++) {
878  rmspecialdet[jj][kk] = rmspecialdet_loc[jj][kk];}}
879  }
880 
881  /******************************/
882 
883  //Stream variable
884  stringstream mystream;
885 
886  //Radical change: HO iterates over eta and phi rather than crate, HTR, etc.
887  for(isid = -1; isid < 2; isid+=2){
888  for (iph = 0; iph < NHOPHI; iph++){
889  for (iet = 0; iet < NHOETA; iet++){
890 
891  iphi = iph + 1;
892  ieta = iet + 1;
893  iside = isid;
894 
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;
898  else ic = 3;
899 
900  icrate=hocrate[ic];
901  idepth=4;
902  det = "HO";
903 
904  //fpga = top/bottom for Ring 0 depends on a pattern that repeats every 30 degrees (6 phi)
905  //Hence, phmod6 (not phi mod 6 because I don't want to separate 71 and 72, etc.)
906 
907  phmod6 = iph % 6;
908  //Bools associated with phmod6 to be used with htr_fi and the patch panel
909  phmod6e450 = (phmod6 == 4 || phmod6 == 5 || phmod6 == 0);
910  phmod6e123 = (phmod6 == 1 || phmod6 == 2 || phmod6 == 3);
911 
912  //Ring 0 (HTR type 0) is special
913  if (ieta <= 3 && (iside < 0 || phmod6 >= 4)) fpga = "bot";
914  else if (ieta <= 3 && iside > 0 && phmod6 < 4) fpga = "top";
915  //new HX HTR
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";
918  //HTR types 0 and 1
919  else if (ieta >= 10 && iside > 0) fpga = "top";
920  else if (ieta < 10 && ieta >= 6 && iside > 0) fpga = "bot";
921  //HTR types 2 and 3
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;
926 
927  //dphi
928  if (ieta <= 20) idphi = 1;
929  else idphi = -1000;
930 
931  //create values usable in arrays from side and fpga
932  if (iside == 1) sidear = 1;
933  else sidear = 0;
934 
935  if (fpga == "bot") itb = 1;//convention different than for the
936  else itb = 0;//electronics id, modified in the
937  //MapEntry code
938 
939  phmod24 = iph % 24;
940 
941  //Again, x - 1 because the array starts at 0 while the variables start at 1
942  irm = HO_RM_table[phmod24][iet][sidear];
943 
944  //x - 5 for the eta array for the same reason
945  // the new stuff for HX
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];
950  else irm_fi = -1000;
951 
952  //Determine which of HTR in the set belongs here. It depends only on eta and side.
953  // the new stuff for HX
954  //if (ieta==16)
955  //
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;
959  else ih = 2;
960 
961  //Each value of "is" covers 30 degrees (that is, 6 values of phi). To calculate which ones,
962  //I use phi % 18. Crates start at phi = 71, 17, 35, 53
963 
964  if (iphi % 18 == 17 || iphi % 18 <= 4) is = 0;
965  else if (iphi % 18 >= 5 && iphi % 18 <= 10) is = 1;
966  else is = 2;
967 
968  if ( ieta == 16 && iside > 0 ) ihtr=21;
969  else ihtr=ihslotho[is][ih];
970 
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;
974  idcc=ihtr<9?1:2;
975  idcc_sl = idcc == 1 ?10:20;
976 
977  ifed=fedhonum[ic][idcc-1];
978 
979  //HTR fiber
980 
981  //
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;
987 
988  //Fiber Channel
989  //Eta >= 5 bools
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);
992 
993  //Ring 0 bools
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);
996  //v3: phi 5 to 15 odd; v4: phi 6 to 16 even
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);
999 
1000  if (ieta >= 5){
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;
1007  }
1008  else if (ieta == 4){
1009  if (iside == -1){
1010  if (phir0v1) ifi_ch = 0;
1011  else if (phir0v4) ifi_ch = 1;
1012  else if (iphi % 2 == 1) ifi_ch = 2;
1013  }
1014  else{
1015  if (phir0v3) ifi_ch = 0;
1016  else if (phir0v2) ifi_ch = 1;
1017  else if (iphi % 2 == 0) ifi_ch = 2;
1018  }
1019  }
1020  //eta = -3 and eta = +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;
1025  }
1026  //eta = -2 and eta = +3
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;
1031  }
1032  //ieta = 1
1033  else if (ieta == 1){
1034  if (phir0v1 || phir0v3) ifi_ch = 0;
1035  else if (phir0v2 || phir0v4) ifi_ch = 1;
1036  }
1037 
1038  //Intentional integer truncation; iqie and iadc are the same across all subdetectors
1039  //(Although irm_fi for HF starts at 1 and for HO it starts at 2, so one can't just copy and paste)
1040  iqie = (irm_fi - 2) / 2 + 1;
1041 
1042  if (irm_fi % 2 == 0) iadc = ifi_ch;
1043  else iadc = NFCH + (ifi_ch + 1) % 3;
1044 
1045  //Pixel and Letter Code (Ring 0 is separate)
1046  if (ieta <= 4){
1047  ipixel = ipixelHO[irm_fi - 2][ifi_ch][0];
1048  letter = letterHO[irm_fi - 2][ifi_ch][0];
1049  }
1050  else{
1051  ipixel = ipixelHO[irm_fi - 2][ifi_ch][1];
1052  letter = letterHO[irm_fi - 2][ifi_ch][1];
1053  }
1054 
1055  //RBX and sector
1056 
1057  if (iside == -1) sidesign = 'M';
1058  else sidesign = 'P';
1059 
1060  if (ieta <= 4) ring = 0;
1061  else if (ieta >= 5 && ieta <= 10) ring = 1;
1062  else ring = 2;
1063 
1064  //Sector ranges from 1 to 12 depending on phi. Sector 1 goes 71,72,1,2,3,4 so I start at -2
1065  sector = 0;
1066  for (i = -2; i < iphi; i+=6){
1067  sector++;
1068  }
1069  if (sector > 12) sector = 1; //It rolls over for phi = 71,72
1070 
1071  isector = sector;
1072 
1073  //For rings 1 and 2, we only want even sectors for the rbx
1074  if (ring != 0 && sector % 2 != 0) sector++;
1075 
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);
1078  mystream<<tempbuff;
1079  rbx = mystream.str();
1080  mystream.str("");
1081  if (ieta == 16) {
1082  det = "HOX";
1083  letter = "X";}
1084  else det = "HO";
1085 
1086  // the new htr_fi stuff for HX
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];
1089 
1090  if ((ieta > 15 && iside > 0) && (icrate == 3 || icrate == 7)) {
1091  icrate = 6;
1092  ifed = 729;
1093  }
1094  else if ((ieta > 15 && iside > 0) && (icrate == 6 || icrate == 13)) {
1095  icrate = 7;
1096  ifed = 727;
1097  }
1098 
1099  if ( ieta == 16 ) ieta = 15;
1100  // fixing the switched RM's
1101  if ( iside == 1 && ring == 2 ) {
1102  if ( iphi == 5 ) {
1103  ieta = rmspecialeta[0][iet - 10];
1104  letter = rmspeciallet_code[0][iet - 10];
1105  det = rmspecialdet[0][iet - 10];
1106  }
1107  else if ( iphi == 67 ) {
1108  ieta = rmspecialeta[1][iet - 10];
1109  letter = rmspeciallet_code[1][iet - 10];
1110  det = rmspecialdet[1][iet - 10];
1111  }
1112  }
1113  else if ( iside == -1) {
1114  if ( ring == 1 ) {
1115  if ( iphi == 57 ) {
1116  ieta = rmspecialeta[2][iet - 4];
1117  letter = rmspeciallet_code[2][iet - 4];
1118  det = rmspecialdet[2][iet - 4];
1119  }
1120  else if ( iphi == 65 ) {
1121  ieta = rmspecialeta[3][iet - 4];
1122  letter = rmspeciallet_code[3][iet - 4];
1123  det = rmspecialdet[3][iet - 4];
1124  }
1125  }
1126  else if ( ring == 2 ) {
1127  if ( iphi == 16 ) {
1128  ieta = rmspecialeta[4][iet - 10];
1129  letter = rmspeciallet_code[4][iet - 10];
1130  det = rmspecialdet[4][iet - 10];
1131  }
1132  else if ( iphi == 31 ) {
1133  ieta = rmspecialeta[5][iet - 10];
1134  letter = rmspeciallet_code[5][iet - 10];
1135  det = rmspecialdet[5][iet - 10];
1136  }
1137  }
1138  }
1139 
1140  HOHXLogicalMapEntry hoxlmapentry(
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,
1144  rbx, letter
1145  );
1146  HOHXEntries.push_back(hoxlmapentry);
1147  LinearIndex2Entry.at(hoxlmapentry.getLinearIndex())=HcalLogicalMap::makeEntryNumber(1,1,HOHXEntries.size()-1);
1148 
1149  const HcalGenericDetId hgdi(hoxlmapentry.getDetId());
1150  unsigned int denseId;
1151  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenOuter) {
1152  denseId=topo->detId2denseIdHO(hgdi);
1153  HoHash2Entry.at(denseId)=HOHXEntries.size();
1154  } else if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenCalibration) {
1155  denseId=topo->detId2denseIdCALIB(hgdi);
1156  HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1157  }
1158 
1159  if (ring==0){
1160  if (ipixel==1){
1161  ipixel = 2;
1162  iadc = 4;
1163  ifi_ch = 0;
1164  letter = "X";
1165  det = "HOX";
1166  HOHXLogicalMapEntry hoxlmapentry(
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,
1170  rbx, letter
1171  );
1172  HOHXEntries.push_back(hoxlmapentry);
1173  LinearIndex2Entry.at(hoxlmapentry.getLinearIndex())=HcalLogicalMap::makeEntryNumber(1,1,HOHXEntries.size()-1);
1174 
1175  const HcalGenericDetId hgdi(hoxlmapentry.getDetId());
1176  unsigned int denseId;
1177  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenOuter) {
1178  denseId=topo->detId2denseIdHO(hgdi);
1179  HoHash2Entry.at(denseId)=HOHXEntries.size();
1180  } else if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenCalibration) {
1181  denseId=topo->detId2denseIdCALIB(hgdi);
1182  HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1183  }
1184  }
1185  else if (ipixel==17){
1186  ipixel = 18;
1187  iadc = 1;
1188  ifi_ch = 1;
1189  letter = "X";
1190  det = "HOX";
1191  HOHXLogicalMapEntry hoxlmapentry(
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,
1195  rbx, letter
1196  );
1197  HOHXEntries.push_back(hoxlmapentry);
1198  LinearIndex2Entry.at(hoxlmapentry.getLinearIndex())=HcalLogicalMap::makeEntryNumber(1,1,HOHXEntries.size()-1);
1199 
1200  const HcalGenericDetId hgdi(hoxlmapentry.getDetId());
1201  unsigned int denseId;
1202  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenOuter) {
1203  denseId=topo->detId2denseIdHO(hgdi);
1204  HoHash2Entry.at(denseId)=HOHXEntries.size();
1205  } else if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenCalibration) {
1206  denseId=topo->detId2denseIdCALIB(hgdi);
1207  HxCalibHash2Entry.at(denseId)=HOHXEntries.size();
1208  }
1209  }
1210  }
1211  }
1212  }
1213  }
1214 }
1215 
1217  std::vector <CALIBLogicalMapEntry>& CALIBEntries,
1218  std::vector <uint32_t>& LinearIndex2Entry,
1219  std::vector <uint32_t>& HxCalibHash2Entry) {
1220 
1221  /******************************/
1222  /* CALIB crate numbering in order of FEDID*/
1223  int calibcrate_loc[NCALIBCR]={4,0,1,5,11,15,17,14,10,9,7,6,13};//HBHE,HF,HO
1224  memcpy( calibcrate, calibcrate_loc, sizeof(int)*NCALIBCR );
1225  /* CALIB FED numbering of DCCs */
1226  int fedcalibnum_loc[NCALIBCR][2]={{700,701},{702,703},{704,705},{706,707},{708,709},{710,711},{712,713},{714,715},{716,717},/*calib_hbhe 4,0,1,5,11,15,17,14,10*/
1227  {720,721},/*calib_hf 9*/
1228  {726,727},{728,729},{730,731}};//calib_ho 7,6,13
1229  memcpy( fedcalibnum, fedcalibnum_loc, sizeof(int)*NCALIBCR*2 );
1230  /* iphi (lower) starting index for each CALIB crate */
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 );
1233  /* icalibsector_min minimum sector on each crate {0,1,4,5,10,11,14,15,17,9,7,6,13}*/
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 );
1236  /* icalibsector_max maximum sector on each crate */
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 );
1239  //detectors represented on each crate (0 for top, 1 for bot)
1240  std::string detIDCALIB_loc[NCALIBCR][NTOPBOT] = {{"HB","HE"},/*crate 4*/
1241  {"HB","HE"},/*crate 0*/
1242  {"HB","HE"},/*crate 1*/
1243  {"HB","HE"},/*crate 5*/
1244  {"HB","HE"},/*crate 11*/
1245  {"HB","HE"},/*crate 15*/
1246  {"HB","HE"},/*crate 17*/
1247  {"HB","HE"},/*crate 14*/
1248  {"HB","HE"},/*crate 10*/
1249  {"HF","HF"},/*crate 9*/
1250  {"HO","HO"},/*crate 7*/
1251  {"HO","HO"},/*crate 6*/
1252  {"HO","HO"}};/*crate 13*/
1253  for (int jj = 0; jj < NCALIBCR; jj++) {
1254  for (int kk = 0; kk < NTOPBOT; kk++) {
1255  detIDCALIB[jj][kk] = detIDCALIB_loc[jj][kk];
1256  }
1257  }
1258 
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 );
1261  //HB only utilizes 4 htr_fibers HE all 8
1262  int calibHOinfo_loc[NHOCR][NTOPBOT][NFBR][2]={/*sector and ring of HO for the calib channel*/
1263  {{{4,0},{5,0},{6,0},{},{6,-2},{6,-1},{6,1},{6,2}},
1264  {{4,-2},{4,-1},{4,1},{4,2},{},{},{},{}}},/*crate 7*/
1265 
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}}},/*crate 6*/
1268 
1269  {{{10,0},{11,0},{12,0},{},{10,-2},{10,-1},{10,1},{10,2}},
1270  {{12,-2},{12,-1},{12,1},{12,2},{},{},{},{}}}/*crate 13*/
1271  };
1272  memcpy( calibHOinfo, calibHOinfo_loc, sizeof(int)*NHOCR*NTOPBOT*NFBR*2 );
1273 
1274  /*********************************/
1275 
1276  //Stream variable
1277 
1278  stringstream mystream;
1279 
1280  ihtr=8; //calibration units are housed on htr slot 8
1281  idcc=1;
1282  idcc_sl=10;
1283  irm_fi = 1;// everything other than HE is on A
1284  det = "";
1285 
1286  /*****************************************************/
1287  /*HBHE calibration channels*/
1288  for(ic=0; ic<NHBHECR; ic++){
1289  icrate=calibcrate[ic];
1290  ifed=fedcalibnum[ic][idcc-1];
1291  /* top and bottom */
1292  for(itb=0; itb<NTOPBOT; itb++){
1293  /* 4 or 8 fibers used per HTR FPGA */
1294  for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1295  det = detIDCALIB[ic][itb];
1296  ihtr_fi=ifb+1;
1297  irm_fi = 1;// everything other than he is on A
1298  idphi=4;
1299  if (itb==1) if(ihtr_fi%2==0) irm_fi = 2; //all of the even fibers in HE are on B rather than A
1300  if (det=="HE"){
1301  ispigot=13;
1302  fpga="bot";
1303  if (ihtr_fi==1||ihtr_fi==2||ihtr_fi==5||ihtr_fi==6) {
1304  iwedge = icalibsector_min[ic];
1305  }
1306  else if (ihtr_fi==3||ihtr_fi==4||ihtr_fi==7||ihtr_fi==8) {
1307  iwedge = icalibsector_max[ic];
1308  }
1309  if (ihtr_fi<5) {
1310  sidesign = 'M';
1311  S_side = '1';
1312  ieta = -1;
1313  iside=-1;
1314  }
1315  else {
1316  sidesign = 'P';
1317  S_side = '1';
1318  ieta = 1;
1319  iside=1;
1320  }
1321  }
1322  else if (det=="HB"){
1323  ispigot=12;
1324  fpga="top";
1325  (ihtr_fi%2==1) ? iwedge = icalibsector_min[ic] : iwedge = icalibsector_max[ic];
1326  if (ihtr_fi<3) {
1327  sidesign = 'M';
1328  S_side = '1';
1329  ieta = -1;
1330  iside=-1;
1331  }
1332  else {
1333  sidesign = 'P';
1334  S_side = '1';
1335  ieta = 1;
1336  iside=1;
1337  }
1338  }
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');
1342  mystream<<tempbuff;
1343  rbx = mystream.str();
1344  mystream.str("");
1345  /* three channels per fiber */
1346  for(ifc=0; ifc<NFCH; ifc++){
1347  ifi_ch=ifc;
1348  if (irm_fi==1){
1349  if (ifc==0) ich_type=0;
1350  else if (ifc==1) ich_type=1;
1351  else if (ifc==2) {
1352  if (det=="HB") ich_type=2;
1353  else if(det=="HE") ich_type=3;
1354  }
1355  }
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;
1360  }
1361  CALIBLogicalMapEntry caliblmapentry(
1362  ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1363  det, ieta, iphi, ich_type,
1364  iside, idphi, rbx, iwedge, irm_fi,
1365  subdet
1366  );
1367  CALIBEntries.push_back(caliblmapentry);
1368  LinearIndex2Entry.at(caliblmapentry.getLinearIndex())=HcalLogicalMap::makeEntryNumber(1,2,CALIBEntries.size()-1);
1369 
1370  const HcalGenericDetId hgdi(caliblmapentry.getDetId());
1371  const unsigned int hashedId=topo->detId2denseIdCALIB(hgdi);
1372  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenCalibration) HxCalibHash2Entry.at(hashedId)=CALIBEntries.size();
1373  }
1374  }
1375  }
1376  }
1377 
1378  /* only one CALIB HF crate */
1379  /* top and bottom */
1380  for(itb=0; itb<NTOPBOT; itb++){
1381  /* four CALIB HF fibers per HTR FPGA */
1382  for(ifb=0; ifb<4; ifb++){
1383  /* three channels per fiber */
1384  for(ifc=0; ifc<NFCH; ifc++){
1385  icrate=calibcrate[ic];
1386  det = "HF";
1387  ihtr_fi=ifb+1;
1388  ifi_ch=ifc;
1389  (ihtr_fi==1)?iphi=1:((ihtr_fi==2)?iphi=19:((ihtr_fi==3)?iphi=37:iphi=55));
1390  idphi=18;
1391  ifed=fedcalibnum[ic][idcc-1];
1392  (ifc==0)?ich_type=8:(ifc==1?ich_type=0:ich_type=1);
1393  //changed ch_type of fibre channel 0 from 2 to 8, as per HcalCalibDetId specification
1394  irm_fi = 1;
1395  //Wedge has steps of 3, HF(P/M)2,5,8,11
1396  //iwedge=ihtr_fi;
1397  iwedge=2+(ifb*3);
1398  if (itb==0){
1399  ispigot=12;
1400  fpga="top";
1401  sidesign='P';
1402  iside=1;
1403  ieta=1;
1404  }
1405  else {
1406  ispigot=13;
1407  fpga="bot";
1408  sidesign='M';
1409  iside=-1;
1410  ieta=-1;
1411  }
1412  subdet = "CALIB_"+det;
1413  sprintf (tempbuff, "%s%c%2.2i%c", det.c_str(), sidesign, iwedge,'\0');
1414  mystream<<tempbuff;
1415  rbx = mystream.str();
1416  mystream.str("");
1417  CALIBLogicalMapEntry caliblmapentry(
1418  ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1419  det, ieta, iphi, ich_type,
1420  iside, idphi, rbx, iwedge, irm_fi,
1421  subdet
1422  );
1423  CALIBEntries.push_back(caliblmapentry);
1424  LinearIndex2Entry.at(caliblmapentry.getLinearIndex())=HcalLogicalMap::makeEntryNumber(1,2,CALIBEntries.size()-1);
1425 
1426  const HcalGenericDetId hgdi(caliblmapentry.getDetId());
1427  const unsigned int hashedId=topo->detId2denseIdCALIB(hgdi);
1428  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenCalibration) HxCalibHash2Entry.at(hashedId)=CALIBEntries.size();
1429 
1430  }
1431  }
1432  }
1433  ic++;
1434 
1435  /*HO calibration channels*/
1436  for(ic=ic; ic<NCALIBCR; ic++){
1437  icrate=calibcrate[ic];
1438  irm_fi = 1;// everything other than he is on A
1439  ifed=fedcalibnum[ic][idcc-1];
1440  /* top and bottom */
1441  for(itb=0; itb<NTOPBOT; itb++){
1442  det=detIDCALIB[ic][itb];
1443  /* 4 or 8 fibers used per HTR FPGA */
1444  for(ifb=0; ifb<nfbr_max[ic][itb]; ifb++){
1445  if (itb==1) {
1446  ispigot = 13;
1447  fpga = "bot";
1448  }
1449  else{
1450  ispigot = 12;
1451  fpga = "top";
1452  }
1453  ihtr_fi=ifb+1;
1454  iwedge=calibHOinfo[ic-10][itb][ifb][0];
1455  ieta=calibHOinfo[ic-10][itb][ifb][1];
1456  if (ieta<0) {
1457  iside=-1;
1458  sidesign='M';
1459  }
1460  else if (ieta>0){
1461  iside=1;
1462  sidesign='P';
1463  }
1464  else {
1465  iside=0;
1466  sidesign='0';
1467  }
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';
1472 
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');
1476  mystream<<tempbuff;
1477  rbx = mystream.str();
1478  mystream.str("");
1479  /* only two channels used in HO per fiber */
1480  //now new information suggests that the third channel is used for x-talk
1481  //but only in some of the rm's, seems to be dependent on whether nfbr_max
1482  //sector 10 on YB+2,1,0,-1, sector 12 on YB-2
1483  int NFCH_HO;
1484  //( nfbr_max[ic][itb] == 4 ) ? NFCH_HO = 2 : NFCH_HO = 3;
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++){
1487  ifi_ch=ifc;
1488  (ifi_ch == 2) ? ich_type = 7 : ich_type = ifi_ch;
1489  (ieta==0) ? idphi = 6 : idphi = 12;
1490 
1491  (ieta==0) ? iphi=((iwedge*idphi)+71-idphi)%72 : iphi=(((iwedge/2)*idphi)+71-idphi)%72;
1492  //nothing on htr_fi=4 for the top
1493  do {
1494  if (iside==0&&ifb==3) break;
1495  CALIBLogicalMapEntry caliblmapentry(
1496  ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1497  det, ieta, iphi, ich_type,
1498  iside, idphi, rbx, iwedge, irm_fi,
1499  subdet
1500  );
1501  CALIBEntries.push_back(caliblmapentry);
1502  LinearIndex2Entry.at(caliblmapentry.getLinearIndex())=HcalLogicalMap::makeEntryNumber(1,2,CALIBEntries.size()-1);
1503 
1504  const HcalGenericDetId hgdi(caliblmapentry.getDetId());
1505  const unsigned int hashedId=topo->detId2denseIdCALIB(hgdi);
1506  if (hgdi.genericSubdet()==HcalGenericDetId::HcalGenCalibration) HxCalibHash2Entry.at(hashedId)=CALIBEntries.size();
1507  } while (ifb!=ifb);
1508  }
1509  }
1510  }
1511  }
1512 }
1513 
1514 void HcalLogicalMapGenerator::buildZDCMap(const HcalTopology* topo, std::vector <ZDCLogicalMapEntry>& ZDCEntries,
1515  std::vector <uint32_t>& LinearIndex2Entry,
1516  std::vector <uint32_t>& ZdcHash2Entry) {
1517  /******************************/
1518  /*ZDC channels*/
1519  //Stream variable
1520  stringstream mystream;
1521 
1522  ifed=722;
1523  iy=1;
1524  ihtr=8;
1525  icrate=12;
1526  idcc=1;
1527  idcc_sl=10;
1528  ispigot=12;
1529  /* side plus and minus */
1530  for(itb=0; itb<NTOPBOT; itb++){
1531  if (itb==0) {
1532  iside = 1;
1533  irm = 1;
1534  fpga = "top";
1535  }
1536  else {
1537  iside = -1;
1538  irm = 2;
1539  if (mapIOV_<4) {
1540  fpga = "top";
1541  ispigot = 12;}
1542  else {
1543  fpga = "bot";
1544  ispigot = 13;}
1545  }
1546  /*loop over ZDC cables*/
1547  for(icab=1; icab<NZDCCAB+1; icab++){
1548  if (icab < 4) {
1549  irm_fi = 1;
1550  iadc = icab - 1;
1551  ifi_ch = iadc;
1552  }
1553  else if (icab < 7) {
1554  irm_fi = 2;
1555  iadc = icab - 1;
1556  ifi_ch = iadc - 3;
1557  }
1558  else {
1559  irm_fi = 3;
1560  iadc = icab - 7;
1561  ifi_ch = iadc;
1562  }
1563  if (itb==0) {
1564  ihtr_fi = irm_fi;
1565  }
1566  else {
1567  if (mapIOV_<4) ihtr_fi = irm_fi + 3;
1568  else ihtr_fi = irm_fi;
1569  }
1570  if (icab < 6) {
1571  ix = icab;
1572  idepth = 1;
1573  idx = 1;
1574  det = "ZDC_EM";
1575  idet_ch = ix;
1576  iqie = 1;
1577  }
1578  else {
1579  ix = 1;
1580  idepth = icab - 4;
1581  idx = 5;
1582  det = "ZDC_HAD";
1583  idet_ch = icab - 5;
1584  if (icab==6) iqie = 1;
1585  else iqie = 2;
1586  }
1587  ZDCLogicalMapEntry zdclmapentry(
1588  ifi_ch, ihtr_fi, ispigot, ifed, icrate, ihtr, fpga,
1589  det, iside, idepth,
1590  ix, iy, idx, idet_ch, icab, irm, iqie,
1591  iadc, irm_fi
1592  );
1593  ZDCEntries.push_back(zdclmapentry);
1594  LinearIndex2Entry.at(zdclmapentry.getLinearIndex())=HcalLogicalMap::makeEntryNumber(1,3,ZDCEntries.size()-1);
1595  }
1596  }
1597 }
1598 
1599 
1600 /********************************************************/
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,
1605  int ihtr_fi, int ispigot, int islb, std::string slbin, std::string slbin2,
1606  std::string slnam, int irctcra, int irctcar, int irctcon, std::string rctnam, int ifed
1607  )
1608 {
1609 
1610  string t_chDet,t_fpga;
1611  string t_slnam,t_rctnam,t_slbin,t_slbin2;
1612 
1613  int t_nDat=-1;
1614  int t_side,t_iEta,t_iPhi,t_jPhi,t_iDep,t_topbot;
1615  int t_wedge,t_crate,t_htr;
1616  // int t_rm,t_pixel,t_qie,t_adc,t_rm_fi,t_fi_ch,t_htr_fi;
1617  int t_spigo,t_slb,t_rctcra,t_rctcar,t_rctcon,t_fedid;
1618 
1619  //making global variables local for modification
1620  (fpga=="bot") ? t_topbot = 1 : t_topbot = 0;
1621  t_side = iside;
1622  t_iEta = ieta;
1623  t_iPhi = iphi;
1624  t_jPhi = idphi;
1625  t_iDep = idepth;
1626  t_chDet = det;
1627  t_wedge = iwedge;
1628  // t_rm = irm;
1629  // t_pixel = ipixel;
1630  // t_qie = iqie;
1631  // t_adc = iadc;
1632  // t_rm_fi = irm_fi;
1633  // t_fi_ch = ifi_ch;
1634  t_crate = icrate;
1635  t_htr = ihtr;
1636  t_fpga = fpga;
1637  // t_htr_fi = ihtr_fi;
1638  t_spigo = ispigot;
1639  t_slb = islb;
1640  t_slbin = slbin;
1641  t_slbin2 = slbin2;
1642  t_slnam = slnam;
1643  t_rctcra = irctcra;
1644  t_rctcar = irctcar;
1645  t_rctcon = irctcon;
1646  t_rctnam = rctnam;
1647  t_fedid = ifed;
1648 
1649  do {
1650  if(t_iDep!=1) break;
1651  if(t_chDet=="HE"&&t_iEta==29) break;
1652 
1653  if(t_chDet=="HF") {
1654  t_jPhi=4;//20 degree slices in HF
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;
1658 
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;
1662 
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;
1667  }
1668 
1669  if(t_side<0) t_iEta=-t_iEta;
1670  t_chDet="HT";
1671 
1672  if(t_slbin!="NA") {
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;
1678 
1679  HTLogicalMapEntry htlmapentry(
1680  t_iEta, t_iPhi,
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
1684  );
1685  HTEntries.push_back(htlmapentry);
1686  }
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;
1692  t_jPhi=1;//after splitting up these towers, each half should have dphi of 1
1693  t_iPhi+=1;
1694 
1695  HTLogicalMapEntry htlmapentry(
1696  t_iEta, t_iPhi,//changed from t_iPhi + 1 here to the spot above
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
1700  );
1701  HTEntries.push_back(htlmapentry);
1702  }
1703  } while(1!=1);
1704 }
int i
Definition: DBlmapReader.cc:9
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
int j
Definition: DBlmapReader.cc:9
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,&quot;trackMonIterativeTracking2012&quot;): print &quot;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