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)
31 HBHEHFEntries_.resize(HBHEHFEntries.size());
32 HOHXEntries_.resize(HOHXEntries.size());
33 CALIBEntries_.resize(CALIBEntries.size());
34 ZDCEntries_.resize(ZDCEntries.size());
35 HTEntries_.resize(HTEntries.size());
37 LinearIndex2Entry_.resize(LinearIndex2Entry.size());
38 HbHash2Entry_.resize(HbHash2Entry.size());
39 HeHash2Entry_.resize(HeHash2Entry.size());
40 HfHash2Entry_.resize(HfHash2Entry.size());
41 HtHash2Entry_.resize(HtHash2Entry.size());
42 HoHash2Entry_.resize(HoHash2Entry.size());
43 HxCalibHash2Entry_.resize(HxCalibHash2Entry.size());
44 ZdcHash2Entry_.resize(ZdcHash2Entry.size());
46 copy(HBHEHFEntries.begin(),HBHEHFEntries.end(),HBHEHFEntries_.begin());
47 copy(HOHXEntries.begin(),HOHXEntries.end(),HOHXEntries_.begin());
48 copy(CALIBEntries.begin(),CALIBEntries.end(),CALIBEntries_.begin());
49 copy(ZDCEntries.begin(),ZDCEntries.end(),ZDCEntries_.begin());
50 copy(HTEntries.begin(),HTEntries.end(),HTEntries_.begin());
51 copy(LinearIndex2Entry.begin(),LinearIndex2Entry.end(),LinearIndex2Entry_.begin());
52 copy(HbHash2Entry.begin(),HbHash2Entry.end(),HbHash2Entry_.begin());
53 copy(HeHash2Entry.begin(),HeHash2Entry.end(),HeHash2Entry_.begin());
54 copy(HfHash2Entry.begin(),HfHash2Entry.end(),HfHash2Entry_.begin());
55 copy(HtHash2Entry.begin(),HtHash2Entry.end(),HtHash2Entry_.begin());
56 copy(HoHash2Entry.begin(),HoHash2Entry.end(),HoHash2Entry_.begin());
57 copy(HxCalibHash2Entry.begin(),HxCalibHash2Entry.end(),HxCalibHash2Entry_.begin());
58 copy(ZdcHash2Entry.begin(),ZdcHash2Entry.end(),ZdcHash2Entry_.begin());
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";
101 else if (mapIOV==4) IOVlabel =
"D";
104 HBEFmapstr =
"./HCALmapHBEF_"+IOVlabel+
".txt";
105 HOXmapstr =
"./HCALmapHO_"+IOVlabel+
".txt";
106 CALIBmapstr =
"./HCALmapCALIB_"+IOVlabel+
".txt";
107 ZDCmapstr =
"./ZDCmap_"+IOVlabel+
".txt";
108 HTmapstr =
"./HCALmapHT_"+IOVlabel+
".txt";
116 HBEFmap = fopen(HBEFmapstr.c_str(),
"w");
117 HOXmap = fopen(HOXmapstr.c_str(),
"w");
118 CALIBmap = fopen(CALIBmapstr.c_str(),
"w");
119 ZDCmap = fopen(ZDCmapstr.c_str(),
"w");
120 HTmap = fopen(HTmapstr.c_str(),
"w");
124 fprintf(HBEFmap,
"## file created %s ##\n",date.c_str());
125 printHBEFMap(HBEFmap);
127 else cout <<HBEFmapstr<<
" not found!"<<endl;
130 fprintf(HOXmap,
"## file created %s ##\n",date.c_str());
133 else cout <<HOXmapstr<<
" not found!"<<endl;
136 fprintf(CALIBmap,
"## file created %s ##\n",date.c_str());
137 printCalibMap(CALIBmap);
139 else cout <<CALIBmapstr<<
" not found!"<<endl;
142 fprintf(ZDCmap,
"## file created %s ##\n",date.c_str());
145 else cout <<ZDCmapstr<<
" not found!"<<endl;
148 fprintf(HTmap,
"## file created %s ##\n",date.c_str());
151 else cout <<HTmapstr<<
" not found!"<<endl;
160 for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
161 theemap->
mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
162 for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
163 theemap->
mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
164 for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
165 theemap->
mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
166 for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
167 theemap->
mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
168 for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
169 theemap->
mapEId2tId( it->getHcalTrigElectronicsId(), it->getDetId() );}
176 int titlecounter = 0;
178 for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
179 titlecounter = titlecounter % 21;
180 if (titlecounter == 0){
181 fprintf(hbefmapfile,
"# side eta phi dphi depth det rbx wedge rm pixel qie adc");
182 fprintf(hbefmapfile,
" rm_fi fi_ch crate htr fpga htr_fi dcc_sl spigo dcc slb slbin slbin2");
183 fprintf(hbefmapfile,
" slnam rctcra rctcar rctcon rctnam fedid\n");
186 fprintf(hbefmapfile,
"%s",it->printLMapLine());
192 int titlecounter = 0;
194 for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
195 titlecounter = titlecounter % 21;
196 if (titlecounter == 0){
197 fprintf(hoxmapfile,
"# side eta phi dphi depth det rbx sector rm pixel qie adc");
198 fprintf(hoxmapfile,
" rm_fi fi_ch let_code crate htr fpga htr_fi dcc_sl spigo dcc fedid\n");
201 fprintf(hoxmapfile,
"%s",it->printLMapLine());
207 int titlecounter = 0;
209 for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
210 titlecounter = titlecounter % 21;
211 if (titlecounter == 0){
212 fprintf(calibmapfile,
"# side eta phi dphi det rbx sector rm rm_fi ");
213 fprintf(calibmapfile,
" fi_ch crate htr fpga htr_fi dcc_sl spigo dcc fedid ch_type name\n");
216 fprintf(calibmapfile,
"%s",it->printLMapLine());
222 int titlecounter = 0;
224 for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
225 titlecounter = titlecounter % 21;
226 if (titlecounter == 0){
227 fprintf(zdcmapfile,
"# side x y dx depth det det_ch cable rm qie ");
228 fprintf(zdcmapfile,
" adc rm_fi fi_ch crate htr fpga htr_fi dcc_sl spigo dcc fedid\n");
231 fprintf(zdcmapfile,
"%s",it->printLMapLine());
237 int titlecounter = 0;
239 for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
240 titlecounter = titlecounter % 21;
241 if (titlecounter == 0){
242 fprintf(htmapfile,
"# side eta phi dphi depth det wedge crate");
243 fprintf(htmapfile,
" htr fpga dcc_sl spigo dcc slb slbin slbin2 nDat ");
244 fprintf(htmapfile,
" slnam rctcra rctcar rctcon rctnam fedid\n");
247 fprintf(htmapfile,
"%s",it->printLMapLine());
255 if ( !(entry&0x1) )
return DetId(0);
256 if ( ((entry>>1)&0x3)==0)
return HBHEHFEntries_.at(entry>>3).getDetId();
257 if ( ((entry>>1)&0x3)==1)
return HOHXEntries_.at(entry>>3).getDetId();
258 if ( ((entry>>1)&0x3)==2)
return CALIBEntries_.at(entry>>3).getDetId();
259 if ( ((entry>>1)&0x3)==3)
return ZDCEntries_.at(entry>>3).getDetId();
267 const int hashedId=hgdi.
hashedId(
false);
269 const uint32_t
entry=HbHash2Entry_.at(hashedId)-1;
270 return HBHEHFEntries_.at(entry).getHcalFrontEndId();
273 const uint32_t
entry=HeHash2Entry_.at(hashedId)-1;
274 return HBHEHFEntries_.at(entry).getHcalFrontEndId();
277 const uint32_t
entry=HfHash2Entry_.at(hashedId)-1;
278 return HBHEHFEntries_.at(entry).getHcalFrontEndId();
281 const uint32_t
entry=HoHash2Entry_.at(hashedId)-1;
282 return HOHXEntries_.at(entry).getHcalFrontEndId();
287 const uint32_t
entry=HxCalibHash2Entry_.at(hashedId)-1;
288 return HOHXEntries_.at(entry).getHcalFrontEndId();
291 const uint32_t
entry=HxCalibHash2Entry_.at(hashedId)-1;
292 return CALIBEntries_.at(entry).getHcalFrontEndId();
299 int HBHEHF_EID_pass=0;
300 int HBHEHF_EID_fail=0;
303 int CALIB_EID_pass=0;
304 int CALIB_EID_fail=0;
308 int HBHEHF_FEID_pass=0;
309 int HBHEHF_FEID_fail=0;
310 int HOHX_FEID_pass=0;
311 int HOHX_FEID_fail=0;
312 int CALIB_FEID_pass=0;
313 int CALIB_FEID_fail=0;
315 cout <<
"\nRunning the id function checker..." << endl;
317 for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
319 const DetId did0=it->getDetId();
320 const DetId did1=getDetId(heid);
321 if (did0==did1) HBHEHF_EID_pass++;
322 else HBHEHF_EID_fail++;
326 if (hfeid0==hfeid1) HBHEHF_FEID_pass++;
327 else HBHEHF_FEID_fail++;
329 for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
331 const DetId did0=it->getDetId();
332 const DetId did1=getDetId(heid);
333 if (did0==did1) HOHX_EID_pass++;
334 else HOHX_EID_fail++;
338 if (hfeid0==hfeid1) HOHX_FEID_pass++;
339 else HOHX_FEID_fail++;
341 for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
343 const DetId did0=it->getDetId();
344 const DetId did1=getDetId(heid);
345 if (did0==did1) CALIB_EID_pass++;
346 else CALIB_EID_fail++;
350 if (hfeid0==hfeid1) CALIB_FEID_pass++;
351 else CALIB_FEID_fail++;
353 for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
355 const DetId did0=it->getDetId();
356 const DetId did1=getDetId(heid);
357 if (did0==did1) ZDC_EID_pass++;
361 cout <<
"Checking detIds from electronics ids..." << endl;
362 cout <<
"HBHEHF EID (pass,fail) = (" << HBHEHF_EID_pass <<
"," << HBHEHF_EID_fail <<
")" << endl;
363 cout <<
"HOHX EID (pass,fail) = (" << HOHX_EID_pass <<
"," << HOHX_EID_fail <<
")" << endl;
364 cout <<
"CALIB EID (pass,fail) = (" << CALIB_EID_pass <<
"," << CALIB_EID_fail <<
")" << endl;
365 cout <<
"ZDC EID (pass,fail) = (" << ZDC_EID_pass <<
"," << ZDC_EID_fail <<
")" << endl;
367 cout <<
"Checking frontEndIds from electronics ids..." << endl;
368 cout <<
"HBHEHF FEID (pass,fail) = (" << HBHEHF_FEID_pass <<
"," << HBHEHF_FEID_fail <<
")" << endl;
369 cout <<
"HOHX FEID (pass,fail) = (" << HOHX_FEID_pass <<
"," << HOHX_FEID_fail <<
")" << endl;
370 cout <<
"CALIB FEID (pass,fail) = (" << CALIB_FEID_pass <<
"," << CALIB_FEID_fail <<
")" << endl;
375 std::vector<int> HB_Hashes_;
376 std::vector<int> HE_Hashes_;
377 std::vector<int> HF_Hashes_;
378 std::vector<int> HO_Hashes_;
379 std::vector<int> CALIBHX_Hashes_;
380 std::vector<int> ZDC_Hashes_;
381 std::vector<int> HT_Hashes_;
383 int numfails[7] = {0,0,0,0,0,0,0};
384 int numpass[7] = {0,0,0,0,0,0,0};
385 int numnotdense[7] = {0,0,0,0,0,0,0};
387 cout <<
"\nRunning the hash checker for detIds..." << endl;
388 for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
390 HB_Hashes_.push_back(
HcalGenericDetId(it->getDetId().rawId()).hashedId(
false));
392 else if (it->getDetId().subdetId()==
HcalEndcap) {
393 HE_Hashes_.push_back(
HcalGenericDetId(it->getDetId().rawId()).hashedId(
false));
396 HF_Hashes_.push_back(
HcalGenericDetId(it->getDetId().rawId()).hashedId(
false));
399 for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
401 CALIBHX_Hashes_.push_back(
HcalGenericDetId(it->getDetId().rawId()).hashedId(
false));
404 HO_Hashes_.push_back(
HcalGenericDetId(it->getDetId().rawId()).hashedId(
false));
407 for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
408 CALIBHX_Hashes_.push_back(
HcalGenericDetId(it->getDetId().rawId()).hashedId(
false));
410 for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
411 ZDC_Hashes_.push_back(
HcalGenericDetId(it->getDetId().rawId()).hashedId(
false));
413 for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
414 HT_Hashes_.push_back(
HcalGenericDetId(it->getDetId().rawId()).hashedId(
false));
417 sort(HB_Hashes_.begin() , HB_Hashes_.end());
418 sort(HE_Hashes_.begin() , HE_Hashes_.end());
419 sort(HF_Hashes_.begin() , HF_Hashes_.end());
420 sort(HO_Hashes_.begin() , HO_Hashes_.end());
421 sort(CALIBHX_Hashes_.begin(), CALIBHX_Hashes_.end());
422 sort(ZDC_Hashes_.begin() , ZDC_Hashes_.end());
423 sort(HT_Hashes_.begin() , HT_Hashes_.end());
425 for(
unsigned int i = 0;
i<HB_Hashes_.size()-1;
i++) {
426 int diff = HB_Hashes_.at(
i+1)-HB_Hashes_.at(
i);
427 if (diff==0) numfails[0]++;
428 else if (diff>1) numnotdense[0]++;
431 for(
unsigned int i = 0;
i<HE_Hashes_.size()-1;
i++) {
432 int diff = HE_Hashes_.at(
i+1)-HE_Hashes_.at(
i);
433 if (diff==0) numfails[1]++;
434 else if (diff>1) numnotdense[1]++;
437 for(
unsigned int i = 0;
i<HF_Hashes_.size()-1;
i++) {
438 int diff = HF_Hashes_.at(
i+1)-HF_Hashes_.at(
i);
439 if (diff==0) numfails[2]++;
440 else if (diff>1) numnotdense[2]++;
443 for(
unsigned int i = 0;
i<HO_Hashes_.size()-1;
i++) {
444 int diff = HO_Hashes_.at(
i+1)-HO_Hashes_.at(
i);
445 if (diff==0) numfails[3]++;
446 else if (diff>1) numnotdense[3]++;
449 for(
unsigned int i = 0;
i<CALIBHX_Hashes_.size()-1;
i++) {
450 int diff = CALIBHX_Hashes_.at(
i+1)-CALIBHX_Hashes_.at(
i);
451 if (diff==0) numfails[4]++;
452 else if (diff>1) numnotdense[4]++;
455 for(
unsigned int i = 0;
i<ZDC_Hashes_.size()-1;
i++) {
456 int diff = ZDC_Hashes_.at(
i+1)-ZDC_Hashes_.at(
i);
457 if (diff==0) numfails[5]++;
458 else if (diff>1) numnotdense[5]++;
461 for(
unsigned int i = 0;
i<HT_Hashes_.size()-1;
i++) {
462 int diff = HT_Hashes_.at(
i+1)-HT_Hashes_.at(
i);
463 if (diff==0) numfails[6]++;
464 else if (diff>1) numnotdense[6]++;
467 cout <<
"HB HashIds (pass, collisions, non-dense) = (" << numpass[0] <<
"," << numfails[0] <<
"," << numnotdense[0] <<
")" << endl;
468 cout <<
"HE HashIds (pass, collisions, non-dense) = (" << numpass[1] <<
"," << numfails[1] <<
"," << numnotdense[1] <<
")" << endl;
469 cout <<
"HF HashIds (pass, collisions, non-dense) = (" << numpass[2] <<
"," << numfails[2] <<
"," << numnotdense[2] <<
")" << endl;
470 cout <<
"HO HashIds (pass, collisions, non-dense) = (" << numpass[3] <<
"," << numfails[3] <<
"," << numnotdense[3] <<
")" << endl;
471 cout <<
"CALIB/HX HashIds (pass, collisions, non-dense) = (" << numpass[4] <<
"," << numfails[4] <<
"," << numnotdense[4] <<
")" << endl;
472 cout <<
"ZDC HashIds (pass, collisions, non-dense) = (" << numpass[5] <<
"," << numfails[5] <<
"," << numnotdense[5] <<
")" << endl;
473 cout <<
"HT HashIds (pass, collisions, non-dense) = (" << numpass[6] <<
"," << numfails[6] <<
"," << numnotdense[6] <<
")" << endl;
477 std::vector<int> Electronics_Hashes_;
483 cout <<
"\nRunning the hash checker for electronics Ids..." << endl;
484 for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
485 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
487 for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
488 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
490 for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
491 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
493 for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
494 Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
496 for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
497 Electronics_Hashes_.push_back((it->getHcalTrigElectronicsId()).linearIndex());
500 sort(Electronics_Hashes_.begin() , Electronics_Hashes_.end());
502 for(
unsigned int i = 0;
i<Electronics_Hashes_.size()-1;
i++) {
503 int diff = Electronics_Hashes_.at(
i+1)-Electronics_Hashes_.at(
i);
504 if (diff==0) numfails++;
505 else if (diff>1) numnotdense++;
508 cout <<
"Electronics Id linearIndex (pass, collisions, nondense) = (" << numpass <<
"," << numfails <<
"," << numnotdense <<
")" << endl;
int hashedId(bool h2mode_=false) const
CalibDetType calibFlavor() const
get the flavor of this calibration detid
static uint32_t makeEntryNumber(bool, int, int)
void printCalibMap(FILE *calibmapfile)
void printHTMap(FILE *htmapfile)
void printHOXMap(FILE *hoxmapfile)
void printZDCMap(FILE *zdcmapfile)
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
HcalElectronicsMap generateHcalElectronicsMap()
void checkElectronicsHashIds()
std::pair< std::string, MonitorElement * > entry
void printMap(unsigned int mapIOV)
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
const HcalFrontEndId getHcalFrontEndId(const DetId &)
void printHBEFMap(FILE *hbefmapfile)
const DetId getDetId(const HcalElectronicsId &)
int linearIndex() const
get a fast, compact, unique index for linear lookups (maximum value = 16384)
HcalLogicalMap(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 > &)
HcalGenericSubdetector genericSubdet() const
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...