test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 (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 66 of file ElectronicsMap.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file ElectronicsMap.h.

40  :
41  _emap(NULL)
42  {}
#define NULL
Definition: scimark2.h:8
HcalElectronicsMap const * _emap
hcaldqm::electronicsmap::ElectronicsMap::ElectronicsMap ( ElectronicsMapType  etype)
inline

Definition at line 44 of file ElectronicsMap.h.

44  :
45  _etype(etype), _emap(NULL)
46  {}
#define NULL
Definition: scimark2.h:8
HcalElectronicsMap const * _emap
hcaldqm::electronicsmap::ElectronicsMap::~ElectronicsMap ( )
inline

Definition at line 47 of file ElectronicsMap.h.

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(), hcaldqm::electronicsmap::fD2EHashMap, hcaldqm::electronicsmap::fE2DHashMap, hcaldqm::electronicsmap::fE2THashMap, hcaldqm::electronicsmap::fHcalElectronicsMap, hcaldqm::electronicsmap::fT2EHashMap, cond::hash, hcaldqm::hashfunctions::hash_EChannel(), HcalGenericDetId::isHcalDetId(), HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), DetId::rawId(), and HcalElectronicsId::rawId().

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

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  if (!did.isHcalDetId())
26  continue;
27 
28  _ids.insert(std::make_pair(did.rawId(), it->rawId()));
29  }
30  }
31  else if (_etype==fT2EHashMap)
32  {
33  // HcalTrigTowerDetId -> HcalElectronicsId
34  std::vector<HcalTrigTowerDetId> tids =
35  emap->allTriggerId();
36  for (std::vector<HcalTrigTowerDetId>::const_iterator it=
37  tids.begin(); it!=tids.end(); ++it)
38  {
40  uint32_t hash = it->rawId();
41  EMapType::iterator eit = _ids.find(hash);
42  if (eit!=_ids.end())
43  continue;
44 
45  _ids.insert(std::make_pair(hash, eid.rawId()));
46  }
47  }
48  else if (_etype==fE2DHashMap)
49  {
50  // HcalElectronicId -> HcalDetId hash map
51  std::vector<HcalElectronicsId> eids =
52  emap->allElectronicsIdPrecision();
53  for (std::vector<HcalElectronicsId>::const_iterator
54  it=eids.begin(); it!=eids.end(); ++it)
55  {
56  HcalDetId did = HcalDetId(_emap->lookup(*it));
57  uint32_t hash = hashfunctions::hash_EChannel(
58  *it);
59  EMapType::iterator eit = _ids.find(hash);
60  if (eit!=_ids.end())
61  continue;
62 
63  // note, we have EChannel hashing here
64  _ids.insert(std::make_pair(hash, did.rawId()));
65  }
66  }
67  else if (_etype==fE2THashMap)
68  {
69  // HcalElectronicId -> HcalDetId hash map
70  std::vector<HcalElectronicsId> eids =
71  emap->allElectronicsIdTrigger();
72  for (std::vector<HcalElectronicsId>::const_iterator
73  it=eids.begin(); it!=eids.end(); ++it)
74  {
75  HcalTrigTowerDetId tid =
77  EMapType::iterator eit = _ids.find(it->rawId());
78  if (eit!=_ids.end())
79  continue;
80 
81  // eid.rawId() -> tid.rawId()
82  _ids.insert(std::make_pair(it->rawId(),
83  tid.rawId()));
84  }
85  }
86  }
87  }
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
uint32_t rawId() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool isHcalDetId() const
HcalElectronicsMap const * _emap
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
uint32_t hash_EChannel(HcalElectronicsId const &)
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 89 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(), HcalGenericDetId::isHcalDetId(), HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), and DetId::rawId().

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

Definition at line 177 of file ElectronicsMap.cc.

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

178  {
179  uint32_t hash = id.rawId();
180  return _etype==fHcalElectronicsMap? _emap->lookup(id).rawId():
181  _ids[hash];
182  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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 184 of file ElectronicsMap.cc.

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

185  {
186  std::cout << "Electronics HashMap Type=" << _etype << std::endl;
187  BOOST_FOREACH(EMapType::value_type &v, _ids)
188  {
189  std::cout << std::hex << v.first
190  << " "<< v.second << std::dec << std::endl;
191  }
192  }
tuple cout
Definition: gather_cfg.py:145

Member Data Documentation

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

Definition at line 70 of file ElectronicsMap.h.

Referenced by initialize(), and lookup().

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

Definition at line 63 of file ElectronicsMap.h.

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

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

Definition at line 67 of file ElectronicsMap.h.

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