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 37 of file ElectronicsMap.h.

Member Typedef Documentation

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

Definition at line 67 of file ElectronicsMap.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file ElectronicsMap.h.

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

Definition at line 44 of file ElectronicsMap.h.

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

Definition at line 47 of file ElectronicsMap.h.

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

47 {}

Member Function Documentation

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

Definition at line 8 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(), QIE10Task::bookHistograms(), QIE11Task::bookHistograms(), TPTask::bookHistograms(), LEDTask::bookHistograms(), RawTask::bookHistograms(), LaserTask::bookHistograms(), RecHitTask::bookHistograms(), DigiTask::bookHistograms(), DigiPhase1Task::bookHistograms(), hcaldqm::RecoRunSummary::endJob(), hcaldqm::TPRunSummary::endJob(), and ~ElectronicsMap().

10  {
11  _etype=etype;
12  _emap = emap;
13  // if we actually use a HashMap then
15  {
16  if (_etype==fD2EHashMap)
17  {
18  std::vector<HcalElectronicsId> eids =
20  for (std::vector<HcalElectronicsId>::const_iterator it=
21  eids.begin(); it!=eids.end(); ++it)
22  {
24  _emap->lookup(*it));
25  EMapType::iterator dit = _ids.find(did.rawId());
26  if (dit!=_ids.end())
27  continue;
28 // if (!did.isHcalDetId())
29 // continue;
30 
31  _ids.insert(std::make_pair(did.rawId(), it->rawId()));
32  }
33  }
34  else if (_etype==fT2EHashMap)
35  {
36  // HcalTrigTowerDetId -> HcalElectronicsId
37  std::vector<HcalTrigTowerDetId> tids =
38  emap->allTriggerId();
39  for (std::vector<HcalTrigTowerDetId>::const_iterator it=
40  tids.begin(); it!=tids.end(); ++it)
41  {
43  uint32_t hash = it->rawId();
44  EMapType::iterator eit = _ids.find(hash);
45  if (eit!=_ids.end())
46  continue;
47 
48  _ids.insert(std::make_pair(hash, eid.rawId()));
49  }
50  }
51  else if (_etype==fE2DHashMap)
52  {
53  // HcalElectronicId -> HcalDetId hash map
54  std::vector<HcalElectronicsId> eids =
55  emap->allElectronicsIdPrecision();
56  for (std::vector<HcalElectronicsId>::const_iterator
57  it=eids.begin(); it!=eids.end(); ++it)
58  {
60  uint32_t hash = it->rawId();
61  EMapType::iterator eit = _ids.find(hash);
62  if (eit!=_ids.end())
63  continue;
64 
65  // note, we have EChannel hashing here
66  _ids.insert(std::make_pair(hash, did.rawId()));
67  }
68  }
69  else if (_etype==fE2THashMap)
70  {
71  // HcalElectronicId -> HcalDetId hash map
72  std::vector<HcalElectronicsId> eids =
73  emap->allElectronicsIdTrigger();
74  for (std::vector<HcalElectronicsId>::const_iterator
75  it=eids.begin(); it!=eids.end(); ++it)
76  {
77  HcalTrigTowerDetId tid =
79  EMapType::iterator eit = _ids.find(it->rawId());
80  if (eit!=_ids.end())
81  continue;
82 
83  // eid.rawId() -> tid.rawId()
84  _ids.insert(std::make_pair(it->rawId(),
85  tid.rawId()));
86  }
87  }
88  }
89  }
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
uint32_t rawId() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
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 91 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().

93  {
94  _etype=etype;
95  _emap = emap;
96 
97  // note this initialization has iteration over electronics not
98  // detector.
99  // Filtering is done on Electronics id - possible to have
100  // several electronics ids to 1 detid - not vice versa
102  {
103  if (_etype==fD2EHashMap)
104  {
105  std::vector<HcalElectronicsId> eids =
107  for (std::vector<HcalElectronicsId>::const_iterator it=
108  eids.begin(); it!=eids.end(); ++it)
109  {
111  _emap->lookup(*it));
112  if (filter.filter(*it))
113  continue;
114  // skip those that are not detid or calib ids
115 // if (!did.isHcalDetId())
116 // continue;
117 
118  _ids.insert(std::make_pair(did.rawId(), it->rawId()));
119  }
120  }
121  else if (_etype==fT2EHashMap)
122  {
123  std::vector<HcalElectronicsId> eids=
124  emap->allElectronicsIdTrigger();
125  for (std::vector<HcalElectronicsId>::const_iterator it=
126  eids.begin(); it!=eids.end(); ++it)
127  {
128  if (filter.filter(*it))
129  continue;
130  HcalTrigTowerDetId tid = emap->lookupTrigger(*it);
131  _ids.insert(std::make_pair(tid.rawId(), it->rawId()));
132  }
133  }
134  else if (_etype==fE2DHashMap)
135  {
136  std::vector<HcalElectronicsId> eids =
137  emap->allElectronicsIdPrecision();
138  for (std::vector<HcalElectronicsId>::const_iterator it=
139  eids.begin(); it!=eids.end(); ++it)
140  {
142  _emap->lookup(*it));
144  *it);
145  if (filter.filter(*it))
146  continue;
147  // skip those that are not detid or calib ids
148 // if (!did.isHcalDetId())
149 // continue;
150 
151  // note: use EChannel hashing here!
152  _ids.insert(std::make_pair(hash,did.rawId()));
153  }
154  }
155  else if (_etype==fE2THashMap)
156  {
157  std::vector<HcalElectronicsId> eids=
158  emap->allElectronicsIdTrigger();
159  for (std::vector<HcalElectronicsId>::const_iterator it=
160  eids.begin(); it!=eids.end(); ++it)
161  {
162  if (filter.filter(*it))
163  continue;
164  HcalTrigTowerDetId tid = emap->lookupTrigger(*it);
165  _ids.insert(std::make_pair(it->rawId(), tid.rawId()));
166  }
167  }
168  }
169  }
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
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 172 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(), hcaldqm::DigiRunSummary::beginRun(), PedestalTask::bookHistograms(), DigiTask::bookHistograms(), hcaldqm::TPRunSummary::endJob(), hcaldqm::RecoRunSummary::endJob(), hcaldqm::DigiRunSummary::endJob(), hcaldqm::RawRunSummary::endLuminosityBlock(), hcaldqm::DigiRunSummary::endLuminosityBlock(), and ~ElectronicsMap().

173  {
174  uint32_t hash = id.rawId();
176  return _emap->lookup(id).rawId();
177  else
178  {
179  EMapType::iterator it = _ids.find(hash);
180  return it==_ids.end() ? 0 : it->second;
181  }
182  return 0;
183  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
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 185 of file ElectronicsMap.cc.

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

186  {
187  // Turn the HcalDetId into a HcalGenericDetId to avoid newForm
188  uint32_t hash = (id.oldFormat() ? id.otherForm() : id.rawId());
189  HcalGenericDetId gdid(hash);
191  return _emap->lookup(gdid).rawId();
192  else
193  {
194  EMapType::iterator it = _ids.find(hash);
195  return it==_ids.end() ? 0 : it->second;
196  }
197  return 0;
198  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
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 200 of file ElectronicsMap.cc.

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

201  {
202  uint32_t hash = id.rawId();
204  return _emap->lookup(id).rawId();
205  else
206  {
207  EMapType::iterator it=_ids.find(hash);
208  return it==_ids.end() ? 0 : it->second;
209  }
210  return 0;
211  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
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 213 of file ElectronicsMap.cc.

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

Referenced by ~ElectronicsMap().

214  {
215  std::cout << "Electronics HashMap Type=" << _etype << std::endl;
216  BOOST_FOREACH(EMapType::value_type &v, _ids)
217  {
218  std::cout << std::hex << v.first
219  << " "<< v.second << std::dec << std::endl;
220  }
221  }

Member Data Documentation

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

Definition at line 71 of file ElectronicsMap.h.

Referenced by initialize(), and lookup().

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

Definition at line 64 of file ElectronicsMap.h.

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

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

Definition at line 68 of file ElectronicsMap.h.

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