17 std::vector<HOHXLogicalMapEntry>& HOHXEntries,
18 std::vector<CALIBLogicalMapEntry>& CALIBEntries,
19 std::vector<ZDCLogicalMapEntry>& ZDCEntries,
20 std::vector<HTLogicalMapEntry>& HTEntries,
21 std::vector<uint32_t>& LinearIndex2Entry,
22 std::vector<uint32_t>& HbHash2Entry,
23 std::vector<uint32_t>& HeHash2Entry,
24 std::vector<uint32_t>& HfHash2Entry,
25 std::vector<uint32_t>& HtHash2Entry,
26 std::vector<uint32_t>& HoHash2Entry,
27 std::vector<uint32_t>& HxCalibHash2Entry,
28 std::vector<uint32_t>& ZdcHash2Entry) : topo_(topo)
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) );
98 if (mapIOV==1) IOVlabel =
"A";
99 else if (mapIOV==2) IOVlabel =
"B";
100 else if (mapIOV==3) IOVlabel =
"C";
103 HBEFmapstr =
"./HCALmapHBEF_"+IOVlabel+
".txt";
104 HOXmapstr =
"./HCALmapHO_"+IOVlabel+
".txt";
105 CALIBmapstr =
"./HCALmapCALIB_"+IOVlabel+
".txt";
106 ZDCmapstr =
"./ZDCmap_"+IOVlabel+
".txt";
107 HTmapstr =
"./HCALmapHT_"+IOVlabel+
".txt";
115 HBEFmap = fopen(HBEFmapstr.c_str(),
"w");
116 HOXmap = fopen(HOXmapstr.c_str(),
"w");
117 CALIBmap = fopen(CALIBmapstr.c_str(),
"w");
118 ZDCmap = fopen(ZDCmapstr.c_str(),
"w");
119 HTmap = fopen(HTmapstr.c_str(),
"w");
123 fprintf(HBEFmap,
"## file created %s ##\n",date.c_str());
126 else cout <<HBEFmapstr<<
" not found!"<<endl;
129 fprintf(HOXmap,
"## file created %s ##\n",date.c_str());
132 else cout <<HOXmapstr<<
" not found!"<<endl;
135 fprintf(CALIBmap,
"## file created %s ##\n",date.c_str());
138 else cout <<CALIBmapstr<<
" not found!"<<endl;
141 fprintf(ZDCmap,
"## file created %s ##\n",date.c_str());
144 else cout <<ZDCmapstr<<
" not found!"<<endl;
147 fprintf(HTmap,
"## file created %s ##\n",date.c_str());
150 else cout <<HTmapstr<<
" not found!"<<endl;
160 theemap->
mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
162 theemap->
mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
164 theemap->
mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
166 theemap->
mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
167 for (std::vector<HTLogicalMapEntry>::iterator it =
HTEntries_.begin(); it!=
HTEntries_.end(); ++it) {
168 theemap->
mapEId2tId( it->getHcalTrigElectronicsId(), it->getDetId() );}
175 int titlecounter = 0;
178 titlecounter = titlecounter % 21;
179 if (titlecounter == 0){
180 fprintf(hbefmapfile,
"# side eta phi dphi depth det rbx wedge rm pixel qie adc");
181 fprintf(hbefmapfile,
" rm_fi fi_ch crate htr fpga htr_fi dcc_sl spigo dcc slb slbin slbin2");
182 fprintf(hbefmapfile,
" slnam rctcra rctcar rctcon rctnam fedid\n");
185 fprintf(hbefmapfile,
"%s",it->printLMapLine());
191 int titlecounter = 0;
194 titlecounter = titlecounter % 21;
195 if (titlecounter == 0){
196 fprintf(hoxmapfile,
"# side eta phi dphi depth det rbx sector rm pixel qie adc");
197 fprintf(hoxmapfile,
" rm_fi fi_ch let_code crate htr fpga htr_fi dcc_sl spigo dcc fedid\n");
200 fprintf(hoxmapfile,
"%s",it->printLMapLine());
206 int titlecounter = 0;
209 titlecounter = titlecounter % 21;
210 if (titlecounter == 0){
211 fprintf(calibmapfile,
"# side eta phi dphi det rbx sector rm rm_fi ");
212 fprintf(calibmapfile,
" fi_ch crate htr fpga htr_fi dcc_sl spigo dcc fedid ch_type name\n");
215 fprintf(calibmapfile,
"%s",it->printLMapLine());
221 int titlecounter = 0;
224 titlecounter = titlecounter % 21;
225 if (titlecounter == 0){
226 fprintf(zdcmapfile,
"# side x y dx depth det det_ch cable rm qie ");
227 fprintf(zdcmapfile,
" adc rm_fi fi_ch crate htr fpga htr_fi dcc_sl spigo dcc fedid\n");
230 fprintf(zdcmapfile,
"%s",it->printLMapLine());
236 int titlecounter = 0;
238 for (std::vector<HTLogicalMapEntry>::iterator it =
HTEntries_.begin(); it!=
HTEntries_.end(); ++it) {
239 titlecounter = titlecounter % 21;
240 if (titlecounter == 0){
241 fprintf(htmapfile,
"# side eta phi dphi depth det wedge crate");
242 fprintf(htmapfile,
" htr fpga dcc_sl spigo dcc slb slbin slbin2 nDat ");
243 fprintf(htmapfile,
" slnam rctcra rctcar rctcon rctnam fedid\n");
246 fprintf(htmapfile,
"%s",it->printLMapLine());
254 if ( !(entry&0x1) )
return DetId(0);
255 if ( ((entry>>1)&0x3)==0)
return HBHEHFEntries_.at(entry>>3).getDetId();
256 if ( ((entry>>1)&0x3)==1)
return HOHXEntries_.at(entry>>3).getDetId();
257 if ( ((entry>>1)&0x3)==2)
return CALIBEntries_.at(entry>>3).getDetId();
258 if ( ((entry>>1)&0x3)==3)
return ZDCEntries_.at(entry>>3).getDetId();
304 int HBHEHF_EID_pass=0;
305 int HBHEHF_EID_fail=0;
308 int CALIB_EID_pass=0;
309 int CALIB_EID_fail=0;
313 int HBHEHF_FEID_pass=0;
314 int HBHEHF_FEID_fail=0;
315 int HOHX_FEID_pass=0;
316 int HOHX_FEID_fail=0;
317 int CALIB_FEID_pass=0;
318 int CALIB_FEID_fail=0;
320 cout <<
"\nRunning the id function checker..." << endl;
324 const DetId did0=it->getDetId();
326 if (did0==did1) HBHEHF_EID_pass++;
327 else HBHEHF_EID_fail++;
331 if (hfeid0==hfeid1) HBHEHF_FEID_pass++;
332 else HBHEHF_FEID_fail++;
336 const DetId did0=it->getDetId();
338 if (did0==did1) HOHX_EID_pass++;
339 else HOHX_EID_fail++;
343 if (hfeid0==hfeid1) HOHX_FEID_pass++;
344 else HOHX_FEID_fail++;
348 const DetId did0=it->getDetId();
350 if (did0==did1) CALIB_EID_pass++;
351 else CALIB_EID_fail++;
355 if (hfeid0==hfeid1) CALIB_FEID_pass++;
356 else CALIB_FEID_fail++;
360 const DetId did0=it->getDetId();
362 if (did0==did1) ZDC_EID_pass++;
366 cout <<
"Checking detIds from electronics ids..." << endl;
367 cout <<
"HBHEHF EID (pass,fail) = (" << HBHEHF_EID_pass <<
"," << HBHEHF_EID_fail <<
")" << endl;
368 cout <<
"HOHX EID (pass,fail) = (" << HOHX_EID_pass <<
"," << HOHX_EID_fail <<
")" << endl;
369 cout <<
"CALIB EID (pass,fail) = (" << CALIB_EID_pass <<
"," << CALIB_EID_fail <<
")" << endl;
370 cout <<
"ZDC EID (pass,fail) = (" << ZDC_EID_pass <<
"," << ZDC_EID_fail <<
")" << endl;
372 cout <<
"Checking frontEndIds from electronics ids..." << endl;
373 cout <<
"HBHEHF FEID (pass,fail) = (" << HBHEHF_FEID_pass <<
"," << HBHEHF_FEID_fail <<
")" << endl;
374 cout <<
"HOHX FEID (pass,fail) = (" << HOHX_FEID_pass <<
"," << HOHX_FEID_fail <<
")" << endl;
375 cout <<
"CALIB FEID (pass,fail) = (" << CALIB_FEID_pass <<
"," << CALIB_FEID_fail <<
")" << endl;
380 std::vector<int> HB_Hashes_;
381 std::vector<int> HE_Hashes_;
382 std::vector<int> HF_Hashes_;
383 std::vector<int> HO_Hashes_;
384 std::vector<int> CALIBHX_Hashes_;
385 std::vector<int> ZDC_Hashes_;
386 std::vector<int> HT_Hashes_;
388 int numfails[7] = {0,0,0,0,0,0,0};
389 int numpass[7] = {0,0,0,0,0,0,0};
390 int numnotdense[7] = {0,0,0,0,0,0,0};
392 cout <<
"\nRunning the hash checker for detIds..." << endl;
397 else if (it->getDetId().subdetId()==
HcalEndcap) {
416 ZDC_Hashes_.push_back(
HcalZDCDetId(it->getDetId()).denseIndex());
418 for (std::vector<HTLogicalMapEntry>::iterator it =
HTEntries_.begin(); it!=
HTEntries_.end(); ++it) {
422 sort(HB_Hashes_.begin() , HB_Hashes_.end());
423 sort(HE_Hashes_.begin() , HE_Hashes_.end());
424 sort(HF_Hashes_.begin() , HF_Hashes_.end());
425 sort(HO_Hashes_.begin() , HO_Hashes_.end());
426 sort(CALIBHX_Hashes_.begin(), CALIBHX_Hashes_.end());
427 sort(ZDC_Hashes_.begin() , ZDC_Hashes_.end());
428 sort(HT_Hashes_.begin() , HT_Hashes_.end());
430 for(
unsigned int i = 0;
i<HB_Hashes_.size()-1;
i++) {
431 int diff = HB_Hashes_.at(
i+1)-HB_Hashes_.at(
i);
432 if (diff==0) numfails[0]++;
433 else if (diff>1) numnotdense[0]++;
436 for(
unsigned int i = 0;
i<HE_Hashes_.size()-1;
i++) {
437 int diff = HE_Hashes_.at(
i+1)-HE_Hashes_.at(
i);
438 if (diff==0) numfails[1]++;
439 else if (diff>1) numnotdense[1]++;
442 for(
unsigned int i = 0;
i<HF_Hashes_.size()-1;
i++) {
443 int diff = HF_Hashes_.at(
i+1)-HF_Hashes_.at(
i);
444 if (diff==0) numfails[2]++;
445 else if (diff>1) numnotdense[2]++;
448 for(
unsigned int i = 0;
i<HO_Hashes_.size()-1;
i++) {
449 int diff = HO_Hashes_.at(
i+1)-HO_Hashes_.at(
i);
450 if (diff==0) numfails[3]++;
451 else if (diff>1) numnotdense[3]++;
454 for(
unsigned int i = 0;
i<CALIBHX_Hashes_.size()-1;
i++) {
455 int diff = CALIBHX_Hashes_.at(
i+1)-CALIBHX_Hashes_.at(
i);
456 if (diff==0) numfails[4]++;
457 else if (diff>1) numnotdense[4]++;
460 for(
unsigned int i = 0;
i<ZDC_Hashes_.size()-1;
i++) {
461 int diff = ZDC_Hashes_.at(
i+1)-ZDC_Hashes_.at(
i);
462 if (diff==0) numfails[5]++;
463 else if (diff>1) numnotdense[5]++;
466 for(
unsigned int i = 0;
i<HT_Hashes_.size()-1;
i++) {
467 int diff = HT_Hashes_.at(
i+1)-HT_Hashes_.at(
i);
468 if (diff==0) numfails[6]++;
469 else if (diff>1) numnotdense[6]++;
472 cout <<
"HB HashIds (pass, collisions, non-dense) = (" << numpass[0] <<
"," << numfails[0] <<
"," << numnotdense[0] <<
")" << endl;
473 cout <<
"HE HashIds (pass, collisions, non-dense) = (" << numpass[1] <<
"," << numfails[1] <<
"," << numnotdense[1] <<
")" << endl;
474 cout <<
"HF HashIds (pass, collisions, non-dense) = (" << numpass[2] <<
"," << numfails[2] <<
"," << numnotdense[2] <<
")" << endl;
475 cout <<
"HO HashIds (pass, collisions, non-dense) = (" << numpass[3] <<
"," << numfails[3] <<
"," << numnotdense[3] <<
")" << endl;
476 cout <<
"CALIB/HX HashIds (pass, collisions, non-dense) = (" << numpass[4] <<
"," << numfails[4] <<
"," << numnotdense[4] <<
")" << endl;
477 cout <<
"ZDC HashIds (pass, collisions, non-dense) = (" << numpass[5] <<
"," << numfails[5] <<
"," << numnotdense[5] <<
")" << endl;
478 cout <<
"HT HashIds (pass, collisions, non-dense) = (" << numpass[6] <<
"," << numfails[6] <<
"," << numnotdense[6] <<
")" << endl;
482 std::vector<int> Electronics_Hashes_;
488 cout <<
"\nRunning the hash checker for electronics Ids..." << endl;
490 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
493 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
496 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
499 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
501 for (std::vector<HTLogicalMapEntry>::iterator it =
HTEntries_.begin(); it!=
HTEntries_.end(); ++it) {
502 Electronics_Hashes_.push_back((it->getHcalTrigElectronicsId()).linearIndex());
505 sort(Electronics_Hashes_.begin() , Electronics_Hashes_.end());
507 for(
unsigned int i = 0;
i<Electronics_Hashes_.size()-1;
i++) {
508 int diff = Electronics_Hashes_.at(
i+1)-Electronics_Hashes_.at(
i);
509 if (diff==0) numfails++;
510 else if (diff>1) numnotdense++;
513 cout <<
"Electronics Id linearIndex (pass, collisions, nondense) = (" << numpass <<
"," << numfails <<
"," << numnotdense <<
")" << endl;
CalibDetType calibFlavor() const
get the flavor of this calibration detid
static uint32_t makeEntryNumber(bool, int, int)
void printCalibMap(FILE *calibmapfile)
std::vector< uint32_t > HeHash2Entry_
void printHTMap(FILE *htmapfile)
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT
unsigned int detId2denseIdHF(const DetId &id) const
return a linear packed id from HF
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
void printHOXMap(FILE *hoxmapfile)
void printZDCMap(FILE *zdcmapfile)
unsigned int detId2denseIdHB(const DetId &id) const
return a linear packed id from HB
std::vector< uint32_t > HbHash2Entry_
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
std::vector< uint32_t > LinearIndex2Entry_
std::vector< uint32_t > HoHash2Entry_
std::vector< uint32_t > ZdcHash2Entry_
const HcalTopology * topo_
HcalElectronicsMap generateHcalElectronicsMap()
void checkElectronicsHashIds()
std::vector< HTLogicalMapEntry > HTEntries_
std::pair< std::string, MonitorElement * > entry
void printMap(unsigned int mapIOV)
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
const HcalFrontEndId getHcalFrontEndId(const DetId &)
std::vector< HOHXLogicalMapEntry > HOHXEntries_
void printHBEFMap(FILE *hbefmapfile)
std::vector< uint32_t > HtHash2Entry_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
const DetId getDetId(const HcalElectronicsId &)
std::vector< ZDCLogicalMapEntry > ZDCEntries_
std::vector< uint32_t > HxCalibHash2Entry_
int linearIndex() const
get a fast, compact, unique index for linear lookups (maximum value = 16384)
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
HcalGenericSubdetector genericSubdet() const
std::vector< uint32_t > HfHash2Entry_
unsigned int detId2denseIdCALIB(const DetId &id) const
return a linear packed id from CALIB
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
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 > &)