CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< HcalElectronicsMap
generateHcalElectronicsMap ()
 
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
< HBHEHFLogicalMapEntry
HBHEHFEntries_
 
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 12 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_, filterCSVwithJSON::copy, HbHash2Entry_, HBHEHFEntries_, HeHash2Entry_, HfHash2Entry_, HoHash2Entry_, HOHXEntries_, HTEntries_, HtHash2Entry_, HxCalibHash2Entry_, LinearIndex2Entry_, ZDCEntries_, and ZdcHash2Entry_.

31  : topo_(topo)
32 
33 {
34  HBHEHFEntries_.resize(HBHEHFEntries.size());
35  HOHXEntries_.resize(HOHXEntries.size());
36  CALIBEntries_.resize(CALIBEntries.size());
37  ZDCEntries_.resize(ZDCEntries.size());
38  HTEntries_.resize(HTEntries.size());
39 
40  LinearIndex2Entry_.resize(LinearIndex2Entry.size());
41  HbHash2Entry_.resize(HbHash2Entry.size());
42  HeHash2Entry_.resize(HeHash2Entry.size());
43  HfHash2Entry_.resize(HfHash2Entry.size());
44  HtHash2Entry_.resize(HtHash2Entry.size());
45  HoHash2Entry_.resize(HoHash2Entry.size());
46  HxCalibHash2Entry_.resize(HxCalibHash2Entry.size());
47  ZdcHash2Entry_.resize(ZdcHash2Entry.size());
48 
49  copy(HBHEHFEntries.begin(), HBHEHFEntries.end(), HBHEHFEntries_.begin());
50  copy(HOHXEntries.begin(), HOHXEntries.end(), HOHXEntries_.begin());
51  copy(CALIBEntries.begin(), CALIBEntries.end(), CALIBEntries_.begin());
52  copy(ZDCEntries.begin(), ZDCEntries.end(), ZDCEntries_.begin());
53  copy(HTEntries.begin(), HTEntries.end(), HTEntries_.begin());
54  copy(LinearIndex2Entry.begin(), LinearIndex2Entry.end(), LinearIndex2Entry_.begin());
55  copy(HbHash2Entry.begin(), HbHash2Entry.end(), HbHash2Entry_.begin());
56  copy(HeHash2Entry.begin(), HeHash2Entry.end(), HeHash2Entry_.begin());
57  copy(HfHash2Entry.begin(), HfHash2Entry.end(), HfHash2Entry_.begin());
58  copy(HtHash2Entry.begin(), HtHash2Entry.end(), HtHash2Entry_.begin());
59  copy(HoHash2Entry.begin(), HoHash2Entry.end(), HoHash2Entry_.begin());
60  copy(HxCalibHash2Entry.begin(), HxCalibHash2Entry.end(), HxCalibHash2Entry_.begin());
61  copy(ZdcHash2Entry.begin(), ZdcHash2Entry.end(), ZdcHash2Entry_.begin());
62 }
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 64 of file HcalLogicalMap.cc.

64 {}

Member Function Documentation

void HcalLogicalMap::checkElectronicsHashIds ( )

Definition at line 520 of file HcalLogicalMap.cc.

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

520  {
521  std::vector<int> Electronics_Hashes_;
522 
523  int numfails = 0;
524  int numpass = 0;
525  int numnotdense = 0;
526 
527  cout << "\nRunning the hash checker for electronics Ids..." << endl;
528  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it != HBHEHFEntries_.end(); ++it) {
529  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
530  }
531  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
532  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
533  }
534  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
535  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
536  }
537  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
538  Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
539  }
540  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it != HTEntries_.end(); ++it) {
541  Electronics_Hashes_.push_back((it->getHcalTrigElectronicsId()).linearIndex());
542  }
543 
544  sort(Electronics_Hashes_.begin(), Electronics_Hashes_.end());
545 
546  for (unsigned int i = 0; i < Electronics_Hashes_.size() - 1; i++) {
547  int diff = Electronics_Hashes_.at(i + 1) - Electronics_Hashes_.at(i);
548  if (diff == 0)
549  numfails++;
550  else if (diff > 1)
551  numnotdense++;
552  else
553  numpass++;
554  }
555  cout << "Electronics Id linearIndex (pass, collisions, nondense) = (" << numpass << "," << numfails << ","
556  << numnotdense << ")" << endl;
557 }
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
std::vector< HTLogicalMapEntry > HTEntries_
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
std::vector< ZDCLogicalMapEntry > ZDCEntries_
tuple cout
Definition: gather_cfg.py:144
void HcalLogicalMap::checkHashIds ( )

Definition at line 393 of file HcalLogicalMap.cc.

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

393  {
394  std::vector<int> HB_Hashes_; // index 0
395  std::vector<int> HE_Hashes_; // index 1
396  std::vector<int> HF_Hashes_; // index 2
397  std::vector<int> HO_Hashes_; // index 3
398  std::vector<int> CALIBHX_Hashes_; // index 4
399  std::vector<int> ZDC_Hashes_; // index 5
400  std::vector<int> HT_Hashes_; // index 6
401 
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};
405 
406  cout << "\nRunning the hash checker for detIds..." << endl;
407  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it != HBHEHFEntries_.end(); ++it) {
408  if (it->getDetId().subdetId() == HcalBarrel) {
409  HB_Hashes_.push_back(topo_->detId2denseIdHB(it->getDetId()));
410  } else if (it->getDetId().subdetId() == HcalEndcap) {
411  HE_Hashes_.push_back(topo_->detId2denseIdHE(it->getDetId()));
412  } else if (it->getDetId().subdetId() == HcalForward) {
413  HF_Hashes_.push_back(topo_->detId2denseIdHF(it->getDetId()));
414  }
415  }
416  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
417  if (HcalGenericDetId(it->getDetId().rawId()).isHcalCalibDetId()) {
418  CALIBHX_Hashes_.push_back(topo_->detId2denseIdCALIB(it->getDetId()));
419  } else {
420  HO_Hashes_.push_back(topo_->detId2denseIdHO(it->getDetId()));
421  }
422  }
423  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
424  CALIBHX_Hashes_.push_back(topo_->detId2denseIdCALIB(it->getDetId()));
425  }
426  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
427  ZDC_Hashes_.push_back(HcalZDCDetId(it->getDetId()).denseIndex());
428  }
429  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it != HTEntries_.end(); ++it) {
430  HT_Hashes_.push_back(topo_->detId2denseIdHT(it->getDetId()));
431  }
432 
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());
440 
441  for (unsigned int i = 0; i < HB_Hashes_.size() - 1; i++) {
442  int diff = HB_Hashes_.at(i + 1) - HB_Hashes_.at(i);
443  if (diff == 0)
444  numfails[0]++;
445  else if (diff > 1)
446  numnotdense[0]++;
447  else
448  numpass[0]++;
449  }
450  for (unsigned int i = 0; i < HE_Hashes_.size() - 1; i++) {
451  int diff = HE_Hashes_.at(i + 1) - HE_Hashes_.at(i);
452  if (diff == 0)
453  numfails[1]++;
454  else if (diff > 1)
455  numnotdense[1]++;
456  else
457  numpass[1]++;
458  }
459  for (unsigned int i = 0; i < HF_Hashes_.size() - 1; i++) {
460  int diff = HF_Hashes_.at(i + 1) - HF_Hashes_.at(i);
461  if (diff == 0)
462  numfails[2]++;
463  else if (diff > 1)
464  numnotdense[2]++;
465  else
466  numpass[2]++;
467  }
468  for (unsigned int i = 0; i < HO_Hashes_.size() - 1; i++) {
469  int diff = HO_Hashes_.at(i + 1) - HO_Hashes_.at(i);
470  if (diff == 0)
471  numfails[3]++;
472  else if (diff > 1)
473  numnotdense[3]++;
474  else
475  numpass[3]++;
476  }
477  for (unsigned int i = 0; i < CALIBHX_Hashes_.size() - 1; i++) {
478  int diff = CALIBHX_Hashes_.at(i + 1) - CALIBHX_Hashes_.at(i);
479  if (diff == 0)
480  numfails[4]++;
481  else if (diff > 1)
482  numnotdense[4]++;
483  else
484  numpass[4]++;
485  }
486  for (unsigned int i = 0; i < ZDC_Hashes_.size() - 1; i++) {
487  int diff = ZDC_Hashes_.at(i + 1) - ZDC_Hashes_.at(i);
488  if (diff == 0)
489  numfails[5]++;
490  else if (diff > 1)
491  numnotdense[5]++;
492  else
493  numpass[5]++;
494  }
495  for (unsigned int i = 0; i < HT_Hashes_.size() - 1; i++) {
496  int diff = HT_Hashes_.at(i + 1) - HT_Hashes_.at(i);
497  if (diff == 0)
498  numfails[6]++;
499  else if (diff > 1)
500  numnotdense[6]++;
501  else
502  numpass[6]++;
503  }
504  cout << "HB HashIds (pass, collisions, non-dense) = (" << numpass[0] << "," << numfails[0] << "," << numnotdense[0]
505  << ")" << endl;
506  cout << "HE HashIds (pass, collisions, non-dense) = (" << numpass[1] << "," << numfails[1] << "," << numnotdense[1]
507  << ")" << endl;
508  cout << "HF HashIds (pass, collisions, non-dense) = (" << numpass[2] << "," << numfails[2] << "," << numnotdense[2]
509  << ")" << endl;
510  cout << "HO HashIds (pass, collisions, non-dense) = (" << numpass[3] << "," << numfails[3] << "," << numnotdense[3]
511  << ")" << endl;
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]
515  << ")" << endl;
516  cout << "HT HashIds (pass, collisions, non-dense) = (" << numpass[6] << "," << numfails[6] << "," << numnotdense[6]
517  << ")" << endl;
518 }
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
tuple cout
Definition: gather_cfg.py:144
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)
328  HBHEHF_EID_pass++;
329  else
330  HBHEHF_EID_fail++;
331 
332  const HcalFrontEndId hfeid0 = it->getHcalFrontEndId();
333  const HcalFrontEndId hfeid1 = getHcalFrontEndId(did0);
334  if (hfeid0 == hfeid1)
335  HBHEHF_FEID_pass++;
336  else
337  HBHEHF_FEID_fail++;
338  }
339  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
340  const HcalElectronicsId heid = it->getHcalElectronicsId();
341  const DetId did0 = it->getDetId();
342  const DetId did1 = getDetId(heid);
343  if (did0 == did1)
344  HOHX_EID_pass++;
345  else
346  HOHX_EID_fail++;
347 
348  const HcalFrontEndId hfeid0 = it->getHcalFrontEndId();
349  const HcalFrontEndId hfeid1 = getHcalFrontEndId(did0);
350  if (hfeid0 == hfeid1)
351  HOHX_FEID_pass++;
352  else
353  HOHX_FEID_fail++;
354  }
355  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
356  const HcalElectronicsId heid = it->getHcalElectronicsId();
357  const DetId did0 = it->getDetId();
358  const DetId did1 = getDetId(heid);
359  if (did0 == did1)
360  CALIB_EID_pass++;
361  else
362  CALIB_EID_fail++;
363 
364  const HcalFrontEndId hfeid0 = it->getHcalFrontEndId();
365  const HcalFrontEndId hfeid1 = getHcalFrontEndId(did0);
366  if (hfeid0 == hfeid1)
367  CALIB_FEID_pass++;
368  else
369  CALIB_FEID_fail++;
370  }
371  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
372  const HcalElectronicsId heid = it->getHcalElectronicsId();
373  const DetId did0 = it->getDetId();
374  const DetId did1 = getDetId(heid);
375  if (did0 == did1)
376  ZDC_EID_pass++;
377  else
378  ZDC_EID_fail++;
379  }
380 
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;
386  cout << 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;
391 }
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
const HcalFrontEndId getHcalFrontEndId(const DetId &)
Definition: DetId.h:17
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
const DetId getDetId(const HcalElectronicsId &)
std::vector< ZDCLogicalMapEntry > ZDCEntries_
tuple cout
Definition: gather_cfg.py:144
Readout chain identification for Hcal.
std::unique_ptr< HcalElectronicsMap > HcalLogicalMap::generateHcalElectronicsMap ( )

Definition at line 160 of file HcalLogicalMap.cc.

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

160  {
161  HcalElectronicsMapAddons::Helper theemapHelper;
162 
163  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it != HBHEHFEntries_.end(); ++it) {
164  theemapHelper.mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
165  }
166  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
167  theemapHelper.mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
168  }
169  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
170  theemapHelper.mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
171  }
172  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
173  theemapHelper.mapEId2chId(it->getHcalElectronicsId(), it->getDetId());
174  }
175  for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it != HTEntries_.end(); ++it) {
176  theemapHelper.mapEId2tId(it->getHcalTrigElectronicsId(), it->getDetId());
177  }
178  return std::make_unique<HcalElectronicsMap>(theemapHelper);
179 }
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 254 of file HcalLogicalMap.cc.

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

Referenced by checkIdFunctions().

254  {
255  const uint32_t entry = LinearIndex2Entry_.at(eid.linearIndex());
256  if (!(entry & 0x1))
257  return DetId(0);
258  if (((entry >> 1) & 0x3) == 0)
259  return HBHEHFEntries_.at(entry >> 3).getDetId();
260  if (((entry >> 1) & 0x3) == 1)
261  return HOHXEntries_.at(entry >> 3).getDetId();
262  if (((entry >> 1) & 0x3) == 2)
263  return CALIBEntries_.at(entry >> 3).getDetId();
264  if (((entry >> 1) & 0x3) == 3)
265  return ZDCEntries_.at(entry >> 3).getDetId();
266  return DetId(0);
267 }
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
std::vector< uint32_t > LinearIndex2Entry_
constexpr int linearIndex() const
get a fast, compact, unique index for linear lookups
Definition: DetId.h:17
std::vector< HOHXLogicalMapEntry > HOHXEntries_
std::vector< CALIBLogicalMapEntry > CALIBEntries_
std::vector< ZDCLogicalMapEntry > ZDCEntries_
list entry
Definition: mps_splice.py:68
const HcalFrontEndId HcalLogicalMap::getHcalFrontEndId ( const DetId did)

Definition at line 269 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(), and CMTRawAnalyzer::fillMAP().

269  {
270  const HcalGenericDetId hgdi(did);
271 
272  const HcalGenericDetId::HcalGenericSubdetector hgsd = hgdi.genericSubdet();
273  if (hgsd == HcalGenericDetId::HcalGenBarrel) {
274  const int hashedId = topo_->detId2denseIdHB(did);
275  const uint32_t entry = HbHash2Entry_.at(hashedId) - 1;
276  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
277  } else if (hgsd == HcalGenericDetId::HcalGenEndcap) {
278  const int hashedId = topo_->detId2denseIdHE(did);
279  const uint32_t entry = HeHash2Entry_.at(hashedId) - 1;
280  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
281  } else if (hgsd == HcalGenericDetId::HcalGenForward) {
282  const int hashedId = topo_->detId2denseIdHF(did);
283  const uint32_t entry = HfHash2Entry_.at(hashedId) - 1;
284  return HBHEHFEntries_.at(entry).getHcalFrontEndId();
285  } else if (hgsd == HcalGenericDetId::HcalGenOuter) {
286  const int hashedId = topo_->detId2denseIdHO(did);
287  const uint32_t entry = HoHash2Entry_.at(hashedId) - 1;
288  return HOHXEntries_.at(entry).getHcalFrontEndId();
289  } else if (hgsd == HcalGenericDetId::HcalGenCalibration) {
290  HcalCalibDetId hcid(did);
291  if (hcid.calibFlavor() == HcalCalibDetId::HOCrosstalk) {
292  const int hashedId = topo_->detId2denseIdCALIB(did);
293  const uint32_t entry = HxCalibHash2Entry_.at(hashedId) - 1;
294  return HOHXEntries_.at(entry).getHcalFrontEndId();
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
list entry
Definition: mps_splice.py:68
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.

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

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

Definition at line 211 of file HcalLogicalMap.cc.

References CALIBEntries_.

Referenced by printMap().

211  {
212  int titlecounter = 0;
213 
214  for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it != CALIBEntries_.end(); ++it) {
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");
219  }
220  titlecounter++;
221  fprintf(calibmapfile, "%s", it->printLMapLine());
222  }
223 }
std::vector< CALIBLogicalMapEntry > CALIBEntries_
void HcalLogicalMap::printHBEFMap ( FILE *  hbefmapfile)
private

Definition at line 182 of file HcalLogicalMap.cc.

References HBHEHFEntries_.

Referenced by printMap().

182  {
183  int titlecounter = 0;
184 
185  for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it != HBHEHFEntries_.end(); ++it) {
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");
191  }
192  titlecounter++;
193  fprintf(hbefmapfile, "%s", it->printLMapLine());
194  }
195 }
std::vector< HBHEHFLogicalMapEntry > HBHEHFEntries_
void HcalLogicalMap::printHOXMap ( FILE *  hoxmapfile)
private

Definition at line 197 of file HcalLogicalMap.cc.

References HOHXEntries_.

Referenced by printMap().

197  {
198  int titlecounter = 0;
199 
200  for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it != HOHXEntries_.end(); ++it) {
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");
205  }
206  titlecounter++;
207  fprintf(hoxmapfile, "%s", it->printLMapLine());
208  }
209 }
std::vector< HOHXLogicalMapEntry > HOHXEntries_
void HcalLogicalMap::printHTMap ( FILE *  htmapfile)
private

Definition at line 239 of file HcalLogicalMap.cc.

References HTEntries_.

Referenced by printMap().

239  {
240  int titlecounter = 0;
241 
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");
248  }
249  titlecounter++;
250  fprintf(htmapfile, "%s", it->printLMapLine());
251  }
252 }
std::vector< HTLogicalMapEntry > HTEntries_
void HcalLogicalMap::printMap ( unsigned int  mapIOV)

Definition at line 74 of file HcalLogicalMap.cc.

References gather_cfg::cout, printCalibMap(), printHBEFMap(), printHOXMap(), printHTMap(), and printZDCMap().

74  {
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)
99  IOVlabel = "A";
100  else if (mapIOV == 2)
101  IOVlabel = "B";
102  else if (mapIOV == 3)
103  IOVlabel = "C";
104  else if (mapIOV == 4)
105  IOVlabel = "D";
106  else
107  IOVlabel = "E";
108 
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";
114 
115  // HBEFmapstr = "./HCALmapHBEF_"+date+".txt";
116  // HOXmapstr = "./HCALmapHO_"+date+"_"+IOVlabel+".txt";
117  // CALIBmapstr = "./HCALmapCALIB_"+date+".txt";
118  // ZDCmapstr = "./ZDCmap_"+date+".txt";
119  // HTmapstr = "./HCALmapHT_"+date+".txt";
120 
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");
126  /**********************/
127 
128  if (HBEFmap) {
129  fprintf(HBEFmap, "## file created %s ##\n", date.c_str());
130  printHBEFMap(HBEFmap);
131  } else
132  cout << HBEFmapstr << " not found!" << endl;
133 
134  if (HOXmap) {
135  fprintf(HOXmap, "## file created %s ##\n", date.c_str());
136  printHOXMap(HOXmap);
137  } else
138  cout << HOXmapstr << " not found!" << endl;
139 
140  if (CALIBmap) {
141  fprintf(CALIBmap, "## file created %s ##\n", date.c_str());
142  printCalibMap(CALIBmap);
143  } else
144  cout << CALIBmapstr << " not found!" << endl;
145 
146  if (ZDCmap) {
147  fprintf(ZDCmap, "## file created %s ##\n", date.c_str());
148  printZDCMap(ZDCmap);
149  } else
150  cout << ZDCmapstr << " not found!" << endl;
151 
152  if (HTmap) {
153  fprintf(HTmap, "## file created %s ##\n", date.c_str());
154  printHTMap(HTmap);
155  } else
156  cout << HTmapstr << " not found!" << endl;
157 }
void printCalibMap(FILE *calibmapfile)
void printHTMap(FILE *htmapfile)
void printHOXMap(FILE *hoxmapfile)
void printZDCMap(FILE *zdcmapfile)
void printHBEFMap(FILE *hbefmapfile)
tuple cout
Definition: gather_cfg.py:144
void HcalLogicalMap::printZDCMap ( FILE *  zdcmapfile)
private

Definition at line 225 of file HcalLogicalMap.cc.

References ZDCEntries_.

Referenced by printMap().

225  {
226  int titlecounter = 0;
227 
228  for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it != ZDCEntries_.end(); ++it) {
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");
233  }
234  titlecounter++;
235  fprintf(zdcmapfile, "%s", it->printLMapLine());
236  }
237 }
std::vector< ZDCLogicalMapEntry > ZDCEntries_

Member Data Documentation

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

Definition at line 55 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 56 of file HcalLogicalMap.h.

Referenced by getHcalFrontEndId(), and HcalLogicalMap().

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

Definition at line 57 of file HcalLogicalMap.h.

Referenced by getHcalFrontEndId(), and HcalLogicalMap().

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

Definition at line 59 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 58 of file HcalLogicalMap.h.

Referenced by HcalLogicalMap().

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

Definition at line 60 of file HcalLogicalMap.h.

Referenced by getHcalFrontEndId(), and HcalLogicalMap().

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

Definition at line 54 of file HcalLogicalMap.h.

Referenced by getDetId(), and HcalLogicalMap().

unsigned int HcalLogicalMap::mapIOV_
private

Definition at line 47 of file HcalLogicalMap.h.

const HcalTopology* HcalLogicalMap::topo_
private

Definition at line 63 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 61 of file HcalLogicalMap.h.

Referenced by HcalLogicalMap().