CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HcalLogicalMap Class Reference

#include <HcalLogicalMap.h>

Public Member Functions

void checkElectronicsHashIds ()
 
void checkHashIds ()
 
void checkIdFunctions ()
 
std::unique_ptr< HcalElectronicsMapgenerateHcalElectronicsMap ()
 
const DetId getDetId (const HcalElectronicsId &)
 
const HcalFrontEndId getHcalFrontEndId (const DetId &)
 
 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 > &)
 
void printMap (unsigned int mapIOV)
 
 ~HcalLogicalMap ()
 

Static Public Member Functions

static uint32_t makeEntryNumber (bool, int, int)
 

Private Member Functions

void printCalibMap (FILE *calibmapfile)
 
void printHBEFMap (FILE *hbefmapfile)
 
void printHOXMap (FILE *hoxmapfile)
 
void printHTMap (FILE *htmapfile)
 
void printZDCMap (FILE *zdcmapfile)
 

Private Attributes

std::vector< CALIBLogicalMapEntryCALIBEntries_
 
std::vector< uint32_t > HbHash2Entry_
 
std::vector< HBHEHFLogicalMapEntryHBHEHFEntries_
 
std::vector< uint32_t > HeHash2Entry_
 
std::vector< uint32_t > HfHash2Entry_
 
std::vector< uint32_t > HoHash2Entry_
 
std::vector< HOHXLogicalMapEntryHOHXEntries_
 
std::vector< HTLogicalMapEntryHTEntries_
 
std::vector< uint32_t > HtHash2Entry_
 
std::vector< uint32_t > HxCalibHash2Entry_
 
std::vector< uint32_t > LinearIndex2Entry_
 
unsigned int mapIOV_
 
const HcalTopologytopo_
 
std::vector< ZDCLogicalMapEntryZDCEntries_
 
std::vector< uint32_t > ZdcHash2Entry_
 

Detailed Description

Definition at line 9 of file HcalLogicalMap.h.

Constructor & Destructor Documentation

HcalLogicalMap::HcalLogicalMap ( const HcalTopology topo,
std::vector< HBHEHFLogicalMapEntry > &  HBHEHFEntries,
std::vector< HOHXLogicalMapEntry > &  HOHXEntries,
std::vector< CALIBLogicalMapEntry > &  CALIBEntries,
std::vector< ZDCLogicalMapEntry > &  ZDCEntries,
std::vector< HTLogicalMapEntry > &  HTEntries,
std::vector< uint32_t > &  LinearIndex2Entry,
std::vector< uint32_t > &  HbHash2Entry,
std::vector< uint32_t > &  HeHash2Entry,
std::vector< uint32_t > &  HfHash2Entry,
std::vector< uint32_t > &  HtHash2Entry,
std::vector< uint32_t > &  HoHash2Entry,
std::vector< uint32_t > &  HxCalibHash2Entry,
std::vector< uint32_t > &  ZdcHash2Entry 
)

Definition at line 17 of file HcalLogicalMap.cc.

References CALIBEntries_, popcon2dropbox::copy(), HbHash2Entry_, HBHEHFEntries_, HeHash2Entry_, HfHash2Entry_, HoHash2Entry_, HOHXEntries_, HTEntries_, HtHash2Entry_, HxCalibHash2Entry_, LinearIndex2Entry_, ZDCEntries_, and ZdcHash2Entry_.

29  : topo_(topo)
30 
31 {
32  HBHEHFEntries_.resize(HBHEHFEntries.size());
33  HOHXEntries_.resize(HOHXEntries.size());
34  CALIBEntries_.resize(CALIBEntries.size());
35  ZDCEntries_.resize(ZDCEntries.size());
36  HTEntries_.resize(HTEntries.size());
37 
38  LinearIndex2Entry_.resize(LinearIndex2Entry.size());
39  HbHash2Entry_.resize(HbHash2Entry.size());
40  HeHash2Entry_.resize(HeHash2Entry.size());
41  HfHash2Entry_.resize(HfHash2Entry.size());
42  HtHash2Entry_.resize(HtHash2Entry.size());
43  HoHash2Entry_.resize(HoHash2Entry.size());
44  HxCalibHash2Entry_.resize(HxCalibHash2Entry.size());
45  ZdcHash2Entry_.resize(ZdcHash2Entry.size());
46 
47  copy(HBHEHFEntries.begin(),HBHEHFEntries.end(),HBHEHFEntries_.begin());
48  copy(HOHXEntries.begin(),HOHXEntries.end(),HOHXEntries_.begin());
49  copy(CALIBEntries.begin(),CALIBEntries.end(),CALIBEntries_.begin());
50  copy(ZDCEntries.begin(),ZDCEntries.end(),ZDCEntries_.begin());
51  copy(HTEntries.begin(),HTEntries.end(),HTEntries_.begin());
52  copy(LinearIndex2Entry.begin(),LinearIndex2Entry.end(),LinearIndex2Entry_.begin());
53  copy(HbHash2Entry.begin(),HbHash2Entry.end(),HbHash2Entry_.begin());
54  copy(HeHash2Entry.begin(),HeHash2Entry.end(),HeHash2Entry_.begin());
55  copy(HfHash2Entry.begin(),HfHash2Entry.end(),HfHash2Entry_.begin());
56  copy(HtHash2Entry.begin(),HtHash2Entry.end(),HtHash2Entry_.begin());
57  copy(HoHash2Entry.begin(),HoHash2Entry.end(),HoHash2Entry_.begin());
58  copy(HxCalibHash2Entry.begin(),HxCalibHash2Entry.end(),HxCalibHash2Entry_.begin());
59  copy(ZdcHash2Entry.begin(),ZdcHash2Entry.end(),ZdcHash2Entry_.begin());
60 }
std::vector< uint32_t > HeHash2Entry_
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
std::vector< uint32_t > HbHash2Entry_
std::vector< uint32_t > LinearIndex2Entry_
std::vector< uint32_t > HoHash2Entry_
std::vector< uint32_t > ZdcHash2Entry_
const HcalTopology * topo_
std::vector< HTLogicalMapEntry > HTEntries_
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< uint32_t > HtHash2Entry_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
std::vector< ZDCLogicalMapEntry > ZDCEntries_
std::vector< uint32_t > HxCalibHash2Entry_
std::vector< uint32_t > HfHash2Entry_
HcalLogicalMap::~HcalLogicalMap ( )

Definition at line 62 of file HcalLogicalMap.cc.

63 {
64 }

Member Function Documentation

void HcalLogicalMap::checkElectronicsHashIds ( )

Definition at line 482 of file HcalLogicalMap.cc.

References CALIBEntries_, gather_cfg::cout, diffTreeTool::diff, HBHEHFEntries_, HOHXEntries_, HTEntries_, mps_fire::i, and ZDCEntries_.

482  {
483  std::vector<int> Electronics_Hashes_;
484 
485  int numfails = 0;
486  int numpass = 0;
487  int numnotdense = 0;
488 
489  cout << "\nRunning the hash checker for electronics Ids..." << endl;
490  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
491  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
492  }
493  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
494  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
495  }
496  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
497  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
498  }
499  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
500  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
501  }
502  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
503  Electronics_Hashes_.push_back((it->getHcalTrigElectronicsId()).linearIndex());
504  }
505 
506  sort(Electronics_Hashes_.begin() , Electronics_Hashes_.end());
507 
508  for(unsigned int i = 0; i<Electronics_Hashes_.size()-1; i++) {
509  int diff = Electronics_Hashes_.at(i+1)-Electronics_Hashes_.at(i);
510  if (diff==0) numfails++;
511  else if (diff>1) numnotdense++;
512  else numpass++;
513  }
514  cout << "Electronics Id linearIndex (pass, collisions, nondense) = (" << numpass << "," << numfails << "," << numnotdense << ")" << endl;
515 }
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
std::vector< HTLogicalMapEntry > HTEntries_
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
std::vector< ZDCLogicalMapEntry > ZDCEntries_
void HcalLogicalMap::checkHashIds ( )

Definition at line 380 of file HcalLogicalMap.cc.

References CALIBEntries_, gather_cfg::cout, HcalTopology::detId2denseIdCALIB(), HcalTopology::detId2denseIdHB(), HcalTopology::detId2denseIdHE(), HcalTopology::detId2denseIdHF(), HcalTopology::detId2denseIdHO(), HcalTopology::detId2denseIdHT(), diffTreeTool::diff, HBHEHFEntries_, HcalBarrel, HcalEndcap, HcalForward, HOHXEntries_, HTEntries_, mps_fire::i, topo_, and ZDCEntries_.

380  {
381  std::vector<int> HB_Hashes_; // index 0
382  std::vector<int> HE_Hashes_; // index 1
383  std::vector<int> HF_Hashes_; // index 2
384  std::vector<int> HO_Hashes_; // index 3
385  std::vector<int> CALIBHX_Hashes_;// index 4
386  std::vector<int> ZDC_Hashes_; // index 5
387  std::vector<int> HT_Hashes_; // index 6
388 
389  int numfails[7] = {0,0,0,0,0,0,0};
390  int numpass[7] = {0,0,0,0,0,0,0};
391  int numnotdense[7] = {0,0,0,0,0,0,0};
392 
393  cout << "\nRunning the hash checker for detIds..." << endl;
394  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
395  if (it->getDetId().subdetId()==HcalBarrel) {
396  HB_Hashes_.push_back(topo_->detId2denseIdHB(it->getDetId()));
397  }
398  else if (it->getDetId().subdetId()==HcalEndcap) {
399  HE_Hashes_.push_back(topo_->detId2denseIdHE(it->getDetId()));
400  }
401  else if (it->getDetId().subdetId()==HcalForward) {
402  HF_Hashes_.push_back(topo_->detId2denseIdHF(it->getDetId()));
403  }
404  }
405  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
406  if (HcalGenericDetId(it->getDetId().rawId()).isHcalCalibDetId() ) {
407  CALIBHX_Hashes_.push_back(topo_->detId2denseIdCALIB(it->getDetId()));
408  }
409  else {
410  HO_Hashes_.push_back(topo_->detId2denseIdHO(it->getDetId()));
411  }
412  }
413  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
414  CALIBHX_Hashes_.push_back(topo_->detId2denseIdCALIB(it->getDetId()));
415  }
416  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
417  ZDC_Hashes_.push_back(HcalZDCDetId(it->getDetId()).denseIndex());
418  }
419  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
420  HT_Hashes_.push_back(topo_->detId2denseIdHT(it->getDetId()));
421  }
422 
423  sort(HB_Hashes_.begin() , HB_Hashes_.end());
424  sort(HE_Hashes_.begin() , HE_Hashes_.end());
425  sort(HF_Hashes_.begin() , HF_Hashes_.end());
426  sort(HO_Hashes_.begin() , HO_Hashes_.end());
427  sort(CALIBHX_Hashes_.begin(), CALIBHX_Hashes_.end());
428  sort(ZDC_Hashes_.begin() , ZDC_Hashes_.end());
429  sort(HT_Hashes_.begin() , HT_Hashes_.end());
430 
431  for(unsigned int i = 0; i<HB_Hashes_.size()-1; i++) {
432  int diff = HB_Hashes_.at(i+1)-HB_Hashes_.at(i);
433  if (diff==0) numfails[0]++;
434  else if (diff>1) numnotdense[0]++;
435  else numpass[0]++;
436  }
437  for(unsigned int i = 0; i<HE_Hashes_.size()-1; i++) {
438  int diff = HE_Hashes_.at(i+1)-HE_Hashes_.at(i);
439  if (diff==0) numfails[1]++;
440  else if (diff>1) numnotdense[1]++;
441  else numpass[1]++;
442  }
443  for(unsigned int i = 0; i<HF_Hashes_.size()-1; i++) {
444  int diff = HF_Hashes_.at(i+1)-HF_Hashes_.at(i);
445  if (diff==0) numfails[2]++;
446  else if (diff>1) numnotdense[2]++;
447  else numpass[2]++;
448  }
449  for(unsigned int i = 0; i<HO_Hashes_.size()-1; i++) {
450  int diff = HO_Hashes_.at(i+1)-HO_Hashes_.at(i);
451  if (diff==0) numfails[3]++;
452  else if (diff>1) numnotdense[3]++;
453  else numpass[3]++;
454  }
455  for(unsigned int i = 0; i<CALIBHX_Hashes_.size()-1; i++) {
456  int diff = CALIBHX_Hashes_.at(i+1)-CALIBHX_Hashes_.at(i);
457  if (diff==0) numfails[4]++;
458  else if (diff>1) numnotdense[4]++;
459  else numpass[4]++;
460  }
461  for(unsigned int i = 0; i<ZDC_Hashes_.size()-1; i++) {
462  int diff = ZDC_Hashes_.at(i+1)-ZDC_Hashes_.at(i);
463  if (diff==0) numfails[5]++;
464  else if (diff>1) numnotdense[5]++;
465  else numpass[5]++;
466  }
467  for(unsigned int i = 0; i<HT_Hashes_.size()-1; i++) {
468  int diff = HT_Hashes_.at(i+1)-HT_Hashes_.at(i);
469  if (diff==0) numfails[6]++;
470  else if (diff>1) numnotdense[6]++;
471  else numpass[6]++;
472  }
473  cout << "HB HashIds (pass, collisions, non-dense) = (" << numpass[0] << "," << numfails[0] << "," << numnotdense[0] << ")" << endl;
474  cout << "HE HashIds (pass, collisions, non-dense) = (" << numpass[1] << "," << numfails[1] << "," << numnotdense[1] << ")" << endl;
475  cout << "HF HashIds (pass, collisions, non-dense) = (" << numpass[2] << "," << numfails[2] << "," << numnotdense[2] << ")" << endl;
476  cout << "HO HashIds (pass, collisions, non-dense) = (" << numpass[3] << "," << numfails[3] << "," << numnotdense[3] << ")" << endl;
477  cout << "CALIB/HX HashIds (pass, collisions, non-dense) = (" << numpass[4] << "," << numfails[4] << "," << numnotdense[4] << ")" << endl;
478  cout << "ZDC HashIds (pass, collisions, non-dense) = (" << numpass[5] << "," << numfails[5] << "," << numnotdense[5] << ")" << endl;
479  cout << "HT HashIds (pass, collisions, non-dense) = (" << numpass[6] << "," << numfails[6] << "," << numnotdense[6] << ")" << endl;
480 }
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_
unsigned int detId2denseIdHB(const DetId &id) const
return a linear packed id from HB
const HcalTopology * topo_
std::vector< HTLogicalMapEntry > HTEntries_
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
std::vector< ZDCLogicalMapEntry > ZDCEntries_
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
unsigned int detId2denseIdCALIB(const DetId &id) const
return a linear packed id from CALIB
void HcalLogicalMap::checkIdFunctions ( )

Definition at line 304 of file HcalLogicalMap.cc.

References CALIBEntries_, gather_cfg::cout, getDetId(), getHcalFrontEndId(), HBHEHFEntries_, HOHXEntries_, and ZDCEntries_.

304  {
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) HBHEHF_EID_pass++;
328  else HBHEHF_EID_fail++;
329 
330  const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
331  const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
332  if (hfeid0==hfeid1) HBHEHF_FEID_pass++;
333  else HBHEHF_FEID_fail++;
334  }
335  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
336  const HcalElectronicsId heid=it->getHcalElectronicsId();
337  const DetId did0=it->getDetId();
338  const DetId did1=getDetId(heid);
339  if (did0==did1) HOHX_EID_pass++;
340  else HOHX_EID_fail++;
341 
342  const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
343  const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
344  if (hfeid0==hfeid1) HOHX_FEID_pass++;
345  else HOHX_FEID_fail++;
346  }
347  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
348  const HcalElectronicsId heid=it->getHcalElectronicsId();
349  const DetId did0=it->getDetId();
350  const DetId did1=getDetId(heid);
351  if (did0==did1) CALIB_EID_pass++;
352  else CALIB_EID_fail++;
353 
354  const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
355  const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
356  if (hfeid0==hfeid1) CALIB_FEID_pass++;
357  else CALIB_FEID_fail++;
358  }
359  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
360  const HcalElectronicsId heid=it->getHcalElectronicsId();
361  const DetId did0=it->getDetId();
362  const DetId did1=getDetId(heid);
363  if (did0==did1) ZDC_EID_pass++;
364  else ZDC_EID_fail++;
365  }
366 
367  cout << "Checking detIds from electronics ids..." << endl;
368  cout << "HBHEHF EID (pass,fail) = (" << HBHEHF_EID_pass << "," << HBHEHF_EID_fail << ")" << endl;
369  cout << "HOHX EID (pass,fail) = (" << HOHX_EID_pass << "," << HOHX_EID_fail << ")" << endl;
370  cout << "CALIB EID (pass,fail) = (" << CALIB_EID_pass << "," << CALIB_EID_fail << ")" << endl;
371  cout << "ZDC EID (pass,fail) = (" << ZDC_EID_pass << "," << ZDC_EID_fail << ")" << endl;
372  cout << endl;
373  cout << "Checking frontEndIds from electronics ids..." << endl;
374  cout << "HBHEHF FEID (pass,fail) = (" << HBHEHF_FEID_pass << "," << HBHEHF_FEID_fail << ")" << endl;
375  cout << "HOHX FEID (pass,fail) = (" << HOHX_FEID_pass << "," << HOHX_FEID_fail << ")" << endl;
376  cout << "CALIB FEID (pass,fail) = (" << CALIB_FEID_pass << "," << CALIB_FEID_fail << ")" << endl;
377 }
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
const HcalFrontEndId getHcalFrontEndId(const DetId &)
Definition: DetId.h:18
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
const DetId getDetId(const HcalElectronicsId &)
std::vector< ZDCLogicalMapEntry > ZDCEntries_
Readout chain identification for Hcal.
std::unique_ptr< HcalElectronicsMap > HcalLogicalMap::generateHcalElectronicsMap ( )

Definition at line 157 of file HcalLogicalMap.cc.

References CALIBEntries_, HBHEHFEntries_, HOHXEntries_, HTEntries_, HcalElectronicsMapAddons::Helper::mapEId2chId(), HcalElectronicsMapAddons::Helper::mapEId2tId(), and ZDCEntries_.

158 {
159  HcalElectronicsMapAddons::Helper theemapHelper;
160 
161  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
162  theemapHelper.mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
163  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
164  theemapHelper.mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
165  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
166  theemapHelper.mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
167  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
168  theemapHelper.mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
169  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
170  theemapHelper.mapEId2tId( it->getHcalTrigElectronicsId(), it->getDetId() );}
171  return std::make_unique<HcalElectronicsMap>(theemapHelper);
172 }
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
std::vector< HTLogicalMapEntry > HTEntries_
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
std::vector< ZDCLogicalMapEntry > ZDCEntries_
const DetId HcalLogicalMap::getDetId ( const HcalElectronicsId eid)

Definition at line 252 of file HcalLogicalMap.cc.

References CALIBEntries_, mps_splice::entry, HBHEHFEntries_, HOHXEntries_, HcalElectronicsId::linearIndex(), LinearIndex2Entry_, globals_cff::x1, and ZDCEntries_.

Referenced by checkIdFunctions().

253 {
254  const uint32_t entry=LinearIndex2Entry_.at(eid.linearIndex());
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();
260  return DetId(0);
261 }
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
std::vector< uint32_t > LinearIndex2Entry_
Definition: DetId.h:18
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
std::vector< ZDCLogicalMapEntry > ZDCEntries_
int linearIndex() const
get a fast, compact, unique index for linear lookups
const HcalFrontEndId HcalLogicalMap::getHcalFrontEndId ( const DetId did)

Definition at line 263 of file HcalLogicalMap.cc.

References CALIBEntries_, HcalCalibDetId::calibFlavor(), HcalCalibDetId::CalibrationBox, HcalTopology::detId2denseIdCALIB(), HcalTopology::detId2denseIdHB(), HcalTopology::detId2denseIdHE(), HcalTopology::detId2denseIdHF(), HcalTopology::detId2denseIdHO(), mps_splice::entry, HcalGenericDetId::genericSubdet(), HbHash2Entry_, HBHEHFEntries_, HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenCalibration, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HeHash2Entry_, HfHash2Entry_, HcalCalibDetId::HOCrosstalk, HoHash2Entry_, HOHXEntries_, HxCalibHash2Entry_, and topo_.

Referenced by checkIdFunctions().

264 {
265  const HcalGenericDetId hgdi(did);
266 
267  const HcalGenericDetId::HcalGenericSubdetector hgsd=hgdi.genericSubdet();
269  const int hashedId=topo_->detId2denseIdHB(did);
270  const uint32_t entry=HbHash2Entry_.at(hashedId)-1;
271  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
272  }
273  else if (hgsd==HcalGenericDetId::HcalGenEndcap) {
274  const int hashedId=topo_->detId2denseIdHE(did);
275  const uint32_t entry=HeHash2Entry_.at(hashedId)-1;
276  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
277  }
278  else if (hgsd==HcalGenericDetId::HcalGenForward) {
279  const int hashedId=topo_->detId2denseIdHF(did);
280  const uint32_t entry=HfHash2Entry_.at(hashedId)-1;
281  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
282  }
283  else if (hgsd==HcalGenericDetId::HcalGenOuter) {
284  const int hashedId=topo_->detId2denseIdHO(did);
285  const uint32_t entry=HoHash2Entry_.at(hashedId)-1;
286  return HOHXEntries_.at(entry).getHcalFrontEndId();
287  }
288  else if (hgsd==HcalGenericDetId::HcalGenCalibration) {
289  HcalCalibDetId hcid(did);
290  if (hcid.calibFlavor()==HcalCalibDetId::HOCrosstalk) {
291  const int hashedId=topo_->detId2denseIdCALIB(did);
292  const uint32_t entry=HxCalibHash2Entry_.at(hashedId)-1;
293  return HOHXEntries_.at(entry).getHcalFrontEndId();
294  }
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 }
std::vector< uint32_t > HeHash2Entry_
unsigned int detId2denseIdHF(const DetId &id) const
return a linear packed id from HF
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
unsigned int detId2denseIdHB(const DetId &id) const
return a linear packed id from HB
std::vector< uint32_t > HbHash2Entry_
std::vector< uint32_t > HoHash2Entry_
const HcalTopology * topo_
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
std::vector< uint32_t > HxCalibHash2Entry_
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
std::vector< uint32_t > HfHash2Entry_
unsigned int detId2denseIdCALIB(const DetId &id) const
return a linear packed id from CALIB
uint32_t HcalLogicalMap::makeEntryNumber ( bool  isvalid,
int  vectorid,
int  entry 
)
static

Definition at line 66 of file HcalLogicalMap.cc.

References submit::answer.

Referenced by HcalLogicalMapGenerator::buildCALIBMap(), HcalLogicalMapGenerator::buildHBEFTMap(), HcalLogicalMapGenerator::buildHOXMap(), and HcalLogicalMapGenerator::buildZDCMap().

67 {
68  uint32_t answer=0;
69  answer|=isvalid;
70  answer|=(vectorid&0x3)<<1;
71  answer|=entry<<3;
72  return answer;
73 }
answer
Definition: submit.py:44
void HcalLogicalMap::printCalibMap ( FILE *  calibmapfile)
private

Definition at line 205 of file HcalLogicalMap.cc.

References CALIBEntries_.

Referenced by printMap().

205  {
206 
207  int titlecounter = 0;
208 
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");
214  }
215  titlecounter++;
216  fprintf(calibmapfile,"%s",it->printLMapLine());
217  }
218 }
std::vector< CALIBLogicalMapEntry > CALIBEntries_
void HcalLogicalMap::printHBEFMap ( FILE *  hbefmapfile)
private

Definition at line 175 of file HcalLogicalMap.cc.

References HBHEHFEntries_.

Referenced by printMap().

175  {
176  int titlecounter = 0;
177 
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");
184  }
185  titlecounter++;
186  fprintf(hbefmapfile,"%s",it->printLMapLine());
187  }
188 }
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
void HcalLogicalMap::printHOXMap ( FILE *  hoxmapfile)
private

Definition at line 190 of file HcalLogicalMap.cc.

References HOHXEntries_.

Referenced by printMap().

190  {
191 
192  int titlecounter = 0;
193 
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");
199  }
200  titlecounter++;
201  fprintf(hoxmapfile,"%s",it->printLMapLine());
202  }
203 }
std::vector< HOHXLogicalMapEntry > HOHXEntries_
void HcalLogicalMap::printHTMap ( FILE *  htmapfile)
private

Definition at line 235 of file HcalLogicalMap.cc.

References HTEntries_.

Referenced by printMap().

235  {
236 
237  int titlecounter = 0;
238 
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");
245  }
246  titlecounter++;
247  fprintf(htmapfile,"%s",it->printLMapLine());
248  }
249 }
std::vector< HTLogicalMapEntry > HTEntries_
void HcalLogicalMap::printMap ( unsigned int  mapIOV)

Definition at line 75 of file HcalLogicalMap.cc.

References gather_cfg::cout, indexGen::date, printCalibMap(), printHBEFMap(), printHOXMap(), printHTMap(), printZDCMap(), and ntuplemaker::time.

75  {
76  using namespace std;
77 
78  static FILE* HBEFmap;
79  static FILE* HOXmap;
80  static FILE* CALIBmap;
81  static FILE* ZDCmap;
82  static FILE* HTmap;
83 
84  char tempbuff[30];
85 
86  stringstream mystream;
87  string HBEFmapstr, HOXmapstr, CALIBmapstr, ZDCmapstr, HTmapstr;
88  string date;
89  string IOVlabel;
90 
91  time_t myTime;
92  time(&myTime);
93 
94  strftime(tempbuff,128,"%d.%b.%Y",localtime(&myTime) );
95  mystream<<tempbuff;
96  date= mystream.str();
97 
98  mystream.str("");
99  if (mapIOV==1) IOVlabel = "A";
100  else if (mapIOV==2) IOVlabel = "B";
101  else if (mapIOV==3) IOVlabel = "C";
102  else if (mapIOV==4) IOVlabel = "D";
103  else IOVlabel = "E";
104 
105  HBEFmapstr = "./HCALmapHBEF_"+IOVlabel+".txt";
106  HOXmapstr = "./HCALmapHO_"+IOVlabel+".txt";
107  CALIBmapstr = "./HCALmapCALIB_"+IOVlabel+".txt";
108  ZDCmapstr = "./ZDCmap_"+IOVlabel+".txt";
109  HTmapstr = "./HCALmapHT_"+IOVlabel+".txt";
110 
111 // HBEFmapstr = "./HCALmapHBEF_"+date+".txt";
112 // HOXmapstr = "./HCALmapHO_"+date+"_"+IOVlabel+".txt";
113 // CALIBmapstr = "./HCALmapCALIB_"+date+".txt";
114 // ZDCmapstr = "./ZDCmap_"+date+".txt";
115 // HTmapstr = "./HCALmapHT_"+date+".txt";
116 
117  HBEFmap = fopen(HBEFmapstr.c_str(),"w");
118  HOXmap = fopen(HOXmapstr.c_str(),"w");
119  CALIBmap = fopen(CALIBmapstr.c_str(),"w");
120  ZDCmap = fopen(ZDCmapstr.c_str(),"w");
121  HTmap = fopen(HTmapstr.c_str(),"w");
122  /**********************/
123 
124  if(HBEFmap) {
125  fprintf(HBEFmap,"## file created %s ##\n",date.c_str());
126  printHBEFMap(HBEFmap);
127  }
128  else cout <<HBEFmapstr<<" not found!"<<endl;
129 
130  if(HOXmap) {
131  fprintf(HOXmap,"## file created %s ##\n",date.c_str());
132  printHOXMap(HOXmap);
133  }
134  else cout <<HOXmapstr<<" not found!"<<endl;
135 
136  if(CALIBmap) {
137  fprintf(CALIBmap,"## file created %s ##\n",date.c_str());
138  printCalibMap(CALIBmap);
139  }
140  else cout <<CALIBmapstr<<" not found!"<<endl;
141 
142  if(ZDCmap) {
143  fprintf(ZDCmap,"## file created %s ##\n",date.c_str());
144  printZDCMap(ZDCmap);
145  }
146  else cout <<ZDCmapstr<<" not found!"<<endl;
147 
148  if(HTmap) {
149  fprintf(HTmap,"## file created %s ##\n",date.c_str());
150  printHTMap(HTmap);
151  }
152  else cout <<HTmapstr<<" not found!"<<endl;
153 
154 }
void printCalibMap(FILE *calibmapfile)
void printHTMap(FILE *htmapfile)
void printHOXMap(FILE *hoxmapfile)
void printZDCMap(FILE *zdcmapfile)
void printHBEFMap(FILE *hbefmapfile)
void HcalLogicalMap::printZDCMap ( FILE *  zdcmapfile)
private

Definition at line 220 of file HcalLogicalMap.cc.

References ZDCEntries_.

Referenced by printMap().

220  {
221 
222  int titlecounter = 0;
223 
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");
229  }
230  titlecounter++;
231  fprintf(zdcmapfile,"%s",it->printLMapLine());
232  }
233 }
std::vector< ZDCLogicalMapEntry > ZDCEntries_

Member Data Documentation

std::vector<CALIBLogicalMapEntry> HcalLogicalMap::CALIBEntries_
private
std::vector<uint32_t> HcalLogicalMap::HbHash2Entry_
private

Definition at line 54 of file HcalLogicalMap.h.

Referenced by getHcalFrontEndId(), and HcalLogicalMap().

std::vector<HBHEHFLogicalMapEntry> HcalLogicalMap::HBHEHFEntries_
private
std::vector<uint32_t> HcalLogicalMap::HeHash2Entry_
private

Definition at line 55 of file HcalLogicalMap.h.

Referenced by getHcalFrontEndId(), and HcalLogicalMap().

std::vector<uint32_t> HcalLogicalMap::HfHash2Entry_
private

Definition at line 56 of file HcalLogicalMap.h.

Referenced by getHcalFrontEndId(), and HcalLogicalMap().

std::vector<uint32_t> HcalLogicalMap::HoHash2Entry_
private

Definition at line 58 of file HcalLogicalMap.h.

Referenced by getHcalFrontEndId(), and HcalLogicalMap().

std::vector<HOHXLogicalMapEntry> HcalLogicalMap::HOHXEntries_
private
std::vector<HTLogicalMapEntry> HcalLogicalMap::HTEntries_
private
std::vector<uint32_t> HcalLogicalMap::HtHash2Entry_
private

Definition at line 57 of file HcalLogicalMap.h.

Referenced by HcalLogicalMap().

std::vector<uint32_t> HcalLogicalMap::HxCalibHash2Entry_
private

Definition at line 59 of file HcalLogicalMap.h.

Referenced by getHcalFrontEndId(), and HcalLogicalMap().

std::vector<uint32_t> HcalLogicalMap::LinearIndex2Entry_
private

Definition at line 53 of file HcalLogicalMap.h.

Referenced by getDetId(), and HcalLogicalMap().

unsigned int HcalLogicalMap::mapIOV_
private

Definition at line 46 of file HcalLogicalMap.h.

const HcalTopology* HcalLogicalMap::topo_
private

Definition at line 62 of file HcalLogicalMap.h.

Referenced by checkHashIds(), and getHcalFrontEndId().

std::vector<ZDCLogicalMapEntry> HcalLogicalMap::ZDCEntries_
private
std::vector<uint32_t> HcalLogicalMap::ZdcHash2Entry_
private

Definition at line 60 of file HcalLogicalMap.h.

Referenced by HcalLogicalMap().