CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
hcaldqm::electronicsmap::ElectronicsMap Class Reference

#include <ElectronicsMap.h>

Public Member Functions

 ElectronicsMap ()
 
 ElectronicsMap (ElectronicsMapType etype)
 
void initialize (HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
 
void initialize (HcalElectronicsMap const *, ElectronicsMapType, filter::HashFilter const &)
 
uint32_t lookup (DetId const &)
 
uint32_t lookup (HcalDetId const &)
 
uint32_t lookup (HcalElectronicsId const &)
 
void print ()
 
 ~ElectronicsMap ()
 

Private Types

typedef boost::unordered_map< uint32_t, uint32_t > EMapType
 

Private Attributes

HcalElectronicsMap const * _emap
 
ElectronicsMapType _etype
 
EMapType _ids
 

Detailed Description

Definition at line 32 of file ElectronicsMap.h.

Member Typedef Documentation

typedef boost::unordered_map<uint32_t, uint32_t> hcaldqm::electronicsmap::ElectronicsMap::EMapType
private

Definition at line 54 of file ElectronicsMap.h.

Constructor & Destructor Documentation

hcaldqm::electronicsmap::ElectronicsMap::ElectronicsMap ( )
inline

Definition at line 34 of file ElectronicsMap.h.

34 : _emap(nullptr) {}
HcalElectronicsMap const * _emap
hcaldqm::electronicsmap::ElectronicsMap::ElectronicsMap ( ElectronicsMapType  etype)
inline

Definition at line 36 of file ElectronicsMap.h.

36 : _etype(etype), _emap(nullptr) {}
HcalElectronicsMap const * _emap
hcaldqm::electronicsmap::ElectronicsMap::~ElectronicsMap ( )
inline

Definition at line 37 of file ElectronicsMap.h.

References hcaldqm::electronicsmap::fHcalElectronicsMap, initialize(), lookup(), and print().

37 {}

Member Function Documentation

void hcaldqm::electronicsmap::ElectronicsMap::initialize ( HcalElectronicsMap const *  emap,
ElectronicsMapType  etype = fHcalElectronicsMap 
)

Definition at line 6 of file ElectronicsMap.cc.

References _emap, _etype, _ids, HcalElectronicsMap::allElectronicsIdPrecision(), HcalElectronicsMap::allElectronicsIdTrigger(), HcalElectronicsMap::allTriggerId(), runTauDisplay::eid, hcaldqm::electronicsmap::fD2EHashMap, hcaldqm::electronicsmap::fE2DHashMap, hcaldqm::electronicsmap::fE2THashMap, hcaldqm::electronicsmap::fHcalElectronicsMap, hcaldqm::electronicsmap::fT2EHashMap, cond::hash, HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), DetId::rawId(), and HcalElectronicsId::rawId().

Referenced by hcaldqm::RawRunSummary::beginRun(), hcaldqm::DigiRunSummary::beginRun(), DigiComparisonTask::bookHistograms(), TPComparisonTask::bookHistograms(), PedestalTask::bookHistograms(), FCDTask::bookHistograms(), LEDTask::bookHistograms(), QIE10Task::bookHistograms(), QIE11Task::bookHistograms(), TPTask::bookHistograms(), LaserTask::bookHistograms(), RawTask::bookHistograms(), RecHitTask::bookHistograms(), DigiPhase1Task::bookHistograms(), DigiTask::bookHistograms(), hcaldqm::TPRunSummary::endJob(), hcaldqm::RecoRunSummary::endJob(), and ~ElectronicsMap().

6  {
7  _etype = etype;
8  _emap = emap;
9  // if we actually use a HashMap then
10  if (_etype != fHcalElectronicsMap) {
11  if (_etype == fD2EHashMap) {
12  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
13  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
15  EMapType::iterator dit = _ids.find(did.rawId());
16  if (dit != _ids.end())
17  continue;
18  // if (!did.isHcalDetId())
19  // continue;
20 
21  _ids.insert(std::make_pair(did.rawId(), it->rawId()));
22  }
23  } else if (_etype == fT2EHashMap) {
24  // HcalTrigTowerDetId -> HcalElectronicsId
25  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
26  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
28  uint32_t hash = it->rawId();
29  EMapType::iterator eit = _ids.find(hash);
30  if (eit != _ids.end())
31  continue;
32 
33  _ids.insert(std::make_pair(hash, eid.rawId()));
34  }
35  } else if (_etype == fE2DHashMap) {
36  // HcalElectronicId -> HcalDetId hash map
37  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
38  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
40  uint32_t hash = it->rawId();
41  EMapType::iterator eit = _ids.find(hash);
42  if (eit != _ids.end())
43  continue;
44 
45  // note, we have EChannel hashing here
46  _ids.insert(std::make_pair(hash, did.rawId()));
47  }
48  } else if (_etype == fE2THashMap) {
49  // HcalElectronicId -> HcalDetId hash map
50  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdTrigger();
51  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
53  EMapType::iterator eit = _ids.find(it->rawId());
54  if (eit != _ids.end())
55  continue;
56 
57  // eid.rawId() -> tid.rawId()
58  _ids.insert(std::make_pair(it->rawId(), tid.rawId()));
59  }
60  }
61  }
62  }
constexpr uint32_t rawId() const
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
HcalElectronicsMap const * _emap
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
Readout chain identification for Hcal.
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
void hcaldqm::electronicsmap::ElectronicsMap::initialize ( HcalElectronicsMap const *  emap,
ElectronicsMapType  etype,
filter::HashFilter const &  filter 
)

Definition at line 64 of file ElectronicsMap.cc.

References _emap, _etype, _ids, HcalElectronicsMap::allElectronicsIdPrecision(), HcalElectronicsMap::allElectronicsIdTrigger(), hcaldqm::electronicsmap::fD2EHashMap, hcaldqm::electronicsmap::fE2DHashMap, hcaldqm::electronicsmap::fE2THashMap, hcaldqm::electronicsmap::fHcalElectronicsMap, hcaldqm::filter::HashFilter::filter(), hcaldqm::electronicsmap::fT2EHashMap, cond::hash, hcaldqm::hashfunctions::hash_EChannel(), HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), and DetId::rawId().

66  {
67  _etype = etype;
68  _emap = emap;
69 
70  // note this initialization has iteration over electronics not
71  // detector.
72  // Filtering is done on Electronics id - possible to have
73  // several electronics ids to 1 detid - not vice versa
74  if (_etype != fHcalElectronicsMap) {
75  if (_etype == fD2EHashMap) {
76  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
77  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
79  if (filter.filter(*it))
80  continue;
81  // skip those that are not detid or calib ids
82  // if (!did.isHcalDetId())
83  // continue;
84 
85  _ids.insert(std::make_pair(did.rawId(), it->rawId()));
86  }
87  } else if (_etype == fT2EHashMap) {
88  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdTrigger();
89  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
90  if (filter.filter(*it))
91  continue;
92  HcalTrigTowerDetId tid = emap->lookupTrigger(*it);
93  _ids.insert(std::make_pair(tid.rawId(), it->rawId()));
94  }
95  } else if (_etype == fE2DHashMap) {
96  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
97  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
99  uint32_t hash = hashfunctions::hash_EChannel(*it);
100  if (filter.filter(*it))
101  continue;
102  // skip those that are not detid or calib ids
103  // if (!did.isHcalDetId())
104  // continue;
105 
106  // note: use EChannel hashing here!
107  _ids.insert(std::make_pair(hash, did.rawId()));
108  }
109  } else if (_etype == fE2THashMap) {
110  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdTrigger();
111  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
112  if (filter.filter(*it))
113  continue;
114  HcalTrigTowerDetId tid = emap->lookupTrigger(*it);
115  _ids.insert(std::make_pair(it->rawId(), tid.rawId()));
116  }
117  }
118  }
119  }
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
HcalElectronicsMap const * _emap
uint32_t hash_EChannel(HcalElectronicsId const &)
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
uint32_t hcaldqm::electronicsmap::ElectronicsMap::lookup ( DetId const &  id)

Definition at line 122 of file ElectronicsMap.cc.

References _emap, _etype, _ids, hcaldqm::electronicsmap::fHcalElectronicsMap, cond::hash, HcalElectronicsMap::lookup(), and DetId::rawId().

Referenced by PedestalTask::_dump(), LEDTask::_dump(), LaserTask::_dump(), DigiComparisonTask::_process(), TPComparisonTask::_process(), QIE10Task::_process(), QIE11Task::_process(), TPTask::_process(), RawTask::_process(), RecHitTask::_process(), LEDTask::_process(), DigiTask::_process(), DigiPhase1Task::_process(), LaserTask::_process(), FCDTask::analyze(), hcaldqm::DigiRunSummary::beginRun(), FCDTask::bookHistograms(), PedestalTask::bookHistograms(), DigiTask::bookHistograms(), hcaldqm::RecoRunSummary::endJob(), hcaldqm::TPRunSummary::endJob(), hcaldqm::DigiRunSummary::endJob(), hcaldqm::RawRunSummary::endLuminosityBlock(), hcaldqm::DigiRunSummary::endLuminosityBlock(), and ~ElectronicsMap().

122  {
123  uint32_t hash = id.rawId();
125  return _emap->lookup(id).rawId();
126  else {
127  EMapType::iterator it = _ids.find(hash);
128  return it == _ids.end() ? 0 : it->second;
129  }
130  return 0;
131  }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
HcalElectronicsMap const * _emap
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
uint32_t hcaldqm::electronicsmap::ElectronicsMap::lookup ( HcalDetId const &  id)

Definition at line 133 of file ElectronicsMap.cc.

References _emap, _etype, _ids, hcaldqm::electronicsmap::fHcalElectronicsMap, cond::hash, HcalElectronicsMap::lookup(), and DetId::rawId().

133  {
134  // Turn the HcalDetId into a HcalGenericDetId to avoid newForm
135  uint32_t hash = (id.oldFormat() ? id.otherForm() : id.rawId());
136  HcalGenericDetId gdid(hash);
138  return _emap->lookup(gdid).rawId();
139  else {
140  EMapType::iterator it = _ids.find(hash);
141  return it == _ids.end() ? 0 : it->second;
142  }
143  return 0;
144  }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
HcalElectronicsMap const * _emap
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
uint32_t hcaldqm::electronicsmap::ElectronicsMap::lookup ( HcalElectronicsId const &  id)

Definition at line 146 of file ElectronicsMap.cc.

References _emap, _etype, _ids, hcaldqm::electronicsmap::fHcalElectronicsMap, cond::hash, HcalElectronicsMap::lookup(), and DetId::rawId().

146  {
147  uint32_t hash = id.rawId();
149  return _emap->lookup(id).rawId();
150  else {
151  EMapType::iterator it = _ids.find(hash);
152  return it == _ids.end() ? 0 : it->second;
153  }
154  return 0;
155  }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
HcalElectronicsMap const * _emap
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
void hcaldqm::electronicsmap::ElectronicsMap::print ( void  )

Definition at line 157 of file ElectronicsMap.cc.

References _etype, _ids, gather_cfg::cout, TauDecayModes::dec, and findQualityFiles::v.

Referenced by ~ElectronicsMap().

157  {
158  std::cout << "Electronics HashMap Type=" << _etype << std::endl;
159  for (auto const &v : _ids) {
160  std::cout << std::hex << v.first << " " << v.second << std::dec << std::endl;
161  }
162  }

Member Data Documentation

HcalElectronicsMap const* hcaldqm::electronicsmap::ElectronicsMap::_emap
private

Definition at line 58 of file ElectronicsMap.h.

Referenced by initialize(), and lookup().

ElectronicsMapType hcaldqm::electronicsmap::ElectronicsMap::_etype
private

Definition at line 51 of file ElectronicsMap.h.

Referenced by initialize(), lookup(), and print().

EMapType hcaldqm::electronicsmap::ElectronicsMap::_ids
private

Definition at line 55 of file ElectronicsMap.h.

Referenced by initialize(), lookup(), and print().