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)
69 answer |= (vectorid & 0x3) << 1;
79 static FILE* CALIBmap;
85 stringstream mystream;
86 string HBEFmapstr, HOXmapstr, CALIBmapstr, ZDCmapstr, HTmapstr;
93 strftime(tempbuff, 128,
"%d.%b.%Y", localtime(&myTime));
95 date = mystream.str();
100 else if (mapIOV == 2)
102 else if (mapIOV == 3)
104 else if (mapIOV == 4)
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";
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");
129 fprintf(HBEFmap,
"## file created %s ##\n", date.c_str());
132 cout << HBEFmapstr <<
" not found!" << endl;
135 fprintf(HOXmap,
"## file created %s ##\n", date.c_str());
138 cout << HOXmapstr <<
" not found!" << endl;
141 fprintf(CALIBmap,
"## file created %s ##\n", date.c_str());
144 cout << CALIBmapstr <<
" not found!" << endl;
147 fprintf(ZDCmap,
"## file created %s ##\n", date.c_str());
150 cout << ZDCmapstr <<
" not found!" << endl;
153 fprintf(HTmap,
"## file created %s ##\n", date.c_str());
156 cout << HTmapstr <<
" not found!" << endl;
164 theemapHelper.
mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
167 theemapHelper.
mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
170 theemapHelper.
mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
173 theemapHelper.
mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
175 for (std::vector<HTLogicalMapEntry>::iterator it =
HTEntries_.begin(); it !=
HTEntries_.end(); ++it) {
176 theemapHelper.
mapEId2tId(it->getHcalTrigElectronicsId(), it->getDetId());
178 return std::make_unique<HcalElectronicsMap>(theemapHelper);
183 int titlecounter = 0;
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");
193 fprintf(hbefmapfile,
"%s", it->printLMapLine());
198 int titlecounter = 0;
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");
207 fprintf(hoxmapfile,
"%s", it->printLMapLine());
212 int titlecounter = 0;
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");
221 fprintf(calibmapfile,
"%s", it->printLMapLine());
226 int titlecounter = 0;
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");
235 fprintf(zdcmapfile,
"%s", it->printLMapLine());
240 int titlecounter = 0;
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");
250 fprintf(htmapfile,
"%s", it->printLMapLine());
258 if (((
entry >> 1) & 0x3) == 0)
260 if (((
entry >> 1) & 0x3) == 1)
262 if (((
entry >> 1) & 0x3) == 2)
264 if (((
entry >> 1) & 0x3) == 3)
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;
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;
321 cout <<
"\nRunning the id function checker..." << endl;
325 const DetId did0 = it->getDetId();
334 if (hfeid0 == hfeid1)
341 const DetId did0 = it->getDetId();
350 if (hfeid0 == hfeid1)
357 const DetId did0 = it->getDetId();
366 if (hfeid0 == hfeid1)
373 const DetId did0 = it->getDetId();
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;
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;
394 std::vector<int> HB_Hashes_;
395 std::vector<int> HE_Hashes_;
396 std::vector<int> HF_Hashes_;
397 std::vector<int> HO_Hashes_;
398 std::vector<int> CALIBHX_Hashes_;
399 std::vector<int> ZDC_Hashes_;
400 std::vector<int> HT_Hashes_;
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};
406 cout <<
"\nRunning the hash checker for detIds..." << endl;
408 if (it->getDetId().subdetId() ==
HcalBarrel) {
410 }
else if (it->getDetId().subdetId() ==
HcalEndcap) {
412 }
else if (it->getDetId().subdetId() ==
HcalForward) {
427 ZDC_Hashes_.push_back(
HcalZDCDetId(it->getDetId()).denseIndex());
429 for (std::vector<HTLogicalMapEntry>::iterator it =
HTEntries_.begin(); it !=
HTEntries_.end(); ++it) {
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());
441 for (
unsigned int i = 0;
i < HB_Hashes_.size() - 1;
i++) {
442 int diff = HB_Hashes_.at(
i + 1) - HB_Hashes_.at(
i);
450 for (
unsigned int i = 0;
i < HE_Hashes_.size() - 1;
i++) {
451 int diff = HE_Hashes_.at(
i + 1) - HE_Hashes_.at(
i);
459 for (
unsigned int i = 0;
i < HF_Hashes_.size() - 1;
i++) {
460 int diff = HF_Hashes_.at(
i + 1) - HF_Hashes_.at(
i);
468 for (
unsigned int i = 0;
i < HO_Hashes_.size() - 1;
i++) {
469 int diff = HO_Hashes_.at(
i + 1) - HO_Hashes_.at(
i);
477 for (
unsigned int i = 0;
i < CALIBHX_Hashes_.size() - 1;
i++) {
478 int diff = CALIBHX_Hashes_.at(
i + 1) - CALIBHX_Hashes_.at(
i);
486 for (
unsigned int i = 0;
i < ZDC_Hashes_.size() - 1;
i++) {
487 int diff = ZDC_Hashes_.at(
i + 1) - ZDC_Hashes_.at(
i);
495 for (
unsigned int i = 0;
i < HT_Hashes_.size() - 1;
i++) {
496 int diff = HT_Hashes_.at(
i + 1) - HT_Hashes_.at(
i);
504 cout <<
"HB HashIds (pass, collisions, non-dense) = (" << numpass[0] <<
"," << numfails[0] <<
"," << numnotdense[0]
506 cout <<
"HE HashIds (pass, collisions, non-dense) = (" << numpass[1] <<
"," << numfails[1] <<
"," << numnotdense[1]
508 cout <<
"HF HashIds (pass, collisions, non-dense) = (" << numpass[2] <<
"," << numfails[2] <<
"," << numnotdense[2]
510 cout <<
"HO HashIds (pass, collisions, non-dense) = (" << numpass[3] <<
"," << numfails[3] <<
"," << numnotdense[3]
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]
516 cout <<
"HT HashIds (pass, collisions, non-dense) = (" << numpass[6] <<
"," << numfails[6] <<
"," << numnotdense[6]
521 std::vector<int> Electronics_Hashes_;
527 cout <<
"\nRunning the hash checker for electronics Ids..." << endl;
529 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
532 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
535 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
538 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
540 for (std::vector<HTLogicalMapEntry>::iterator it =
HTEntries_.begin(); it !=
HTEntries_.end(); ++it) {
541 Electronics_Hashes_.push_back((it->getHcalTrigElectronicsId()).linearIndex());
544 sort(Electronics_Hashes_.begin(), Electronics_Hashes_.end());
546 for (
unsigned int i = 0;
i < Electronics_Hashes_.size() - 1;
i++) {
547 int diff = Electronics_Hashes_.at(
i + 1) - Electronics_Hashes_.at(
i);
555 cout <<
"Electronics Id linearIndex (pass, collisions, nondense) = (" << numpass <<
"," << numfails <<
"," 556 << numnotdense <<
")" << endl;
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
static uint32_t makeEntryNumber(bool, int, int)
void printCalibMap(FILE *calibmapfile)
std::vector< uint32_t > HeHash2Entry_
std::unique_ptr< HcalElectronicsMap > generateHcalElectronicsMap()
void printHTMap(FILE *htmapfile)
unsigned int detId2denseIdHF(const DetId &id) const
return a linear packed id from HF
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
unsigned int detId2denseIdHO(const DetId &id) const
return a linear packed id from HO
void printHOXMap(FILE *hoxmapfile)
void printZDCMap(FILE *zdcmapfile)
std::vector< uint32_t > HbHash2Entry_
std::vector< uint32_t > LinearIndex2Entry_
std::vector< uint32_t > HoHash2Entry_
std::vector< uint32_t > ZdcHash2Entry_
const HcalTopology * topo_
unsigned int detId2denseIdHE(const DetId &id) const
return a linear packed id from HE
unsigned int detId2denseIdCALIB(const DetId &id) const
return a linear packed id from CALIB
unsigned int detId2denseIdHB(const DetId &id) const
return a linear packed id from HB
void checkElectronicsHashIds()
std::vector< HTLogicalMapEntry > HTEntries_
void printMap(unsigned int mapIOV)
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
const HcalFrontEndId getHcalFrontEndId(const DetId &)
HcalGenericSubdetector genericSubdet() const
std::vector< HOHXLogicalMapEntry > HOHXEntries_
void printHBEFMap(FILE *hbefmapfile)
std::vector< uint32_t > HtHash2Entry_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
CalibDetType calibFlavor() const
get the flavor of this calibration detid
const DetId getDetId(const HcalElectronicsId &)
std::vector< ZDCLogicalMapEntry > ZDCEntries_
std::vector< uint32_t > HxCalibHash2Entry_
std::vector< uint32_t > HfHash2Entry_
Readout chain identification for Hcal.
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT
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 > &)