CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalLogicalMap.cc
Go to the documentation of this file.
3 
5 
6 #include <string>
7 #include <cstring>
8 #include <iostream>
9 #include <fstream>
10 #include <sstream>
11 #include <stdio.h>
12 #include <time.h>
13 
14 using namespace std;
15 
16 HcalLogicalMap::HcalLogicalMap(std::vector<HBHEHFLogicalMapEntry>& HBHEHFEntries,
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)
29 
30 {
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());
36 
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());
45 
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());
59 }
60 
62 {
63 }
64 
65 uint32_t HcalLogicalMap::makeEntryNumber(bool isvalid, int vectorid, int entry)
66 {
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) IOVlabel = "A";
99  else if (mapIOV==2) IOVlabel = "B";
100  else if (mapIOV==3) IOVlabel = "C";
101  else IOVlabel = "D";
102 
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";
108 
109 // HBEFmapstr = "./HCALmapHBEF_"+date+".txt";
110 // HOXmapstr = "./HCALmapHO_"+date+"_"+IOVlabel+".txt";
111 // CALIBmapstr = "./HCALmapCALIB_"+date+".txt";
112 // ZDCmapstr = "./ZDCmap_"+date+".txt";
113 // HTmapstr = "./HCALmapHT_"+date+".txt";
114 
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");
120  /**********************/
121 
122  if(HBEFmap) {
123  fprintf(HBEFmap,"## file created %s ##\n",date.c_str());
124  printHBEFMap(HBEFmap);
125  }
126  else cout <<HBEFmapstr<<" not found!"<<endl;
127 
128  if(HOXmap) {
129  fprintf(HOXmap,"## file created %s ##\n",date.c_str());
130  printHOXMap(HOXmap);
131  }
132  else cout <<HOXmapstr<<" not found!"<<endl;
133 
134  if(CALIBmap) {
135  fprintf(CALIBmap,"## file created %s ##\n",date.c_str());
136  printCalibMap(CALIBmap);
137  }
138  else cout <<CALIBmapstr<<" not found!"<<endl;
139 
140  if(ZDCmap) {
141  fprintf(ZDCmap,"## file created %s ##\n",date.c_str());
142  printZDCMap(ZDCmap);
143  }
144  else cout <<ZDCmapstr<<" not found!"<<endl;
145 
146  if(HTmap) {
147  fprintf(HTmap,"## file created %s ##\n",date.c_str());
148  printHTMap(HTmap);
149  }
150  else cout <<HTmapstr<<" not found!"<<endl;
151 
152 }
153 
154 /**************/
156 {
157  HcalElectronicsMap* theemap = new HcalElectronicsMap();
158 
159  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
160  theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
161  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
162  theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
163  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
164  theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
165  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
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() );}
169  theemap->sort();
170  return *theemap;
171 }
172 /**************/
173 
174 void HcalLogicalMap::printHBEFMap(FILE* hbefmapfile){
175  int titlecounter = 0;
176 
177  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
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");
183  }
184  titlecounter++;
185  fprintf(hbefmapfile,"%s",it->printLMapLine());
186  }
187 }
188 
189 void HcalLogicalMap::printHOXMap(FILE* hoxmapfile){
190 
191  int titlecounter = 0;
192 
193  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
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");
198  }
199  titlecounter++;
200  fprintf(hoxmapfile,"%s",it->printLMapLine());
201  }
202 }
203 
204 void HcalLogicalMap::printCalibMap(FILE* calibmapfile){
205 
206  int titlecounter = 0;
207 
208  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
209  titlecounter = titlecounter % 21;
210  if (titlecounter == 0){
211  fprintf(calibmapfile,"# side eta phi dphi det rbx sector rm_fi ");
212  fprintf(calibmapfile," fi_ch crate htr fpga htr_fi dcc_sl spigo dcc fedid ch_type name\n");
213  }
214  titlecounter++;
215  fprintf(calibmapfile,"%s",it->printLMapLine());
216  }
217 }
218 
219 void HcalLogicalMap::printZDCMap(FILE* zdcmapfile){
220 
221  int titlecounter = 0;
222 
223  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
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");
228  }
229  titlecounter++;
230  fprintf(zdcmapfile,"%s",it->printLMapLine());
231  }
232 }
233 
234 void HcalLogicalMap::printHTMap(FILE* htmapfile){
235 
236  int titlecounter = 0;
237 
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");
244  }
245  titlecounter++;
246  fprintf(htmapfile,"%s",it->printLMapLine());
247  }
248 }
249 
250 
252 {
253  const uint32_t entry=LinearIndex2Entry_.at(eid.linearIndex());
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();
259  return DetId(0);
260 }
261 
263 {
264  const HcalGenericDetId hgdi(did);
266  const int hashedId=hgdi.hashedId(false);
268  const uint32_t entry=HbHash2Entry_.at(hashedId)-1;
269  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
270  }
271  else if (hgsd==HcalGenericDetId::HcalGenEndcap) {
272  const uint32_t entry=HeHash2Entry_.at(hashedId)-1;
273  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
274  }
275  else if (hgsd==HcalGenericDetId::HcalGenForward) {
276  const uint32_t entry=HfHash2Entry_.at(hashedId)-1;
277  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
278  }
279  else if (hgsd==HcalGenericDetId::HcalGenOuter) {
280  const uint32_t entry=HoHash2Entry_.at(hashedId)-1;
281  return HOHXEntries_.at(entry).getHcalFrontEndId();
282  }
283  else if (hgsd==HcalGenericDetId::HcalGenCalibration) {
284  HcalCalibDetId hcid(did);
286  const uint32_t entry=HxCalibHash2Entry_.at(hashedId)-1;
287  return HOHXEntries_.at(entry).getHcalFrontEndId();
288  }
289  else if (hcid.calibFlavor()==HcalCalibDetId::CalibrationBox) {
290  const uint32_t entry=HxCalibHash2Entry_.at(hashedId)-1;
291  return CALIBEntries_.at(entry).getHcalFrontEndId();
292  }
293  }
294  return HcalFrontEndId(0);
295 }
296 
298  int HBHEHF_EID_pass=0;
299  int HBHEHF_EID_fail=0;
300  int HOHX_EID_pass=0;
301  int HOHX_EID_fail=0;
302  int CALIB_EID_pass=0;
303  int CALIB_EID_fail=0;
304  int ZDC_EID_pass=0;
305  int ZDC_EID_fail=0;
306 
307  int HBHEHF_FEID_pass=0;
308  int HBHEHF_FEID_fail=0;
309  int HOHX_FEID_pass=0;
310  int HOHX_FEID_fail=0;
311  int CALIB_FEID_pass=0;
312  int CALIB_FEID_fail=0;
313 
314  cout << "\nRunning the id function checker..." << endl;
315 
316  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
317  const HcalElectronicsId heid=it->getHcalElectronicsId();
318  const DetId did0=it->getDetId();
319  const DetId did1=getDetId(heid);
320  if (did0==did1) HBHEHF_EID_pass++;
321  else HBHEHF_EID_fail++;
322 
323  const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
324  const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
325  if (hfeid0==hfeid1) HBHEHF_FEID_pass++;
326  else HBHEHF_FEID_fail++;
327  }
328  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
329  const HcalElectronicsId heid=it->getHcalElectronicsId();
330  const DetId did0=it->getDetId();
331  const DetId did1=getDetId(heid);
332  if (did0==did1) HOHX_EID_pass++;
333  else HOHX_EID_fail++;
334 
335  const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
336  const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
337  if (hfeid0==hfeid1) HOHX_FEID_pass++;
338  else HOHX_FEID_fail++;
339  }
340  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
341  const HcalElectronicsId heid=it->getHcalElectronicsId();
342  const DetId did0=it->getDetId();
343  const DetId did1=getDetId(heid);
344  if (did0==did1) CALIB_EID_pass++;
345  else CALIB_EID_fail++;
346 
347  const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
348  const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
349  if (hfeid0==hfeid1) CALIB_FEID_pass++;
350  else CALIB_FEID_fail++;
351  }
352  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
353  const HcalElectronicsId heid=it->getHcalElectronicsId();
354  const DetId did0=it->getDetId();
355  const DetId did1=getDetId(heid);
356  if (did0==did1) ZDC_EID_pass++;
357  else ZDC_EID_fail++;
358  }
359 
360  cout << "Checking detIds from electronics ids..." << endl;
361  cout << "HBHEHF EID (pass,fail) = (" << HBHEHF_EID_pass << "," << HBHEHF_EID_fail << ")" << endl;
362  cout << "HOHX EID (pass,fail) = (" << HOHX_EID_pass << "," << HOHX_EID_fail << ")" << endl;
363  cout << "CALIB EID (pass,fail) = (" << CALIB_EID_pass << "," << CALIB_EID_fail << ")" << endl;
364  cout << "ZDC EID (pass,fail) = (" << ZDC_EID_pass << "," << ZDC_EID_fail << ")" << endl;
365  cout << endl;
366  cout << "Checking frontEndIds from electronics ids..." << endl;
367  cout << "HBHEHF FEID (pass,fail) = (" << HBHEHF_FEID_pass << "," << HBHEHF_FEID_fail << ")" << endl;
368  cout << "HOHX FEID (pass,fail) = (" << HOHX_FEID_pass << "," << HOHX_FEID_fail << ")" << endl;
369  cout << "CALIB FEID (pass,fail) = (" << CALIB_FEID_pass << "," << CALIB_FEID_fail << ")" << endl;
370 }
371 
372 
374  std::vector<int> HB_Hashes_; // index 0
375  std::vector<int> HE_Hashes_; // index 1
376  std::vector<int> HF_Hashes_; // index 2
377  std::vector<int> HO_Hashes_; // index 3
378  std::vector<int> CALIBHX_Hashes_;// index 4
379  std::vector<int> ZDC_Hashes_; // index 5
380  std::vector<int> HT_Hashes_; // index 6
381 
382  int numfails[7] = {0,0,0,0,0,0,0};
383  int numpass[7] = {0,0,0,0,0,0,0};
384  int numnotdense[7] = {0,0,0,0,0,0,0};
385 
386  cout << "\nRunning the hash checker for detIds..." << endl;
387  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
388  if (it->getDetId().subdetId()==HcalBarrel) {
389  HB_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
390  }
391  else if (it->getDetId().subdetId()==HcalEndcap) {
392  HE_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
393  }
394  else if (it->getDetId().subdetId()==HcalForward) {
395  HF_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
396  }
397  }
398  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
399  if (HcalGenericDetId(it->getDetId().rawId()).isHcalCalibDetId() ) {
400  CALIBHX_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
401  }
402  else {
403  HO_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
404  }
405  }
406  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
407  CALIBHX_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
408  }
409  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
410  ZDC_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
411  }
412  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
413  HT_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
414  }
415 
416  sort(HB_Hashes_.begin() , HB_Hashes_.end());
417  sort(HE_Hashes_.begin() , HE_Hashes_.end());
418  sort(HF_Hashes_.begin() , HF_Hashes_.end());
419  sort(HO_Hashes_.begin() , HO_Hashes_.end());
420  sort(CALIBHX_Hashes_.begin(), CALIBHX_Hashes_.end());
421  sort(ZDC_Hashes_.begin() , ZDC_Hashes_.end());
422  sort(HT_Hashes_.begin() , HT_Hashes_.end());
423 
424  for(unsigned int i = 0; i<HB_Hashes_.size()-1; i++) {
425  int diff = HB_Hashes_.at(i+1)-HB_Hashes_.at(i);
426  if (diff==0) numfails[0]++;
427  else if (diff>1) numnotdense[0]++;
428  else numpass[0]++;
429  }
430  for(unsigned int i = 0; i<HE_Hashes_.size()-1; i++) {
431  int diff = HE_Hashes_.at(i+1)-HE_Hashes_.at(i);
432  if (diff==0) numfails[1]++;
433  else if (diff>1) numnotdense[1]++;
434  else numpass[1]++;
435  }
436  for(unsigned int i = 0; i<HF_Hashes_.size()-1; i++) {
437  int diff = HF_Hashes_.at(i+1)-HF_Hashes_.at(i);
438  if (diff==0) numfails[2]++;
439  else if (diff>1) numnotdense[2]++;
440  else numpass[2]++;
441  }
442  for(unsigned int i = 0; i<HO_Hashes_.size()-1; i++) {
443  int diff = HO_Hashes_.at(i+1)-HO_Hashes_.at(i);
444  if (diff==0) numfails[3]++;
445  else if (diff>1) numnotdense[3]++;
446  else numpass[3]++;
447  }
448  for(unsigned int i = 0; i<CALIBHX_Hashes_.size()-1; i++) {
449  int diff = CALIBHX_Hashes_.at(i+1)-CALIBHX_Hashes_.at(i);
450  if (diff==0) numfails[4]++;
451  else if (diff>1) numnotdense[4]++;
452  else numpass[4]++;
453  }
454  for(unsigned int i = 0; i<ZDC_Hashes_.size()-1; i++) {
455  int diff = ZDC_Hashes_.at(i+1)-ZDC_Hashes_.at(i);
456  if (diff==0) numfails[5]++;
457  else if (diff>1) numnotdense[5]++;
458  else numpass[5]++;
459  }
460  for(unsigned int i = 0; i<HT_Hashes_.size()-1; i++) {
461  int diff = HT_Hashes_.at(i+1)-HT_Hashes_.at(i);
462  if (diff==0) numfails[6]++;
463  else if (diff>1) numnotdense[6]++;
464  else numpass[6]++;
465  }
466  cout << "HB HashIds (pass, collisions, non-dense) = (" << numpass[0] << "," << numfails[0] << "," << numnotdense[0] << ")" << endl;
467  cout << "HE HashIds (pass, collisions, non-dense) = (" << numpass[1] << "," << numfails[1] << "," << numnotdense[1] << ")" << endl;
468  cout << "HF HashIds (pass, collisions, non-dense) = (" << numpass[2] << "," << numfails[2] << "," << numnotdense[2] << ")" << endl;
469  cout << "HO HashIds (pass, collisions, non-dense) = (" << numpass[3] << "," << numfails[3] << "," << numnotdense[3] << ")" << endl;
470  cout << "CALIB/HX HashIds (pass, collisions, non-dense) = (" << numpass[4] << "," << numfails[4] << "," << numnotdense[4] << ")" << endl;
471  cout << "ZDC HashIds (pass, collisions, non-dense) = (" << numpass[5] << "," << numfails[5] << "," << numnotdense[5] << ")" << endl;
472  cout << "HT HashIds (pass, collisions, non-dense) = (" << numpass[6] << "," << numfails[6] << "," << numnotdense[6] << ")" << endl;
473 }
474 
476  std::vector<int> Electronics_Hashes_;
477 
478  int numfails = 0;
479  int numpass = 0;
480  int numnotdense = 0;
481 
482  cout << "\nRunning the hash checker for electronics Ids..." << endl;
483  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
484  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
485  }
486  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
487  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
488  }
489  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
490  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
491  }
492  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
493  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
494  }
495  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
496  Electronics_Hashes_.push_back((it->getHcalTrigElectronicsId()).linearIndex());
497  }
498 
499  sort(Electronics_Hashes_.begin() , Electronics_Hashes_.end());
500 
501  for(unsigned int i = 0; i<Electronics_Hashes_.size()-1; i++) {
502  int diff = Electronics_Hashes_.at(i+1)-Electronics_Hashes_.at(i);
503  if (diff==0) numfails++;
504  else if (diff>1) numnotdense++;
505  else numpass++;
506  }
507  cout << "Electronics Id linearIndex (pass, collisions, nondense) = (" << numpass << "," << numfails << "," << numnotdense << ")" << endl;
508 }
answer
Definition: submit.py:44
int i
Definition: DBlmapReader.cc:9
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
Definition: ME_MAP.h:8
void printMap(unsigned int mapIOV)
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
const HcalFrontEndId getHcalFrontEndId(const DetId &)
Definition: DetId.h:20
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 > &)
tuple cout
Definition: gather_cfg.py:41
HcalGenericSubdetector genericSubdet() const
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...