CMS 3D CMS Logo

HcalLogicalMap.cc
Go to the documentation of this file.
5 
6 #include <string>
7 #include <cstring>
8 #include <iostream>
9 #include <fstream>
10 #include <sstream>
11 #include <cstdio>
12 #include <ctime>
13 #include <memory>
14 
15 using namespace std;
16 
18  std::vector<HBHEHFLogicalMapEntry>& HBHEHFEntries,
19  std::vector<HOHXLogicalMapEntry>& HOHXEntries,
20  std::vector<CALIBLogicalMapEntry>& CALIBEntries,
21  std::vector<ZDCLogicalMapEntry>& ZDCEntries,
22  std::vector<HTLogicalMapEntry>& HTEntries,
23  std::vector<uint32_t>& LinearIndex2Entry,
24  std::vector<uint32_t>& HbHash2Entry,
25  std::vector<uint32_t>& HeHash2Entry,
26  std::vector<uint32_t>& HfHash2Entry,
27  std::vector<uint32_t>& HtHash2Entry,
28  std::vector<uint32_t>& HoHash2Entry,
29  std::vector<uint32_t>& HxCalibHash2Entry,
30  std::vector<uint32_t>& ZdcHash2Entry)
31  : topo_(topo)
32 
33 {
34  HBHEHFEntries_.resize(HBHEHFEntries.size());
35  HOHXEntries_.resize(HOHXEntries.size());
36  CALIBEntries_.resize(CALIBEntries.size());
37  ZDCEntries_.resize(ZDCEntries.size());
38  HTEntries_.resize(HTEntries.size());
39 
40  LinearIndex2Entry_.resize(LinearIndex2Entry.size());
41  HbHash2Entry_.resize(HbHash2Entry.size());
42  HeHash2Entry_.resize(HeHash2Entry.size());
43  HfHash2Entry_.resize(HfHash2Entry.size());
44  HtHash2Entry_.resize(HtHash2Entry.size());
45  HoHash2Entry_.resize(HoHash2Entry.size());
46  HxCalibHash2Entry_.resize(HxCalibHash2Entry.size());
47  ZdcHash2Entry_.resize(ZdcHash2Entry.size());
48 
49  copy(HBHEHFEntries.begin(), HBHEHFEntries.end(), HBHEHFEntries_.begin());
50  copy(HOHXEntries.begin(), HOHXEntries.end(), HOHXEntries_.begin());
51  copy(CALIBEntries.begin(), CALIBEntries.end(), CALIBEntries_.begin());
52  copy(ZDCEntries.begin(), ZDCEntries.end(), ZDCEntries_.begin());
53  copy(HTEntries.begin(), HTEntries.end(), HTEntries_.begin());
54  copy(LinearIndex2Entry.begin(), LinearIndex2Entry.end(), LinearIndex2Entry_.begin());
55  copy(HbHash2Entry.begin(), HbHash2Entry.end(), HbHash2Entry_.begin());
56  copy(HeHash2Entry.begin(), HeHash2Entry.end(), HeHash2Entry_.begin());
57  copy(HfHash2Entry.begin(), HfHash2Entry.end(), HfHash2Entry_.begin());
58  copy(HtHash2Entry.begin(), HtHash2Entry.end(), HtHash2Entry_.begin());
59  copy(HoHash2Entry.begin(), HoHash2Entry.end(), HoHash2Entry_.begin());
60  copy(HxCalibHash2Entry.begin(), HxCalibHash2Entry.end(), HxCalibHash2Entry_.begin());
61  copy(ZdcHash2Entry.begin(), ZdcHash2Entry.end(), ZdcHash2Entry_.begin());
62 }
63 
65 
66 uint32_t HcalLogicalMap::makeEntryNumber(bool isvalid, int vectorid, int entry) {
67  uint32_t answer = 0;
68  answer |= isvalid;
69  answer |= (vectorid & 0x3) << 1;
70  answer |= entry << 3;
71  return answer;
72 }
73 
74 void HcalLogicalMap::printMap(unsigned int mapIOV) {
75  using namespace std;
76 
77  static FILE* HBEFmap;
78  static FILE* HOXmap;
79  static FILE* CALIBmap;
80  static FILE* ZDCmap;
81  static FILE* HTmap;
82 
83  char tempbuff[30];
84 
85  stringstream mystream;
86  string HBEFmapstr, HOXmapstr, CALIBmapstr, ZDCmapstr, HTmapstr;
87  string date;
88  string IOVlabel;
89 
90  time_t myTime;
91  time(&myTime);
92 
93  strftime(tempbuff, 128, "%d.%b.%Y", localtime(&myTime));
94  mystream << tempbuff;
95  date = mystream.str();
96 
97  mystream.str("");
98  if (mapIOV == 1)
99  IOVlabel = "A";
100  else if (mapIOV == 2)
101  IOVlabel = "B";
102  else if (mapIOV == 3)
103  IOVlabel = "C";
104  else if (mapIOV == 4)
105  IOVlabel = "D";
106  else
107  IOVlabel = "E";
108 
109  HBEFmapstr = "./HCALmapHBEF_" + IOVlabel + ".txt";
110  HOXmapstr = "./HCALmapHO_" + IOVlabel + ".txt";
111  CALIBmapstr = "./HCALmapCALIB_" + IOVlabel + ".txt";
112  ZDCmapstr = "./ZDCmap_" + IOVlabel + ".txt";
113  HTmapstr = "./HCALmapHT_" + IOVlabel + ".txt";
114 
115  // HBEFmapstr = "./HCALmapHBEF_"+date+".txt";
116  // HOXmapstr = "./HCALmapHO_"+date+"_"+IOVlabel+".txt";
117  // CALIBmapstr = "./HCALmapCALIB_"+date+".txt";
118  // ZDCmapstr = "./ZDCmap_"+date+".txt";
119  // HTmapstr = "./HCALmapHT_"+date+".txt";
120 
121  HBEFmap = fopen(HBEFmapstr.c_str(), "w");
122  HOXmap = fopen(HOXmapstr.c_str(), "w");
123  CALIBmap = fopen(CALIBmapstr.c_str(), "w");
124  ZDCmap = fopen(ZDCmapstr.c_str(), "w");
125  HTmap = fopen(HTmapstr.c_str(), "w");
126  /**********************/
127 
128  if (HBEFmap) {
129  fprintf(HBEFmap, "## file created %s ##\n", date.c_str());
130  printHBEFMap(HBEFmap);
131  } else
132  cout << HBEFmapstr << " not found!" << endl;
133 
134  if (HOXmap) {
135  fprintf(HOXmap, "## file created %s ##\n", date.c_str());
136  printHOXMap(HOXmap);
137  } else
138  cout << HOXmapstr << " not found!" << endl;
139 
140  if (CALIBmap) {
141  fprintf(CALIBmap, "## file created %s ##\n", date.c_str());
142  printCalibMap(CALIBmap);
143  } else
144  cout << CALIBmapstr << " not found!" << endl;
145 
146  if (ZDCmap) {
147  fprintf(ZDCmap, "## file created %s ##\n", date.c_str());
148  printZDCMap(ZDCmap);
149  } else
150  cout << ZDCmapstr << " not found!" << endl;
151 
152  if (HTmap) {
153  fprintf(HTmap, "## file created %s ##\n", date.c_str());
154  printHTMap(HTmap);
155  } else
156  cout << HTmapstr << " not found!" << endl;
157 }
158 
159 /**************/
160 std::unique_ptr<HcalElectronicsMap> HcalLogicalMap::generateHcalElectronicsMap() {
161  HcalElectronicsMapAddons::Helper theemapHelper;
162 
163  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it != HBHEHFEntries_.end(); ++it) {
164  theemapHelper.mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
165  }
166  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
167  theemapHelper.mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
168  }
169  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
170  theemapHelper.mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
171  }
172  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
173  theemapHelper.mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
174  }
175  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it != HTEntries_.end(); ++it) {
176  theemapHelper.mapEId2tId(it->getHcalTrigElectronicsId(), it->getDetId());
177  }
178  return std::make_unique<HcalElectronicsMap>(theemapHelper);
179 }
180 /**************/
181 
182 void HcalLogicalMap::printHBEFMap(FILE* hbefmapfile) {
183  int titlecounter = 0;
184 
185  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it != HBHEHFEntries_.end(); ++it) {
186  titlecounter = titlecounter % 21;
187  if (titlecounter == 0) {
188  fprintf(hbefmapfile, "# side eta phi dphi depth det rbx wedge rm pixel qie adc");
189  fprintf(hbefmapfile, " rm_fi fi_ch crate htr fpga htr_fi dcc_sl spigo dcc slb slbin slbin2");
190  fprintf(hbefmapfile, " slnam rctcra rctcar rctcon rctnam fedid\n");
191  }
192  titlecounter++;
193  fprintf(hbefmapfile, "%s", it->printLMapLine());
194  }
195 }
196 
197 void HcalLogicalMap::printHOXMap(FILE* hoxmapfile) {
198  int titlecounter = 0;
199 
200  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
201  titlecounter = titlecounter % 21;
202  if (titlecounter == 0) {
203  fprintf(hoxmapfile, "# side eta phi dphi depth det rbx sector rm pixel qie adc");
204  fprintf(hoxmapfile, " rm_fi fi_ch let_code crate htr fpga htr_fi dcc_sl spigo dcc fedid\n");
205  }
206  titlecounter++;
207  fprintf(hoxmapfile, "%s", it->printLMapLine());
208  }
209 }
210 
211 void HcalLogicalMap::printCalibMap(FILE* calibmapfile) {
212  int titlecounter = 0;
213 
214  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
215  titlecounter = titlecounter % 21;
216  if (titlecounter == 0) {
217  fprintf(calibmapfile, "# side eta phi dphi det rbx sector rm rm_fi ");
218  fprintf(calibmapfile, " fi_ch crate htr fpga htr_fi dcc_sl spigo dcc fedid ch_type name\n");
219  }
220  titlecounter++;
221  fprintf(calibmapfile, "%s", it->printLMapLine());
222  }
223 }
224 
225 void HcalLogicalMap::printZDCMap(FILE* zdcmapfile) {
226  int titlecounter = 0;
227 
228  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
229  titlecounter = titlecounter % 21;
230  if (titlecounter == 0) {
231  fprintf(zdcmapfile, "# side x y dx depth det det_ch cable rm qie ");
232  fprintf(zdcmapfile, " adc rm_fi fi_ch crate htr fpga htr_fi dcc_sl spigo dcc fedid\n");
233  }
234  titlecounter++;
235  fprintf(zdcmapfile, "%s", it->printLMapLine());
236  }
237 }
238 
239 void HcalLogicalMap::printHTMap(FILE* htmapfile) {
240  int titlecounter = 0;
241 
242  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it != HTEntries_.end(); ++it) {
243  titlecounter = titlecounter % 21;
244  if (titlecounter == 0) {
245  fprintf(htmapfile, "# side eta phi dphi depth det wedge crate");
246  fprintf(htmapfile, " htr fpga dcc_sl spigo dcc slb slbin slbin2 nDat ");
247  fprintf(htmapfile, " slnam rctcra rctcar rctcon rctnam fedid\n");
248  }
249  titlecounter++;
250  fprintf(htmapfile, "%s", it->printLMapLine());
251  }
252 }
253 
255  const uint32_t entry = LinearIndex2Entry_.at(eid.linearIndex());
256  if (!(entry & 0x1))
257  return DetId(0);
258  if (((entry >> 1) & 0x3) == 0)
259  return HBHEHFEntries_.at(entry >> 3).getDetId();
260  if (((entry >> 1) & 0x3) == 1)
261  return HOHXEntries_.at(entry >> 3).getDetId();
262  if (((entry >> 1) & 0x3) == 2)
263  return CALIBEntries_.at(entry >> 3).getDetId();
264  if (((entry >> 1) & 0x3) == 3)
265  return ZDCEntries_.at(entry >> 3).getDetId();
266  return DetId(0);
267 }
268 
270  const HcalGenericDetId hgdi(did);
271 
273  if (hgsd == HcalGenericDetId::HcalGenBarrel) {
274  const int hashedId = topo_->detId2denseIdHB(did);
275  const uint32_t entry = HbHash2Entry_.at(hashedId) - 1;
276  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
277  } else if (hgsd == HcalGenericDetId::HcalGenEndcap) {
278  const int hashedId = topo_->detId2denseIdHE(did);
279  const uint32_t entry = HeHash2Entry_.at(hashedId) - 1;
280  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
281  } else if (hgsd == HcalGenericDetId::HcalGenForward) {
282  const int hashedId = topo_->detId2denseIdHF(did);
283  const uint32_t entry = HfHash2Entry_.at(hashedId) - 1;
284  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
285  } else if (hgsd == HcalGenericDetId::HcalGenOuter) {
286  const int hashedId = topo_->detId2denseIdHO(did);
287  const uint32_t entry = HoHash2Entry_.at(hashedId) - 1;
288  return HOHXEntries_.at(entry).getHcalFrontEndId();
289  } else if (hgsd == HcalGenericDetId::HcalGenCalibration) {
290  HcalCalibDetId hcid(did);
292  const int hashedId = topo_->detId2denseIdCALIB(did);
293  const uint32_t entry = HxCalibHash2Entry_.at(hashedId) - 1;
294  return HOHXEntries_.at(entry).getHcalFrontEndId();
295  } else if (hcid.calibFlavor() == HcalCalibDetId::CalibrationBox) {
296  const int hashedId = topo_->detId2denseIdCALIB(did);
297  const uint32_t entry = HxCalibHash2Entry_.at(hashedId) - 1;
298  return CALIBEntries_.at(entry).getHcalFrontEndId();
299  }
300  }
301  return HcalFrontEndId(0);
302 }
303 
305  int HBHEHF_EID_pass = 0;
306  int HBHEHF_EID_fail = 0;
307  int HOHX_EID_pass = 0;
308  int HOHX_EID_fail = 0;
309  int CALIB_EID_pass = 0;
310  int CALIB_EID_fail = 0;
311  int ZDC_EID_pass = 0;
312  int ZDC_EID_fail = 0;
313 
314  int HBHEHF_FEID_pass = 0;
315  int HBHEHF_FEID_fail = 0;
316  int HOHX_FEID_pass = 0;
317  int HOHX_FEID_fail = 0;
318  int CALIB_FEID_pass = 0;
319  int CALIB_FEID_fail = 0;
320 
321  cout << "\nRunning the id function checker..." << endl;
322 
323  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it != HBHEHFEntries_.end(); ++it) {
324  const HcalElectronicsId heid = it->getHcalElectronicsId();
325  const DetId did0 = it->getDetId();
326  const DetId did1 = getDetId(heid);
327  if (did0 == did1)
328  HBHEHF_EID_pass++;
329  else
330  HBHEHF_EID_fail++;
331 
332  const HcalFrontEndId hfeid0 = it->getHcalFrontEndId();
333  const HcalFrontEndId hfeid1 = getHcalFrontEndId(did0);
334  if (hfeid0 == hfeid1)
335  HBHEHF_FEID_pass++;
336  else
337  HBHEHF_FEID_fail++;
338  }
339  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
340  const HcalElectronicsId heid = it->getHcalElectronicsId();
341  const DetId did0 = it->getDetId();
342  const DetId did1 = getDetId(heid);
343  if (did0 == did1)
344  HOHX_EID_pass++;
345  else
346  HOHX_EID_fail++;
347 
348  const HcalFrontEndId hfeid0 = it->getHcalFrontEndId();
349  const HcalFrontEndId hfeid1 = getHcalFrontEndId(did0);
350  if (hfeid0 == hfeid1)
351  HOHX_FEID_pass++;
352  else
353  HOHX_FEID_fail++;
354  }
355  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
356  const HcalElectronicsId heid = it->getHcalElectronicsId();
357  const DetId did0 = it->getDetId();
358  const DetId did1 = getDetId(heid);
359  if (did0 == did1)
360  CALIB_EID_pass++;
361  else
362  CALIB_EID_fail++;
363 
364  const HcalFrontEndId hfeid0 = it->getHcalFrontEndId();
365  const HcalFrontEndId hfeid1 = getHcalFrontEndId(did0);
366  if (hfeid0 == hfeid1)
367  CALIB_FEID_pass++;
368  else
369  CALIB_FEID_fail++;
370  }
371  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
372  const HcalElectronicsId heid = it->getHcalElectronicsId();
373  const DetId did0 = it->getDetId();
374  const DetId did1 = getDetId(heid);
375  if (did0 == did1)
376  ZDC_EID_pass++;
377  else
378  ZDC_EID_fail++;
379  }
380 
381  cout << "Checking detIds from electronics ids..." << endl;
382  cout << "HBHEHF EID (pass,fail) = (" << HBHEHF_EID_pass << "," << HBHEHF_EID_fail << ")" << endl;
383  cout << "HOHX EID (pass,fail) = (" << HOHX_EID_pass << "," << HOHX_EID_fail << ")" << endl;
384  cout << "CALIB EID (pass,fail) = (" << CALIB_EID_pass << "," << CALIB_EID_fail << ")" << endl;
385  cout << "ZDC EID (pass,fail) = (" << ZDC_EID_pass << "," << ZDC_EID_fail << ")" << endl;
386  cout << endl;
387  cout << "Checking frontEndIds from electronics ids..." << endl;
388  cout << "HBHEHF FEID (pass,fail) = (" << HBHEHF_FEID_pass << "," << HBHEHF_FEID_fail << ")" << endl;
389  cout << "HOHX FEID (pass,fail) = (" << HOHX_FEID_pass << "," << HOHX_FEID_fail << ")" << endl;
390  cout << "CALIB FEID (pass,fail) = (" << CALIB_FEID_pass << "," << CALIB_FEID_fail << ")" << endl;
391 }
392 
394  std::vector<int> HB_Hashes_; // index 0
395  std::vector<int> HE_Hashes_; // index 1
396  std::vector<int> HF_Hashes_; // index 2
397  std::vector<int> HO_Hashes_; // index 3
398  std::vector<int> CALIBHX_Hashes_; // index 4
399  std::vector<int> ZDC_Hashes_; // index 5
400  std::vector<int> HT_Hashes_; // index 6
401 
402  int numfails[7] = {0, 0, 0, 0, 0, 0, 0};
403  int numpass[7] = {0, 0, 0, 0, 0, 0, 0};
404  int numnotdense[7] = {0, 0, 0, 0, 0, 0, 0};
405 
406  cout << "\nRunning the hash checker for detIds..." << endl;
407  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it != HBHEHFEntries_.end(); ++it) {
408  if (it->getDetId().subdetId() == HcalBarrel) {
409  HB_Hashes_.push_back(topo_->detId2denseIdHB(it->getDetId()));
410  } else if (it->getDetId().subdetId() == HcalEndcap) {
411  HE_Hashes_.push_back(topo_->detId2denseIdHE(it->getDetId()));
412  } else if (it->getDetId().subdetId() == HcalForward) {
413  HF_Hashes_.push_back(topo_->detId2denseIdHF(it->getDetId()));
414  }
415  }
416  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
417  if (HcalGenericDetId(it->getDetId().rawId()).isHcalCalibDetId()) {
418  CALIBHX_Hashes_.push_back(topo_->detId2denseIdCALIB(it->getDetId()));
419  } else {
420  HO_Hashes_.push_back(topo_->detId2denseIdHO(it->getDetId()));
421  }
422  }
423  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
424  CALIBHX_Hashes_.push_back(topo_->detId2denseIdCALIB(it->getDetId()));
425  }
426  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
427  ZDC_Hashes_.push_back(HcalZDCDetId(it->getDetId()).denseIndex());
428  }
429  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it != HTEntries_.end(); ++it) {
430  HT_Hashes_.push_back(topo_->detId2denseIdHT(it->getDetId()));
431  }
432 
433  sort(HB_Hashes_.begin(), HB_Hashes_.end());
434  sort(HE_Hashes_.begin(), HE_Hashes_.end());
435  sort(HF_Hashes_.begin(), HF_Hashes_.end());
436  sort(HO_Hashes_.begin(), HO_Hashes_.end());
437  sort(CALIBHX_Hashes_.begin(), CALIBHX_Hashes_.end());
438  sort(ZDC_Hashes_.begin(), ZDC_Hashes_.end());
439  sort(HT_Hashes_.begin(), HT_Hashes_.end());
440 
441  for (unsigned int i = 0; i < HB_Hashes_.size() - 1; i++) {
442  int diff = HB_Hashes_.at(i + 1) - HB_Hashes_.at(i);
443  if (diff == 0)
444  numfails[0]++;
445  else if (diff > 1)
446  numnotdense[0]++;
447  else
448  numpass[0]++;
449  }
450  for (unsigned int i = 0; i < HE_Hashes_.size() - 1; i++) {
451  int diff = HE_Hashes_.at(i + 1) - HE_Hashes_.at(i);
452  if (diff == 0)
453  numfails[1]++;
454  else if (diff > 1)
455  numnotdense[1]++;
456  else
457  numpass[1]++;
458  }
459  for (unsigned int i = 0; i < HF_Hashes_.size() - 1; i++) {
460  int diff = HF_Hashes_.at(i + 1) - HF_Hashes_.at(i);
461  if (diff == 0)
462  numfails[2]++;
463  else if (diff > 1)
464  numnotdense[2]++;
465  else
466  numpass[2]++;
467  }
468  for (unsigned int i = 0; i < HO_Hashes_.size() - 1; i++) {
469  int diff = HO_Hashes_.at(i + 1) - HO_Hashes_.at(i);
470  if (diff == 0)
471  numfails[3]++;
472  else if (diff > 1)
473  numnotdense[3]++;
474  else
475  numpass[3]++;
476  }
477  for (unsigned int i = 0; i < CALIBHX_Hashes_.size() - 1; i++) {
478  int diff = CALIBHX_Hashes_.at(i + 1) - CALIBHX_Hashes_.at(i);
479  if (diff == 0)
480  numfails[4]++;
481  else if (diff > 1)
482  numnotdense[4]++;
483  else
484  numpass[4]++;
485  }
486  for (unsigned int i = 0; i < ZDC_Hashes_.size() - 1; i++) {
487  int diff = ZDC_Hashes_.at(i + 1) - ZDC_Hashes_.at(i);
488  if (diff == 0)
489  numfails[5]++;
490  else if (diff > 1)
491  numnotdense[5]++;
492  else
493  numpass[5]++;
494  }
495  for (unsigned int i = 0; i < HT_Hashes_.size() - 1; i++) {
496  int diff = HT_Hashes_.at(i + 1) - HT_Hashes_.at(i);
497  if (diff == 0)
498  numfails[6]++;
499  else if (diff > 1)
500  numnotdense[6]++;
501  else
502  numpass[6]++;
503  }
504  cout << "HB HashIds (pass, collisions, non-dense) = (" << numpass[0] << "," << numfails[0] << "," << numnotdense[0]
505  << ")" << endl;
506  cout << "HE HashIds (pass, collisions, non-dense) = (" << numpass[1] << "," << numfails[1] << "," << numnotdense[1]
507  << ")" << endl;
508  cout << "HF HashIds (pass, collisions, non-dense) = (" << numpass[2] << "," << numfails[2] << "," << numnotdense[2]
509  << ")" << endl;
510  cout << "HO HashIds (pass, collisions, non-dense) = (" << numpass[3] << "," << numfails[3] << "," << numnotdense[3]
511  << ")" << endl;
512  cout << "CALIB/HX HashIds (pass, collisions, non-dense) = (" << numpass[4] << "," << numfails[4] << ","
513  << numnotdense[4] << ")" << endl;
514  cout << "ZDC HashIds (pass, collisions, non-dense) = (" << numpass[5] << "," << numfails[5] << "," << numnotdense[5]
515  << ")" << endl;
516  cout << "HT HashIds (pass, collisions, non-dense) = (" << numpass[6] << "," << numfails[6] << "," << numnotdense[6]
517  << ")" << endl;
518 }
519 
521  std::vector<int> Electronics_Hashes_;
522 
523  int numfails = 0;
524  int numpass = 0;
525  int numnotdense = 0;
526 
527  cout << "\nRunning the hash checker for electronics Ids..." << endl;
528  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it != HBHEHFEntries_.end(); ++it) {
529  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
530  }
531  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
532  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
533  }
534  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
535  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
536  }
537  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
538  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
539  }
540  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it != HTEntries_.end(); ++it) {
541  Electronics_Hashes_.push_back((it->getHcalTrigElectronicsId()).linearIndex());
542  }
543 
544  sort(Electronics_Hashes_.begin(), Electronics_Hashes_.end());
545 
546  for (unsigned int i = 0; i < Electronics_Hashes_.size() - 1; i++) {
547  int diff = Electronics_Hashes_.at(i + 1) - Electronics_Hashes_.at(i);
548  if (diff == 0)
549  numfails++;
550  else if (diff > 1)
551  numnotdense++;
552  else
553  numpass++;
554  }
555  cout << "Electronics Id linearIndex (pass, collisions, nondense) = (" << numpass << "," << numfails << ","
556  << numnotdense << ")" << endl;
557 }
HcalLogicalMap::printHOXMap
void printHOXMap(FILE *hoxmapfile)
Definition: HcalLogicalMap.cc:197
change_name.diff
diff
Definition: change_name.py:13
mps_fire.i
i
Definition: mps_fire.py:428
HcalLogicalMap::HBHEHFEntries_
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
Definition: HcalLogicalMap.h:49
HcalLogicalMap::HcalLogicalMap
HcalLogicalMap(const HcalTopology *, std::vector< HBHEHFLogicalMapEntry > &, std::vector< HOHXLogicalMapEntry > &, std::vector< CALIBLogicalMapEntry > &, std::vector< ZDCLogicalMapEntry > &, std::vector< HTLogicalMapEntry > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &, std::vector< uint32_t > &)
Definition: HcalLogicalMap.cc:17
HcalLogicalMap::CALIBEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
Definition: HcalLogicalMap.h:51
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
HcalGenericDetId
Definition: HcalGenericDetId.h:15
HcalLogicalMap::checkIdFunctions
void checkIdFunctions()
Definition: HcalLogicalMap.cc:304
HcalCalibDetId
Definition: HcalCalibDetId.h:45
mps_splice.entry
entry
Definition: mps_splice.py:68
HcalLogicalMap::HbHash2Entry_
std::vector< uint32_t > HbHash2Entry_
Definition: HcalLogicalMap.h:55
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HcalTopology
Definition: HcalTopology.h:26
HcalLogicalMap::makeEntryNumber
static uint32_t makeEntryNumber(bool, int, int)
Definition: HcalLogicalMap.cc:66
HcalLogicalMap::HTEntries_
std::vector< HTLogicalMapEntry > HTEntries_
Definition: HcalLogicalMap.h:53
protons_cff.time
time
Definition: protons_cff.py:39
HcalGenericDetId::HcalGenEndcap
Definition: HcalGenericDetId.h:20
HcalTopology::detId2denseIdHB
unsigned int detId2denseIdHB(const DetId &id) const
return a linear packed id from HB
Definition: HcalTopology.cc:1170
HcalGenericDetId.h
HcalElectronicsMapAddons::Helper::mapEId2tId
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
Definition: HcalElectronicsMap.cc:166
HcalLogicalMap::generateHcalElectronicsMap
std::unique_ptr< HcalElectronicsMap > generateHcalElectronicsMap()
Definition: HcalLogicalMap.cc:160
HcalLogicalMap::HfHash2Entry_
std::vector< uint32_t > HfHash2Entry_
Definition: HcalLogicalMap.h:57
HcalBarrel
Definition: HcalAssistant.h:33
HcalLogicalMap::LinearIndex2Entry_
std::vector< uint32_t > LinearIndex2Entry_
Definition: HcalLogicalMap.h:54
HcalLogicalMap::printZDCMap
void printZDCMap(FILE *zdcmapfile)
Definition: HcalLogicalMap.cc:225
HcalLogicalMap::printHTMap
void printHTMap(FILE *htmapfile)
Definition: HcalLogicalMap.cc:239
DetId
Definition: DetId.h:17
HcalZDCDetId
Definition: HcalZDCDetId.h:16
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
HcalLogicalMap::ZdcHash2Entry_
std::vector< uint32_t > ZdcHash2Entry_
Definition: HcalLogicalMap.h:61
HcalTopology::detId2denseIdHT
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT
Definition: HcalTopology.cc:1254
HcalLogicalMap::~HcalLogicalMap
~HcalLogicalMap()
Definition: HcalLogicalMap.cc:64
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
HcalFrontEndId
Definition: HcalFrontEndId.h:8
HcalLogicalMap::printMap
void printMap(unsigned int mapIOV)
Definition: HcalLogicalMap.cc:74
HcalLogicalMap::checkHashIds
void checkHashIds()
Definition: HcalLogicalMap.cc:393
HcalTopology::detId2denseIdHF
unsigned int detId2denseIdHF(const DetId &id) const
return a linear packed id from HF
Definition: HcalTopology.cc:1234
submit.answer
answer
Definition: submit.py:45
HcalLogicalMap::checkElectronicsHashIds
void checkElectronicsHashIds()
Definition: HcalLogicalMap.cc:520
HcalTopology::detId2denseIdHE
unsigned int detId2denseIdHE(const DetId &id) const
return a linear packed id from HE
Definition: HcalTopology.cc:1189
HcalLogicalMap::HOHXEntries_
std::vector< HOHXLogicalMapEntry > HOHXEntries_
Definition: HcalLogicalMap.h:50
HcalGenericDetId::HcalGenericSubdetector
HcalGenericSubdetector
Definition: HcalGenericDetId.h:17
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
HcalLogicalMap::topo_
const HcalTopology * topo_
Definition: HcalLogicalMap.h:63
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
HcalOtherDetId.h
HcalGenericDetId::HcalGenBarrel
Definition: HcalGenericDetId.h:19
HcalLogicalMap.h
HcalLogicalMap::HoHash2Entry_
std::vector< uint32_t > HoHash2Entry_
Definition: HcalLogicalMap.h:59
HcalCalibDetId::calibFlavor
CalibDetType calibFlavor() const
get the flavor of this calibration detid
Definition: HcalCalibDetId.h:77
HcalLogicalMap::ZDCEntries_
std::vector< ZDCLogicalMapEntry > ZDCEntries_
Definition: HcalLogicalMap.h:52
HcalLogicalMap::getHcalFrontEndId
const HcalFrontEndId getHcalFrontEndId(const DetId &)
Definition: HcalLogicalMap.cc:269
HcalForward
Definition: HcalAssistant.h:36
HcalLogicalMap::HtHash2Entry_
std::vector< uint32_t > HtHash2Entry_
Definition: HcalLogicalMap.h:58
HcalTopology.h
HcalCalibDetId::HOCrosstalk
Definition: HcalCalibDetId.h:50
std
Definition: JetResolutionObject.h:76
indexGen.date
date
Definition: indexGen.py:99
HcalEndcap
Definition: HcalAssistant.h:34
HcalLogicalMap::printCalibMap
void printCalibMap(FILE *calibmapfile)
Definition: HcalLogicalMap.cc:211
HcalLogicalMap::HxCalibHash2Entry_
std::vector< uint32_t > HxCalibHash2Entry_
Definition: HcalLogicalMap.h:60
HcalGenericDetId::genericSubdet
HcalGenericSubdetector genericSubdet() const
Definition: HcalGenericDetId.cc:21
HcalElectronicsMapAddons::Helper
Definition: HcalElectronicsMap.h:137
HcalElectronicsMapAddons::Helper::mapEId2chId
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
Definition: HcalElectronicsMap.cc:182
HcalTopology::detId2denseIdHO
unsigned int detId2denseIdHO(const DetId &id) const
return a linear packed id from HO
Definition: HcalTopology.cc:1216
HcalTopology::detId2denseIdCALIB
unsigned int detId2denseIdCALIB(const DetId &id) const
return a linear packed id from CALIB
Definition: HcalTopology.cc:1279
HcalLogicalMap::printHBEFMap
void printHBEFMap(FILE *hbefmapfile)
Definition: HcalLogicalMap.cc:182
HcalLogicalMap::getDetId
const DetId getDetId(const HcalElectronicsId &)
Definition: HcalLogicalMap.cc:254
HcalGenericDetId::HcalGenOuter
Definition: HcalGenericDetId.h:21
HcalCalibDetId::CalibrationBox
Definition: HcalCalibDetId.h:49
HcalLogicalMap::HeHash2Entry_
std::vector< uint32_t > HeHash2Entry_
Definition: HcalLogicalMap.h:56
HcalGenericDetId::HcalGenForward
Definition: HcalGenericDetId.h:22
HcalGenericDetId::HcalGenCalibration
Definition: HcalGenericDetId.h:25